these payloads may not work , i have no clue honestly i attached them , also there are 2 helper py scripts that might work with some of these payloads
42 lines
1.0 KiB
C
42 lines
1.0 KiB
C
#define GPIO_BASE 0x6000d000
|
|
#define SCL_BIT (1 << 3)
|
|
#define SDA_BIT (1 << 2)
|
|
#define GPIO_P_OFFSET 0x400
|
|
|
|
void delay() {
|
|
for (volatile int i = 0; i < 500; i++)
|
|
;
|
|
}
|
|
|
|
void i2c_start() {
|
|
*(volatile unsigned int *)(GPIO_BASE + GPIO_P_OFFSET + 0x18) =
|
|
SDA_BIT; // SDA High
|
|
*(volatile unsigned int *)(GPIO_BASE + GPIO_P_OFFSET + 0x18) =
|
|
SCL_BIT; // SCL High
|
|
delay();
|
|
*(volatile unsigned int *)(GPIO_BASE + GPIO_P_OFFSET + 0x18) &=
|
|
~SDA_BIT; // SDA Low
|
|
delay();
|
|
*(volatile unsigned int *)(GPIO_BASE + GPIO_P_OFFSET + 0x18) &=
|
|
~SCL_BIT; // SCL Low
|
|
}
|
|
|
|
void _start() {
|
|
*(volatile unsigned int *)(0x60006010) |= (1 << 8);
|
|
|
|
*(volatile unsigned int *)(GPIO_BASE + GPIO_P_OFFSET + 0x10) =
|
|
(SCL_BIT | SDA_BIT);
|
|
*(volatile unsigned int *)(GPIO_BASE + GPIO_P_OFFSET + 0x14) =
|
|
(SCL_BIT | SDA_BIT);
|
|
|
|
i2c_start();
|
|
|
|
*(volatile unsigned int *)(GPIO_BASE + 0x500 + 0x14) = 0x01;
|
|
|
|
while (1) {
|
|
*(volatile unsigned int *)(GPIO_BASE + 0x500 + 0x18) ^= 0x01; // Toggle TX
|
|
for (volatile int i = 0; i < 10000; i++)
|
|
;
|
|
}
|
|
}
|