]> cvs.zerfleddert.de Git - proxmark3-svn/blame - armsrc/i2c.h
Merge branch 'master' into master
[proxmark3-svn] / armsrc / i2c.h
CommitLineData
43591e64 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
32void I2C_init(void);
33void I2C_Reset(void);
34void I2C_SetResetStatus(uint8_t LineRST, uint8_t LineSCK, uint8_t LineSDA);
35
36void I2C_Reset_EnterMainProgram(void);
37void I2C_Reset_EnterBootloader(void);
38
39bool I2C_WriteCmd(uint8_t device_cmd, uint8_t device_address);
40
41bool I2C_WriteByte(uint8_t data, uint8_t device_cmd, uint8_t device_address);
42bool I2C_BufferWrite(uint8_t *data, uint8_t len, uint8_t device_cmd, uint8_t device_address);
43uint8_t I2C_BufferRead(uint8_t *data, uint8_t len, uint8_t device_cmd, uint8_t device_address);
44
45// for firmware
46uint8_t I2C_ReadFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address);
47bool I2C_WriteFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address);
48
49bool GetATR(smart_card_atr_t *card_ptr);
50
51// generic functions
52void SmartCardAtr(void);
53void SmartCardRaw(uint64_t arg0, uint64_t arg1, uint8_t *data);
54void SmartCardUpgrade(uint64_t arg0);
55//void SmartCardSetBaud(uint64_t arg0);
56void SmartCardSetClock(uint64_t arg0);
57void I2C_print_status(void);
58#endif
Impressum, Datenschutz