Exemplo n.º 1
0
/*---------------------------------------------------------------------------*
 * Requirement routines:
 *---------------------------------------------------------------------------*/
void LPC1768_I2S_Require(const T_LPC1768_I2S_Settings *aSettings)
{
    static const T_LPC1768_IOCON_ConfigList pinsRX_SCK[] = {
            {GPIO_P0_4,  IOCON_D_DEFAULT(1)},
            {GPIO_P0_23, IOCON_A_DEFAULT(2)},
    };
    static const T_LPC1768_IOCON_ConfigList pinsRX_SDA[] = {
            {GPIO_P0_6,  IOCON_D_DEFAULT(1)},
            {GPIO_P0_25, IOCON_D_DEFAULT(2)},
    };
    static const T_LPC1768_IOCON_ConfigList pinsRX_WS[] = {
            {GPIO_P0_5,  IOCON_D_DEFAULT(1)},
            {GPIO_P0_24, IOCON_A_DEFAULT(2)},
    };
    static const T_LPC1768_IOCON_ConfigList pinsRX_MCLK[] = {
            {GPIO_P4_28, IOCON_D_DEFAULT(2)},
    };

    static const T_LPC1768_IOCON_ConfigList pinsTX_SCK[] = {
            {GPIO_P2_11, IOCON_D_DEFAULT(3)},
            {GPIO_P0_7,  IOCON_W_DEFAULT(1)},
    };
    static const T_LPC1768_IOCON_ConfigList pinsTX_SDA[] = {
            {GPIO_P2_13, IOCON_D_DEFAULT(3)},
            {GPIO_P0_9,  IOCON_W_DEFAULT(1)},
    };
    static const T_LPC1768_IOCON_ConfigList pinsTX_WS[] = {
            {GPIO_P2_12, IOCON_D_DEFAULT(3)},
            {GPIO_P0_8,  IOCON_W_DEFAULT(1)},
    };
    static const T_LPC1768_IOCON_ConfigList pinsTX_MCLK[] = {
            {GPIO_P4_29, IOCON_D_DEFAULT(2)},
    };

    HAL_DEVICE_REQUIRE_ONCE();
    // Register I2S Bus drivers
    HALInterfaceRegister("I2S", (T_halInterface *)&G_LPC1768_I2S_Interface, 0,
            0);
    LPC1768_IOCON_ConfigPinOrNone(aSettings->iRX_SCK, pinsRX_SCK,
            ARRAY_COUNT(pinsRX_SCK));
    LPC1768_IOCON_ConfigPinOrNone(aSettings->iRX_SDA, pinsRX_SDA,
            ARRAY_COUNT(pinsRX_SDA));
    LPC1768_IOCON_ConfigPinOrNone(aSettings->iRX_WS, pinsRX_WS,
            ARRAY_COUNT(pinsRX_WS));
    LPC1768_IOCON_ConfigPinOrNone(aSettings->iRX_MCLK, pinsRX_MCLK,
            ARRAY_COUNT(pinsRX_MCLK));

    LPC1768_IOCON_ConfigPinOrNone(aSettings->iTX_SCK, pinsTX_SCK,
            ARRAY_COUNT(pinsTX_SCK));
    LPC1768_IOCON_ConfigPinOrNone(aSettings->iTX_SDA, pinsTX_SDA,
            ARRAY_COUNT(pinsTX_SDA));
    LPC1768_IOCON_ConfigPinOrNone(aSettings->iTX_WS, pinsTX_WS,
            ARRAY_COUNT(pinsTX_WS));
    LPC1768_IOCON_ConfigPinOrNone(aSettings->iTX_MCLK, pinsTX_MCLK,
            ARRAY_COUNT(pinsTX_MCLK));
}
void LPC17xx_40xx_USBHost_PortB_Require(const T_LPC17xx_40xx_USBHost_Settings *aSettings)
{
    static const T_LPC17xx_40xx_IOCON_ConfigList pinsDP2[] = {
            {GPIO_P0_31, IOCON_U_DEFAULT(1)}, // USB_D+2
    };
    static const T_LPC17xx_40xx_IOCON_ConfigList pinsCONNECT2[] = {
            {GPIO_P0_14, IOCON_D_DEFAULT(3)}, // USB_CONNECT2
    };
    static const T_LPC17xx_40xx_IOCON_ConfigList pinsUP_LED2[] = {
            {GPIO_P0_13, IOCON_A_DEFAULT(1)}, // USB_UP_LED2
    };
    static const T_LPC17xx_40xx_IOCON_ConfigList pinsPPWR2[] = {
            {GPIO_P0_12, IOCON_A_DEFAULT(1)}, // USB_PPWR2n
    };
    static const T_LPC17xx_40xx_IOCON_ConfigList pinsPWRD2[] = {
            {GPIO_P1_30, IOCON_A_DEFAULT(1)}, // USB_PWRD2
    };
    static const T_LPC17xx_40xx_IOCON_ConfigList pinsOVRCR2[] = {
            {GPIO_P1_31, IOCON_A_DEFAULT(1)}, // USB_OVRCR2n
    };
    static const T_LPC17xx_40xx_IOCON_ConfigList pinsHSTEN2[] = {
            {GPIO_P0_14, IOCON_D_DEFAULT(1)}, // USB_HSTEN2n
    };
    HAL_DEVICE_REQUIRE_ONCE();
    // Register USB Host driver ports for LPC24xx
    HALInterfaceRegister("USBHost:PortB",
            (T_halInterface *)&G_LPC17xx_40xx_USBHost_Interface_PortB, 0, 0);

//    LPC17xx_40xx_USBHost_VBUS_Require(aSettings->iVBUS);
    LPC17xx_40xx_IOCON_ConfigPin(aSettings->iDP, pinsDP2, ARRAY_COUNT(pinsDP2));
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iDM, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iCONNECT, pinsCONNECT2,
            ARRAY_COUNT(pinsCONNECT2));
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iUP_LED, pinsUP_LED2,
            ARRAY_COUNT(pinsUP_LED2));
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iINTn, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iSCL, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iSDA, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iTX_E, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iTX_DP, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iTX_DM, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iRCV, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iRX_DP, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iRX_DM, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iLSn, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iSSPNDn, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iPPWRn, pinsPPWR2,
            ARRAY_COUNT(pinsPPWR2));
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iPWRDn, pinsPWRD2,
            ARRAY_COUNT(pinsPWRD2));
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iOVRCRn, pinsOVRCR2,
            ARRAY_COUNT(pinsOVRCR2));
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aSettings->iHSTENn, pinsHSTEN2,
            ARRAY_COUNT(pinsHSTEN2));
}
Exemplo n.º 3
0
void LPC17xx_40xx_SSP1_Require(
        T_uezGPIOPortPin aPinSCK1,
        T_uezGPIOPortPin aPinMISO1,
        T_uezGPIOPortPin aPinMOSI1,
        T_uezGPIOPortPin aPinSSEL1)
{
    static const T_LPC17xx_40xx_IOCON_ConfigList sck1[] = {
            {GPIO_P0_7,  IOCON_W_DEFAULT(2)},
            {GPIO_P1_19, IOCON_D_DEFAULT(5)},
            {GPIO_P1_31, IOCON_A_DEFAULT(2)},
            {GPIO_P4_20, IOCON_D_DEFAULT(3)},
    };
    static const T_LPC17xx_40xx_IOCON_ConfigList ssel1[] = {
            {GPIO_P0_6,  IOCON_D_DEFAULT(2)},
            {GPIO_P0_14, IOCON_D_DEFAULT(2)},
            {GPIO_P4_21, IOCON_D_DEFAULT(3)},
    };
    static const T_LPC17xx_40xx_IOCON_ConfigList miso1[] = {
            {GPIO_P0_8,  IOCON_W_DEFAULT(2)},
            {GPIO_P0_12, IOCON_A_DEFAULT(2)},
            {GPIO_P1_18, IOCON_D_DEFAULT(5)},
            {GPIO_P4_22, IOCON_D_DEFAULT(3)},
    };
    static const T_LPC17xx_40xx_IOCON_ConfigList mosi1[] = {
            {GPIO_P0_9,  IOCON_W_DEFAULT(2)},
            {GPIO_P0_13, IOCON_A_DEFAULT(2)},
            {GPIO_P1_22, IOCON_D_DEFAULT(5)},
            {GPIO_P4_23, IOCON_D_DEFAULT(3)},
    };

    HAL_DEVICE_REQUIRE_ONCE();
    // Register SSP1
    HALInterfaceRegister("SSP1",
            (T_halInterface *)&SSP_LPC17xx_40xx_Port1_Interface, 0, 0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aPinSCK1, sck1, ARRAY_COUNT(sck1));
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aPinSSEL1, ssel1, ARRAY_COUNT(ssel1));
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aPinMISO1, miso1, ARRAY_COUNT(miso1));
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aPinMOSI1, mosi1, ARRAY_COUNT(mosi1));
    LPC17xx_40xxPowerOn(1<<10);

    // Setup interrupt, but do not enable
    InterruptRegister(SSP1_IRQn, ISSP1IRQ, INTERRUPT_PRIORITY_HIGH, "SSP1");
    InterruptDisable(SSP1_IRQn);
}
Exemplo n.º 4
0
void LPC1768_UART3_Require(
        T_uezGPIOPortPin aPinTXD3,
        T_uezGPIOPortPin aPinRXD3)
{
    static const T_LPC1768_IOCON_ConfigList txd3[] = {
            {GPIO_P0_0,  IOCON_D_DEFAULT(2)},
            {GPIO_P0_25, IOCON_A_DEFAULT(3)},
            {GPIO_P4_28, IOCON_D_DEFAULT(2)},
    };
    static const T_LPC1768_IOCON_ConfigList rxd3[] = {
            {GPIO_P0_1,  IOCON_D_DEFAULT(2)},
            {GPIO_P0_26, IOCON_A_DEFAULT(3)},
            {GPIO_P4_29, IOCON_D_DEFAULT(2)},
    };
    HAL_DEVICE_REQUIRE_ONCE();
    HALInterfaceRegister("UART3", (T_halInterface *)&G_LPC1768_Serial_UART3, 0,
            0);
    LPC1768_IOCON_ConfigPinOrNone(aPinTXD3, txd3, ARRAY_COUNT(txd3));
    LPC1768_IOCON_ConfigPinOrNone(aPinRXD3, rxd3, ARRAY_COUNT(rxd3));
}
Exemplo n.º 5
0
void LPC17xx_40xx_UART4_Require(
        T_uezGPIOPortPin aPinTXD4,
        T_uezGPIOPortPin aPinRXD4)
{
    static const T_LPC17xx_40xx_IOCON_ConfigList txd4[] = {
            {GPIO_P0_22,  IOCON_D_DEFAULT(3)},
            {GPIO_P1_29,  IOCON_D_DEFAULT(5)},
            {GPIO_P5_4,   IOCON_A_DEFAULT(4)},
    };
    static const T_LPC17xx_40xx_IOCON_ConfigList rxd4[] = {
            {GPIO_P2_9,  IOCON_D_DEFAULT(3)},
            {GPIO_P5_3,  IOCON_D_DEFAULT(4)},
    };
    HAL_DEVICE_REQUIRE_ONCE();
    HALInterfaceRegister("UART4", (T_halInterface *)&G_LPC17xx_40xx_Serial_UART4, 0,
            0);
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aPinTXD4, txd4, ARRAY_COUNT(txd4));
    LPC17xx_40xx_IOCON_ConfigPinOrNone(aPinRXD4, rxd4, ARRAY_COUNT(rxd4));
}