maple.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. int (*connect) (struct maple_device * dev);
  58. void (*disconnect) (struct maple_device * dev);
  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. void maple_add_packet(struct mapleq *mq);
  67. #define to_maple_dev(n) container_of(n, struct maple_device, dev)
  68. #define to_maple_driver(n) container_of(n, struct maple_driver, drv)
  69. #endif /* __LINUX_MAPLE_H */