/********************************************************************************************************
*
* File                : LED
* Hardware Environment:
* Build Environment   : Quartus II Version 10.1 / Nios II 10.1
* Version             :
* By                  : Su Wei Feng
*
*                                  (c) Copyright 2005-2011, WaveShare
*                                       http://www.waveshare.net
*                                          All Rights Reserved
*
*********************************************************************************************************/

#include <io.h>
#include <unistd.h>
#include <system.h>
#include "altera_avalon_pio_regs.h"

#include <stdio.h>
#define msleep(ms)  usleep(1000*ms)
#define DIRECTION_PA(data)  IOWR_ALTERA_AVALON_PIO_DIRECTION(LED_BASE, data)
#define DATA_PA(data)  IOWR_ALTERA_AVALON_PIO_DATA(LED_BASE, data)

int main()
{   printf("hello world");
    DIRECTION_PA(0xFF);
    alt_u8 tmp = 0X01;
    unsigned char i;
    printf("hello");
    while(1)
    {   tmp = 0X01;
        for(i=0;i<4;i++) 
        {
        DATA_PA(tmp);
        tmp=tmp<<1;
        msleep(50);
        };
    }

    return 0;
}
