Exemple #1
0
void uartprinntf()
{
    //
    // Initionalize system clock.
    //
    xSysCtlPeripheralClockSourceSet( 10000000,  xSYSCTL_XTAL_6MHZ );
 
    SysCtlDelay(10000);

    xSPinTypeUART(UART0RX,PB0);
    xSPinTypeUART(UART0TX,PB1);

    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART0);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART0);
    SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_UART_S_EXT12M);

    //
    // Config 8 bit word length, 1 stop bit, 
    // and none parity bit, receive FIFO 1 byte.
    //
    UARTConfigSetExpClk(UART0_BASE, 115200, (UART_CONFIG_WLEN_8 | 
                                             UART_CONFIG_STOP_ONE | 
                                               UART_CONFIG_PAR_NONE));

    UARTEnable(UART0_BASE, (UART_BLOCK_UART | UART_BLOCK_TX | UART_BLOCK_RX));

    UARTBufferWrite(UART0_BASE, "NUC1xx.UART.BAUDRATE EXAMPLE \r\n", sizeof("NUC1xx.UART.BAUDRATE EXAMPLE \r\n")); 
}
Exemple #2
0
//*****************************************************************************
//
//! \brief Init uart to print.
//!
//! \param None
//!
//! \details uart config as (115200, 8 data bit, 1 stop bit , no partiy)
//!
//! \return None.
//
//*****************************************************************************
static 
void UartInit(void)
{

    xSysCtlPeripheralEnable(SYSCTL_PERIPH_AFIO);

    xSPinTypeUART(UART0RX, PC10);
    xSPinTypeUART(UART0TX, PC8);
    

    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART0);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART0);
    //
    // Set UART0 clock source.
    //
    SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_UART_S_HCLK);

    //
    // Configure 8 bit word length, 1 stop bit,
    // and none parity bit, receive FIFO 1 byte.
    //
    xUARTConfigSet(UART0_BASE, 115200, (xUART_CONFIG_WLEN_8 |
                                        xUART_CONFIG_STOP_1 |
                                        xUART_CONFIG_PAR_NONE));

    xUARTEnable(UART0_BASE, (UART_BLOCK_UART | xUART_BLOCK_TX | xUART_BLOCK_RX));
}
Exemple #3
0
void UART_example(void)
{
    unsigned int i = 0;

    //
    // Configure System clock
    //
    xSysCtlClockSet(84000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_12MHZ);
    SysCtlDelay(10000);

    //
    // Enable GPIO/UART Clock
    //
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART0);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_GPIOG);

    //
    // Remap UART pin to GPIO Port UART0_RX --> PG1 UART0_TX --> PG2
    xSPinTypeUART(UART0RX, PG1);
    xSPinTypeUART(UART0TX, PG2);

    //
    // Configure UART Baud 115200 8-N-1
    //
    xUARTConfigSet(xUART0_BASE, 115200, xUART_CONFIG_WLEN_8 | xUART_CONFIG_PAR_NONE | xUART_CONFIG_STOP_1);

    //
    // Enable UART Receive/Transmit
    //
    xUARTEnable(xUART0_BASE, xUART_BLOCK_UART | xUART_BLOCK_TX | xUART_BLOCK_RX);

    //
    // print out welcome information
    //

    i = 0;
    while(Buf[i] != '\0')
    {
        xUARTCharPut(xUART0_BASE, Buf[i++]);
    }

    //
    // Echo user's input information
    //
    while((Rec = UxARTCharGet(xUART0_BASE)) != '\n')
    {
        xUARTCharPut(xUART0_BASE, Rec);
    }

    //
    // print out run over information
    //
    i = 0;
    while(Buf[i] != '\0')
    {
        xUARTCharPut(xUART0_BASE, End[i++]);
    }

    while(1);                  
}
Exemple #4
0
void UART_Example_Basic(void)
{ 

    /********************** Configure System clock *************************/
    SysCtlClockSet(100000000, SYSCTL_OSC_INT | SYSCTL_XTAL_12_MHZ);
    SysCtlDelay(TICK_SLOW);
    
    /********************** Configure GPIO Port ****************************/      
#if (UART_ID == 0)
    // 1: Enable GPIO Power and Clock
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    // 2: Map GPIO Pin
    //    UART0 TX --> PA2
    //    UART0 RX --> PA3
    xSPinTypeUART(UART0TX, PA2);
    xSPinTypeUART(UART0RX, PA3);
#elif (UART_ID == 1)
    // 1: Enable GPIO Power and Clock
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    // 2: Map GPIO Pin
    //    UART1 TX --> PC0
    //    UART1 RX --> PC1
    xSPinTypeUART(UART1TX, PC0);
    xSPinTypeUART(UART1RX, PC1);
#endif  

    /********************** Configure UART *********************************/
    // 1: Enable UART0 Power and clock
#if (UART_ID == 0)
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    UARTCfg(UART0_BASE, 9600, UART_CFG_LEN_8_BIT | UART_CFG_STOP_1_BIT |
            UART_CFG_PARITY_NONE | UART_CFG_BREAK_DIS);
    UARTFIFOCfg(UART0_BASE, FIFO_CFG_FIFO_EN | FIFO_CFG_RX_TRI_LVL_0);

    UARTIntEnable(UART0_BASE, INT_ABEO | INT_ABTO);
    UARTIntCallbackInit(UART0_BASE, UserUARTHandler);
    xIntEnable(xINT_UART0);
    xHWREG(UART0_BASE + ACR) |= ACR_START;
    while(Passed == 0);
    UARTStrSend(UART0_BASE, "\r\nHello world\r\n");
#elif (UART_ID == 1)
    // 1: Enable UART1 Power and clock
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
    UARTCfg(UART1_BASE, 9600, UART_CFG_LEN_8_BIT | UART_CFG_STOP_1_BIT |
            UART_CFG_PARITY_NONE | UART_CFG_BREAK_DIS);
    UARTFIFOCfg(UART1_BASE, FIFO_CFG_FIFO_EN | FIFO_CFG_RX_TRI_LVL_0);

    UARTStrSend(UART1_BASE, "Hello world\r\n");
#endif

    while (1)
    {
        ;
    }
}
Exemple #5
0
//*****************************************************************************
//
//! \brief Initializes the PTC08 device.
//!
//! Initializes the PTC08 device,it will set the baud rate 115200,image size 
//! 320*240,ziprate 36 and non-save power.
//!
//! \return None.
//
//*****************************************************************************
xtBoolean 
PTC08Init(void)
{
    xSysCtlPeripheralEnable2(PTC08_UART);
    xSysCtlPeripheralEnable2(xGPIOSPinToPeripheralId(PTC08_PIN_UART_RX));
    xSysCtlPeripheralEnable2(xGPIOSPinToPeripheralId(PTC08_PIN_UART_TX));
    xSysCtlPeripheralClockSourceSet(xSYSCTL_UART1_MAIN, 1);

    xSPinTypeUART(PTC08_UART_RX, PTC08_PIN_UART_RX);
    xSPinTypeUART(PTC08_UART_TX, PTC08_PIN_UART_TX);

    xUARTConfigSet(PTC08_UART, 38400, (xUART_CONFIG_WLEN_8 |
    		                           xUART_CONFIG_STOP_1 |
                                       xUART_CONFIG_PAR_NONE));

    xUARTEnable(PTC08_UART, (xUART_BLOCK_UART | xUART_BLOCK_TX | xUART_BLOCK_RX));

    //
    // Must wait for 2.5s before the camera can received Command
    //
    xSysCtlDelay(25000000); 
    
    if(!PTC08PhotoReset())
    {
        return xfalse;
    }
    if(!PTC08PhotoSizeSet(PTC08_SIZE_320_240))
    {
        return xfalse;
    }
    if(!PTC08ZipRateSet(0x36))
    {
        return xfalse;
    }
    xSysCtlDelay(10);
    
    if(!PTC08SavePowerSet(PTC08_SAVE_POWER_DIS))
    {
        return xfalse;
    } 
    if(!PTC08BaudRateSet(PTC08_BAUDRATE_115200))
    {
        return xfalse;
    } 
    xUARTConfigSet(PTC08_UART, 115200, (UART_CONFIG_WLEN_8 | 
                                        UART_CONFIG_STOP_ONE | 
                                        UART_CONFIG_PAR_NONE));
    return xtrue;
}
Exemple #6
0
//*****************************************************************************
//
//! \brief Init uart to print.
//!
//! \param None
//!
//! \details uart config as (115200, 8 data bit, 1 stop bit , no partiy)
//!
//! \return None.
//
//*****************************************************************************
static 
void UartInit(void)
{
    xSPinTypeUART(UART0RX,PB0);
    xSPinTypeUART(UART0TX,PB1);

    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART0);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART0);
    
    xSysCtlPeripheralClockSourceSet(xSYSCTL_UART0_MAIN, 1);

    xUARTConfigSet(UART0_BASE, 115200, (UART_CONFIG_WLEN_8 |
                                        UART_CONFIG_STOP_ONE | 
                                        UART_CONFIG_PAR_NONE));
}
Exemple #7
0
//*****************************************************************************
//
//! \brief print some data to terminal.
//!
//! \param None
//!
//! \return None.
//
//*****************************************************************************
void UartPrintf(void)
{
    unsigned long i;
    //
    //Set System Clock
    //
    xSysCtlClockSet(72000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ);

    xSysCtlDelay(10000);

    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_GPIOA);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_GPIOD);
    xSysCtlPeripheralEnable(SYSCTL_PERIPH_AFIO);

      xSPinTypeUART(UART1TX,PA9);
    

    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART1);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART1);

    xUARTConfigSet(USART1_BASE, 115200, (UART_CONFIG_WLEN_8 |
                                         UART_CONFIG_STOP_ONE | 
                                         UART_CONFIG_PAR_NONE));

    xUARTEnable(USART1_BASE, (UART_BLOCK_UART | UART_BLOCK_TX | UART_BLOCK_RX));

    for(i = 0; i < sizeof("STM32F1xx.UART Example of CoX \r\n"); i++)
    {
        xUARTCharPut(USART1_BASE, ucData[i]);
    }
}
Exemple #8
0
void Init_UART0(int baud, int buffer_size)
{
	xtEventCallback UART0_INT_HANDLE = USART0IntHandler;

	// Enable GPIO and UART Clock
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

	// Remap UART pin to GPIO Port UART0_RX --> PA2 UART0_TX --> PA1
	xSPinTypeUART(UART0RX, PA1);
	xSPinTypeUART(UART0TX, PA2);

	// Set UART clock
	SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_UART0_S_MCGPLLCLK_2);

	// Disable UART Receive/Transmit
	UARTDisable(UART0_BASE, UART_TX | UART_RX);

	// Configure UART Baud 115200
	UARTConfigSet(UART0_BASE, baud, UART_CONFIG_SAMPLE_RATE_DEFAULT | UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_1);

	if (OSSemCreate(0, &SerialTX0) != ALLOC_EVENT_OK)
	{
	  // Oh Oh
	  // Não deveria entrar aqui !!!
	  while(1){};
	};

	// Só cria fila se for passado um tamanho maior que 0
	if (buffer_size){
		if (OSQueueCreate(buffer_size, &Serial0) != ALLOC_EVENT_OK)
		{
		  // Oh Oh
		  // Não deveria entrar aqui !!!
		  while(1){};
		};
	}

	UARTIntEnable(UART0_BASE, UART_INT_R);
	UARTIntCallbackInit(UART0_BASE, UART0_INT_HANDLE);

	// Enable UART Receive and Transmit
	UARTEnable(UART0_BASE, UART_TX | UART_RX);

	xIntEnable(28);
}
Exemple #9
0
void 
TestIOInit(void)
{    
    xSysCtlClockSet(50000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_12MHZ);

    SysCtlDelay(10000);

    xSPinTypeUART(UART0RX,PB0);
    xSPinTypeUART(UART0TX,PB1);

    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART0);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART0);
    
    xSysCtlPeripheralClockSourceSet(xSYSCTL_UART0_MAIN, 1);

    xUARTConfigSet(UART0_BASE, 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));

    xUARTEnable(UART0_BASE, (UART_BLOCK_UART | UART_BLOCK_TX | UART_BLOCK_RX));
}
Exemple #10
0
void Init_UART2(void)
{
	xtEventCallback UART2_INT_HANDLE = USART2IntHandler;

	// Enable GPIO and UART Clock
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);

	// Remap UART pin to GPIO Port UART0_RX --> PA2 UART0_TX --> PA1
	xSPinTypeUART(UART2RX, PE23);
	xSPinTypeUART(UART2TX, PE22);

	// Set UART clock
	SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_UART0_S_MCGPLLCLK_2);

	// Disable UART Receive/Transmit
	UARTDisable(UART2_BASE, UART_TX | UART_RX);

	// Configure UART Baud 115200
	UARTConfigSet(UART2_BASE, 9600, UART_CONFIG_SAMPLE_RATE_DEFAULT | UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_1);

	if (OSSemCreate(0, &SerialTX2) != ALLOC_EVENT_OK)
	{
	  // Oh Oh
	  // Não deveria entrar aqui !!!
	  while(1){};
	};

	if (OSQueueCreate(128, &Serial2) != ALLOC_EVENT_OK)
	{
	  // Oh Oh
	  // Não deveria entrar aqui !!!
	  while(1){};
	};

	UARTIntEnable(UART2_BASE, UART_INT_R);
	UARTIntCallbackInit(UART2_BASE, UART2_INT_HANDLE);

	// Enable UART Receive and Transmit
	UARTEnable(UART2_BASE, UART_TX | UART_RX);

	xIntEnable(30);
}
Exemple #11
0
//*****************************************************************************
//
//! \biref uart0 configre 
//!
//! \return  none
//
//*****************************************************************************
void UART0Configuration(void)
{
  
	xSPinTypeUART(U0RX,PB0);
	xSPinTypeUART(U0TX,PB1);

    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART0);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART0);
    SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_UART_S_EXT12M);


    xHWREG(UART0_BASE + UART_FCR) |= 0x6;
    xHWREG(UART0_BASE + UART_FCR) &= ~(0xF0);
    xHWREG(UART0_BASE + UART_FCR) |= 0;

    xHWREG(UART0_BASE + UART_LCR) = 3;
    xHWREG(UART0_BASE + UART_BAUD) = 0x3F000066;

	SysCtlDelay(10000);
}
Exemple #12
0
//////////////////////////////////////////////////////////////////////////////
// Platform (STM32F103X) initialization for peripherals as GPIO, SPI, UARTs //
//////////////////////////////////////////////////////////////////////////////
void platform_init(void)
{
    xSysCtlClockSet(72000000,  xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ);

    xSysCtlDelay((xSysCtlClockGet()/1000)*50); // wait 50ms


    /**************************/
    /* GPIO_A For SPI CS PIN  */// It must be first to enable GPIO peripheral than other peripheral. (Otherwise, UART do not run in STM32F103X)
    /**************************/
    xSysCtlPeripheralEnable( xSYSCTL_PERIPH_GPIOA );
    xGPIODirModeSet(xGPIO_PORTA_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_OUT);


    /************/
    /* For UART */
    /************/
    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART1);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART1);
    xSPinTypeUART(UART1TX,PA9);
    xSPinTypeUART(UART1RX,PA10);
    xUARTConfigSet(xUART1_BASE, 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
    xUARTEnable(xUART1_BASE, (UART_BLOCK_UART | UART_BLOCK_TX | UART_BLOCK_RX));


    /***********/
    /* For SPI */
    /***********/
    xSysCtlPeripheralReset(WIZCHIP_SPI_PERIPH);
    xSysCtlPeripheralEnable(WIZCHIP_SPI_PERIPH);
    xSPinTypeSPI(WIZCHIP_SPI_CLK, WIZCHIP_SPI_CLK_PIN);  // xGPIODirModeSet(xGPIO_PORTA, xGPIO_PIN_5, GPIO_TYPE_AFOUT_STD, GPIO_OUT_SPEED_50M);
    xSPinTypeSPI(WIZCHIP_SPI_MOSI,WIZCHIP_SPI_MOSI_PIN);  // xGPIODirModeSet(xGPIO_PORTA, xGPIO_PIN_7, GPIO_TYPE_AFOUT_STD, GPIO_OUT_SPEED_50M);
    xSPinTypeSPI(WIZCHIP_SPI_MISO,WIZCHIP_SPI_MISO_PIN);  // xGPIODirModeSet(xGPIO_PORTA, xGPIO_PIN_6, GPIO_TYPE_IN_FLOATING, GPIO_IN_SPEED_FIXED);
    xSPIConfigSet(WIZCHIP_SPI_BASE, xSysCtlClockGet()/2, xSPI_MOTO_FORMAT_MODE_0 | xSPI_MODE_MASTER | xSPI_MSB_FIRST | xSPI_DATA_WIDTH8);

    xSPISSSet(WIZCHIP_SPI_BASE, SPI_SS_SOFTWARE, xSPI_SS_NONE);
    xSPIEnable(WIZCHIP_SPI_BASE);

    printf("HCLK = %dMHz\r\n", (unsigned int)(xSysCtlClockGet()/1000000));
}
Exemple #13
0
void 
TestIOInit(void)
{
    xSysCtlClockSet(72000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ);
    SysCtlDelay(10000);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_AFIO);
    xSPinTypeUART(UART0RX, PA8);
    xSPinTypeUART(UART0TX, PA9);
    

    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART0);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART0);
    SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_UART_S_HCLK);

    UARTConfigSetExpClk(UART0_BASE, 115200, (UART_CONFIG_WLEN_8 | 
                                             UART_CONFIG_STOP_ONE | 
                                             UART_CONFIG_PAR_NONE));

    UARTEnable(UART0_BASE, (UART_BLOCK_UART | UART_BLOCK_TX | UART_BLOCK_RX));
}
Exemple #14
0
void 
TestIOInit(void)
{
    SysCtlKeyAddrUnlock();
    xHWREG(SYSCLK_PWRCON) |= SYSCLK_PWRCON_XTL12M_EN;
    xSysCtlClockSet(12000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_12MHZ);
    SysCtlDelay(10000);

    xSPinTypeUART(UART0RX, PA1);
    xSPinTypeUART(UART0TX, PA0);
    

    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART0);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART0);
    SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_UART_S_EXT12M);

    UARTConfigSetExpClk(UART0_BASE, 115200, (UART_CONFIG_WLEN_8 | 
                                             UART_CONFIG_STOP_ONE | 
                                             UART_CONFIG_PAR_NONE));

    UARTEnable(UART0_BASE, (UART_BLOCK_UART | UART_BLOCK_TX | UART_BLOCK_RX));
}
Exemple #15
0
//*****************************************************************************
//
//! \brief initialize USART for debugging use
//!
//! \param None
//!
//! \details Initialize USART1 for debugging use. Debugging will use printf function,
//!   so we use USART1 as the debugging tool. Don't forget to add and transplant printf.c.
//! If you don't need debugging or you have your own debugging function, remove this
//! function.
//!
//! \return None
//
//*****************************************************************************
void    mInitSTDIO( void )
{
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_GPIOA);

    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART1);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART1);
    xUARTConfigSet(xUART1_BASE, 115200, (xUART_CONFIG_WLEN_8 |
    									 xUART_CONFIG_STOP_1 |
    									 xUART_CONFIG_PAR_NONE));

    xUARTEnable(xUART1_BASE, (xUART_BLOCK_UART | xUART_BLOCK_TX | xUART_BLOCK_RX));
    xSysCtlPeripheralEnable(SYSCTL_PERIPH_AFIO);
    xSPinTypeUART(UART1TX, PA9);
}
Exemple #16
0
void uartprinntf()
{
    xSysCtlClockSet(84000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_12MHZ);
    xSysCtlDelay(10000);

    xSPinTypeUART(UART0RX,PG1);
    xSPinTypeUART(UART0TX,PG2);

    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART0);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART0);

    //
    // Config 8 bit word length, 1 stop bit, 
    // and none parity bit, receive FIFO 1 byte.
    //
    xUARTConfigSet(xUART0_BASE, 115200, (xUART_CONFIG_WLEN_8   | \
                                         xUART_CONFIG_STOP_1   | \
                                         xUART_CONFIG_PAR_NONE));

    xUARTEnable(xUART0_BASE, (xUART_BLOCK_UART | xUART_BLOCK_TX | xUART_BLOCK_RX));

    UARTBufferWrite(UART0_BASE, "NUC1xx.UART.BAUDRATE EXAMPLE \r\n", sizeof("NUC1xx.UART.BAUDRATE EXAMPLE \r\n")); 
}
Exemple #17
0
//*****************************************************************************
//
//! \brief print some data to terminal.
//!
//! \param None
//!
//! \return None.
//
//*****************************************************************************
void UartPrintf(void)
{
    unsigned long i;
    //
    //Set System Clock
    //
    xSysCtlClockSet(72000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ);
 
    xSysCtlDelay(10000);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_AFIO);
    xSPinTypeUART(UART0RX, PA8);
    xSPinTypeUART(UART0TX, PA9);

    xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART0);
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART0);
    //
    // Set UART0 clock source.
    //
    xSysCtlPeripheralClockSourceSet(xSYSCTL_UART0_HCLK, 1);

    //
    // Configure 8 bit word length, 1 stop bit, 
    // and none parity bit, receive FIFO 1 byte.
    //
    xUARTConfigSet(UART0_BASE, 115200, (xUART_CONFIG_WLEN_8 | 
                                        xUART_CONFIG_STOP_1 | 
                                        xUART_CONFIG_PAR_NONE));

    xUARTEnable(UART0_BASE, (UART_BLOCK_UART | xUART_BLOCK_TX | xUART_BLOCK_RX));
    
    for(i = 0; i < sizeof("HT32F125x.UART Example of CoX \r\n"); i++)
    {
        xUARTCharPut(UART0_BASE, ucData[i]);
    }
}
Exemple #18
0
void UART_example(void)
{
    unsigned int i = 0;
    char Rec       = 0;

    //
    // Configure System clock
    //
    xSysCtlClockSet(48000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ);
    SysCtlDelay(1000000);

    //
    // Enable GPIO/UART Clock
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);

    //
    // Remap UART pin to GPIO Port UART1_RX --> PC3 UART1_TX --> PC4
    xSPinTypeUART(UART1RX, PC3);
    xSPinTypeUART(UART1TX, PC4);

    //
    // Disable UART Receive/Transmit
    //
    UARTDisable(UART1_BASE, UART_TX | UART_RX);

    //
    // Configure UART Baud 9600 8-N-1
    //
    UARTConfigSet(UART1_BASE, 9600, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE |
            UART_CONFIG_STOP_1);

    //
    // Enable UART Receive/Transmit
    //
    UARTEnable(UART1_BASE, UART_TX | UART_RX);

    //
    // print out welcome information
    //

    i = 0;
    while(Begin[i] != '\0')
    {
        UARTCharPut(UART1_BASE, Begin[i++]);
    }

    //
    // Echo user's input information
    //
    while((Rec = UARTCharGet(UART1_BASE)) != '\n')
    {
        UARTCharPut(UART1_BASE, Rec);
    }

    //
    // print out run over information
    //
    i = 0;
    while(End[i] != '\0')
    {
        UARTCharPut(UART1_BASE, End[i++]);
    }

    while(1);                  
}
Exemple #19
0
void RTCTickInt()
{   
    xSysCtlClockSet(72000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ);

		xSysCtlPeripheralEnable(SYSCTL_PERIPH_PWR);

		xSysCtlPeripheralEnable(xSYSCTL_PERIPH_GPIOA);
		
		SysCtlBackupAccessEnable();
	
    SysCtlLSEConfig(SYSCTL_LSE_OSC_EN);
    SysCtlPeripheralClockSourceSet(SYSCTL_RTC_LSE); 
		xSysCtlPeripheralEnable(SYSCTL_PERIPH_RTC);
	
    SysCtlDelay(10000);
		
    xSPinTypeUART(UART1RX,PA10);   
    xSPinTypeUART(UART1TX,PA9);
		xSysCtlPeripheralReset(xSYSCTL_PERIPH_UART1);
		xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART1);	 
    xUARTConfigSet(xUART1_BASE, 115200, (UART_CONFIG_WLEN_8 | 
                                          UART_CONFIG_STOP_ONE | 
                                            UART_CONFIG_PAR_NONE));		
		xUARTEnable(xUART1_BASE, UART_BLOCK_UART | UART_BLOCK_RX | UART_BLOCK_TX);

		UARTBufferWrite(xUART1_BASE, "usart init is ok!", sizeof("usart init is ok!")-1);
		
    RTCTimeInit(0X7FFF);
			
    tTime1.ulSecond = 20;     
    
    tTime1.ulMinute = 10; 
    
    tTime1.ulHour = 11; 
    
    tTime1.ulMDay = 13;  
    
    tTime1.ulMonth = 6;   
    
    tTime1.ulYear = 2012;    
    
    tTime1.ulWDay = 3;   
    
    //
    // Writes current time to corresponding register.
    //
    RTCTimeWrite(&tTime1, ulTimeAlarm[0]);
		
		SysCtlDelay(10000);

    RTCIntCallbackInit(xRTCCallback);  
		
    //
    // Enables tick interrupt.
    //
    RTCIntEnable(RTC_INT_TIME_TICK);
		
    xIntEnable(INT_RTC);
    xIntMasterEnable();
    while(ulj < 2);
    xIntMasterDisable(); 
		RTCTimeRead(&tTime1, ulTimeAlarm[0]);
 }
