Beispiel #1
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_I2S_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the I2S drivers for talking to the expansion board.
 *---------------------------------------------------------------------------*/
void UEZGUI_EXP_DK_I2S_Require(void)
{
#if (UEZ_PROCESSOR==NXP_LPC1788)
#include <Source/Processor/NXP/LPC17xx_40xx/LPC17xx_40xx_I2S.h>
    static const T_LPC17xx_40xx_I2S_Settings settings = {
            GPIO_NONE,  // I2S_RX_SDA   = not used, conflicts
            GPIO_NONE,  // I2S_RX_SCK   = not used, conflicts
            GPIO_NONE,  // I2S_RX_WS    = not used, conflicts
            GPIO_NONE,  // I2S_RX_MCLK  = not used
            GPIO_P0_9,  // I2S_TX_SDA   = P0.9_I2STX_SDA_MOSI1_MAT2.3
            GPIO_P0_7,  // I2S_TX_SCK   = P0.7_I2STX_CLK_SCK1_MAT2.1
            GPIO_P0_8,  // I2S_TX_WS    = P0.8_I2STX_WS_MISO1_MAT2.2
            GPIO_NONE,  // I2S_TX_MCLK  = not used
    };
    DEVICE_CREATE_ONCE();
    LPC17xx_40xx_I2S_Require(&settings);
#endif
#if (UEZ_PROCESSOR==NXP_LPC2478)
#include <Source/Processor/NXP/LPC2478/LPC2478_I2S.h>
    static const T_LPC2478_I2S_Settings settings = {
            GPIO_NONE,  // I2S_RX_SDA   = not used, conflicts
            GPIO_NONE,  // I2S_RX_SCK   = not used, conflicts
            GPIO_NONE,  // I2S_RX_WS    = not used, conflicts
			
            GPIO_P0_9,  // I2S_TX_SDA   = P0.9_I2STX_SDA_MOSI1_MAT2.3
            GPIO_P0_7,  // I2S_TX_SCK   = P0.7_I2STX_CLK_SCK1_MAT2.1
            GPIO_P0_8,  // I2S_TX_WS    = P0.8_I2STX_WS_MISO1_MAT2.2
    };
    DEVICE_CREATE_ONCE();
    LPC2478_I2S_Require(&settings);
#endif
    Generic_I2S_Create("I2S", "I2S");
}
Beispiel #2
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_Speaker_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the Speaker device driver
 *---------------------------------------------------------------------------*/
void UEZPlatform_Speaker_Require(void)
{
    const T_ToneGenerator_Generic_PWM_Settings settings = {
            "PWM_TPU0",
            1,
            GPIO_NONE,
            0,
            0,
    };
	T_uezDevice pwmDevice;
	
    DEVICE_CREATE_ONCE();

	UEZPlatform_PWM_TPU0_Require();
	UEZDeviceTableFind("PWM_TPU0", &pwmDevice);
	
	// The PWM Speaker is output by setting and clearing a GPIO pin
	// through software by using Callback routines.
	UEZGPIOClear(GPIO_P17);	// AUD_R
	UEZGPIOOutput(GPIO_P17);
	
	UEZGPIOClear(GPIO_PA0);	// AUD_L
	UEZGPIOOutput(GPIO_PA0);
	
	UEZGPIOSet(GPIO_PA2);	// AMP
	UEZGPIOOutput(GPIO_PA2);
	
	UEZPWMSetMatchCallback(pwmDevice, 0, UEZPlatform_SpeakerMasterCallback, 0);
	UEZPWMSetMatchCallback(pwmDevice, 1, UEZPlatform_SpeakerMatchCallback, 0);

    ToneGenerator_Generic_PWM_Create("Speaker", &settings);
}
Beispiel #3
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_Temp_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the Temperature device driver.
 *---------------------------------------------------------------------------*/
void UEZPlatform_Temp_Require(void)
{
    DEVICE_CREATE_ONCE();

    UEZPlatform_I2C0_Require();
    Temp_AnalogDevices_ADT7420_Create("Temp0", "I2C0", 0x90 >> 1);
}
Beispiel #4
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_Accel_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the Accelerometer device driver.
 *---------------------------------------------------------------------------*/
