Beispiel #1
0
/**
 ****************************************************************************************
 * @brief  GPIO functionn configuration.
 *
 * Set Pins as gpio pin or function pin
 *****************************************************************************************
 */
static void SystemIOCfg(void)
{
    // pin mux
    syscon_SetPMCR0(QN_SYSCON, P00_UART0_TXD_PIN_CTRL
                             | P01_GPIO_1_PIN_CTRL
                             | P02_GPIO_2_PIN_CTRL
                             | P03_GPIO_3_PIN_CTRL
                             | P04_GPIO_4_PIN_CTRL
                             | P05_GPIO_5_PIN_CTRL
                             | P06_SW_DAT_PIN_CTRL
                             | P07_SW_CLK_PIN_CTRL

                             | P10_GPIO_8_PIN_CTRL
                             | P11_GPIO_9_PIN_CTRL
                             | P12_GPIO_10_PIN_CTRL
                             | P13_GPIO_11_PIN_CTRL
                             | P14_GPIO_12_PIN_CTRL
                             | P15_GPIO_13_PIN_CTRL
                             | P16_GPIO_14_PIN_CTRL
                             | P17_UART0_RXD_PIN_CTRL
                             );
    syscon_SetPMCR1(QN_SYSCON, P20_UART1_RXD_PIN_CTRL
                             | P21_UART1_TXD_PIN_CTRL
                             | P22_GPIO_18_PIN_CTRL
                             | P23_GPIO_19_PIN_CTRL
                             | P24_GPIO_20_PIN_CTRL
                             | P25_GPIO_21_PIN_CTRL
                             | P26_GPIO_22_PIN_CTRL
                             | P27_GPIO_23_PIN_CTRL

                             | P30_GPIO_24_PIN_CTRL
                             | P31_GPIO_25_PIN_CTRL
                             | P32_GPIO_26_PIN_CTRL
                             | P33_GPIO_27_PIN_CTRL
                             | P34_GPIO_28_PIN_CTRL
                             | P35_GPIO_29_PIN_CTRL
                             | P36_GPIO_30_PIN_CTRL
                             );

    /**
     * Pin select
     **** USART1
     * Pin37 <--> USART1_CTS
     * Pin20 <--> USART1_RXD
     **** SPI0
     * Pin32 <--> SPI0_DIN
     * Pin33 <--> SPI0_DAT
     * Pin34 <--> SPI0_CLK
     * Pin35 <--> SPI0_CS0
     */
    syscon_SetPMCR2(QN_SYSCON, SYSCON_MASK_UART1_PIN_SEL | SYSCON_MASK_SPI0_PIN_SEL);

    // driver ability
    syscon_SetPDCR(QN_SYSCON, 0x0); // 0 : low driver, 1 : high driver

    // pin pull ( 00 : High-Z,  01 : Pull-down,  10 : Pull-up,  11 : Reserved )
    syscon_SetPPCR0(QN_SYSCON, 0xAAAA5AAA);
    syscon_SetPPCR1(QN_SYSCON, 0x2AAAAAAA);
}
Beispiel #2
0
/**
 ****************************************************************************************
 * @brief  GPIO functionn configuration.
 *
 * Set Pins as gpio pin or function pin
 *****************************************************************************************
 */
static void SystemIOCfg(void)
{
    // pin mux
    syscon_SetPMCR0(QN_SYSCON, P00_UART0_TXD_PIN_CTRL
                             | P01_GPIO_1_PIN_CTRL
                             | P02_GPIO_2_PIN_CTRL
                             | P03_GPIO_3_PIN_CTRL
                             | P04_GPIO_4_PIN_CTRL
                             | P05_GPIO_5_PIN_CTRL
                             | P06_SW_DAT_PIN_CTRL
                             | P07_SW_CLK_PIN_CTRL

                             | P10_GPIO_8_PIN_CTRL
                             | P11_GPIO_9_PIN_CTRL
                             | P12_GPIO_10_PIN_CTRL
                             | P13_GPIO_11_PIN_CTRL
                             | P14_GPIO_12_PIN_CTRL
                             | P15_GPIO_13_PIN_CTRL
                             | P16_GPIO_14_PIN_CTRL
                             | P17_UART0_RXD_PIN_CTRL
                             );
    syscon_SetPMCR1(QN_SYSCON, P20_GPIO_16_PIN_CTRL
                             | P21_GPIO_17_PIN_CTRL
                             | P22_GPIO_18_PIN_CTRL
                             | P23_GPIO_19_PIN_CTRL
                             | P24_GPIO_20_PIN_CTRL
                             | P25_GPIO_21_PIN_CTRL
                             | P26_PWM1_PIN_CTRL
                             | P27_GPIO_23_PIN_CTRL

                             | P30_GPIO_24_PIN_CTRL
                             | P31_GPIO_25_PIN_CTRL
#if (defined(CFG_HCI_SPI))                             
                             | P32_SPI0_DIN_PIN_CTRL        //P3.2 spi1 data in
                             | P33_SPI0_DAT_PIN_CTRL        //P3.3 spi1 data out 
                             | P34_SPI0_CLK_PIN_CTRL        //P3.4 spi1 clk
                             | P35_SPI0_CS0_PIN_CTRL        //P3.5 spi1 cs
#else
                             | P32_GPIO_26_PIN_CTRL          
                             | P33_GPIO_27_PIN_CTRL          
                             | P34_GPIO_28_PIN_CTRL          
                             | P35_GPIO_29_PIN_CTRL              
#endif
                             | P36_GPIO_30_PIN_CTRL
                             );

    // pin select
    syscon_SetPMCR2(QN_SYSCON, SYSCON_MASK_UART1_PIN_SEL | SYSCON_MASK_SPI0_PIN_SEL);

    // driver ability
    syscon_SetPDCR(QN_SYSCON, 0x0); // 0 : low driver, 1 : high driver

    // pin pull ( 00 : High-Z,  01 : Pull-down,  10 : Pull-up,  11 : Reserved )
    syscon_SetPPCR0(QN_SYSCON, 0xAAAA5AAA);
    syscon_SetPPCR1(QN_SYSCON, 0x2AAAAAAA);
}
Beispiel #3
0
/**
 ****************************************************************************************
 * @brief  GPIO functionn configuration.
 *
 * Set Pins as gpio pin or function pin
 *****************************************************************************************
 */
