#include "vars.h"



#define CSL_GPIO_CFG_REGS 0x0260BF00
#define CSL_GPIO_DIR        (*(unsigned int*)(CSL_GPIO_CFG_REGS + 0x010))
#define GPIO_SET_DATA       (*(unsigned int*)(CSL_GPIO_CFG_REGS + 0x018))
#define GPIO_CLEAR_DATA     (*(unsigned int*)(CSL_GPIO_CFG_REGS + 0x01C))

int main(void)
{
    int i;

    CSL_GPIO_DIR = 0xFFFE;

    while(1){
        GPIO_SET_DATA = 0x1;
        for (i=0;i<100;i++);
        GPIO_CLEAR_DATA = 0x1;
        for (i=0;i<100;i++);
    }



	return 0;
}


/*****************************************************************************
* Function: Utility function a cycle clock
****************************************************************************/
static unsigned int  readTime32(void)
{
    unsigned int timeVal;

    #if defined (_TMS320C6X)
    timeVal = TSCL;
    #elif __ARM_ARCH_7A__
    __asm__ __volatile__ ("MRC p15, 0, %0, c9, c13, 0\t\n": "=r"(timeVal));
    #else
    /* M4 specific implementation*/
    static unsigned int simuTimer = 0;

    simuTimer++;
    timeVal = simuTimer;
    #endif
    return timeVal;
}

/*****************************************************************************
* Function: Utility function to introduce delay
****************************************************************************/
void cycleDelay (unsigned int count)
{
    unsigned int start = (unsigned int)readTime32();

while (((unsigned int)readTime32() - start) < count);
}
