cdc_acm_protocol.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * cdc_acm_protocol.h
  3. *
  4. * Greaseweazle protocol over CDC ACM streams.
  5. *
  6. * Written & released by Keir Fraser <keir.xen@gmail.com>
  7. *
  8. * This is free and unencumbered software released into the public domain.
  9. * See the file COPYING for more details, or visit <http://unlicense.org>.
  10. */
  11. /* CMD_GET_INFO, length=3, 0. Returns 32 bytes after ACK. */
  12. #define CMD_GET_INFO 0
  13. /* CMD_SEEK, length=3, cyl# */
  14. #define CMD_SEEK 1
  15. /* CMD_SIDE, length=3, side# (0=bottom) */
  16. #define CMD_SIDE 2
  17. /* CMD_SET_DELAYS, length=2+4*2, <delay_params> */
  18. #define CMD_SET_DELAYS 3
  19. /* CMD_GET_DELAYS, length=2. Returns 4*2 bytes after ACK. */
  20. #define CMD_GET_DELAYS 4
  21. /* CMD_MOTOR, length=3, motor_state */
  22. #define CMD_MOTOR 5
  23. /* CMD_READ_FLUX, length=3, #revs. Returns flux readings until EOStream. */
  24. #define CMD_READ_FLUX 6
  25. /* CMD_WRITE_FLUX, length=2. Host follows with flux readings until EOStream. */
  26. #define CMD_WRITE_FLUX 7
  27. /* CMD_GET_FLUX_STATUS, length=2. Last read/write status returned in ACK. */
  28. #define CMD_GET_FLUX_STATUS 8
  29. /* CMD_GET_READ_INFO, length=2. Returns 7*8 bytes after ACK. */
  30. #define CMD_GET_READ_INFO 9
  31. /* [BOOTLOADER] CMD_UPDATE, length=6, <update_len>.
  32. * Host follows with <update_len> bytes.
  33. * Bootloader finally returns a status byte, 0 on success. */
  34. #define CMD_UPDATE 1
  35. #define ACK_OKAY 0
  36. #define ACK_BAD_COMMAND 1
  37. #define ACK_NO_INDEX 2
  38. #define ACK_NO_TRK0 3
  39. #define ACK_FLUX_OVERFLOW 4
  40. #define ACK_FLUX_UNDERFLOW 5
  41. #define ACK_WRPROT 6
  42. #define BAUD_CLEAR_COMMS 10000
  43. struct __packed gw_info {
  44. uint8_t fw_major;
  45. uint8_t fw_minor;
  46. uint8_t max_rev;
  47. uint8_t max_cmd;
  48. uint32_t sample_freq;
  49. };
  50. /*
  51. * Local variables:
  52. * mode: C
  53. * c-file-style: "Linux"
  54. * c-basic-offset: 4
  55. * tab-width: 4
  56. * indent-tabs-mode: nil
  57. * End:
  58. */