Created
December 29, 2021 15:31
-
-
Save lp6m/7836a36929c991b337af876a8ff97131 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "platform.h" | |
#include "xil_printf.h" | |
#include "sleep.h" | |
#define GPIO_DIRM_5_OFFSET 0XFF0A0344 | |
#define GPIO_OEN_5_OFFSET 0xFF0A0348 | |
#define GPIO_DATA_5_OFFSET 0xFF0A0054 | |
#define REG(address) *(volatile unsigned int*)(address) | |
void reset(){ | |
//low! | |
REG(GPIO_DATA_5_OFFSET) &= ~(1 << 31); | |
usleep(1000); | |
//high! | |
REG(GPIO_DATA_5_OFFSET) |= 1 << 31; | |
} | |
int main() | |
{ | |
init_platform(); | |
int i = 0; | |
print("Hello World\n\r"); | |
//set EMIO95 as output | |
REG(GPIO_OEN_5_OFFSET) |= 1 << 31; | |
REG(GPIO_DIRM_5_OFFSET) |= 1 << 31; | |
for(i=0; i<10; i++){ | |
sleep(5); | |
print("Reset now!!!"); | |
reset(); | |
} | |
print("Successfully ran Hello World application"); | |
cleanup_platform(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment