summaryrefslogtreecommitdiffstats
path: root/kernel/include/linux/maple.h
blob: c37288b23e0cf4cb1bb37fa4a0516efcd0cd4d5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef __LINUX_MAPLE_H
#define __LINUX_MAPLE_H

#include <mach/maple.h>

struct device;
extern struct bus_type maple_bus_type;

/* Maple Bus command and response codes */
enum maple_code {
	MAPLE_RESPONSE_FILEERR =	-5,
	MAPLE_RESPONSE_AGAIN,	/* retransmit */
	MAPLE_RESPONSE_BADCMD,
	MAPLE_RESPONSE_BADFUNC,
	MAPLE_RESPONSE_NONE,	/* unit didn't respond*/
	MAPLE_COMMAND_DEVINFO =		1,
	MAPLE_COMMAND_ALLINFO,
	MAPLE_COMMAND_RESET,
	MAPLE_COMMAND_KILL,
	MAPLE_RESPONSE_DEVINFO,
	MAPLE_RESPONSE_ALLINFO,
	MAPLE_RESPONSE_OK,
	MAPLE_RESPONSE_DATATRF,
	MAPLE_COMMAND_GETCOND,
	MAPLE_COMMAND_GETMINFO,
	MAPLE_COMMAND_BREAD,
	MAPLE_COMMAND_BWRITE,
	MAPLE_COMMAND_BSYNC,
	MAPLE_COMMAND_SETCOND,
	MAPLE_COMMAND_MICCONTROL
};

enum maple_file_errors {
	MAPLE_FILEERR_INVALID_PARTITION =	0x01000000,
	MAPLE_FILEERR_PHASE_ERROR =		0x02000000,
	MAPLE_FILEERR_INVALID_BLOCK =		0x04000000,
	MAPLE_FILEERR_WRITE_ERROR =		0x08000000,
	MAPLE_FILEERR_INVALID_WRITE_LENGTH =	0x10000000,
	MAPLE_FILEERR_BAD_CRC = 		0x20000000
};

struct maple_buffer {
	char bufx[0x400];
	void *buf;
};

struct mapleq {
	struct list_head list;
	struct maple_device *dev;
	struct maple_buffer *recvbuf;
	void *sendbuf, *recvbuf_p2;
	unsigned char length;
	enum maple_code command;
};

struct maple_devinfo {
	unsigned long function;
	unsigned long function_data[3];
	unsigned char area_code;
	unsigned char connector_direction;
	char product_name[31];
	char product_licence[61];
	unsigned short standby_power;
	unsigned short max_power;
};

struct maple_device {
	struct maple_driver *driver;
	struct mapleq *mq;
	void (*callback) (struct mapleq * mq);
	void (*fileerr_handler)(struct maple_device *mdev, void *recvbuf);
	int (*can_unload)(struct maple_device *mdev);
	unsigned long when, interval, function;
	struct maple_devinfo devinfo;
	unsigned char port, unit;
	char product_name[32];
	char product_licence[64];
	atomic_t busy;
	wait_queue_head_t maple_wait;
	struct device dev;
};

struct maple_driver {
	unsigned long function;
	struct device_driver drv;
};

void maple_getcond_callback(struct maple_device *dev,
			    void (*callback) (struct mapleq * mq),
			    unsigned long interval,
			    unsigned long function);
int maple_driver_register(struct maple_driver *);
void maple_driver_unregister(struct maple_driver *);

int maple_add_packet(struct maple_device *mdev, u32 function,
	u32 command, u32 length, void *data);
void maple_clear_dev(struct maple_device *mdev);

#define to_maple_dev(n) container_of(n, struct maple_device, dev)
#define to_maple_driver(n) container_of(n, struct maple_driver, drv)

#define maple_get_drvdata(d)		dev_get_drvdata(&(d)->dev)
#define maple_set_drvdata(d,p)		dev_set_drvdata(&(d)->dev, (p))

#endif				/* __LINUX_MAPLE_H */
"n">lines = split_text(self.description, LINE_LENGTH - 6) out = "" out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2))) out += ("| Tier: " + self.name.ljust(LINE_LENGTH - 10) + "|\n") out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2))) out += ("| Order: " + str(self.order).ljust(LINE_LENGTH - 10) + "|\n") out += ("| CI Loop: " + str(self.ci_loop).ljust(LINE_LENGTH - 12) + "|\n") out += ("| Description:".ljust(LINE_LENGTH - 1) + "|\n") for line in lines: out += ("| " + line.ljust(LINE_LENGTH - 7) + " |\n") out += ("| Test cases:".ljust(LINE_LENGTH - 1) + "|\n") tests = self.get_test_names() if len(tests) > 0: for i in range(len(tests)): out += ("| - %s |\n" % tests[i].ljust(LINE_LENGTH - 9)) else: out += ("| (There are no supported test cases " .ljust(LINE_LENGTH - 1) + "|\n") out += ("| in this tier for the given scenario) " .ljust(LINE_LENGTH - 1) + "|\n") out += ("|".ljust(LINE_LENGTH - 1) + "|\n") out += ("+%s+\n" % ("-" * (LINE_LENGTH - 2))) return out class TestCase(object): def __init__(self, name, enabled, dependency, criteria, blocking, clean_flag, description=""): self.name = name self.enabled = enabled self.dependency = dependency self.criteria = criteria self.blocking = blocking self.clean_flag = clean_flag self.description = description @staticmethod def is_none(item): return item is None or item is "" def is_compatible(self, ci_installer, ci_scenario): try: if not self.is_none(ci_installer): if re.search(self.dependency.get_installer(), ci_installer) is None: return False if not self.is_none(ci_scenario): if re.search(self.dependency.get_scenario(), ci_scenario) is None: return False return True except TypeError: return False def get_name(self): return self.name def is_enabled(self): return self.enabled def get_criteria(self): return self.criteria def is_blocking(self): return self.blocking def needs_clean(self): return self.clean_flag def __str__(self): lines = split_text(self.description, LINE_LENGTH - 6) out = "" out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2))) out += ("| Testcase: " + self.name.ljust(LINE_LENGTH - 14) + "|\n") out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2))) out += ("| Description:".ljust(LINE_LENGTH - 1) + "|\n") for line in lines: out += ("| " + line.ljust(LINE_LENGTH - 7) + " |\n") out += ("| Criteria: " + str(self.criteria).ljust(LINE_LENGTH - 14) + "|\n") out += ("| Dependencies:".ljust(LINE_LENGTH - 1) + "|\n") installer = self.dependency.get_installer() scenario = self.dependency.get_scenario() out += ("| - Installer:" + installer.ljust(LINE_LENGTH - 17) + "|\n") out += ("| - Scenario :" + scenario.ljust(LINE_LENGTH - 17) + "|\n") out += ("|".ljust(LINE_LENGTH - 1) + "|\n") out += ("+%s+\n" % ("-" * (LINE_LENGTH - 2))) return out class Dependency(object): def __init__(self, installer, scenario): self.installer = installer self.scenario = scenario def get_installer(self): return self.installer def get_scenario(self): return self.scenario def __str__(self): return ("Dependency info:\n" " installer: " + self.installer + "\n" " scenario: " + self.scenario + "\n")