static void SystemIOCfg(void)
{
    // pin mux
    syscon_SetPMCR0(QN_SYSCON, P00_UART0_TXD_PIN_CTRL
                    | P01_GPIO_1_PIN_CTRL
                    | P02_GPIO_2_PIN_CTRL
                    | P03_GPIO_3_PIN_CTRL
                    | P04_GPIO_4_PIN_CTRL
                    | P05_GPIO_5_PIN_CTRL
#if	!(FB_SWD)
                    | P06_GPIO_6_PIN_CTRL
                    | P07_GPIO_7_PIN_CTRL
#else
                    | P06_SW_DAT_PIN_CTRL
                    | P07_SW_CLK_PIN_CTRL
#endif

                    | P10_GPIO_8_PIN_CTRL
                    | P11_GPIO_9_PIN_CTRL
                    | P12_GPIO_10_PIN_CTRL
                    | P13_GPIO_11_PIN_CTRL
                    | P14_GPIO_12_PIN_CTRL
                    | P15_GPIO_13_PIN_CTRL
                    | P16_GPIO_14_PIN_CTRL
                    | P17_UART0_RXD_PIN_CTRL
                   );
    syscon_SetPMCR1(QN_SYSCON, P20_GPIO_16_PIN_CTRL
                    | P21_GPIO_17_PIN_CTRL
                    | P22_GPIO_18_PIN_CTRL
                    | P23_I2C_SDA_PIN_CTRL
                    | P24_I2C_SCL_PIN_CTRL
                    | P25_GPIO_21_PIN_CTRL
                    | P26_PWM1_PIN_CTRL
                    | P27_GPIO_23_PIN_CTRL

#if	!defined(CFG_JOYSTICK)
                    | P30_GPIO_24_PIN_CTRL
#else
                    | P30_AIN0_PIN_CTRL
#endif
                    | P31_GPIO_25_PIN_CTRL
#if (defined(CFG_HCI_SPI))
                    | P32_SPI0_DIN_PIN_CTRL        //P3.2 spi1 data in
                    | P33_SPI0_DAT_PIN_CTRL        //P3.3 spi1 data out
                    | P34_SPI0_CLK_PIN_CTRL        //P3.4 spi1 clk
                    | P35_SPI0_CS0_PIN_CTRL        //P3.5 spi1 cs
#else
                    | P32_GPIO_26_PIN_CTRL
                    | P33_GPIO_27_PIN_CTRL
                    | P34_GPIO_28_PIN_CTRL
                    | P35_GPIO_29_PIN_CTRL
#endif
                    | P36_GPIO_30_PIN_CTRL
                   );

    // pin select
    syscon_SetPMCR2(QN_SYSCON, SYSCON_MASK_UART1_PIN_SEL | SYSCON_MASK_SPI0_PIN_SEL);

    // driver ability
    syscon_SetPDCR(QN_SYSCON, 0x0); // 0 : low driver, 1 : high driver

    // pin pull ( 00 : High-Z,  01 : Pull-down,  10 : Pull-up,  11 : Reserved )
#if defined(QN_EXT_FLASH)
    // If external flash is used, P1.0~P1.3 should be Pull down for preventing leakage.
    syscon_SetPPCR0(QN_SYSCON, 0xAA555AAA);
#else
#if (FB_SWD)
    syscon_SetPPCR0(QN_SYSCON, 0xAAAA5AAA);
#else
    syscon_SetPPCR0(QN_SYSCON, 0xAAAAAAAA);
#endif
#endif
    syscon_SetPPCR1(QN_SYSCON, 0x2AAAAAAA);
}
Beispiel #4
0
/**
 ****************************************************************************************
 * @brief  GPIO functionn configuration.
 *
 * Set Pins as gpio pin or function pin
 *****************************************************************************************
 */