void UEZPlatform_Accel_Require(void)
{
    DEVICE_CREATE_ONCE();

    UEZPlatform_I2C0_Require();
    ST_Accelerometer_ADXL345_Create("Accel0", "I2C0");
}
Beispiel #5
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_I2C2_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the I2C1 device driver
 *---------------------------------------------------------------------------*/
void UEZPlatform_I2C0_Require(void)
{
    DEVICE_CREATE_ONCE();

    // Ensure the I2C0 exists in the HAL level
    RX63N_RIIC0_Require();
    I2C_Generic_Create("I2C0", "RIIC0", 0);
}
Beispiel #6
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_RTC_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the RTC device driver
 *---------------------------------------------------------------------------*/
void UEZPlatform_RTC_Require(void)
{
    DEVICE_CREATE_ONCE();

    // Ensure the RTC exists in the HAL level
    RX63N_RTC_Require();
    RTC_Generic_Create("RTC", "RTC");
}
Beispiel #7
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_Speaker_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the Speaker device driver
 *---------------------------------------------------------------------------*/
void UEZPlatform_PWM_TPU0_Require(void)
{
    DEVICE_CREATE_ONCE();

	RX63N_PWM_TPU0_Require(GPIO_NONE);
	
	PWM_Generic_Create("PWM_TPU0", "PWM_TPU0");
}
Beispiel #8
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZGUI_EXP_DK_AudioAmp1_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      The WM8731 AudioCodec has an amp for controlling output to
 *      the headphones.  Register this amp as EXPDK_AMP1.
 *---------------------------------------------------------------------------*/
void UEZGUI_EXP_DK_AudioAmp1_Require(void)
{
    DEVICE_CREATE_ONCE();

    UEZGUI_EXP_DK_AudioI2C_Require();
    AudioAmp_WM8731_Create("EXPDK_AMP1", EXPDK_AUDIO_I2C, 0x7F);
    UEZAudioAmpOpen("EXPDK_AMP1", &G_Amp1);
    UEZAudioAmpSetLevel(G_Amp1, UEZ_DEFAULT_AUDIO_LEVEL);
}
Beispiel #9
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZGUI_EXP_DK_AudioAmp_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup EXP-DK AudioAmp, a LM48100QMH at U10.  It uses AUDIOSDA/AUDIOSCL
 *      to control it.  Set it up as "EXP_AMP0".
 *
 *      NOTE: To enable I2C to this audio amp, JP16 must connect I2CSCL
 *          to AUDIOSCL and I2CSDA to AUDIOSDA.
 *---------------------------------------------------------------------------*/
void UEZGUI_EXP_DK_AudioAmp0_Require(void)
{
    DEVICE_CREATE_ONCE();

    UEZGUI_EXP_DK_AudioI2C_Require();
    AudioAmp_LM48110_Create("EXPDK_AMP0", EXPDK_AUDIO_I2C, 0x1F);
    UEZAudioAmpOpen("EXPDK_AMP0", &G_Amp0);
    UEZAudioAmpSetLevel(G_Amp0, UEZ_DEFAULT_AUDIO_LEVEL);
}
Beispiel #10
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_FileSystem_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the File System using FATFS
 *---------------------------------------------------------------------------*/
void UEZPlatform_FileSystem_Require(void)
{
    T_uezDevice dev_fs;

    DEVICE_CREATE_ONCE();

    FileSystem_FATFS_Create("FATFS");
    UEZDeviceTableFind("FATFS", &dev_fs);
    UEZFileSystemInit();
    UEZFileSystemMount(dev_fs, "/");
}
Beispiel #11
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_ADC0_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the ADC0 device driver.
 *---------------------------------------------------------------------------*/
