]> cvs.zerfleddert.de Git - proxmark3-svn/blob - armsrc/i2c.h
Merge branch 'master' into master
[proxmark3-svn] / armsrc / i2c.h
1 //-----------------------------------------------------------------------------
2 // Willok, June 2018
3 // Edits by Iceman, July 2018
4 //
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
7 // the license.
8 //-----------------------------------------------------------------------------
9 // The main i2c code, for communications with smart card module
10 //-----------------------------------------------------------------------------
11 #ifndef __I2C_H
12 #define __I2C_H
13
14 #include <stddef.h>
15 #include "proxmark3.h"
16 #include "apps.h"
17 #include "util.h"
18 #include "BigBuf.h"
19 #include "smartcard.h"
20
21 #define I2C_DEVICE_ADDRESS_BOOT 0xB0
22 #define I2C_DEVICE_ADDRESS_MAIN 0xC0
23
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
30
31
32 void I2C_init(void);
33 void I2C_Reset(void);
34 void I2C_SetResetStatus(uint8_t LineRST, uint8_t LineSCK, uint8_t LineSDA);
35
36 void I2C_Reset_EnterMainProgram(void);
37 void I2C_Reset_EnterBootloader(void);
38
39 bool I2C_WriteCmd(uint8_t device_cmd, uint8_t device_address);
40
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);
44
45 // for firmware
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);
48
49 bool GetATR(smart_card_atr_t *card_ptr);
50
51 // generic functions
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);
58 #endif
Impressum, Datenschutz