void UART_example(void)
{
    unsigned int i = 0;

    //
    // Configure System clock
    //
    xSysCtlClockSet(48000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ);
    SysCtlDelay(1000000);

    // Note: Defore call UART0 Function, you must call SysCtlPeripheralClockSourceSet Function.
    // SYSCTL_PERIPH_UART0_S_MCGFLLCLK, SYSCTL_PERIPH_UART0_S_MCGPLLCLK_2,
    // SYSCTL_PERIPH_UART0_S_OSCERCLK, SYSCTL_PERIPH_UART0_S_MCGIRCLK,
    // For UART1/2, just comment it
    SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_UART0_S_MCGPLLCLK_2);

    //
    // Enable GPIO/UART Clock
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    //
    // Remap UART pin to GPIO Port UART1_RX --> PC3 UART1_TX --> PC4
    xSPinTypeUART(UART0RX, PA1);
    xSPinTypeUART(UART0TX, PA2);

    //
    // Disable UART Receive/Transmit
    //
    UARTDisable(UART0_BASE, UART_TX | UART_RX);

    //
    // Configure UART Baud 115200 8-N-1
    //
    UARTConfigSet(UART0_BASE, 115200, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE |
                  UART_CONFIG_STOP_1);

    //
    // Enable UART Receive/Transmit
    //
    UARTEnable(UART0_BASE, UART_TX | UART_RX);

    //
    // print out welcome information
    //

    i = 0;
    while(Begin[i] != '\0')
    {
        UARTCharPut(UART0_BASE, Begin[i++]);
    }

    //
    // Echo user's input information
    //
    while((Rec = UARTCharGet(UART0_BASE)) != '\n')
    {
        UARTCharPut(UART0_BASE, Rec);
    }

    //
    // print out run over information
    //
    i = 0;
    while(End[i] != '\0')
    {
        UARTCharPut(UART0_BASE, End[i++]);
    }

    while(1);
}
Exemple #21
0
//*****************************************************************************
//
//! \brief xgpio001 test execute main body.
//!
//! \return None.
//
//*****************************************************************************
static void xgpio001Execute(void)
{
   
    unsigned long ulPin, ulPort;
    unsigned long ulvalue, ulTemp;  
    int i, j;

    //
    // GPIOA PIN mode test
    //
    xGPIODirModeSet(xGPIO_PORTA_BASE, xGPIO_PIN_0, xGPIO_DIR_MODE_IN);
    ulvalue = xGPIODirModeGet(xGPIO_PORTA_BASE, xGPIO_PIN_0) ;  
    TestAssert((ulvalue == xGPIO_DIR_MODE_IN), 
                "xgpioA, \" GPIODirModeSet or GPIODirModeGet()\" error");      
    xGPIODirModeSet(xGPIO_PORTA_BASE, xGPIO_PIN_0, xGPIO_DIR_MODE_OUT);
    ulvalue = xGPIODirModeGet(xGPIO_PORTA_BASE, xGPIO_PIN_0) ;    
    TestAssert((ulvalue == xGPIO_DIR_MODE_OUT), 
               "xgpioA, \" GPIODirModeSet or GPIODirModeGet()\" error"); 
    
    xGPIODirModeSet(xGPIO_PORTA_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_IN);
    ulvalue = xGPIODirModeGet(xGPIO_PORTA_BASE, xGPIO_PIN_4) ;  
    TestAssert((ulvalue == xGPIO_DIR_MODE_IN), 
                "xgpioA, \" GPIODirModeSet or GPIODirModeGet()\" error");
    xGPIODirModeSet(xGPIO_PORTA_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_OUT);
    ulvalue = xGPIODirModeGet(xGPIO_PORTA_BASE, xGPIO_PIN_4) ;    
    TestAssert((ulvalue == xGPIO_DIR_MODE_OUT), 
               "xgpioA, \" GPIODirModeSet or GPIODirModeGet()\" error"); 
    
    //
    // GPIOB pin mode test
    //
    xGPIODirModeSet(xGPIO_PORTB_BASE, xGPIO_PIN_0, xGPIO_DIR_MODE_IN);
    ulvalue = xGPIODirModeGet(xGPIO_PORTB_BASE, xGPIO_PIN_0) ;  
    TestAssert((ulvalue == xGPIO_DIR_MODE_IN), 
                "xgpioB, \" GPIODirModeSet or GPIODirModeGet()\" error");      
    xGPIODirModeSet(xGPIO_PORTB_BASE, xGPIO_PIN_0, xGPIO_DIR_MODE_OUT);
    ulvalue = xGPIODirModeGet(xGPIO_PORTB_BASE, xGPIO_PIN_0) ;    
    TestAssert((ulvalue == xGPIO_DIR_MODE_OUT), 
               "xgpioB, \" GPIODirModeSet or GPIODirModeGet()\" error");     
    xGPIODirModeSet(xGPIO_PORTB_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_IN);
    ulvalue = xGPIODirModeGet(xGPIO_PORTB_BASE, xGPIO_PIN_4) ;  
    TestAssert((ulvalue == xGPIO_DIR_MODE_IN), 
                "xgpioB, \" GPIODirModeSet or GPIODirModeGet()\" error");
    xGPIODirModeSet(xGPIO_PORTB_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_OUT);
    ulvalue = xGPIODirModeGet(xGPIO_PORTB_BASE, xGPIO_PIN_4) ;    
    TestAssert((ulvalue == xGPIO_DIR_MODE_OUT), 
               "xgpioB, \" GPIODirModeSet or GPIODirModeGet()\" error");
	
    //
    // GPIOC pin mode test
    //			   
    xGPIODirModeSet(xGPIO_PORTC_BASE, xGPIO_PIN_0, xGPIO_DIR_MODE_IN);
    ulvalue = xGPIODirModeGet(xGPIO_PORTC_BASE, xGPIO_PIN_0) ;  
    TestAssert((ulvalue == xGPIO_DIR_MODE_IN), 
                "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
    xGPIODirModeSet(xGPIO_PORTC_BASE, xGPIO_PIN_0, xGPIO_DIR_MODE_OUT);
    ulvalue = xGPIODirModeGet(xGPIO_PORTC_BASE, xGPIO_PIN_0) ;    
    TestAssert((ulvalue == xGPIO_DIR_MODE_OUT), 
               "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
    xGPIODirModeSet(xGPIO_PORTC_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_IN);
    ulvalue = xGPIODirModeGet(xGPIO_PORTC_BASE, xGPIO_PIN_4) ;  
    TestAssert((ulvalue == xGPIO_DIR_MODE_IN), 
                "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
    xGPIODirModeSet(xGPIO_PORTC_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_OUT);
    ulvalue = xGPIODirModeGet(xGPIO_PORTC_BASE, xGPIO_PIN_4) ;    
    TestAssert((ulvalue == xGPIO_DIR_MODE_OUT), 
               "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
    //
    // GPIOD pin mode test
    //			   			      
    xGPIODirModeSet(xGPIO_PORTD_BASE, xGPIO_PIN_0, xGPIO_DIR_MODE_IN);
    ulvalue = xGPIODirModeGet(xGPIO_PORTD_BASE, xGPIO_PIN_0) ;  
    TestAssert((ulvalue == xGPIO_DIR_MODE_IN), 
                "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
    xGPIODirModeSet(xGPIO_PORTD_BASE, xGPIO_PIN_0, xGPIO_DIR_MODE_OUT);
    ulvalue = xGPIODirModeGet(xGPIO_PORTD_BASE, xGPIO_PIN_0) ;    
    TestAssert((ulvalue == xGPIO_DIR_MODE_OUT), 
               "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
    xGPIODirModeSet(xGPIO_PORTD_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_IN);
    ulvalue = xGPIODirModeGet(xGPIO_PORTD_BASE, xGPIO_PIN_4) ;  
    TestAssert((ulvalue == xGPIO_DIR_MODE_IN), 
                "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
    xGPIODirModeSet(xGPIO_PORTD_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_OUT);
    ulvalue = xGPIODirModeGet(xGPIO_PORTD_BASE, xGPIO_PIN_4) ;    
    TestAssert((ulvalue == xGPIO_DIR_MODE_OUT), 
               "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
	
    //
    // GPIOE pin mode test
    //			       
    xGPIODirModeSet(xGPIO_PORTE_BASE, xGPIO_PIN_0, xGPIO_DIR_MODE_IN);
    ulvalue = xGPIODirModeGet(xGPIO_PORTE_BASE, xGPIO_PIN_0) ;  
    TestAssert((ulvalue == xGPIO_DIR_MODE_IN), 
                "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
    xGPIODirModeSet(xGPIO_PORTE_BASE, xGPIO_PIN_0, xGPIO_DIR_MODE_OUT);
    ulvalue = xGPIODirModeGet(xGPIO_PORTE_BASE, xGPIO_PIN_0) ;    
    TestAssert((ulvalue == xGPIO_DIR_MODE_OUT), 
               "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
    xGPIODirModeSet(xGPIO_PORTE_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_IN);
    ulvalue = xGPIODirModeGet(xGPIO_PORTE_BASE, xGPIO_PIN_4) ;  
    TestAssert((ulvalue == xGPIO_DIR_MODE_IN), 
                "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
    xGPIODirModeSet(xGPIO_PORTE_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_OUT);
    ulvalue = xGPIODirModeGet(xGPIO_PORTE_BASE, xGPIO_PIN_4) ;    
    TestAssert((ulvalue == xGPIO_DIR_MODE_OUT), 
               "xgpioC, \" GPIODirModeSet or GPIODirModeGet()\" error");
       
    xIntDisable(xINT_GPIOA);
    xIntDisable(xINT_GPIOB);
    xIntDisable(xINT_GPIOC);
    xIntDisable(xINT_GPIOD);
    xIntDisable(xINT_GPIOE);
 
/*    
    //
    // GPIOA int enable test
    //
    for(i = 0; i < 5; i++)
    {
        xGPIOPinIntEnable(xGPIO_PORTA_BASE, xGPIO_PIN_0, ulIntTypes[i]);
        ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_CFGR0) & EXTI_CFGR0_SRCTYPE_M;
        TestAssert(ulTemp == ulIntTypes[i],
                   "xgpio, \"xGPIOPinIntEnable \" error");
        ulTemp =  xHWREG(GPIO_AFIO_BASE + AFIO_ESSRO) & AFIO_ESSR0_EXTINPIN_M;
        TestAssert(ulTemp == 0,
                   "xgpio, \"xGPIOPinIntEnable \" error");
	    ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_ICR) & 0x00000001;
        TestAssert(ulTemp == 0x00000001,
                   "xgpio, \"xGPIOPinIntEnable \" error");
    }
    
    //
    // GPIOB int enable test
    //
    for(i = 0; i < 5; i++)
    {
        xGPIOPinIntEnable(xGPIO_PORTB_BASE, xGPIO_PIN_9, ulIntTypes[i]);
        ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_CFGR0 + 9*4) & EXTI_CFGR0_SRCTYPE_M;
        TestAssert(ulTemp == ulIntTypes[i],
                   "xgpio, \"xGPIOPinIntEnable \" error");  
        ulTemp =  xHWREG(GPIO_AFIO_BASE + AFIO_ESSR1) & (AFIO_ESSR0_EXTINPIN_M << 4);
        TestAssert(ulTemp == (1 << 4),
                   "xgpio, \"xGPIOPinIntEnable \" error");
	    ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_ICR) & (0x00000001 << 9);
        TestAssert(ulTemp == (0x00000001 << 9),
                   "xgpio, \"xGPIOPinIntEnable \" error");
    }    

    //
    // GPIOC int enable test
    //
    for(i = 0; i < 5; i++)
    {
        xGPIOPinIntEnable(xGPIO_PORTC_BASE, xGPIO_PIN_1, ulIntTypes[i]);
        ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_CFGR0 + 4) & EXTI_CFGR0_SRCTYPE_M;
        TestAssert(ulTemp == ulIntTypes[i],
                   "xgpio, \"xGPIOPinIntEnable \" error");
        ulTemp =  xHWREG(GPIO_AFIO_BASE + AFIO_ESSRO) & (AFIO_ESSR0_EXTINPIN_M << 4);
        TestAssert(ulTemp == 2 << 4,
                   "xgpio, \"xGPIOPinIntEnable \" error");
	    ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_ICR) & 0x00000002;
        TestAssert(ulTemp == 0x00000002,
                   "xgpio, \"xGPIOPinIntEnable \" error");
    }

    //
    // GPIOD int enable test
    //
    for(i = 0; i < 5; i++)
    {
        xGPIOPinIntEnable(xGPIO_PORTD_BASE, xGPIO_PIN_9, ulIntTypes[i]);
        ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_CFGR0 + 9*4) & EXTI_CFGR0_SRCTYPE_M;
        TestAssert(ulTemp == ulIntTypes[i],
                   "xgpio, \"xGPIOPinIntEnable \" error");  
        ulTemp =  xHWREG(GPIO_AFIO_BASE + AFIO_ESSR1) & (AFIO_ESSR0_EXTINPIN_M << 4);
        TestAssert(ulTemp == (3 << 4),
                   "xgpio, \"xGPIOPinIntEnable \" error");
	    ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_ICR) & (0x00000001 << 9);
        TestAssert(ulTemp == (0x00000001 << 9),
                   "xgpio, \"xGPIOPinIntEnable \" error");
    }

    //
    // GPIOE int enable test
    //
    for(i = 0; i < 5; i++)
    {
        xGPIOPinIntEnable(xGPIO_PORTE_BASE, xGPIO_PIN_10, ulIntTypes[i]);
        ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_CFGR0 + 10*4) & EXTI_CFGR0_SRCTYPE_M;
        TestAssert(ulTemp == ulIntTypes[i],
                   "xgpio, \"xGPIOPinIntEnable \" error");  
        ulTemp =  xHWREG(GPIO_AFIO_BASE + AFIO_ESSR1) & (AFIO_ESSR0_EXTINPIN_M << 8);
        TestAssert(ulTemp == (4 << 8),
                   "xgpio, \"xGPIOPinIntEnable \" error");
	    ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_ICR) & (0x00000001 << 10);
        TestAssert(ulTemp == (0x00000001 << 10),
                   "xgpio, \"xGPIOPinIntEnable \" error");
    } 	 
*/	 
    //
	// Int Disable test
	//
    for(ulPin = 0; ulPin < 16; ulPin++)
    {
        xGPIOPinIntDisable(GPIO_AFIO_BASE, ulPackedPin[ulPin]);
	    ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_ICR) & (0x00000001 << ulPin);
        TestAssert(ulTemp == 0,
                   "xgpio, \"Interrupt disable test \" error"); 
    }
 
    //
    // GPIOA out/in test
    //
    xGPIODirModeSet( xGPIO_PORTA_BASE, xGPIO_PIN_0, GPIO_DIR_MODE_OUT );
    xGPIOPinWrite(xGPIO_PORTA_BASE, xGPIO_PIN_0, 1);
    ulTemp = GPIOPinPortDoutGet(xGPIO_PORTA_BASE);
    TestAssert(ulTemp == xGPIO_PIN_0,
               "xgpio, \"Output pin value set \" error");   

    xGPIOPinWrite(xGPIO_PORTA_BASE, xGPIO_PIN_0, 0);
    ulTemp = GPIOPinPortDoutGet(xGPIO_PORTA_BASE);
    TestAssert(ulTemp == 0,
               "xgpio, \"Output pin value set \" error");  
    
    //
    // GPIOB out/in test
    //
    xGPIODirModeSet( xGPIO_PORTB_BASE, xGPIO_PIN_2, GPIO_DIR_MODE_OUT );
    xGPIOPinWrite(xGPIO_PORTB_BASE, xGPIO_PIN_2, 1);
    ulTemp = GPIOPinPortDoutGet(xGPIO_PORTB_BASE) & xGPIO_PIN_2;
    TestAssert(ulTemp == xGPIO_PIN_2,
               "xgpio, \"Output pin value set \" error");

    xGPIOPinWrite(xGPIO_PORTB_BASE, xGPIO_PIN_2, 0);
    ulTemp = GPIOPinPortDoutGet(xGPIO_PORTB_BASE) & xGPIO_PIN_2;
    TestAssert(ulTemp == 0,
               "xgpio, \"Output pin value set \" error");

    GPIOPortWrite(xGPIO_PORTB_BASE, 0x00000004);
	ulTemp = GPIOPinPortDoutGet(xGPIO_PORTB_BASE) & xGPIO_PIN_2;
    TestAssert(ulTemp == 0x00000004,
               "xgpio, \"Output port value set \" error");
	GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_2, 0);
	ulTemp = GPIOPinPortDoutGet(xGPIO_PORTB_BASE) & xGPIO_PIN_2;
    TestAssert(ulTemp == 0,
               "xgpio, \"Output port value set2 \" error");

    //
    // GPIOC out/in test
    //
    xGPIODirModeSet( xGPIO_PORTC_BASE, xGPIO_PIN_0, GPIO_DIR_MODE_OUT );
    xGPIOPinWrite(xGPIO_PORTC_BASE, xGPIO_PIN_0, 1);
    ulTemp = GPIOPinPortDoutGet(xGPIO_PORTC_BASE);
    TestAssert(ulTemp == xGPIO_PIN_0,
               "xgpio, \"Output pin value set \" error");   

    xGPIOPinWrite(xGPIO_PORTC_BASE, xGPIO_PIN_0, 0);
    ulTemp = GPIOPinPortDoutGet(xGPIO_PORTC_BASE);
    TestAssert(ulTemp == 0,
               "xgpio, \"Output pin value set \" error"); 

    //
    // GPIOD out/in test
    //
    xGPIODirModeSet( xGPIO_PORTD_BASE, xGPIO_PIN_0, GPIO_DIR_MODE_OUT );
    xGPIOPinWrite(xGPIO_PORTD_BASE, xGPIO_PIN_0, 1);
    ulTemp = GPIOPinPortDoutGet(xGPIO_PORTD_BASE);
    TestAssert(ulTemp == xGPIO_PIN_0,
               "xgpio, \"Output pin value set \" error");   

    xGPIOPinWrite(xGPIO_PORTD_BASE, xGPIO_PIN_0, 0);
    ulTemp = GPIOPinPortDoutGet(xGPIO_PORTD_BASE);
    TestAssert(ulTemp == 0,
               "xgpio, \"Output pin value set \" error"); 

    //
    // GPIOE out/in test
    //
    xGPIODirModeSet( xGPIO_PORTE_BASE, xGPIO_PIN_0, GPIO_DIR_MODE_OUT );
    xGPIOPinWrite(xGPIO_PORTE_BASE, xGPIO_PIN_0, 1);
    ulTemp = GPIOPinPortDoutGet(xGPIO_PORTE_BASE);
    TestAssert(ulTemp == xGPIO_PIN_0,
               "xgpio, \"Output pin value set \" error");   

    xGPIOPinWrite(xGPIO_PORTE_BASE, xGPIO_PIN_0, 0);
    ulTemp = GPIOPinPortDoutGet(xGPIO_PORTE_BASE);
    TestAssert(ulTemp == 0,
               "xgpio, \"Output pin value set \" error");
	    
    //
    // EXTI line De-bounce enable test
    //
    EXTILineDebounceEnable(xGPIO_PIN_0);
    ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_CFGR0) & EXTI_CFGR0_DBEN;
    TestAssert(ulTemp == EXTI_CFGR0_DBEN,
               "xgpio, \"De-bounce enable test \" error");  

	//
	// EXTI line De-bounce disable test
	//
    EXTILineDebounceDisable(xGPIO_PIN_0);
    ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_CFGR0) & EXTI_CFGR0_DBEN;
    TestAssert(ulTemp == 0,
               "xgpio, \"De-bounce disable test \" error"); 
	
	//
	// EXTI line De-bounce time set test
	//
	for(i = 0; i < 3; i++)
	{
	    for(j = 0; j < 3; j++)
		{
		    EXTIDebounceTimeSet(ulEXTILines[i], ulDeBounceTime[j]);
			ulTemp = EXTIDebounceTimeGet(ulEXTILines[i]);   
			TestAssert(ulTemp == ulDeBounceTime[j], 
			           "xgpio, \"De-bounce disable test \" error");  
		}  
	}	
	
	//
	// EXTI Wake Up Int configure test
	//
    EXTIWakeUpIntConfigure(ulEXTIWakeUpInt[0]);
	ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_WAKUPCR) & EXTI_WAKUPCR_EVWUPIEN;
    TestAssert(ulTemp == EXTI_WAKUPCR_EVWUPIEN,
               "xgpio, \"EXTI Wake Up Int Enable \" error");
	EXTIWakeUpIntConfigure(ulEXTIWakeUpInt[1]);
	ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_WAKUPCR) & EXTI_WAKUPCR_EVWUPIEN;
    TestAssert(ulTemp == 0,
               "xgpio, \"EXTI Wake Up Int Enable \" error");	   

	//
	// EXTI Wake up Configure test
	//
	for(i = 0; i < 3; i++)
	{	
		EXTILineWakeUpConfigure(ulEXTILines[i], ulEXTIWakeUpLevel[0],
			                    ulEXTIWakeUp[0]);
		ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_WAKUPPOLR) & 
		               (1 << ulEXTILineShift[i]);
		TestAssert(ulTemp == (1 << ulEXTILineShift[i]),
                   "xgpio, \"EXTI Wake Up Level \" error");

		EXTILineWakeUpConfigure(ulEXTILines[i], ulEXTIWakeUpLevel[1],
			                    ulEXTIWakeUp[0]);
		ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_WAKUPPOLR) & 
		               (1 << ulEXTILines[i]);
		TestAssert(ulTemp == 0,
                   "xgpio, \"EXTI Wake Up Level \" error");

		ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_WAKUPCR) & 
		               (1 << ulEXTILineShift[i]);
		TestAssert(ulTemp == (1 << ulEXTILineShift[i]),
                   "xgpio, \"EXTI Wake Up Enable \" error");

		EXTILineWakeUpConfigure(ulEXTILines[i], ulEXTIWakeUpLevel[0],
			                    ulEXTIWakeUp[1]);
		ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_WAKUPCR) & 
		               (1 << ulEXTILineShift[i]);
		TestAssert(ulTemp == 0,
                   "xgpio, \"EXTI Wake Up Disable \" error");
	}	  	   
	
	//
	// GPIO Pad configure
	//
    GPIOPadConfigSet(GPIO_PORTA_BASE, xGPIO_PIN_3, 
                     ulStrengthValue[0], ulOpenDrain[0] | ulPullResistor[0]);
    ulTemp =  xHWREG(GPIO_PORTA_BASE + GPIO_DRVR) & xGPIO_PIN_3;
    TestAssert(ulTemp ==0,
               "xgpio, \"Current drain Configure\" error");
    ulTemp = xHWREG(GPIO_PORTA_BASE + GPIO_PUR) & xGPIO_PIN_3;
    TestAssert(ulTemp == xGPIO_PIN_3,
               "xgpio, \"Pull up resistor Enable \" error");
    ulTemp = xHWREG(GPIO_PORTA_BASE + GPIO_PDR) & xGPIO_PIN_3;
    TestAssert(ulTemp == 0,
               "xgpio, \"Pull up resistor Enable \" error");
    ulTemp = xHWREG(ulPort + GPIO_ODR) & xGPIO_PIN_3;
    TestAssert(ulTemp == xGPIO_PIN_3,
               "xgpio, \"Open drain enable \" error");

    GPIOPadConfigSet(GPIO_PORTA_BASE, xGPIO_PIN_3, 
                     ulStrengthValue[1], ulOpenDrain[1] | ulPullResistor[1]);
    ulTemp =  xHWREG(GPIO_PORTA_BASE + GPIO_DRVR) & xGPIO_PIN_3;
    TestAssert(ulTemp == xGPIO_PIN_3,
               "xgpio, \"Current drain Configure\" error");
    ulTemp = xHWREG(GPIO_PORTA_BASE + GPIO_PUR) & xGPIO_PIN_3;
    TestAssert(ulTemp == 0,
               "xgpio, \"Pull up resistor Enable \" error");
    ulTemp = xHWREG(GPIO_PORTA_BASE + GPIO_PDR) & xGPIO_PIN_3;
    TestAssert(ulTemp == xGPIO_PIN_3,
               "xgpio, \"Pull up resistor Enable \" error");
    ulTemp = xHWREG(GPIO_PORTA_BASE + GPIO_ODR) & xGPIO_PIN_3;
    TestAssert(ulTemp == 0,
               "xgpio, \"Open drain disable \" error");	
			   
	//
	// Software Trigger test
	//
	for(i = 0; i < 3; i++)
	{		   		   			   	
	    EXTILineSoftwareTrigger(ulEXTILines[i]);
		ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_SSCR) &  ulEXTILines[i];
		TestAssert(ulTemp == ulEXTILines[i],
                   "xgpio, \"Software Trigger Set \" error");	
    }
	
	//
	// Software Trigger clear
	//	  
	for(i = 0; i < 3; i++)
	{
	    EXTILineSoftwareClear(ulEXTILines[i]);
		ulTemp = xHWREG(GPIO_EXTI_BASE + EXTI_SSCR) &  ulEXTILines[i];
		TestAssert(ulTemp == 0,
                   "xgpio, \"Software Trigger Clear \" error");
    }
    
    //
    // Short pin to pin test
    //
    ulTemp = xGPIOSPinToPin(PA0);
    TestAssert(ulTemp == ulPinValue[0],
               "xgpio, \" Short pin to pin test \" error");  
    ulTemp = xGPIOSPinToPin(PA1);
    TestAssert(ulTemp == ulPinValue[1],
               "xgpio, \" Short pin to pin test \" error");        
    ulTemp = xGPIOSPinToPin(PA2);
    TestAssert(ulTemp == ulPinValue[2],
               "xgpio, \" Short pin to pin test \" error");   
    
    
    //
    // Short pin write test
    //
    xGPIOSPinWrite(PA0, 1);
    ulTemp = GPIOSPinRead(PA0) & GPIO_PIN_0;
    TestAssert(ulTemp == GPIO_PIN_0,
               "xgpio, \"Short pin write test \" error"); 
 
   
    //
    // Ture pin to ADC function
    //    
    xSPinTypeADC(ADC0, PA0);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 0);
    TestAssert((ulTemp == (1 << 0 )),
               "xgpio, \"Turn pin to ADC AIN0 \" error");      
    
    xSPinTypeADC(ADC1, PA1);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 2);
    TestAssert((ulTemp == (1 << 2 )),
               "xgpio, \"Turn pin to ADC AIN1 \" error");  
    
    xSPinTypeADC(ADC2, PA2);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 4);
    TestAssert((ulTemp == (1 << 4 )),
               "xgpio, \"Turn pin to ADC AIN2 \" error");     

    xSPinTypeADC(ADC3, PA3);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 6);
    TestAssert((ulTemp == (1 << 6 )),
               "xgpio, \"Turn pin to ADC AIN3 \" error"); 
    
    xSPinTypeADC(ADC4, PA4);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 8);
    TestAssert((ulTemp == (1 << 8 )),
               "xgpio, \"Turn pin to ADC AIN4 \" error");  
    
    xSPinTypeADC(ADC5, PA5);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 10);
    TestAssert((ulTemp == (1 << 10 )),
               "xgpio, \"Turn pin to ADC AIN5 \" error"); 
    
    xSPinTypeADC(ADC6, PA6);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 12);
    TestAssert((ulTemp == (1 << 12 )),
               "xgpio, \"Turn pin to ADC AIN6 \" error");    
    
    xSPinTypeADC(ADC7, PA7);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 14);
    TestAssert((ulTemp == (1 << 14 )),
               "xgpio, \"Turn pin to ADC AIN7 \" error"); 

    
    //
    // Ture pin to I2C0 function
    //    
    xSPinTypeI2C(I2C0SDA, PC5);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 10);
    TestAssert((ulTemp == (2 << 10)),
               "xgpio, \"Turn pin to I2C SDA \" error");
    xSPinTypeI2C(I2C0SDA, PC12);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 24);
    TestAssert((ulTemp == (1 << 24)),
               "xgpio, \"Turn pin to I2C SDA \" error");
    xSPinTypeI2C(I2C0SDA, PD13);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 26);
    TestAssert((ulTemp == (2 << 26)),
               "xgpio, \"Turn pin to I2C SDA \" error");     			        			         
    
    xSPinTypeI2C(I2C0SCK, PC4);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 8);
    TestAssert((ulTemp == (2 << 8 )),
               "xgpio, \"Turn pin to I2C SCK \" error"); 
    xSPinTypeI2C(I2C0SCK, PC11);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 22);
    TestAssert((ulTemp == (1 << 22 )),
               "xgpio, \"Turn pin to I2C SCK \" error");
    xSPinTypeI2C(I2C0SCK, PD12);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 24);
    TestAssert((ulTemp == (2 << 24 )),
               "xgpio, \"Turn pin to I2C SCK \" error"); 

    //
    // Ture pin to I2C1 function
    //    
    xSPinTypeADC(I2C1SDA, PB7);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 14);
    TestAssert((ulTemp == (2 << 14 )),
               "xgpio, \"Turn pin to I2C1 SDA \" error");
    xSPinTypeADC(I2C1SDA, PC1);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 2);
    TestAssert((ulTemp == (3 << 2 )),
               "xgpio, \"Turn pin to I2C1 SDA \" error");
    xSPinTypeADC(I2C1SDA, PC7);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 14);
    TestAssert((ulTemp == (1 << 14 )),
               "xgpio, \"Turn pin to I2C1 SDA \" error"); 
    xSPinTypeADC(I2C1SDA, PE10);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 20);
    TestAssert((ulTemp == (3 << 20 )),
               "xgpio, \"Turn pin to I2C1 SDA \" error"); 

    xSPinTypeI2C(I2C1SCK, PC0);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 0);
    TestAssert((ulTemp == (3 << 0 )),
               "xgpio, \"Turn pin to I2C1 SCK \" error");
    xSPinTypeI2C(I2C1SCK, PC6);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 12);
    TestAssert((ulTemp == (1 << 12 )),
               "xgpio, \"Turn pin to I2C1 SCK \" error"); 
    xSPinTypeI2C(I2C1SCK, PE9);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 20);
    TestAssert((ulTemp == (3 << 20 )),
               "xgpio, \"Turn pin to I2C1 SCK \" error"); 			   			    			    
		      			     