void UEZPlatform_S12AD_Require(void)
{
	TUInt32 channels;
	
    DEVICE_CREATE_ONCE();
	
	channels = (1<<2); 	// AN002 = Potentiometer
	channels |= (1<<5); // AN005 = Microphone
	channels |= (1<<6); // AN006 = Right Audio Feedback
    RX63N_S12AD_Require(channels);
    ADCBank_Generic_Create("ADC_S12AD", "ADC_S12AD");
}
Beispiel #12
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZGUI_EXP_DK_ProximitySensor_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Enable the EXP_DK Proximity Sensor -- a VCNL4010-GS08.
 *---------------------------------------------------------------------------*/
void UEZGUI_EXP_DK_ProximitySensor_Require(void)
{
    DEVICE_CREATE_ONCE();

    // Currently, there is no driver for the VCNL4010-GS08.
    // Manual readings of I2C have been performed, but nothing more.

    // In order to use this, it must use EXPDK_I2C-B provided by the I2C Mux
    UEZGUI_EXP_DK_I2CMux_Require();

    // TODO: Make a proximity driver appear on this!
}
Beispiel #13
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZGUI_EXP_DK_CAN_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup CAN to the EXP DK (currently not supported as a driver yet)
 *---------------------------------------------------------------------------*/
void UEZGUI_EXP_DK_CAN_Require(void)
{
    DEVICE_CREATE_ONCE();

    // The EXP-DK has a CAN option when JP23 is set to connect CANTD and CANRD
    // to NXPCANTD/NXPCANRD (meaning this is currently a NXP processor only
    // option).
    // NXPCANTD/NXPCANRD are on the secondary expansion connector at J1-11/12.
    // This is UART_D on the expansion board.

    // TBD: Currently, uEZ does NOT have a CAN driver, so there is nothing else
    // to do here!
}
Beispiel #14
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_WiredNetwork0_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the networking for Wired connections.
 *---------------------------------------------------------------------------*/
void UEZPlatform_WiredNetwork0_Require(void)
{
    DEVICE_CREATE_ONCE();

	RX63N_UnlockProtectionBits();

    // Wired network needs an EMAC
    RX63N_100_EMAC_RMII_Require();

    // Create the network driver for talking to lwIP on a wired
    // network.
    Network_lwIP_Create("WiredNetwork0");
}
Beispiel #15
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZGUI_EXP_DK_AudioCodec_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the WM8731 AudioCodec for directing audio in and out.
 *---------------------------------------------------------------------------*/
void UEZGUI_EXP_DK_AudioCodec_Require(void)
{
    T_uezDevice p_ac;
    DEVICE_AudioCodec **ac;

    DEVICE_CREATE_ONCE();

    AudioCodec_WM8731_ADXL345_Create("EXP_AudioCodec0", EXPDK_AUDIO_I2C);
    UEZDeviceTableFind("EXP_AudioCodec0", &p_ac);
    UEZDeviceTableGetWorkspace(p_ac, (T_uezDeviceWorkspace **)&ac);

    // Configure so that both audio inputs are output to the headphones.
    (*ac)->UseConfiguration((void*)ac, 0);
}
Beispiel #16
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_SDCard_Drive_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the SDCard drive using MS1 on the given drive number
 *---------------------------------------------------------------------------*/
void UEZPlatform_SDCard_Drive_Require(TUInt8 aDriveNum)
{
    T_uezDevice ms1;
    T_uezDeviceWorkspace *p_ms1;

    DEVICE_CREATE_ONCE();

    UEZPlatform_MS1_Require();
    UEZPlatform_FileSystem_Require();

    UEZDeviceTableFind("MS1", &ms1);
    UEZDeviceTableGetWorkspace(ms1, (T_uezDeviceWorkspace **)&p_ms1);
    FATFS_RegisterMassStorageDevice(aDriveNum, (DEVICE_MassStorage **)p_ms1);
}
Beispiel #17
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZGUI_EXP_DK_I2CMux_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup I2CMux on the expansion board as EXP_I2C-A - EXP_I2C-D
 *---------------------------------------------------------------------------*/
