maple.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef __LINUX_MAPLE_H
  2. #define __LINUX_MAPLE_H
  3. #include <linux/device.h>
  4. #include <mach/maple.h>
  5. extern struct bus_type maple_bus_type;
  6. /* Maple Bus command and response codes */
  7. enum maple_code {
  8. MAPLE_RESPONSE_FILEERR = -5,
  9. MAPLE_RESPONSE_AGAIN = -4, /* request should be retransmitted */
  10. MAPLE_RESPONSE_BADCMD = -3,
  11. MAPLE_RESPONSE_BADFUNC = -2,
  12. MAPLE_RESPONSE_NONE = -1, /* unit didn't respond at all */
  13. MAPLE_COMMAND_DEVINFO = 1,
  14. MAPLE_COMMAND_ALLINFO = 2,
  15. MAPLE_COMMAND_RESET = 3,
  16. MAPLE_COMMAND_KILL = 4,
  17. MAPLE_RESPONSE_DEVINFO = 5,
  18. MAPLE_RESPONSE_ALLINFO = 6,
  19. MAPLE_RESPONSE_OK = 7,
  20. MAPLE_RESPONSE_DATATRF = 8,
  21. MAPLE_COMMAND_GETCOND = 9,
  22. MAPLE_COMMAND_GETMINFO = 10,
  23. MAPLE_COMMAND_BREAD = 11,
  24. MAPLE_COMMAND_BWRITE = 12,
  25. MAPLE_COMMAND_SETCOND = 14
  26. };
  27. struct mapleq {
  28. struct list_head list;
  29. struct maple_device *dev;
  30. void *sendbuf, *recvbuf, *recvbufdcsp;
  31. unsigned char length;
  32. enum maple_code command;
  33. struct mutex mutex;
  34. };
  35. struct maple_devinfo {
  36. unsigned long function;
  37. unsigned long function_data[3];
  38. unsigned char area_code;
  39. unsigned char connector_direction;
  40. char product_name[31];
  41. char product_licence[61];
  42. unsigned short standby_power;
  43. unsigned short max_power;
  44. };
  45. struct maple_device {
  46. struct maple_driver *driver;
  47. struct mapleq *mq;
  48. void *private_data;
  49. void (*callback) (struct mapleq * mq);
  50. unsigned long when, interval, function;
  51. struct maple_devinfo devinfo;
  52. unsigned char port, unit;
  53. char product_name[32];
  54. char product_licence[64];
  55. struct device dev;
  56. };
  57. struct maple_driver {
  58. unsigned long function;
  59. struct device_driver drv;
  60. };
  61. void maple_getcond_callback(struct maple_device *dev,
  62. void (*callback) (struct mapleq * mq),
  63. unsigned long interval,
  64. unsigned long function);
  65. int maple_driver_register(struct device_driver *drv);
  66. int maple_add_packet_sleeps(struct maple_device *mdev, u32 function,
  67. u32 command, u32 length, void *data);
  68. void maple_clear_dev(struct maple_device *mdev);
  69. #define to_maple_dev(n) container_of(n, struct maple_device, dev)
  70. #define to_maple_driver(n) container_of(n, struct maple_driver, drv)
  71. #endif /* __LINUX_MAPLE_H */