adb.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef __ADB_H__
  2. #define __ADB_H__
  3. #include "system/task.h"
  4. #include "device/device.h"
  5. #include "usb/scsi.h"
  6. #include "usb_bulk_transfer.h"
  7. #include "usb/host/usb_host.h"
  8. struct adb_device_t {
  9. u32 local_id;
  10. u32 remote_id;
  11. void *buffer;
  12. u32 max_len;
  13. u8 target_epin;
  14. u8 target_epout;
  15. u8 host_epin;
  16. u8 host_epout;
  17. u8 extr_in;
  18. u8 extr_out;
  19. };
  20. u32 usb_adb_interface_ptp_mtp_parse(struct usb_host_device *host_dev, u8 interface_num, const u8 *pBuf);
  21. int usb_adb_parser(struct usb_host_device *host_dev, u8 interface_num, const u8 *pBuf);
  22. u32 adb_process();
  23. void adb_switch_aoa(u32 id);
  24. #if 1
  25. #define A_SYNC 0x434e5953
  26. #define A_CNXN 0x4e584e43
  27. #define A_OPEN 0x4e45504f
  28. #define A_OKAY 0x59414b4f
  29. #define A_CLSE 0x45534c43
  30. #define A_WRTE 0x45545257
  31. #define A_AUTH 0x48545541
  32. //#define S_ID_LOCAL 0x00003456
  33. /* AUTH packets first argument */
  34. /* Request */
  35. #define ADB_AUTH_TOKEN 1
  36. /* Response */
  37. #define ADB_AUTH_SIGNATURE 2
  38. #define ADB_AUTH_RSAPUBLICKEY 3
  39. #define A_VERSION 0x01000000 // ADB protocol version
  40. #define ADB_VERSION_MAJOR 1 // Used for help/version information
  41. #define ADB_VERSION_MINOR 0 // Used for help/version information
  42. #else
  43. #define A_SYNC 0x53594e43
  44. #define A_CNXN 0x434e584e
  45. #define A_OPEN 0x4f50454e
  46. #define A_OKAY 0x4f4b4159
  47. #define A_CLSE 0x434c5345
  48. #define A_WRTE 0x57525445
  49. #define A_VERSION 0x00000001 // ADB protocol version
  50. #define ADB_VERSION_MAJOR 1 // Used for help/version information
  51. #define ADB_VERSION_MINOR 0 // Used for help/version information
  52. #endif
  53. struct amessage {
  54. unsigned long int command; /* command identifier constant */
  55. unsigned long int arg0; /* first argument */
  56. unsigned long int arg1; /* second argument */
  57. unsigned long int data_length; /* length of payload (0 is allowed) */
  58. unsigned long int data_check; /* checksum of data payload */
  59. unsigned long int magic; /* command ^ 0xffffffff */
  60. };
  61. #endif /*ADB_H*/