void UEZGUI_EXP_DK_I2CMux_Require(void)
{
    void *p_group = 0;
    DEVICE_CREATE_ONCE();

    UEZPlatform_ExpansionPrimary_I2C_A_Require();
    I2C_Mux_PCA9546_Create("EXPDK_I2C-A", PRIMARY_EXPANSION_I2C_A,
        UEZGUI_EXP_DK_I2CMUX_I2C_ADDRESS, 0, &p_group);
    I2C_Mux_PCA9546_Create("EXPDK_I2C-B", PRIMARY_EXPANSION_I2C_A,
        UEZGUI_EXP_DK_I2CMUX_I2C_ADDRESS, 1, &p_group);
    I2C_Mux_PCA9546_Create("EXPDK_I2C-C", PRIMARY_EXPANSION_I2C_A,
        UEZGUI_EXP_DK_I2CMUX_I2C_ADDRESS, 2, &p_group);
    I2C_Mux_PCA9546_Create("EXPDK_I2C-D", PRIMARY_EXPANSION_I2C_A,
        UEZGUI_EXP_DK_I2CMUX_I2C_ADDRESS, 3, &p_group);
}
Beispiel #18
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_Console_FullDuplex_UART_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the console using a full duplex UART.
 * Inputs:
 *      const char *aHALSerialName -- Name of UART serial driver to use
 *      TUInt32 aWriteBufferSize -- Size in bytes of outgoing buffer
 *      TUInt32 aReadBufferSize -- Size in bytes of incoming buffer
 *---------------------------------------------------------------------------*/
void UEZPlatform_Console_FullDuplex_SCI_Require(
        const char *aHALSerialName,
        TUInt32 aWriteBufferSize,
        TUInt32 aReadBufferSize)
{
    DEVICE_CREATE_ONCE();

    Serial_Generic_FullDuplex_Stream_Create("Console", aHALSerialName,
            aWriteBufferSize, aReadBufferSize);

    // Set standard output to console
    UEZStreamOpen("Console", &G_stdout);
    G_stdin = G_stdout;
    StdinRedirect(G_stdin);
    StdoutRedirect(G_stdout);
}
Beispiel #19
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZGUI_EXP_DK_RS232_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the RS232 connection here.  This just links to a UART
 *      on the platform.  Let's setup an alias to whatever that name is.
 *      UART_B on J2-41/42 is what is used for the RS232
 *---------------------------------------------------------------------------*/
void UEZGUI_EXP_DK_RS232_Require(
    TUInt32 aWriteBufferSize,
    TUInt32 aReadBufferSize)
{
    DEVICE_CREATE_ONCE()
    ;

    // Setup UARTB into a full duplex RS232 serial port
    UEZPlatform_ExpansionPrimary_UART_B_Require(aWriteBufferSize,
        aReadBufferSize);

    // Setup an alias for this name that is common.
    // NOTE: This alias is a convenience, but the port may already be
    // in use elsewhere as "Console", "UART0", or some other name.
    UEZDeviceTableRegisterAlias(PRIMARY_EXPANSION_UART_B, "EXPDK_RS232");
}
Beispiel #20
0
/*---------------------------------------------------------------------------*
 * Routine:
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the I2C GPIO LEDs on EXPDK_I2C-A
 *---------------------------------------------------------------------------*/
void UEZGUI_EXP_DK_LED_Require(void)
{
    T_uezDeviceWorkspace *p_led0;
    T_uezDevice i2c;
    T_uezDeviceWorkspace *p_i2c;

    DEVICE_CREATE_ONCE();
    UEZGUI_EXP_DK_I2CMux_Require();
    // In order to use this, it must use EXPDK_I2C-A provided by the I2C Mux
    UEZDeviceTableFind("EXPDK_I2C-A", &i2c);
    UEZDeviceTableGetWorkspace(i2c, (T_uezDeviceWorkspace **)&p_i2c);

    UEZDeviceTableRegister(
        "LEDBank0",
        (T_uezDeviceInterface *)&LEDBank_NXP_PCA9551_Interface,
        0,
        &p_led0);
    LED_NXP_PCA9551_Configure(p_led0, (DEVICE_I2C_BUS **)p_i2c, 0xC0>>1);
}
Beispiel #21
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZGUI_EXP_DK_AudioMixer_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup all the audio components needed for the audio mixer
 *      and register a callback function for controlling audio to those
 *      units.
 *---------------------------------------------------------------------------*/
