smartbook.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef __SMARTBOOK_H__
  2. #define __SMARTBOOK_H__
  3. //#define HID_CRYPTO // enable scratchpad cryptiion (deprecated)
  4. //#define SBK_FAKE_BATTERY // faking 2nd battery data
  5. #define HID_BUF 64
  6. #define HID_SIZE 8 // 16 // HID_SIZE = Protocol used Registers count.
  7. #define KB_MODLEN 8
  8. #define KB_LEN 250
  9. #define HID_COMMAND_PAYLOAD_LEN 6
  10. //CBUS command define
  11. #define SCRATCHPAD_OFFSET 0x40
  12. #define WRITEBURST_MAX_LEN 0x8
  13. #define CA_PMU_LEN
  14. //Category
  15. #define CA_INPUT_DEV 0x1
  16. #define CA_MISC 0x2
  17. #define CA_PMU 0x80
  18. //COMMAND
  19. #define INPUT_MOUSE 0x2
  20. #define INPUT_KEYBOARD 0x3
  21. #define INPUT_TOUCHPAD 0x4
  22. #define MISC_MOUSE 0x2
  23. #define MISC_KEYBOARD 0x3
  24. #define MISC_TOUCHPAD 0x4
  25. #define MISC_UNSUPPORT 0xff
  26. #define MISC_HANDSHAKE 0x3c
  27. #define MISC_LATENCY 0xaa
  28. #define PMU_BATTERY 0x3
  29. #define PMU_SCREEN 0x55
  30. #define ID_LEN 6
  31. //ID
  32. #define SMB_SOURCE_ID_0 0x66
  33. #define SMB_SOURCE_ID_1 0x19
  34. #define SMB_SOURCE_ID_2 0x5a
  35. #define SMB_SOURCE_ID_3 0x22
  36. #define SMB_SOURCE_ID_4 0xba
  37. #define SMB_SOURCE_ID_5 0x51
  38. #define SMB_SINK_ID_0 0x22
  39. #define SMB_SINK_ID_1 0x45
  40. #define SMB_SINK_ID_2 0x43
  41. #define SMB_SINK_ID_3 0x69
  42. #define SMB_SINK_ID_4 0x77
  43. #define SMB_SINK_ID_5 0x26
  44. typedef struct{
  45. unsigned char category;
  46. unsigned char command;
  47. unsigned char payload[HID_COMMAND_PAYLOAD_LEN];
  48. }HIDCommand;
  49. typedef enum{
  50. ImmediateOff = 0,
  51. DownCount = 1,
  52. CancelDownCount = 2
  53. }ScreenOffType;
  54. typedef enum{
  55. Init = 0,
  56. Ack = 1
  57. }HandshakeType;
  58. typedef enum{
  59. NotConnect = 0,
  60. SmartBook = 1,
  61. MonitorTV = 2,
  62. Unknown = 3
  63. }SinkType;
  64. #define DEBUG_LOG
  65. #ifdef DEBUG_LOG
  66. #define smb_print(fmt, args...) pr_debug(fmt, ##args)
  67. #else
  68. #define smb_print(fmt, args...)
  69. #endif
  70. #ifdef DEBUG_LOG
  71. #define smb_mmp_print(event, type, data1, data2, str) MMProfileLogMetaStringEx(event, type, data1, data2, str)
  72. #else
  73. #define smb_mmp_print(event, type, data1, data2, str)
  74. #endif
  75. //export function
  76. extern SinkType SMBGetSinkStatus(void);
  77. extern int SiiHandshakeCommand(HandshakeType ComType);
  78. extern void SiiHidSuspend(int flag);
  79. extern int SiiHidWrite(uint8_t *scratchpad_data);
  80. // others function
  81. extern void update_battery_2nd_info(int status_2nd, int capacity_2nd, int present_2nd);
  82. extern void RecordStamp(bool dump, char tag);
  83. #endif