CryptoAuthLib
Atmel CryptoAuthentication Library
i2c_bitbang_at88ck9000.h
Go to the documentation of this file.
1 
44 #ifndef I2C_BITBANG_AT88CK9000_H_
45 #define I2C_BITBANG_AT88CK9000_H_
46 
47 #include "atca_status.h"
48 #include "timer_utilities.h"
49 
50 
51 #define MAX_I2C_BUSES 11
52 
53 
54 typedef struct
55 {
58 } I2CBuses;
59 
61 
62 extern uint32_t pin_sda;
63 extern uint32_t pin_scl;
64 
65 
66 #define I2C_ENABLE() pio_configure_pin(pin_sda, PIO_OUTPUT_0);pio_configure_pin(pin_scl, PIO_OUTPUT_0)
67 #define I2C_DISABLE() pio_configure_pin(pin_sda, PIO_INPUT);pio_configure_pin(pin_scl, PIO_INPUT)
68 #define I2C_CLOCK_LOW() pio_set_pin_low(pin_scl)
69 #define I2C_CLOCK_HIGH() pio_set_pin_high(pin_scl)
70 #define I2C_DATA_LOW() pio_set_pin_low(pin_sda)
71 #define I2C_DATA_HIGH() pio_set_pin_high(pin_sda)
72 #define I2C_DATA_IN() pio_get_pin_value(pin_sda)
73 #define I2C_SET_OUTPUT() pio_configure_pin(pin_sda, PIO_OUTPUT_0)
74 #define I2C_SET_OUTPUT_HIGH() I2C_SET_OUTPUT(); I2C_DATA_HIGH()
75 #define I2C_SET_OUTPUT_LOW() I2C_SET_OUTPUT(); I2C_DATA_LOW()
76 #define I2C_SET_INPUT() pio_configure_pin(pin_sda, PIO_INPUT)
77 #define DISABLE_INTERRUPT() cpu_irq_disable()
78 #define ENABLE_INTERRUPT() cpu_irq_enable()
79 
80 
81 #define I2C_CLOCK_DELAY_WRITE_LOW() delay_us(1)
82 #define I2C_CLOCK_DELAY_WRITE_HIGH() delay_us(1)
83 #define I2C_CLOCK_DELAY_READ_LOW() delay_us(1)
84 #define I2C_CLOCK_DELAY_READ_HIGH() delay_us(1)
85 #define I2C_CLOCK_DELAY_SEND_ACK() delay_us(1)
87 #define I2C_HOLD_DELAY() i2c_delay()
89 
90 
92 #define I2C_ACK_TIMEOUT (4)
93 
94 
102 void i2c_set_pin(uint32_t sda, uint32_t scl);
103 
104 
108 void i2c_enable(void);
109 
113 void i2c_disable(void);
114 
115 
119 void i2c_send_start(void);
120 
126 void i2c_send_ack(uint8_t ack);
127 
131 void i2c_send_stop(void);
132 
136 void i2c_send_wake_token(void);
137 
145 ATCA_STATUS i2c_send_byte(uint8_t i2c_byte);
146 
155 ATCA_STATUS i2c_send_bytes(uint8_t count, uint8_t *data);
156 
164 uint8_t i2c_receive_one_byte(uint8_t ack);
165 
171 void i2c_receive_byte(uint8_t *data);
172 
179 void i2c_receive_bytes(uint8_t count, uint8_t *data);
180 
181 #endif /* I2C_BITBANG_AT88CK9000_H_ */
#define MAX_I2C_BUSES
AT88CK9000 has 11 sets of GPIO pins dedicated for I2C (including 1 for on-board SHA204A) ...
Definition: i2c_bitbang_at88ck9000.h:51
uint32_t pin_sda
Definition: i2c_bitbang_at88ck9000.c:54
void i2c_enable(void)
Configure GPIO pins for I2C clock and data as output.
Definition: i2c_bitbang_at88ck9000.c:63
void i2c_send_stop(void)
Send a STOP condition.
Definition: i2c_bitbang_at88ck9000.c:105
ATCA_STATUS i2c_send_byte(uint8_t i2c_byte)
Send one byte.
Definition: i2c_bitbang_at88ck9000.c:122
ATCA_STATUS
Definition: atca_status.h:55
uint8_t i2c_receive_one_byte(uint8_t ack)
Receive one byte (MSB first).
Definition: i2c_bitbang_at88ck9000.c:215
void i2c_send_wake_token(void)
Send a Wake Token.
Definition: i2c_bitbang_at88ck9000.c:115
ATCA_STATUS i2c_send_bytes(uint8_t count, uint8_t *data)
Send a number of bytes.
Definition: i2c_bitbang_at88ck9000.c:193
void i2c_receive_bytes(uint8_t count, uint8_t *data)
Receive a number of bytes.
Definition: i2c_bitbang_at88ck9000.c:251
I2CBuses i2c_buses_default
Definition: i2c_bitbang_at88ck9000.c:49
uint32_t pin_scl
Definition: i2c_bitbang_at88ck9000.c:54
void i2c_set_pin(uint32_t sda, uint32_t scl)
Set I2C data and clock pin. Other functions will use these pins.
Definition: i2c_bitbang_at88ck9000.c:57
void i2c_receive_byte(uint8_t *data)
Receive one byte and send ACK.
Definition: i2c_bitbang_at88ck9000.c:246
void i2c_send_start(void)
Send a START condition.
Definition: i2c_bitbang_at88ck9000.c:76
Atmel Crypto Auth status codes.
Definition: i2c_bitbang_at88ck9000.h:54
void i2c_disable(void)
Configure GPIO pins for I2C clock and data as input.
Definition: i2c_bitbang_at88ck9000.c:70
void i2c_send_ack(uint8_t ack)
Send an ACK or NACK (after receive).
Definition: i2c_bitbang_at88ck9000.c:86