InPlay API
hal_sync7816.h
1 
12 #ifndef HAL_SYNC7816_H
13 #define HAL_SYNC7816_H
14 #include <stdint.h>
15 #include "./hal/hal_power.h"
16 #include "./hal/hal_counter.h"
17 
27 enum sync7816_error {
28  SYNC7816_ERR_OK = 0,
29  SYNC7816_ERR_INVALID_PARAM = -1,
30  SYNC7816_ERR_TIMEOUT = -2,
31  SYNC7816_ERR_LOCK = -3,
32 };
33 
34 typedef struct sync7816_init {
35  int clk_port;
36  int clk_pin;
37  int rst_port;
38  int rst_pin;
39  int data_port;
40  int data_pin;
41  uint32_t clk;
42  int prio;
43 } sync7816_init_t;
49 void* hal_sync7816_open(sync7816_init_t *init);
50 
56 void hal_sync7816_close(void* dev);
57 
63 void hal_sync7816_stop(void* dev);
64 
71 int hal_sync7816_answer_to_rst(void* dev, uint32_t* pval);
72 
82 int fm4428_read_cmd(void* dev, uint32_t cmd, uint32_t addr, uint32_t *rx_data, uint32_t rx_len);
83 
92 int fm4428_read_byte(void* dev, uint32_t addr, int protect, uint8_t *rx_data);
93 
103 int fm4428_write_cmd(void* dev, uint32_t cmd, uint32_t addr, uint8_t data, uint32_t wait_clk);
104 
112 int fm4428_write_byte(void* dev, uint32_t addr, uint8_t data);
113 
114 
122 int fm4428_unlock(void* dev, uint8_t psc1, uint8_t psc2);
123 
133 int fm4442_read_cmd(void* dev, uint32_t cmd, uint32_t addr, uint32_t *rx_data, uint32_t rx_len);
134 
143 int fm4442_write_cmd(void* dev, uint32_t cmd, uint32_t addr, uint8_t data);
144 
145 
147 #endif
int fm4428_read_cmd(void *dev, uint32_t cmd, uint32_t addr, uint32_t *rx_data, uint32_t rx_len)
Send read command for fm4428 chip.
int fm4428_write_cmd(void *dev, uint32_t cmd, uint32_t addr, uint8_t data, uint32_t wait_clk)
Send write command for fm4428 chip.
void hal_sync7816_close(void *dev)
Close sync7816 device.
void * hal_sync7816_open(sync7816_init_t *init)
Init sync7816 device.
int fm4428_read_byte(void *dev, uint32_t addr, int protect, uint8_t *rx_data)
Read one byte for fm4428 chip.
void hal_sync7816_stop(void *dev)
Send stop signal to device.
int fm4428_unlock(void *dev, uint8_t psc1, uint8_t psc2)
Unlock fm4428 chip for write.
int fm4442_read_cmd(void *dev, uint32_t cmd, uint32_t addr, uint32_t *rx_data, uint32_t rx_len)
Send read command for fm4442 chip.
int hal_sync7816_answer_to_rst(void *dev, uint32_t *pval)
Get answer to reset.
int fm4428_write_byte(void *dev, uint32_t addr, uint8_t data)
Write one byte for fm4428 chip.
int fm4442_write_cmd(void *dev, uint32_t cmd, uint32_t addr, uint8_t data)
Send write command for fm4442 chip.