maple.h 1.9 KB

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