Skip to content

Instantly share code, notes, and snippets.

@lp6m
Created December 29, 2021 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lp6m/7836a36929c991b337af876a8ff97131 to your computer and use it in GitHub Desktop.
Save lp6m/7836a36929c991b337af876a8ff97131 to your computer and use it in GitHub Desktop.
#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