void SystemIOCfg(void)
{

    // P0.0 -> UART0 [TX]   Pull Up    Drive ability: Low  
    // P0.1 -> GPIO         Pull Up    Drive ability: Low  
    // P0.2 -> GPIO         Pull Up    Drive ability: Low  
    // P0.3 -> GPIO         Pull Up    Drive ability: Low  
    // P0.4 -> GPIO         Pull Up    Drive ability: Low  
    // P0.5 -> GPIO         Pull Up    Drive ability: Low  
    // P0.6 -> SWD   [DAT]  Pull Up    Drive ability: Low  
    // P0.7 -> SWD   [CLK]  Pull Up    Drive ability: Low  
    // P1.0 -> UART1 [RX]   Pull Up    Drive ability: Low  
    // P1.1 -> UART1 [TX]   Pull Up    Drive ability: Low  
    // P1.2 -> GPIO         Pull Up    Drive ability: Low  
    // P1.3 -> GPIO         Pull Up    Drive ability: Low  
    // P1.4 -> GPIO         Pull Up    Drive ability: Low  
    // P1.5 -> GPIO         Pull Up    Drive ability: Low  
    // P1.6 -> GPIO         Pull Up    Drive ability: Low  
    // P1.7 -> UART0 [RX]   Pull Up    Drive ability: Low  
    // P2.0 -> GPIO         Pull Up    Drive ability: Low  
    // P2.1 -> GPIO         Pull Up    Drive ability: Low  
    // P2.2 -> GPIO         Pull Up    Drive ability: Low  
    // P2.3 -> I2C   [SDA]  Pull Up    Drive ability: Low  
    // P2.4 -> I2C   [SCL]  Pull Up    Drive ability: Low  
    // P2.5 -> GPIO         Pull Up    Drive ability: Low  
    // P2.6 -> GPIO         Pull Up    Drive ability: Low  
    // P2.7 -> GPIO         Pull Up    Drive ability: Low  
    // P3.0 -> GPIO         Pull Up    Drive ability: Low  
    // P3.1 -> GPIO         Pull Up    Drive ability: Low  
    // P3.2 -> GPIO         Pull Up    Drive ability: Low  
    // P3.3 -> GPIO         Pull Up    Drive ability: Low  
    // P3.4 -> GPIO         Pull Up    Drive ability: Low  
    // P3.5 -> GPIO         Pull Up    Drive ability: Low  
    // P3.6 -> GPIO         Pull Up    Drive ability: Low  


    //Pin Mux Control Register
    syscon_SetPMCR0(QN_SYSCON, P00_UART0_TXD_PIN_CTRL        
                             | P01_GPIO_1_PIN_CTRL           
                             | P02_GPIO_2_PIN_CTRL           
                             | P03_GPIO_3_PIN_CTRL           
                             | P04_GPIO_4_PIN_CTRL           
                             | P05_GPIO_5_PIN_CTRL           
                             | P06_SW_DAT_PIN_CTRL           
                             | P07_SW_CLK_PIN_CTRL           
                             | P10_UART1_RXD_PIN_CTRL        
                             | P11_UART1_TXD_PIN_CTRL        
                             | P12_GPIO_10_PIN_CTRL          
                             | P13_GPIO_11_PIN_CTRL          
                             | P14_GPIO_12_PIN_CTRL          
                             | P15_GPIO_13_PIN_CTRL          
                             | P16_GPIO_14_PIN_CTRL          
                             | P17_UART0_RXD_PIN_CTRL);

    //Pin Mux Control Register
    syscon_SetPMCR2(QN_SYSCON, 0);

    //Pin Mux Control Register
    syscon_SetPMCR1(QN_SYSCON, P20_GPIO_16_PIN_CTRL          
                             | P21_GPIO_17_PIN_CTRL          
                             | P22_GPIO_18_PIN_CTRL          
                             | P23_I2C_SDA_PIN_CTRL          
                             | P24_I2C_SCL_PIN_CTRL          
                             | P25_GPIO_21_PIN_CTRL          
                             | P26_GPIO_22_PIN_CTRL          
                             | P27_GPIO_23_PIN_CTRL          
                             | P30_GPIO_24_PIN_CTRL          
                             | P31_GPIO_25_PIN_CTRL          
                             | P32_GPIO_26_PIN_CTRL          
                             | P33_GPIO_27_PIN_CTRL          
                             | P34_GPIO_28_PIN_CTRL          
                             | P35_GPIO_29_PIN_CTRL          
                             | P36_GPIO_30_PIN_CTRL);
	 //P23_I2C_SDA_PIN_CTRL
	 //P24_I2C_SCL_PIN_CTRL
    //Pull Control Register
    syscon_SetPPCR0(QN_SYSCON, 0xAAAAAAAA);

    //Pull Control Register
    syscon_SetPPCR1(QN_SYSCON, 0xAAAAAAAA);

    //Drive ability Control Register
    syscon_SetPDCR(QN_SYSCON, 0x00000000);

}