/*			               
    //
    // Turn pin to pwm mode
    //
    xSPinTypePWM(PWM0, PC2);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP2;
    ulTemp1 = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_ALT2;
    TestAssert((ulTemp == 0) && (ulTemp1 == GCR_GPCMFP_ALT2),
               "xgpio, \"Turn pin to PWM function \" error");    
   
    xSPinTypePWM(PWM1, PC3);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP3;
    ulTemp1 = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_ALT3;
    TestAssert((ulTemp == 0) && (ulTemp1 == GCR_GPCMFP_ALT3),
               "xgpio, \"Turn pin to PWM function \" error");
    
    xSPinTypePWM(PWM2, PC4);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP4;
    ulTemp1 = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_ALT4;
    TestAssert((ulTemp == 0) && (ulTemp1 == GCR_GPCMFP_ALT4),
               "xgpio, \"Turn pin to PWM function \" error");    
    
    xSPinTypePWM(PWM3, PC5);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP5;
    ulTemp1 = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_ALT5;
    TestAssert((ulTemp == 0) && (ulTemp1 == GCR_GPCMFP_ALT5),
               "xgpio, \"Turn pin to PWM function \" error");       
    
    xSPinTypePWM(PWM4, PC6);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP6;
    ulTemp1 = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_ALT6;
    TestAssert((ulTemp == 0) && (ulTemp1 == GCR_GPCMFP_ALT6),
               "xgpio, \"Turn pin to PWM function \" error");   

    xSPinTypePWM(PWM5, PA4);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP5;
    ulTemp1 = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_ALT5;
    TestAssert((ulTemp == 0) && (ulTemp1 == GCR_GPCMFP_ALT5),
               "xgpio, \"Turn pin to PWM function \" error"); 
*/			         

 
    //
    // Turn pin to spi function test
    //
    xSPinTypeSPI(SPI0CLK, PB1);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 2);
    TestAssert((ulTemp == (3 << 2)),
               "xgpio, \"Turn pin to SPI function \" error");   
    xSPinTypeSPI(SPI0CLK, PD1);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 2);
    TestAssert((ulTemp == (2 << 2)),
               "xgpio, \"Turn pin to SPI function \" error");
    xSPinTypeSPI(SPI0CLK, PD9);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 18);
    TestAssert((ulTemp == (1 << 18)),
               "xgpio, \"Turn pin to SPI function \" error"); 			      

    xSPinTypeSPI(SPI0MOSI, PB2);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 4);
    TestAssert((ulTemp == (3 << 4 )),
               "xgpio, \"Turn pin to SPI function \" error");   
    xSPinTypeSPI(SPI0MOSI, PD2);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 4);
    TestAssert((ulTemp == (2 << 4 )),
               "xgpio, \"Turn pin to SPI function \" error");
    xSPinTypeSPI(SPI0MOSI, PD10);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 20);
    TestAssert((ulTemp == (1 << 20 )),
               "xgpio, \"Turn pin to SPI function \" error");
			    			    

    xSPinTypeSPI(SPI0MISO, PB3);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 6);
    TestAssert((ulTemp == (3 << 6 )),
               "xgpio, \"Turn pin to SPI function \" error"); 
    xSPinTypeSPI(SPI0MISO, PD3);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 6);
    TestAssert((ulTemp == (2 << 6 )),
               "xgpio, \"Turn pin to SPI function \" error");
    xSPinTypeSPI(SPI0MISO, PD11);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 22);
    TestAssert((ulTemp == (1 << 22 )),
               "xgpio, \"Turn pin to SPI function \" error");			    
    
    xSPinTypeSPI(SPI0CS, PB0);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 0);
    TestAssert((ulTemp == (3 << 0 )),
               "xgpio, \"Turn pin to SPI function \" error");        
    xSPinTypeSPI(SPI0CS, PD0);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 0);
    TestAssert((ulTemp == (2 << 0)),
               "xgpio, \"Turn pin to SPI function \" error"); 
    xSPinTypeSPI(SPI0CS, PD8);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 16);
    TestAssert((ulTemp == (1 << 16)),
               "xgpio, \"Turn pin to SPI function \" error");
    
    //
    // Turn pin to timer function test
    //
    xSPinTypeTimer(TIMCCP0, PA0);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 0);
    TestAssert((ulTemp == (3 << 0)),
               "xgpio, \"Turn pin to TIMER function \" error"); 
    xSPinTypeTimer(TIMCCP0, PB0);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 0);
    TestAssert((ulTemp == (1 << 0)),
               "xgpio, \"Turn pin to TIMER function \" error");
    xSPinTypeTimer(TIMCCP0, PD0);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 0);
    TestAssert((ulTemp == (1 << 0)),
               "xgpio, \"Turn pin to TIMER function \" error");
    xSPinTypeTimer(TIMCCP0, PE5);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 10);
    TestAssert((ulTemp == (2 << 10)),
               "xgpio, \"Turn pin to TIMER function \" error"); 			    			    
			     
    xSPinTypeTimer(TIMCCP1, PA1);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 2);
    TestAssert((ulTemp == (3 << 2)),
               "xgpio, \"Turn pin to TIMER function \" error");		      
    xSPinTypeTimer(TIMCCP1, PB1);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 2);
    TestAssert((ulTemp == (1 << 2)),
               "xgpio, \"Turn pin to TIMER function \" error");
    xSPinTypeTimer(TIMCCP1, PD1);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 2);
    TestAssert((ulTemp == (1 << 2)),
               "xgpio, \"Turn pin to TIMER function \" error");
    xSPinTypeTimer(TIMCCP1, PE6);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 12);
    TestAssert((ulTemp == (2 << 12)),
               "xgpio, \"Turn pin to TIMER function \" error");
			    	
			   
    xSPinTypeTimer(TIMCCP2, PA2);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 4);
    TestAssert((ulTemp == (3 << 4)),
               "xgpio, \"Turn pin to TIMER function \" error");		      
    xSPinTypeTimer(TIMCCP2, PB2);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 4);
    TestAssert((ulTemp == (1 << 4)),
               "xgpio, \"Turn pin to TIMER function \" error");
    xSPinTypeTimer(TIMCCP2, PD2);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 4);
    TestAssert((ulTemp == (1 << 4)),
               "xgpio, \"Turn pin to TIMER function \" error");
    xSPinTypeTimer(TIMCCP2, PE7);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 14);
    TestAssert((ulTemp == (2 << 14)),
               "xgpio, \"Turn pin to TIMER function \" error"); 
			   
    xSPinTypeTimer(TIMCCP3, PA3);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 6);
    TestAssert((ulTemp == (3 << 6)),
               "xgpio, \"Turn pin to TIMER function \" error");		      
    xSPinTypeTimer(TIMCCP3, PB3);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 6);
    TestAssert((ulTemp == (1 << 6)),
               "xgpio, \"Turn pin to TIMER function \" error");
    xSPinTypeTimer(TIMCCP3, PD3);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 6);
    TestAssert((ulTemp == (1 << 6)),
               "xgpio, \"Turn pin to TIMER function \" error");
    xSPinTypeTimer(TIMCCP3, PE8);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 16);
    TestAssert((ulTemp == (2 << 16)),
               "xgpio, \"Turn pin to TIMER function \" error"); 
			   
    xSPinTypeTimer(TIMCCP4, PA12);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 24);
    TestAssert((ulTemp == (1 << 24)),
               "xgpio, \"Turn pin to TIMER function \" error");   
    xSPinTypeTimer(TIMCCP4, PC0);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 0);
    TestAssert((ulTemp == (2 << 0)),
               "xgpio, \"Turn pin to TIMER function \" error"); 
    xSPinTypeTimer(TIMCCP4, PD8);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 16);
    TestAssert((ulTemp == (3 << 16)),
               "xgpio, \"Turn pin to TIMER function \" error"); 			   	
			 
    xSPinTypeTimer(TIMCCP5, PA13);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 26);
    TestAssert((ulTemp == (1 << 26)),
               "xgpio, \"Turn pin to TIMER function \" error");   
    xSPinTypeTimer(TIMCCP5, PC1);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 2);
    TestAssert((ulTemp == (2 << 2)),
               "xgpio, \"Turn pin to TIMER function \" error"); 
    xSPinTypeTimer(TIMCCP5, PD9);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 18);
    TestAssert((ulTemp == (3 << 18)),
               "xgpio, \"Turn pin to TIMER function \" error"); 	
			   
    xSPinTypeTimer(TIMCCP6, PA14);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 28);
    TestAssert((ulTemp == (1 << 28)),
               "xgpio, \"Turn pin to TIMER function \" error");   
    xSPinTypeTimer(TIMCCP6, PC2);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 4);
    TestAssert((ulTemp == (2 << 4)),
               "xgpio, \"Turn pin to TIMER function \" error"); 
    xSPinTypeTimer(TIMCCP6, PD10);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 20);
    TestAssert((ulTemp == (3 << 20)),
               "xgpio, \"Turn pin to TIMER function \" error");	
			   
    xSPinTypeTimer(TIMCCP7, PA15);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 30);
    TestAssert((ulTemp == (1 << 30)),
               "xgpio, \"Turn pin to TIMER function \" error");   
    xSPinTypeTimer(TIMCCP7, PC3);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 6);
    TestAssert((ulTemp == (2 << 6)),
               "xgpio, \"Turn pin to TIMER function \" error"); 
    xSPinTypeTimer(TIMCCP7, PD11);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 22);
    TestAssert((ulTemp == (3 << 22)),
               "xgpio, \"Turn pin to TIMER function \" error");		   		   		   		    			   			   		     
    
    xSPinTypeTimer(T0EX, PC15);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 30);
    TestAssert((ulTemp == (2 << 30)),
               "xgpio, \"Turn pin to TIMER function \" error");  
    xSPinTypeTimer(T0EX, PD13);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 26);
    TestAssert((ulTemp == (3 << 26)),
               "xgpio, \"Turn pin to TIMER function \" error");
    xSPinTypeTimer(T0EX, PE9);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 18);
    TestAssert((ulTemp == (2 << 18)),
               "xgpio, \"Turn pin to TIMER function \" error");			     
    
    xSPinTypeTimer(T1EX, PD12);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 24);
    TestAssert((ulTemp == (3 << 24)),
               "xgpio, \"Turn pin to TIMER function \" error");
    xSPinTypeTimer(T1EX, PE10);   
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 20);
    TestAssert((ulTemp == (2 << 20)),
               "xgpio, \"Turn pin to TIMER function \" error");
			   			    
    
    // 
    // Turn pin to uart function test
    //
    xSPinTypeUART(UART0RX, PA3);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 6);
    TestAssert((ulTemp == (2 << 6)),
               "xgpio, \"Turn pin to UART function \" error"); 
    xSPinTypeUART(UART0RX, PA11);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 22);
    TestAssert((ulTemp == (2 << 22)),
               "xgpio, \"Turn pin to UART function \" error");	
    xSPinTypeUART(UART0RX, PB13);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 26);
    TestAssert((ulTemp == (1 << 26)),
               "xgpio, \"Turn pin to UART function \" error");	
    xSPinTypeUART(UART0RX, PC10);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 20);
    TestAssert((ulTemp == (3 << 20)),
               "xgpio, \"Turn pin to UART function \" error");

    xSPinTypeUART(UART0TX, PA2);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 4);
    TestAssert((ulTemp == (2 << 4)),
               "xgpio, \"Turn pin to UART function \" error");
    xSPinTypeUART(UART0TX, PA10);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 20);
    TestAssert((ulTemp == (2 << 20)),
               "xgpio, \"Turn pin to UART function \" error");
    xSPinTypeUART(UART0TX, PB10);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 20);
    TestAssert((ulTemp == (1 << 20)),
               "xgpio, \"Turn pin to UART function \" error");
    xSPinTypeUART(UART0TX, PC8);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 16);
    TestAssert((ulTemp == (3 << 16)),
               "xgpio, \"Turn pin to UART function \" error");				             
    
    xSPinTypeUART(UART0RTS, PA8);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 16);
    TestAssert((ulTemp == (2 << 16)),
               "xgpio, \"Turn pin to UART function \" error");  
    xSPinTypeUART(UART0RTS, PB8);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 16);
    TestAssert((ulTemp == (1 << 16)),
               "xgpio, \"Turn pin to UART function \" error");
    xSPinTypeUART(UART0RTS, PC11);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 22);
    TestAssert((ulTemp == (3 << 22)),
               "xgpio, \"Turn pin to UART function \" error"); 
    
    xSPinTypeUART(UART0CTS, PA9);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 18);
    TestAssert((ulTemp == (2 << 18)),
               "xgpio, \"Turn pin to UART function \" error");  
    xSPinTypeUART(UART0CTS, PB9);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 18);
    TestAssert((ulTemp == (1 << 18)),
               "xgpio, \"Turn pin to UART function \" error");
    xSPinTypeUART(UART0CTS, PC12);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 24);
    TestAssert((ulTemp == (3 << 24)),
               "xgpio, \"Turn pin to UART function \" error"); 

    xSPinTypeUART(UART0DCD, PC3);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 6);
    TestAssert((ulTemp == (3 << 6)),
               "xgpio, \"Turn pin to UART function \" error");  
    xSPinTypeUART(UART0DCD, PD2);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 4);
    TestAssert((ulTemp == (3 << 4)),
               "xgpio, \"Turn pin to UART function \" error");
			   
    xSPinTypeUART(UART0DSR, PC15);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 30);
    TestAssert((ulTemp == (3 << 30)),
               "xgpio, \"Turn pin to UART function \" error");  			   
	
    xSPinTypeUART(UART0DTR, PB7);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 14);
    TestAssert((ulTemp == (3 << 14)),
               "xgpio, \"Turn pin to UART function \" error");  
    xSPinTypeUART(UART0DTR, PD0);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 0);
    TestAssert((ulTemp == (3 << 0)),
               "xgpio, \"Turn pin to UART function \" error"); 	
			   
    xSPinTypeUART(UART0RI, PC2);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 4);
    TestAssert((ulTemp == (3 << 4)),
               "xgpio, \"Turn pin to UART function \" error");  
    xSPinTypeUART(UART0RI, PD1);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPDCFGR) & (3 << 2);
    TestAssert((ulTemp == (3 << 2)),
               "xgpio, \"Turn pin to UART function \" error"); 
			   
    xSPinTypeUART(UART1RX, PA7);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 14);
    TestAssert((ulTemp == (2 << 14)),
               "xgpio, \"Turn pin to UART function \" error"); 
    xSPinTypeUART(UART1RX, PB3);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 6);
    TestAssert((ulTemp == (2 << 6)),
               "xgpio, \"Turn pin to UART function \" error");
    xSPinTypeUART(UART1RX, PC5);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 10);
    TestAssert((ulTemp == (1 << 10)),
               "xgpio, \"Turn pin to UART function \" error");	   			   		    

    xSPinTypeUART(UART1TX, PA6);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 12);
    TestAssert((ulTemp == (2 << 12)),
               "xgpio, \"Turn pin to UART function \" error"); 
    xSPinTypeUART(UART1TX, PB2);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 4);
    TestAssert((ulTemp == (2 << 4)),
               "xgpio, \"Turn pin to UART function \" error");
    xSPinTypeUART(UART1TX, PC4);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 8);
    TestAssert((ulTemp == (1 << 8)),
               "xgpio, \"Turn pin to UART function \" error");

    xSPinTypeUART(UART1RTS, PA4);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 8);
    TestAssert((ulTemp == (2 << 8)),
               "xgpio, \"Turn pin to UART function \" error"); 
    xSPinTypeUART(UART1RTS, PB0);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 0);
    TestAssert((ulTemp == (2 << 0)),
               "xgpio, \"Turn pin to UART function \" error");
    xSPinTypeUART(UART1RTS, PB15);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 30);
    TestAssert((ulTemp == (1 << 30)),
               "xgpio, \"Turn pin to UART function \" error");
    xSPinTypeUART(UART1RTS, PC13);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 26);
    TestAssert((ulTemp == (3 << 26)),
               "xgpio, \"Turn pin to UART function \" error");

    xSPinTypeUART(UART1CTS, PA5);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPACFGR) & (3 << 10);
    TestAssert((ulTemp == (2 << 10)),
               "xgpio, \"Turn pin to UART function \" error"); 
    xSPinTypeUART(UART1CTS, PB1);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 2);
    TestAssert((ulTemp == (2 << 2)),
               "xgpio, \"Turn pin to UART function \" error");
    xSPinTypeUART(UART1CTS, PB14);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPBCFGR) & (3 << 28);
    TestAssert((ulTemp == (1 << 28)),
               "xgpio, \"Turn pin to UART function \" error");
    xSPinTypeUART(UART1CTS, PC14);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPCCFGR) & (3 << 28);
    TestAssert((ulTemp == (3 << 28)),
               "xgpio, \"Turn pin to UART function \" error");

   
    //
    // Turn the pin to ACMP function
    //
    xSPinTypeACMP(CMP0P, PE6);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 12);
    TestAssert((ulTemp == (1 << 12)),
               "xgpio, \"Turn pin to ACMP function \" error");  
    
    xSPinTypeACMP(CMP0N, PE5);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 10);
    TestAssert((ulTemp == (1 << 10)),
               "xgpio, \"Turn pin to ACMP function \" error");       

    xSPinTypeACMP(CMP0O, PE7);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 14);
    TestAssert((ulTemp == (1 << 14)),
               "xgpio, \"Turn pin to ACMP function \" error");     

    xSPinTypeACMP(CMP1P, PE9);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 18);
    TestAssert((ulTemp == (1 << 18)),
               "xgpio, \"Turn pin to ACMP function \" error"); 

    xSPinTypeACMP(CMP1N, PE8);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 16);
    TestAssert((ulTemp == (1 << 16)),
               "xgpio, \"Turn pin to ACMP function \" error"); 

    xSPinTypeACMP(CMP1O, PE10);
    ulTemp = xHWREG(GPIO_AFIO_BASE + AFIO_GPECFGR) & (3 << 20);
    TestAssert((ulTemp == (1 << 20)),
               "xgpio, \"Turn pin to ACMP function \" error");

}   
Exemple #22
0
void Blinky(void)
{
	volatile int i = 0;
    //
    // Initionalize system clock.
    //
    xSysCtlClockSet(72000000,  xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ);

    //
    // Configure LED and USB Disc Port
    //
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_GPIOB);
    xSysCtlPeripheralEnable(SYSCTL_PERIPH_AFIO);
    xGPIOPinConfigure(PB4(APP), PB4);

    //
    // Configure UART Pin
    // PA9-->TX   PA10-->RX
    //
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_GPIOA);
    xSPinTypeUART(UART1TX, PA9);
    xSPinTypeUART(UART1RX, PA10);

    //xSPinTypeUART(UART2TX, PA2);
    //xSPinTypeUART(UART2RX, PA3);

    //
    // Configure UART1 115200 8-N-1
    //
    xSysCtlPeripheralEnable(xSYSCTL_PERIPH_UART1);
    xUARTConfigSet(USART1_BASE, 115200, xUART_CONFIG_WLEN_8 |
    		                            xUART_CONFIG_STOP_1 |
    		                            xUART_CONFIG_PAR_NONE);
    xUARTEnable(USART1_BASE, xUART_BLOCK_UART | xUART_BLOCK_TX | xUART_BLOCK_RX);

    PrintStr("Embedded Pi Board Test Begin\r\n");
    PrintStr("1:LED Test, Now LED will Light\r\n");

    //
    // Configure LED Port
    //
    xGPIODirModeSet( xGPIO_PORTB_BASE, xGPIO_PIN_13, xGPIO_DIR_MODE_OUT );
    xGPIOPinWrite( xGPIO_PORTB_BASE, xGPIO_PIN_13 , 1 );

    xSysCtlDelay(MAX_TICK*10);

    PrintStr("2: USB Disc Test, Now you computer will find a new device\r\n");
    PrintStr("And LED is Blinking\r\n");
    xGPIODirModeSet( xGPIO_PORTB_BASE, xGPIO_PIN_4, xGPIO_DIR_MODE_OUT );
    xGPIOPinWrite( xGPIO_PORTB_BASE, xGPIO_PIN_4 , 0 );

    //
    // Shane LED to indicate that USB Disc is PROCESSING
    //
    for(i = 0; i < 10; i++)
    {
    	//
    	// Turn on LED
    	//
        xGPIOPinWrite( xGPIO_PORTB_BASE, xGPIO_PIN_13 , 1 );
        xSysCtlDelay(MAX_TICK);

    	//
    	// Turn off LED
    	//
        xGPIOPinWrite( xGPIO_PORTB_BASE, xGPIO_PIN_13 , 0 );
        xSysCtlDelay(MAX_TICK);
    }

    PrintStr("Now, USB Disc test is over and led will be turned off\r\n");
    //
    // Turn off LED, USB Disc is over
    //
    xGPIOPinWrite( xGPIO_PORTB_BASE, xGPIO_PIN_4 , 1 );
    xGPIOPinWrite( xGPIO_PORTB_BASE, xGPIO_PIN_13 , 0 );

    //Configure PB4 to Jtag Mode
    AFIO_DEBUG_REG &= 0x00FFFFFF;


    //
    // Test Low Speed External crystal
    //
    PrintStr("3: Low Speed External crystal test begin\r\n");
    PrintStr("If you can't see OK later, then test is failure\r\n");
    xSysCtlPeripheralEnable(SYSCTL_PERIPH_PWR | SYSCTL_PERIPH_BKP);
    SysCtlBackupAccessEnable();
    SysCtlLSEConfig(SYSCTL_LSE_OSC_EN);
    PrintStr("OK\r\n");

    PrintStr("Running");

    while(1)
    {
    	xGPIOPinWrite( xGPIO_PORTB_BASE, xGPIO_PIN_13 , 1 );
        PrintStr(".");
        xSysCtlDelay(10*MAX_TICK);

        xGPIOPinWrite( xGPIO_PORTB_BASE, xGPIO_PIN_13 , 0 );
        PrintStr(".");
        xSysCtlDelay(10*MAX_TICK);

        xGPIOPinWrite( xGPIO_PORTB_BASE, xGPIO_PIN_13 , 1 );
        PrintStr(".");
        xSysCtlDelay(10*MAX_TICK);

        xGPIOPinWrite( xGPIO_PORTB_BASE, xGPIO_PIN_13 , 0 );
        PrintStr(".");
        xSysCtlDelay(10*MAX_TICK);

        PrintStr("\b\b\b\b    \b\b\b\b");
    }
}
Exemple #23
0
//*****************************************************************************
//
//! \brief xgpio001 test execute main body.
//!
//! \return None.
//
//*****************************************************************************
static void xgpio001Execute(void)
{
   
    unsigned long ulPin, ulPort;
    unsigned long ulvalue, ulTemp, ulTemp1;  
    int i, j;
    
    //
    // GPIO mode set and get. 
    //
    for(ulPort = 0; ulPort < 5; ulPort++)
    {
        for(ulPin = 0; ulPin < 16; ulPin++)
        {        
            for(i = 0; i < 5; i++)
            {
                if(ulPort != 1 && ulPort != 3)
                {
                    xGPIODirModeSet(ulGPIO[ulPort], ulPackedPin[ulPin], ulPinMode[i]);        
                    ulvalue = xGPIODirModeGet(ulGPIO[ulPort], ulPackedPin[ulPin]);
                    TestAssert((ulvalue == ulPinMode[i]), 
                                "xgpio, \" GPIODirModeSet or GPIODirModeGet()\" error");
                }
            }
        }
    }
    
    xIntDisable(xINT_GPIOA);
    xIntDisable(xINT_GPIOB);
    xIntDisable(xINT_GPIOC);
    xIntDisable(xINT_GPIOD);
    xIntDisable(xINT_GPIOE);    
    
    
    //
    // Interrupt enable.
    //
    for(ulPort = 0; ulPort < 5; ulPort++)
    {
        for(ulPin = 0; ulPin < 16; ulPin++)
        { 
            for(i = 0; i < 6; i++)
            {
                xGPIOPinIntEnable(ulGPIO[ulPort], ulPackedPin[ulPin], ulIntType[i]);
                if(ulIntType[i] & 0x10)
                { 
                    ulTemp = xHWREG(ulGPIO[ulPort] + GPIO_IMD) & ulPackedPin[ulPin];
                    TestAssert(ulTemp == ulPackedPin[ulPin],
                               "xgpio, \"Level INT type enable \" error");
                }
                else
                {
                    ulTemp = xHWREG(ulGPIO[ulPort] + GPIO_IMD) & ulPackedPin[ulPin];
                    TestAssert(ulTemp == 0,
                               "xgpio, \"Edge INT type enable \" error");
                }
                if(ulIntType[i] & 2)
                {
                    ulTemp = xHWREG(ulGPIO[ulPort] + GPIO_IEN) & (ulPackedPin[ulPin] << 16);
                    TestAssert(ulTemp == (ulPackedPin[ulPin] << 16),
                               "xgpio, \"Rising or high level Int \" error");                    
                }
                if(ulIntType[i] & 1)
                {
                    ulTemp = xHWREG(ulGPIO[ulPort] + GPIO_IEN) & ulPackedPin[ulPin];
                    TestAssert(ulTemp == ulPackedPin[ulPin],
                               "xgpio, \"Falling or low level Int \" error");  
                }
            }
        }
    }

    
    //
    // Interrupt disable test
    //
    for(ulPort = 0; ulPort < 5; ulPort++)
    {
        for(ulPin = 0; ulPin < 16; ulPin++)
        {
            xGPIOPinIntDisable(ulGPIO[ulPort], ulPackedPin[ulPin]);
            ulTemp = xHWREG(ulGPIO[ulPort] + GPIO_IEN) & (ulPackedPin[ulPin] << 16);
            ulTemp1 = xHWREG(ulGPIO[ulPort] + GPIO_IEN) & ulPackedPin[ulPin];
            ulTemp |= ulTemp1;
            TestAssert(ulTemp == 0,
                       "xgpio, \"Interrupt disable test \" error"); 
        }
    }
    
    //
    // Pin Out/in value test
    //
    for(ulPort = 0; ulPort < 5; ulPort++)
    {
        //
        // Output pin value set
        //
        for(ulPin = 0; ulPin < 16; ulPin++)
        {
            xGPIODirModeSet( ulGPIO[ulPort], ulPackedPin[ulPin], GPIO_DIR_MODE_OUT );
            xGPIOPinWrite(ulGPIO[ulPort], ulPackedPin[ulPin], 1);
            ulTemp = xHWREG(ulGPIO[ulPort] + GPIO_DOUT) & ulPackedPin[ulPin];
            TestAssert(ulTemp == ulPackedPin[ulPin],
                       "xgpio, \"Output pin value set \" error"); 
        }   
      
    }
    
    //
    // De-bounce enable/disable test
    //
    for(ulPort = 0; ulPort < 5; ulPort++)
    {
        //
        // De-bounce enable test
        //
        for(ulPin = 0; ulPin < 16; ulPin++)
        {
            GPIOPinDebounceEnable(ulGPIO[ulPort], ulPackedPin[ulPin]);
            ulTemp = xHWREG(ulGPIO[ulPort] + GPIO_DBEN) & ulPackedPin[ulPin];
            TestAssert(ulTemp == ulPackedPin[ulPin],
                       "xgpio, \"De-bounce enable test \" error");  
        }   
        
        //
        // De-bounce disable test
        //
        for(ulPin = 0; ulPin < 16; ulPin++)
        {
            GPIOPinDebounceDisable(ulGPIO[ulPort], ulPackedPin[ulPin]);
            ulTemp = xHWREG(ulGPIO[ulPort] + GPIO_DBEN) & ulPackedPin[ulPin];
            TestAssert(ulTemp == 0,
                       "xgpio, \"De-bounce Disable test \" error");  
        }  
    }
    
    //
    // Mask set/get test
    // 
    for(ulPort = 0; ulPort < 5; ulPort++)
    {
        for(ulPin = 0; ulPin < 16; ulPin++)
        {
            GPIOPinMaskSet(ulGPIO[ulPort], ulPackedPin[ulPin]);
            ulTemp = GPIOPortMaskGet(ulGPIO[ulPort]) & ulPackedPin[ulPin];     
            TestAssert(ulTemp == ulPackedPin[ulPin],
                       "xgpio, \" Mask set/get test \" error");  
        }
    }
    
    //
    // De-bounce time set and get test
    //
    for(i = 0; i < 2; i++)
    {
        for(j = 0; j < 3; j++)
        {
            GPIODebounceTimeSet(ulDelay[i], ulDelayCycle[j]);
            ulTemp = xHWREG(GPIO_DBNCECON) & 0x10;
            if(i == 0)
            {
                TestAssert(ulTemp == 0,
                           "xgpio, \" De-bounce source set \" error");  
            }
            else
            {  
                TestAssert(ulTemp == 0x10,
                           "xgpio, \" De-bounce source set \" error");  
            }
            ulTemp1 = GPIODebounceTimeGet();
            TestAssert(ulTemp1 == ulDelayCycle[j],
                       "xgpio, \" De-bounce cycle test \" error");  
        }
    }
    
    //
    // Pin to peripheral ID test
    //
    ulTemp = xGPIOSPinToPeripheralId(PA0);
    TestAssert(ulTemp == ulPeripheralID[0],
               "xgpio, \" Pin to peripheral ID test \" error");  
    
    //
    // Short pin to pin test
    //
    ulTemp = xGPIOSPinToPin(PA0);
    TestAssert(ulTemp == ulPinValue[0],
               "xgpio, \" Short pin to pin test \" error");  
    ulTemp = xGPIOSPinToPin(PB8);
    TestAssert(ulTemp == ulPinValue[1],
               "xgpio, \" Short pin to pin test \" error");        
    ulTemp = xGPIOSPinToPin(PE15);
    TestAssert(ulTemp == ulPinValue[2],
               "xgpio, \" Short pin to pin test \" error");   
    
    //
    // Short pin dir mode set test
    //
    for(i = 0; i < 5; i++)
    {
        xGPIOSPinDirModeSet(PA0, ulPinMode[i]);
        ulTemp = xGPIODirModeGet(xGPIO_PORTA_BASE, GPIO_PIN_0);
        TestAssert(ulTemp == ulPinMode[i],
                   "xgpio, \" Short pin dir mode set test \" error");       
    }
    
    //
    // Short pin interrupt enable
    //
    for(i = 0; i < 6; i++)
    {
        xGPIOSPinIntEnable(PA0, ulIntType[i]);
        if(ulIntType[i] & 0x10)
        { 
            ulTemp = xHWREG(xGPIO_PORTA_BASE + GPIO_IMD) & GPIO_PIN_0;
            TestAssert(ulTemp == GPIO_PIN_0,
                       "xgpio, \"ShortPin INT type enable \" error");
        }
        else
        {
            ulTemp = xHWREG(xGPIO_PORTA_BASE + GPIO_IMD) & GPIO_PIN_0;
            TestAssert(ulTemp == 0,
                       "xgpio, \"ShortPin INT type enable \" error");
        }
        if(ulIntType[i] & 2)
        {
            ulTemp = xHWREG(xGPIO_PORTA_BASE + GPIO_IEN) & (GPIO_PIN_0 << 16);
            TestAssert(ulTemp == (GPIO_PIN_0 << 16),
                       "xgpio, \"ShortPin INT type enable \" error");                    
        }
        if(ulIntType[i] & 1)
        {
            ulTemp = xHWREG(xGPIO_PORTA_BASE + GPIO_IEN) & GPIO_PIN_0;
            TestAssert(ulTemp == GPIO_PIN_0,
                       "xgpio, \"ShortPin INT type enable \" error");  
        }
    }
    
    //
    // Short pin interrupt disable
    // 
    xGPIOSPinIntDisable(PA0);
    ulTemp = xHWREG(xGPIO_PORTA_BASE + GPIO_IEN) & (GPIO_PIN_0 << 16);
    ulTemp1 = xHWREG(xGPIO_PORTA_BASE + GPIO_IEN) & GPIO_PIN_0;
    ulTemp |= ulTemp1;
    TestAssert(ulTemp == 0,
               "xgpio, \"Short pin interrupt disable \" error"); 
    
    //
    // Short pin write test
    //
    xGPIOSPinWrite(PA0, 1);
    ulTemp = xHWREG(xGPIO_PORTA_BASE + GPIO_DOUT) & GPIO_PIN_0;
    TestAssert(ulTemp == GPIO_PIN_0,
               "xgpio, \"Short pin write test \" error"); 
        
    //
    // Turn pin to gpio mode test
    //  
    xGPIOSPinTypeGPIOInput(PA0);
    ulTemp = xHWREG(GCR_GPAMFP) & GPIO_PIN_0;
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to gpio mode test \" error"); 
    
    //
    // Turn pin to ADC input function
    //
    xSPinTypeADC(ADC0, PA0);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP0;
    TestAssert(ulTemp == GCR_GPAMFP_MFP0,
               "xgpio, \"Turn pin to ADC0 input \" error");   
    
    xSPinTypeADC(ADC1, PA1);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP1;
    TestAssert(ulTemp == GCR_GPAMFP_MFP1,
               "xgpio, \"Turn pin to ADC1 input \" error"); 
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN | GCR_ALTMFP_EBI_HB_EN_4);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to ADC1 input \" error"); 
    
    xSPinTypeADC(ADC2, PA2);  
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP2;
    TestAssert(ulTemp == GCR_GPAMFP_MFP2,
               "xgpio, \"Turn pin to ADC2 input \" error"); 
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN | GCR_ALTMFP_EBI_HB_EN_3);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to ADC2 input \" error");    
    
    xSPinTypeADC(ADC3, PA3);  
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP3;
    TestAssert(ulTemp == GCR_GPAMFP_MFP3,
               "xgpio, \"Turn pin to ADC3 input \" error"); 
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN | GCR_ALTMFP_EBI_HB_EN_2);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to ADC3 input \" error");   
    
    xSPinTypeADC(ADC4, PA4);  
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP4;
    TestAssert(ulTemp == GCR_GPAMFP_MFP4,
               "xgpio, \"Turn pin to ADC4 input \" error"); 
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN | GCR_ALTMFP_EBI_HB_EN_1);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to ADC4 input \" error");
    
    xSPinTypeADC(ADC5, PA5);  
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP5;
    TestAssert(ulTemp == GCR_GPAMFP_MFP5,
               "xgpio, \"Turn pin to ADC5 input \" error"); 
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN | GCR_ALTMFP_EBI_HB_EN_0);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to ADC5 input \" error");
    
    xSPinTypeADC(ADC6, PA6);  
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP6;
    TestAssert(ulTemp == GCR_GPAMFP_MFP6,
               "xgpio, \"Turn pin to ADC6 input \" error"); 
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to ADC6 input \" error");
    
    xSPinTypeADC(ADC7, PA7);  
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP7;
    TestAssert(ulTemp == GCR_GPAMFP_MFP7,
               "xgpio, \"Turn pin to ADC7 input \" error"); 
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to ADC7 input \" error");    
    ulTemp = xHWREG(GCR_ALTMFP) & GCR_ALTMFP_PA7_S21;
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to ADC7 input \" error");   
    
    //
    // Ture pin to I2C function
    //
    xSPinTypeI2C(I2C0SCK, PA9);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP9;
    TestAssert(ulTemp == GCR_GPAMFP_MFP9,
               "xgpio, \"Turn pin to I2C input \" error");    
    
    xSPinTypeI2C(I2C0SDA, PA8);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP8;
    TestAssert(ulTemp == GCR_GPAMFP_MFP8,
               "xgpio, \"Turn pin to I2C input \" error");  
    
    xSPinTypeI2C(I2C1SCK, PA11);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP11;
    TestAssert(ulTemp == GCR_GPAMFP_MFP11,
               "xgpio, \"Turn pin to I2C input \" error");     
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to I2C input \" error");   
    
    xSPinTypeI2C(I2C1SDA, PA10);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP10;
    TestAssert(ulTemp == GCR_GPAMFP_MFP10,
               "xgpio, \"Turn pin to I2C input \" error");     
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to I2C input \" error");    
    
    //
    // Turn pin to CAN function 
    //    
    xSPinTypeCAN(CAN0RX, PD6);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP6;
    TestAssert(ulTemp == GCR_GPDMFP_MFP6,
               "xgpio, \"Turn pin to CAN function \" error"); 
    
    xSPinTypeCAN(CAN0TX, PD7);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP7;
    TestAssert(ulTemp == GCR_GPDMFP_MFP7,
               "xgpio, \"Turn pin to CAN function \" error");   
    
    //
    // Turn pin to I2S function
    //
    xSPinTypeI2S(I2S0RXMCLK, PA15);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP15;
    TestAssert(ulTemp == GCR_GPAMFP_MFP15,
               "xgpio, \"Turn pin to I2S function \" error");     
    ulTemp = xHWREG(GCR_ALTMFP) & GCR_ALTMFP_PA15_I2SMCLK;
    TestAssert(ulTemp == GCR_ALTMFP_PA15_I2SMCLK,
               "xgpio, \"Turn pin to I2S function \" error");   
    
    xSPinTypeI2S(I2S0RXSCK, PC1);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP1;
    TestAssert(ulTemp == GCR_GPCMFP_MFP1,
               "xgpio, \"Turn pin to I2S function \" error");        
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PC1_I2SBCLK);
    TestAssert(ulTemp == GCR_ALTMFP_PC1_I2SBCLK,
               "xgpio, \"Turn pin to I2S function \" error");  
    
    xSPinTypeI2S(I2S0RXSD, PC2);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP2;
    TestAssert(ulTemp == GCR_GPCMFP_MFP2,
               "xgpio, \"Turn pin to I2S function \" error");        
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PC2_I2SDI);
    TestAssert(ulTemp == GCR_ALTMFP_PC2_I2SDI,
               "xgpio, \"Turn pin to I2S function \" error");  
    
    xSPinTypeI2S(I2S0RXWS, PC0);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP0;
    TestAssert(ulTemp == GCR_GPCMFP_MFP0,
               "xgpio, \"Turn pin to I2S function \" error");        
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PC0_I2SLRCLK);
    TestAssert(ulTemp == GCR_ALTMFP_PC0_I2SLRCLK,
               "xgpio, \"Turn pin to I2S function \" error");      
    
    xSPinTypeI2S(I2S0TXMCLK, PA15);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP15;
    TestAssert(ulTemp == GCR_GPAMFP_MFP15,
               "xgpio, \"Turn pin to I2S function \" error");         
    ulTemp = xHWREG(GCR_ALTMFP) & GCR_ALTMFP_PA15_I2SMCLK;
    TestAssert(ulTemp == GCR_ALTMFP_PA15_I2SMCLK,
               "xgpio, \"Turn pin to I2S function \" error");   
 
    xSPinTypeI2S(I2S0TXSCK, PC1);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP1;
    TestAssert(ulTemp == GCR_GPCMFP_MFP1,
               "xgpio, \"Turn pin to I2S function \" error");        
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PC1_I2SBCLK);
    TestAssert(ulTemp == GCR_ALTMFP_PC1_I2SBCLK,
               "xgpio, \"Turn pin to I2S function \" error");   
    
    xSPinTypeI2S(I2S0TXSD, PC3);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP3;
    TestAssert(ulTemp == GCR_GPCMFP_MFP3,
               "xgpio, \"Turn pin to I2S function \" error");        
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PC3_I2SDO);
    TestAssert(ulTemp == GCR_ALTMFP_PC3_I2SDO,
               "xgpio, \"Turn pin to I2S function \" error");  

    xSPinTypeI2S(I2S0TXWS, PC0);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP0;
    TestAssert(ulTemp == GCR_GPCMFP_MFP0,
               "xgpio, \"Turn pin to I2S function \" error");        
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PC0_I2SLRCLK);
    TestAssert(ulTemp == GCR_ALTMFP_PC0_I2SLRCLK,
               "xgpio, \"Turn pin to I2S function \" error");    
    
    //
    // Turn pin to pwm mode
    //
    xSPinTypePWM(PWM0, PA12);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP12;
    TestAssert(ulTemp == GCR_GPAMFP_MFP12,
               "xgpio, \"Turn pin to I2S function \" error");  
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN | GCR_ALTMFP_EBI_HB_EN_5);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to PWM input \" error");   
   
    xSPinTypePWM(PWM1, PA13);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP13;
    TestAssert(ulTemp == GCR_GPAMFP_MFP13,
               "xgpio, \"Turn pin to I2S function \" error");  
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN | GCR_ALTMFP_EBI_HB_EN_6);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to PWM input \" error");       
    
    xSPinTypePWM(PWM2, PA14);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP14;
    TestAssert(ulTemp == GCR_GPAMFP_MFP14,
               "xgpio, \"Turn pin to I2S function \" error");  
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN | GCR_ALTMFP_EBI_HB_EN_7);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to PWM input \" error");     
    
    xSPinTypePWM(PWM3, PA15);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP15;
    TestAssert(ulTemp == GCR_GPAMFP_MFP15,
               "xgpio, \"Turn pin to I2S function \" error");  
    ulTemp = xHWREG(GCR_ALTMFP) & GCR_ALTMFP_PA15_I2SMCLK;
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to PWM function \" error");    
    
    xSPinTypePWM(PWM4, PB11);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP11;
    TestAssert(ulTemp == GCR_GPBMFP_MFP11,
               "xgpio, \"Turn pin to I2S function \" error");    
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PB11_PWM4);
    TestAssert(ulTemp == GCR_ALTMFP_PB11_PWM4,
               "xgpio, \"Turn pin to PWM input \" error");     
    
    xSPinTypePWM(PWM5, PE5);
    ulTemp = xHWREG(GCR_GPEMFP) & GCR_GPEMFP_MFP5;
    TestAssert(ulTemp == GCR_GPEMFP_MFP5,
               "xgpio, \"Turn pin to I2S function \" error");    
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PE5_T1EX);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to PWM input \" error"); 
    
    xSPinTypePWM(PWM6, PE0);
    ulTemp = xHWREG(GCR_GPEMFP) & GCR_GPEMFP_MFP0;
    TestAssert(ulTemp == GCR_GPEMFP_MFP0,
               "xgpio, \"Turn pin to PWM function \" error");    
    
    xSPinTypePWM(PWM7, PE1);
    ulTemp = xHWREG(GCR_GPEMFP) & GCR_GPEMFP_MFP1;
    TestAssert(ulTemp == GCR_GPEMFP_MFP1,
               "xgpio, \"Turn pin to PWM function \" error");  
    
    //
    // Turn pin to spi function test
    //
    xSPinTypeSPI(SPI0CLK, PC1);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP1;
    TestAssert(ulTemp == GCR_GPCMFP_MFP1,
               "xgpio, \"Turn pin to SPI function \" error");      
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PC1_I2SBCLK);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to SPI function \" error"); 

    xSPinTypeSPI(SPI0MOSI, PC5);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP5;
    TestAssert(ulTemp == GCR_GPCMFP_MFP5,
               "xgpio, \"Turn pin to SPI function \" error");  
    
    xSPinTypeSPI(SPI0MOSI, PC3);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP3;
    TestAssert(ulTemp == GCR_GPCMFP_MFP3,
               "xgpio, \"Turn pin to SPI function \" error"); 
    
    xSPinTypeSPI(SPI0MISO, PC2);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP2;
    TestAssert(ulTemp == GCR_GPCMFP_MFP2,
               "xgpio, \"Turn pin to SPI function \" error");  
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PC2_I2SDI);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to I2S function \" error"); 
    
    xSPinTypeSPI(SPI0MISO, PC4);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP4;
    TestAssert(ulTemp == GCR_GPCMFP_MFP4,
               "xgpio, \"Turn pin to SPI function \" error");     
    
    xSPinTypeSPI(SPI0CS, PC0);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP0;
    TestAssert(ulTemp == GCR_GPCMFP_MFP0,
               "xgpio, \"Turn pin to SPI function \" error");   
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PC0_I2SLRCLK);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to SPI function \" error");  

    xSPinTypeSPI(SPI0CS, PB10);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP10;
    TestAssert(ulTemp == GCR_GPBMFP_MFP10,
               "xgpio, \"Turn pin to SPI function \" error");   
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PB10_S01);
    TestAssert(ulTemp == GCR_ALTMFP_PB10_S01,
               "xgpio, \"Turn pin to SPI function \" error");
    
    xSPinTypeSPI(SPI0CS, PC0);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP0;
    TestAssert(ulTemp == GCR_GPCMFP_MFP0,
               "xgpio, \"Turn pin to SPI function \" error");   
    
    xSPinTypeSPI(SPI1MOSI, PC13);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP13;
    TestAssert(ulTemp == GCR_GPCMFP_MFP13,
               "xgpio, \"Turn pin to SPI function \" error");   
    
    xSPinTypeSPI(SPI1MOSI, PC11);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP11;
    TestAssert(ulTemp == GCR_GPCMFP_MFP11,
               "xgpio, \"Turn pin to SPI function \" error");   
    
    xSPinTypeSPI(SPI1MISO, PC12);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP12;
    TestAssert(ulTemp == GCR_GPCMFP_MFP12,
               "xgpio, \"Turn pin to SPI function \" error");   
    
    xSPinTypeSPI(SPI1MISO, PC10);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP10;
    TestAssert(ulTemp == GCR_GPCMFP_MFP10,
               "xgpio, \"Turn pin to SPI function \" error");    
    
    xSPinTypeSPI(SPI1CS, PB9);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP9;
    TestAssert(ulTemp == GCR_GPBMFP_MFP9,
               "xgpio, \"Turn pin to SPI function \" error");  
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PB9_S11);
    TestAssert(ulTemp == GCR_ALTMFP_PB9_S11,
               "xgpio, \"Turn pin to SPI function \" error");  
    
    xSPinTypeSPI(SPI1CS, PC8);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP8;
    TestAssert(ulTemp == GCR_GPCMFP_MFP8,
               "xgpio, \"Turn pin to SPI function \" error");   
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to SPI function \" error");    
    
    xSPinTypeSPI(SPI2CLK, PD1);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP1;
    TestAssert(ulTemp == GCR_GPDMFP_MFP1,
               "xgpio, \"Turn pin to SPI function \" error");   
    
    xSPinTypeSPI(SPI2MOSI, PD3);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP3;
    TestAssert(ulTemp == GCR_GPDMFP_MFP3,
               "xgpio, \"Turn pin to SPI function \" error");     
    
    xSPinTypeSPI(SPI2MOSI, PD5);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP5;
    TestAssert(ulTemp == GCR_GPDMFP_MFP5,
               "xgpio, \"Turn pin to SPI function \" error");    
    
    xSPinTypeSPI(SPI2MISO, PD4);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP4;
    TestAssert(ulTemp == GCR_GPDMFP_MFP4,
               "xgpio, \"Turn pin to SPI function \" error");    
    
    xSPinTypeSPI(SPI2MISO, PD2);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP2;
    TestAssert(ulTemp == GCR_GPDMFP_MFP2,
               "xgpio, \"Turn pin to SPI function \" error"); 
    
    xSPinTypeSPI(SPI2CS, PA7);
    ulTemp = xHWREG(GCR_GPAMFP) & GCR_GPAMFP_MFP7;
    TestAssert(ulTemp == GCR_GPAMFP_MFP7,
               "xgpio, \"Turn pin to SPI function \" error");     
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PA7_S21);
    TestAssert(ulTemp == GCR_ALTMFP_PA7_S21,
               "xgpio, \"Turn pin to SPI function \" error");
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to SPI function \" error");   
    
    xSPinTypeSPI(SPI2CS, PD0);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP0;
    TestAssert(ulTemp == GCR_GPDMFP_MFP0,
               "xgpio, \"Turn pin to SPI function \" error");  
    
    xSPinTypeSPI(SPI3CLK, PD9);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP9;
    TestAssert(ulTemp == GCR_GPDMFP_MFP9,
               "xgpio, \"Turn pin to SPI function \" error");    
    
    xSPinTypeSPI(SPI3MOSI, PD11);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP11;
    TestAssert(ulTemp == GCR_GPDMFP_MFP11,
               "xgpio, \"Turn pin to SPI function \" error");  
    
    xSPinTypeSPI(SPI3MOSI, PD13);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP13;
    TestAssert(ulTemp == GCR_GPDMFP_MFP13,
               "xgpio, \"Turn pin to SPI function \" error");   
    
    xSPinTypeSPI(SPI3MISO, PD10);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP10;
    TestAssert(ulTemp == GCR_GPDMFP_MFP10,
               "xgpio, \"Turn pin to SPI function \" error");     
    
    xSPinTypeSPI(SPI3MISO, PD12);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP12;
    TestAssert(ulTemp == GCR_GPDMFP_MFP12,
               "xgpio, \"Turn pin to SPI function \" error"); 
    
    
    xSPinTypeSPI(SPI3CS, PB14);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP14;
    TestAssert(ulTemp == GCR_GPBMFP_MFP14,
               "xgpio, \"Turn pin to SPI function \" error");     
    ulTemp =  xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PB14_S31);  
    TestAssert(ulTemp == GCR_ALTMFP_PB14_S31,
               "xgpio, \"Turn pin to SPI function \" error");  
    
    
    xSPinTypeSPI(SPI3CS, PD8);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP8;
    TestAssert(ulTemp == GCR_GPDMFP_MFP8,
               "xgpio, \"Turn pin to SPI function \" error");   
    
    //
    // Turn pin to timer function test
    //
    xSPinTypeTimer(TIMCCP0, PB8);   
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP8;
    TestAssert(ulTemp == GCR_GPBMFP_MFP8,
               "xgpio, \"Turn pin to TIMER function \" error");      
    
    xSPinTypeTimer(TIMCCP1, PB9);   
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP9;
    TestAssert(ulTemp == GCR_GPBMFP_MFP9,
               "xgpio, \"Turn pin to TIMER function \" error");        
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PB9_S11);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to TIMER function \" error"); 
    
    xSPinTypeTimer(TIMCCP2, PB10);   
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP10;
    TestAssert(ulTemp == GCR_GPBMFP_MFP10,
               "xgpio, \"Turn pin to TIMER function \" error");        
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PB10_S01);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to TIMER function \" error");     
    
    xSPinTypeTimer(TIMCCP3, PB11);   
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP11;
    TestAssert(ulTemp == GCR_GPBMFP_MFP11,
               "xgpio, \"Turn pin to TIMER function \" error");        
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PB11_PWM4);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to TIMER function \" error");  
    
    // 
    // Turn pin to uart function test
    //
    xSPinTypeUART(UART0RX, PB0);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP0;
    TestAssert(ulTemp == GCR_GPBMFP_MFP0,
               "xgpio, \"Turn pin to UART function \" error");  
    
    xSPinTypeUART(UART0TX, PB1);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP1;
    TestAssert(ulTemp == GCR_GPBMFP_MFP1,
               "xgpio, \"Turn pin to UART function \" error");     
    
    xSPinTypeUART(UART0RTS, PB2);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP2;
    TestAssert(ulTemp == GCR_GPBMFP_MFP2,
               "xgpio, \"Turn pin to UART function \" error");   
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN | GCR_ALTMFP_EBI_nWRL_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to UART function \" error");      
    ulTemp =  xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PB2_T2EX);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to UART function \" error");    

    xSPinTypeUART(UART0CTS, PB3);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP3;
    TestAssert(ulTemp == GCR_GPBMFP_MFP3,
               "xgpio, \"Turn pin to UART function \" error");   
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN | GCR_ALTMFP_EBI_nWRH_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to UART function \" error");
    ulTemp =  xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_PB3_T3EX);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to UART function \" error");  
    
    xSPinTypeUART(UART1RTS, PB6);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP6;
    TestAssert(ulTemp == GCR_GPBMFP_MFP6,
               "xgpio, \"Turn pin to UART function \" error");   
    ulTemp =  xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to UART function \" error");  
    
    xSPinTypeUART(UART1RX, PB4);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP4;
    TestAssert(ulTemp == GCR_GPBMFP_MFP4,
               "xgpio, \"Turn pin to UART function \" error");   
    
    xSPinTypeUART(UART1TX, PB5);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP5;
    TestAssert(ulTemp == GCR_GPBMFP_MFP5,
               "xgpio, \"Turn pin to UART function \" error");   
    
    xSPinTypeUART(UART2RX, PD14);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP14;
    TestAssert(ulTemp == GCR_GPDMFP_MFP14,
               "xgpio, \"Turn pin to UART function \" error");       

    xSPinTypeUART(UART2TX, PD15);
    ulTemp = xHWREG(GCR_GPDMFP) & GCR_GPDMFP_MFP15;
    TestAssert(ulTemp == GCR_GPDMFP_MFP15,
               "xgpio, \"Turn pin to UART function \" error");      
    
    //
    // Turn pin to ACMP function test
    //
    xSPinTypeACMP(CMP0P, PC6);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP6;
    TestAssert(ulTemp == GCR_GPCMFP_MFP6,
               "xgpio, \"Turn pin to SPI function \" error");   
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to SPI function \" error"); 
    
    xSPinTypeACMP(CMP0N, PC7);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP7;
    TestAssert(ulTemp == GCR_GPCMFP_MFP7,
               "xgpio, \"Turn pin to SPI function \" error");   
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to SPI function \" error"); 

    xSPinTypeACMP(CMP0O, PB12);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP12;
    TestAssert(ulTemp == GCR_GPBMFP_MFP12,
               "xgpio, \"Turn pin to SPI function \" error");   
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to SPI function \" error");  

    xSPinTypeACMP(CMP1P, PC14);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP14;
    TestAssert(ulTemp == GCR_GPCMFP_MFP14,
               "xgpio, \"Turn pin to SPI function \" error");   
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to SPI function \" error");      
    
    xSPinTypeACMP(CMP1N, PC15);
    ulTemp = xHWREG(GCR_GPCMFP) & GCR_GPCMFP_MFP15;
    TestAssert(ulTemp == GCR_GPCMFP_MFP15,
               "xgpio, \"Turn pin to SPI function \" error");   
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to SPI function \" error");   
    
    xSPinTypeACMP(CMP1O, PB13);
    ulTemp = xHWREG(GCR_GPBMFP) & GCR_GPBMFP_MFP13;
    TestAssert(ulTemp == GCR_GPBMFP_MFP13,
               "xgpio, \"Turn pin to SPI function \" error");   
    ulTemp = xHWREG(GCR_ALTMFP) & (GCR_ALTMFP_EBI_EN);
    TestAssert(ulTemp == 0,
               "xgpio, \"Turn pin to SPI function \" error");        
    
}   
Exemple #24
0
//*****************************************************************************
//
//! Initialize the UART module and send characters to the terminal
//!
//! \param None
//!
//! This function initializes the UART including clock source, enables RX and TX.
//! Prints the welcome message and echos characters.
//!
//! \return none
//
//*****************************************************************************
void UART_example_freedomKL25(void)
{
    unsigned int i = 0;
    unsigned char Rec;

    //
    // Configure System clock
    //
    xSysCtlClockSet(48000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ);
    SysCtlDelay(1000000);

    //
    // Enable GPIO and UART Clock
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    //
    // Remap UART pin to GPIO Port UART0_RX --> PA2 UART0_TX --> PA1
    //
    xSPinTypeUART(UART0RX, PA1);
    xSPinTypeUART(UART0TX, PA2);

    //
    // Set UART clock
    //
    SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_UART0_S_MCGPLLCLK_2);

    //
    // Disable UART Receive/Transmit
    //
    UARTDisable(UART0_BASE, UART_TX | UART_RX);

    //
    // Configure UART Baud 115200
    //
    UARTConfigSet(UART0_BASE, 115200, UART_CONFIG_SAMPLE_RATE_15 | UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_1);

    //
    // Enable UART Receive and Transmit
    //
    UARTEnable(UART0_BASE, UART_TX | UART_RX);

    //
    // Print out welcome information
    //
    i = 0;
    while(Begin[i] != '\0')
    {
        UARTCharPut(UART0_BASE, Begin[i++]);
    }

    //
    // Echo user's input information. End if 0xD (CR)
    //
    while((Rec = UARTCharGet(UART0_BASE)) != 0xD)
    {
        UARTCharPut(UART0_BASE, Rec);
    }

    //
    // print out last message
    //
    i = 0;
    while(End[i] != '\0')
    {
        UARTCharPut(UART0_BASE, End[i++]);
    }

    while(1);                  
}