void UEZGUI_EXP_DK_AudioMixer_Require(void)
{
    DEVICE_CREATE_ONCE();

    // Make sure all the audio components exist
    UEZGUI_EXP_DK_AudioCodec_Require();
    UEZGUI_EXP_DK_AudioAmp0_Require(); // LM48100 I2C Amp
    UEZGUI_EXP_DK_AudioAmp1_Require(); // Wolfson Audio amp

    // Register an off board speaker
    UEZAudioMixerRegister(UEZ_AUDIO_MIXER_OUTPUT_OFFBOARD_SPEAKER,
        &UEZGUI_EXP_DK_AudioMixerCallback);
    UEZAudioMixerSetLevel(UEZ_AUDIO_MIXER_OUTPUT_OFFBOARD_SPEAKER, 250);
    UEZAudioMixerUnmute(UEZ_AUDIO_MIXER_OUTPUT_OFFBOARD_SPEAKER);

    // Register an off board set of headphones
    UEZAudioMixerRegister(UEZ_AUDIO_MIXER_OUTPUT_OFFBOARD_HEADPHONES,
        &UEZGUI_EXP_DK_AudioMixerCallback);
    UEZAudioMixerSetLevel(UEZ_AUDIO_MIXER_OUTPUT_OFFBOARD_HEADPHONES, 250);
    UEZAudioMixerUnmute(UEZ_AUDIO_MIXER_OUTPUT_OFFBOARD_HEADPHONES);
}
Beispiel #22
0
void UEZGUI_EXP_DK_GainSpan_PMOD_Require(void)
{
    // These SPI pins work for both the Application Header and the PMOD Header
    // for GainSpan Modules with SPI configured.
    const T_GainSpan_Network_SPISettings spi_settings = {
        // SPI Settings
        PRIMARY_EXPANSION_SPI,// SSP Name
        1000000, // 1 MHz
        // Pins.
        GPIO_EXPDK_I2SRXSDA_SSEL,       // SPI CS
        GPIO_EXPDK_IRQ_ISPENTRY,        //  WIFI-IRQ
        GPIO_NONE, // iProgramMode not connected
        GPIO_NONE, // iSPIMode not connected
        GPIO_NONE, // iSRSTn not connected (only to RESET_OUT)
        GPIO_NONE, // Factory Reset not connected 
        };

    DEVICE_CREATE_ONCE();

    UEZPlatform_ExpansionPrimary_SPI_A_Require();
    Network_GainSpan_Create("WirelessNetwork0", &spi_settings);
}
Beispiel #23
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_SPI0_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the SSP1 to be a SPI driver.
 *      NOTE: On expansion header
 *---------------------------------------------------------------------------*/
void UEZPlatform_SPI0_Require(void)
{
    DEVICE_CREATE_ONCE();
    RX63N_RSPI0_Require(GPIO_PC5, GPIO_PC6, GPIO_PC7);
    SPI_Generic_Create("SPI0", "RSPI0");
}
Beispiel #24
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_Flash0_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the Flash0 device driver for the external NOR Flash
 *---------------------------------------------------------------------------*/
void UEZPlatform_DataFlash_Require(void)
{
    DEVICE_CREATE_ONCE();
    Flash_Renesas_RX63N_Create("Flash0");
}
Beispiel #25
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZPlatform_MS1_Require
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the Mass Storage device MS1 using SDCard drive.
 *---------------------------------------------------------------------------*/
void UEZPlatform_MS1_Require(void)
{
    DEVICE_CREATE_ONCE();
    UEZPlatform_SPI0_Require();
    MassStorage_SDCard_Create("MS1", "SPI0", GPIO_PC4);	// SD-CS = PC4
}