cebf746
Dependents: CEBF746_Master CEBF746_Slave_withTPM CEBF746_Master_New
lib_CEBF746.h
- Committer:
- gandol2
- Date:
- 2016-10-18
- Revision:
- 8:da02e9d56be6
- Parent:
- 7:29386624a20f
- Child:
- 9:50facfecef45
File content as of revision 8:da02e9d56be6:
#ifndef _CUBE_CEBF746_H_ #define _CUBE_CEBF746_H_ #define DEBUG_CEBF746 #ifdef DEBUG_CEBF746 #define PRINTD_CEBF746(arg1,arg2...) printf(arg1,##arg2) #endif #define CEBF746_CMD_WAIT() SPI_WAIT(10000) #define CEB_BUF_SIZE 16 #define WRITE_SELF_TEST_DATA "WriteTestString" // 16byte data #define READ_SELF_TEST_DATA "ReadTestString-" // 16byte data /* CEBF716_FUNCTION */ typedef enum { FUNC_READ_STATUS = 0x01, // read status register FUNC_WRITE_ENC_DATA = 0x02, // 암호화 필요 데이터 Write FUNC_READ_ENC_DATA = 0x03, // 암호화된 데이터 Read FUNC_WRITE_DEC_DATA = 0x04, // 암호화 필요 데이터 Write FUNC_READ_DEC_DATA = 0x05, // 복호화된 데이터 Read FUNC_WRITE_SELF_TEST = 0x80, // FUNC_READ_SELF_TEST = 0x81, // } CEBF716_FUNCTION; /* CEBF716_COMMAND_RETURN_CODE */ typedef enum { SUCESS = 0x00, // No errors } CEBF716_COMMAND_RETURN_CODE; typedef struct _spiDataStr{ uint16_t size; // buf size uint8_t *buf; uint16_t crc16; // crc16 = crc(size(2) + buf(?)) } spiDataStr; void cebf746_use_init(void); int16_t cebf746_packet_write(CEBF716_FUNCTION cebf746_command, spiDataStr* sendPacketStruct); int16_t cebf746_packet_read(CEBF716_FUNCTION cebf746_command, spiDataStr* readPacketStruct); void cebf746_print_packet(spiDataStr* in); #endif /* _CUBE_CEBF746_H_ */