Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
maple.h
Go to the documentation of this file.
1 #ifndef __LINUX_MAPLE_H
2 #define __LINUX_MAPLE_H
3 
4 #include <mach/maple.h>
5 
6 struct device;
7 extern struct bus_type maple_bus_type;
8 
9 /* Maple Bus command and response codes */
10 enum maple_code {
12  MAPLE_RESPONSE_AGAIN, /* retransmit */
15  MAPLE_RESPONSE_NONE, /* unit didn't respond*/
31 };
32 
39  MAPLE_FILEERR_BAD_CRC = 0x20000000
40 };
41 
42 struct maple_buffer {
43  char bufx[0x400];
44  void *buf;
45 };
46 
47 struct mapleq {
48  struct list_head list;
49  struct maple_device *dev;
52  unsigned char length;
54 };
55 
56 struct maple_devinfo {
57  unsigned long function;
58  unsigned long function_data[3];
59  unsigned char area_code;
60  unsigned char connector_direction;
61  char product_name[31];
62  char product_licence[61];
63  unsigned short standby_power;
64  unsigned short max_power;
65 };
66 
67 struct maple_device {
69  struct mapleq *mq;
70  void (*callback) (struct mapleq * mq);
71  void (*fileerr_handler)(struct maple_device *mdev, void *recvbuf);
72  int (*can_unload)(struct maple_device *mdev);
73  unsigned long when, interval, function;
75  unsigned char port, unit;
76  char product_name[32];
77  char product_licence[64];
80  struct device dev;
81 };
82 
83 struct maple_driver {
84  unsigned long function;
86 };
87 
89  void (*callback) (struct mapleq * mq),
90  unsigned long interval,
91  unsigned long function);
94 
95 int maple_add_packet(struct maple_device *mdev, u32 function,
96  u32 command, u32 length, void *data);
97 void maple_clear_dev(struct maple_device *mdev);
98 
99 #define to_maple_dev(n) container_of(n, struct maple_device, dev)
100 #define to_maple_driver(n) container_of(n, struct maple_driver, drv)
101 
102 #define maple_get_drvdata(d) dev_get_drvdata(&(d)->dev)
103 #define maple_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p))
104 
105 #endif /* __LINUX_MAPLE_H */