how to code something このページをアンテナに追加 RSSフィード

2017-12-26

ZyboでPS側のGPIO(MIO)を使う

https://forums.xilinx.com/t5/Xcell-Daily-Blog/Driving-the-Zynq-SoC-s-GPIO-Adam-Taylor-s-MicroZed-Chronicles/ba-p/389611

f:id:seinzumtode:20171226094845p:image

f:id:seinzumtode:20171226094723p:image

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xgpiops.h"
#define ledpin 7

int main()
{
    init_platform();

    print("Hello World\n\r");

    XGpioPs Gpio;
    int Status;
    XGpioPs_Config *GPIOConfigPtr;
    //GPIO Initilization
    GPIOConfigPtr = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID);
    Status = XGpioPs_CfgInitialize(&Gpio, GPIOConfigPtr, GPIOConfigPtr ->BaseAddr);
    if (Status != XST_SUCCESS) {
    	return XST_FAILURE;
    }
    XGpioPs_SetDirectionPin(&Gpio, ledpin, 1);
    XGpioPs_SetOutputEnablePin(&Gpio, ledpin, 1);
    while(1){
        XGpioPs_WritePin(&Gpio, ledpin, 0x0);
        usleep(1000*1000);
        XGpioPs_WritePin(&Gpio, ledpin, 0x1);
        usleep(1000*1000);
    }

    cleanup_platform();
    return 0;
}

f:id:seinzumtode:20171226095639g:image