ktiva.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // ktiva.h :
  2. //
  3. #if !defined(AGD_KTIVA_H__4F0F73D0_4834_4018_9B16_27F1B78686DB__INCLUDED_)
  4. #define AGD_KTIVA_H__4F0F73D0_4834_4018_9B16_27F1B78686DB__INCLUDED_
  5. #include "defines.h"
  6. #include "kspi.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif // __cplusplus
  10. /////////////////////////////////////////////////////////////////////////////
  11. // ktiva.h - Declarations:
  12. #define CMD_ACK 0xCC
  13. #define CMD_NAK 0x33
  14. #define COMMAND_PING 0x20
  15. #define COMMAND_DOWNLOAD 0x21
  16. #define COMMAND_RUN 0x22
  17. #define COMMAND_GET_STATUS 0x23
  18. #define COMMAND_SEND_DATA 0x24
  19. #define COMMAND_RESET 0x25
  20. #define COMMAND_IO_TRANSFER 0x50
  21. #define COMMAND_GET_HWSW_REV 0x51
  22. #define COMMAND_GET_TIVA_TYPE 0x52
  23. #define COMMAND_START_BOOTLOADER 0x53
  24. #define COMMAND_GET_MCP7940 0x54
  25. #define COMMAND_SET_MCP7940 0x55
  26. #define COMMAND_GET_I2C 0x56
  27. #define COMMAND_PUT_I2C 0x57
  28. #define COMMAND_GET_ADDR 0x58
  29. #define COMMAND_SET_ADDR 0x59
  30. #define COMMAND_GET_ADC 0x5A
  31. #define COMMAND_SET_BACKLIGHT 0x5B
  32. #define COMMAND_GET_UPTIME 0x5C
  33. //#define COMMAND_GET_MATERIAL_SERIAL_ID 0x5D
  34. #define COMMAND_RET_SUCCESS 0x40
  35. #define COMMAND_RET_UNKNOWN_CMD 0x41
  36. #define COMMAND_RET_INVALID_CMD 0x42
  37. #define COMMAND_RET_INVALID_ADR 0x43
  38. #define COMMAND_RET_FLASH_FAIL 0x44
  39. #define COMMAND_RET_CRC_FAIL 0x45
  40. #define KTIVA_MAX_BUFFER_SIZE 256
  41. #define KTIVA_MAX_WAIT_LOOPS 100
  42. #define KTIVA_UPTIME_ADDRESS 0x200003C0
  43. /////////////////////////////////////////////////////////////////////////////
  44. int ktiva_wait_ack (struct file *pf);
  45. int ktiva_send_frame(struct file *pf, unsigned char cmd, const void *pData, size_t nCbData);
  46. int ktiva_recv_frame(struct file *pf, unsigned char cmd, void *pData, size_t nCbData);
  47. /////////////////////////////////////////////////////////////////////////////
  48. int TivaCmdPing (struct file *pf);
  49. int TivaCmdGetFirmwareVersion (struct file *pf, int *Hw, int *Sw);
  50. int TivaCmdGetADC (struct file *pf, LPTIVA_ADC padc);
  51. int TivaCmdGetUptime (struct file *pf, unsigned long long *put);
  52. int TivaCmdGetAddress (struct file *pf, unsigned int addr, unsigned int *val);
  53. int TivaCmdGetStatus (struct file *pf, unsigned char *stat);
  54. int TivaCmdGetBootloaderStatus (struct file *pf, unsigned char *stat);
  55. int TivaCmdStartBootloader (struct file *pf);
  56. int TivaCmdStartDownload (struct file *pf, unsigned int addr, size_t size);
  57. int TivaCmdSendDataBlock (struct file *pf, const void *pBlock, size_t nCbBlock);
  58. int TivaCmdReset (struct file *pf);
  59. int TivaRevive (struct file *pf);
  60. /////////////////////////////////////////////////////////////////////////////
  61. #ifdef __cplusplus
  62. }
  63. #endif // __cplusplus
  64. #endif // !defined(AGD_KTIVA_H__4F0F73D0_4834_4018_9B16_27F1B78686DB__INCLUDED_)