SDK代码记录

zynq中SDK相关API的学习。记录常用函数

/******************************************************************************
*
* Copyright (C) 2009 - 2014 Xilinx, Inc.  All rights reserved.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/

/*
 * helloworld.c: simple test application
 *
 * This application configures UART 16550 to baud rate 9600.
 * PS7 UART (Zynq) is not initialized by this application, since
 * bootrom/bsp configures it to baud rate 115200
 *
 * ------------------------------------------------
 * | UART TYPE   BAUD RATE                        |
 * ------------------------------------------------
 *   uartns550   9600
 *   uartlite    Configurable only in HW design
 *   ps7_uart    115200 (configured by bootrom/bsp)
 */

/***************************** Include Files *********************************/
#include "xparameters.h"
#include "xgpio.h"
#include "platform.h"

/************************** Variable Defintions ******************************/
/* Instance For GPIO */
XGpio GpioOutput;

int main()
{
    u32 Delay;
    u32 Ledwidth;

    init_platform();

    print("Hello World\n\r");
    XGpio_Initialize(&GpioOutput, XPAR_AXI_GPIO_0_DEVICE_ID); //initialize GPIO IP
    XGpio_SetDataDirection(&GpioOutput, 1, 0x0); //set GPIO as output
    XGpio_DiscreteWrite(&GpioOutput, 1, 0x0); //set GPIO output value to 0

    while (1)
    {
        for (Ledwidth = 0x0; Ledwidth < 4; Ledwidth++)
        {
            XGpio_DiscreteWrite(&GpioOutput, 1, 1 << Ledwidth);
            for (Delay = 0; Delay < 8000000; Delay++);
            XGpio_DiscreteClear(&GpioOutput, 1, 1 << Ledwidth);
        }
    }
    cleanup_platform();
    return 0;
}

 

转载于:https://www.cnblogs.com/shuqingstudy/p/9154427.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值