CryptoAuthLib
Microchip CryptoAuthentication Library
kit_protocol.h
Go to the documentation of this file.
1 
29 #ifndef KIT_PROTOCOL_H_
30 #define KIT_PROTOCOL_H_
31 
32 #include "cryptoauthlib.h"
33 
34 // Define this for debugging communication
35 //#define KIT_DEBUG
36 
44 // The number of bytes to wrap a command in kit protocol. sizeof("s:t()\n<null>")
45 #define KIT_TX_WRAP_SIZE (7)
46 
47 // The number of bytes to wrap a response in kit protocol. sizeof("<KIT_MSG_SIZE>00()\n<null>")
48 #define KIT_MSG_SIZE (32)
49 #define KIT_RX_WRAP_SIZE (KIT_MSG_SIZE + 6)
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
56 
57 ATCA_STATUS kit_send(ATCAIface iface, const uint8_t* txdata, int txlength);
58 ATCA_STATUS kit_receive(ATCAIface iface, uint8_t* rxdata, uint16_t* rxsize);
59 
60 ATCA_STATUS kit_wrap_cmd(const uint8_t* txdata, int txlength, char* pkitbuf, int* nkitbuf, char target);
61 ATCA_STATUS kit_parse_rsp(const char* pkitbuf, int nkitbuf, uint8_t* kitstatus, uint8_t* rxdata, int* nrxdata);
62 
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
73 #endif // KIT_PROTOCOL_H
ATCA_STATUS kit_receive(ATCAIface iface, uint8_t *rxdata, uint16_t *rxsize)
HAL implementation to receive bytes and unwrap from kit protocol. This function calls back to the phy...
Definition: kit_protocol.c:216
ATCA_STATUS
Definition: atca_status.h:41
Single aggregation point for all CryptoAuthLib header files.
ATCA_STATUS kit_parse_rsp(const char *pkitbuf, int nkitbuf, uint8_t *kitstatus, uint8_t *rxdata, int *datasize)
Parse the response ascii from the kit.
Definition: kit_protocol.c:462
ATCA_STATUS kit_idle(ATCAIface iface)
Call the idle for kit protocol.
Definition: kit_protocol.c:308
ATCA_STATUS kit_wake(ATCAIface iface)
Call the wake for kit protocol.
Definition: kit_protocol.c:263
ATCA_STATUS kit_send(ATCAIface iface, const uint8_t *txdata, int txlength)
HAL implementation of kit protocol send. This function calls back to the physical protocol to send th...
Definition: kit_protocol.c:174
atca_iface is the C object backing ATCAIface. See the atca_iface.h file for details on the ATCAIface ...
Definition: atca_iface.h:129
ATCA_STATUS kit_sleep(ATCAIface iface)
Call the sleep for kit protocol.
Definition: kit_protocol.c:353
ATCA_STATUS kit_init(ATCAIface iface)
HAL implementation of kit protocol init. This function calls back to the physical protocol to send th...
Definition: kit_protocol.c:86
ATCA_STATUS kit_wrap_cmd(const uint8_t *txdata, int txlen, char *pkitcmd, int *nkitcmd, char target)
Wrap binary bytes in ascii kit protocol.
Definition: kit_protocol.c:406