]>
Commit | Line | Data |
---|---|---|
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 | //----------------------------------------------------------------------------- | |
050aa18b | 11 | |
43591e64 | 12 | #include "i2c.h" |
050aa18b | 13 | |
14 | #include <stdint.h> | |
15 | #include <stdbool.h> | |
43591e64 | 16 | #include "string.h" //for memset memcmp |
050aa18b | 17 | #include "proxmark3.h" |
18 | #include "mifareutil.h" // for MF_DBGLEVEL | |
19 | #include "BigBuf.h" | |
20 | #include "apps.h" | |
867e10a5 | 21 | #include "usb_cdc.h" |
050aa18b | 22 | |
23 | #ifdef WITH_SMARTCARD | |
24 | #include "smartcard.h" | |
25 | #endif | |
26 | ||
43591e64 | 27 | |
43591e64 | 28 | #define GPIO_RST AT91C_PIO_PA1 |
29 | #define GPIO_SCL AT91C_PIO_PA5 | |
30 | #define GPIO_SDA AT91C_PIO_PA7 | |
31 | ||
32 | #define SCL_H HIGH(GPIO_SCL) | |
33 | #define SCL_L LOW(GPIO_SCL) | |
34 | #define SDA_H HIGH(GPIO_SDA) | |
35 | #define SDA_L LOW(GPIO_SDA) | |
36 | ||
37 | #define SCL_read (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SCL) | |
38 | #define SDA_read (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SDA) | |
39 | ||
40 | #define I2C_ERROR "I2C_WaitAck Error" | |
41 | ||
050aa18b | 42 | static volatile unsigned long c; |
43591e64 | 43 | |
44 |