Last active
May 23, 2016 10:18
-
-
Save cidzoo/18a9c252c93748089902dfd485950bb2 to your computer and use it in GitHub Desktop.
Blink DS23 PS (Processing System a.k.a the ARM Cortex-A9) Led on the Xilinx ZC702 dev board
This file contains hidden or 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
| /* | |
| * @brief Blink DS23 PS (Processing System) Led on the Xilinx ZC702 dev board | |
| * | |
| * To be used with the default BSP generated by Xilinx SDK. | |
| * | |
| * Inspired by: | |
| * - https://forums.xilinx.com/t5/Embedded-Processor-System-Design/ | |
| * ZC706-GPIO-LED-amp-Pushbutton-switch-quot-Magic-Number-quot/td-p/540639 | |
| * | |
| * - http://www.xilinx.com/support/answers/51786.html | |
| * | |
| * @author Romain Maffina | |
| * @date 23.05.2016 | |
| */ | |
| #include "xgpiops.h" | |
| #define DELAY(i,nticks) for (i = 0; i < nticks; i++) | |
| #define GPIO_DEVICE_ID 0 | |
| #define MIO(x) x | |
| #define LED_DELAY 40000000 | |
| #define PS_LED_0 MIO(8) | |
| #define PS_LED_1 MIO(10) | |
| int main() | |
| { | |
| int i; | |
| XGpioPs Gpio; | |
| XGpioPs_Config *ConfigPtr; | |
| // init GPIO driver | |
| ConfigPtr = XGpioPs_LookupConfig(GPIO_DEVICE_ID); | |
| s32 Status = XGpioPs_CfgInitialize(&Gpio, ConfigPtr, ConfigPtr->BaseAddr); | |
| Xil_AssertVoid(Status == XST_SUCCESS); | |
| // configure GPIO LED pin (optional, should be the default config) | |
| XGpioPs_SetDirectionPin(&Gpio, PS_LED_1, 1); | |
| XGpioPs_SetOutputEnablePin(&Gpio, PS_LED_1, 1); | |
| // blink forever | |
| while (1) { | |
| XGpioPs_WritePin(&Gpio, PS_LED_1, 0x0); // turn off | |
| DELAY(i,LED_DELAY); | |
| XGpioPs_WritePin(&Gpio, PS_LED_1, 0x1); // turn on | |
| DELAY(i,LED_DELAY); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment