]>
git.zerfleddert.de Git - proxmark3-svn/blob - armsrc/i2c.h
4c5c522867252a2feaa2d569997d7563fa6f3994
1 //-----------------------------------------------------------------------------
3 // Edits by Iceman, July 2018
5 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
6 // at your option, any later version. See the LICENSE.txt file for the text of
8 //-----------------------------------------------------------------------------
9 // The main i2c code, for communications with smart card module
10 //-----------------------------------------------------------------------------
15 #include "proxmark3.h"
19 #include "smartcard.h"
21 #define I2C_DEVICE_ADDRESS_BOOT 0xB0
22 #define I2C_DEVICE_ADDRESS_MAIN 0xC0
24 #define I2C_DEVICE_CMD_GENERATE_ATR 0x01
25 #define I2C_DEVICE_CMD_SEND 0x02
26 #define I2C_DEVICE_CMD_READ 0x03
27 #define I2C_DEVICE_CMD_SETBAUD 0x04
28 #define I2C_DEVICE_CMD_SIM_CLC 0x05
29 #define I2C_DEVICE_CMD_GETVERSION 0x06
34 void I2C_SetResetStatus(uint8_t LineRST
, uint8_t LineSCK
, uint8_t LineSDA
);
36 void I2C_Reset_EnterMainProgram(void);
37 void I2C_Reset_EnterBootloader(void);
39 bool I2C_WriteCmd(uint8_t device_cmd
, uint8_t device_address
);
41 bool I2C_WriteByte(uint8_t data
, uint8_t device_cmd
, uint8_t device_address
);
42 bool I2C_BufferWrite(uint8_t *data
, uint8_t len
, uint8_t device_cmd
, uint8_t device_address
);
43 uint8_t I2C_BufferRead(uint8_t *data
, uint8_t len
, uint8_t device_cmd
, uint8_t device_address
);
46 uint8_t I2C_ReadFW(uint8_t *data
, uint8_t len
, uint8_t msb
, uint8_t lsb
, uint8_t device_address
);
47 bool I2C_WriteFW(uint8_t *data
, uint8_t len
, uint8_t msb
, uint8_t lsb
, uint8_t device_address
);
49 bool GetATR(smart_card_atr_t
*card_ptr
);
52 void SmartCardAtr(void);
53 void SmartCardRaw(uint64_t arg0
, uint64_t arg1
, uint8_t *data
);
54 void SmartCardUpgrade(uint64_t arg0
);
55 //void SmartCardSetBaud(uint64_t arg0);
56 void SmartCardSetClock(uint64_t arg0
);
57 void I2C_print_status(void);