fix compiler error for USB1 to none in ehci.c

rename and moving bsp ea4357
This commit is contained in:
hathach
2013-04-22 11:00:43 +07:00
parent 3f9a73a34d
commit c20071c55c
19 changed files with 682 additions and 6 deletions
@@ -0,0 +1,49 @@
/*****************************************************************************
*
* Copyright(C) 2011, Embedded Artists AB
* All rights reserved.
*
******************************************************************************
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* products. This software is supplied "AS IS" without any warranties.
* Embedded Artists AB assumes no responsibility or liability for the
* use of the software, conveys no license or title under any patent,
* copyright, or mask work right to the product. Embedded Artists AB
* reserves the right to make changes in the software without
* notification. Embedded Artists AB also make no representation or
* warranty that such application will be suitable for the specified
* use without further testing or modification.
*****************************************************************************/
#ifndef __ACC_H
#define __ACC_H
typedef enum
{
ACC_MODE_STANDBY,
ACC_MODE_MEASURE,
ACC_MODE_LEVEL, /* level detection */
ACC_MODE_PULSE, /* pulse detection */
} acc_mode_t;
typedef enum
{
ACC_RANGE_8G,
ACC_RANGE_2G,
ACC_RANGE_4G,
} acc_range_t;
void acc_init (void);
void acc_read (int8_t *x, int8_t *y, int8_t *z);
void acc_setRange(acc_range_t range);
void acc_setMode(acc_mode_t mode);
#endif /* end __LIGHT_H */
/****************************************************************************
** End Of File
*****************************************************************************/
@@ -0,0 +1,31 @@
/*****************************************************************************
*
* Copyright(C) 2011, Embedded Artists AB
* All rights reserved.
*
******************************************************************************
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* products. This software is supplied "AS IS" without any warranties.
* Embedded Artists AB assumes no responsibility or liability for the
* use of the software, conveys no license or title under any patent,
* copyright, or mask work right to the product. Embedded Artists AB
* reserves the right to make changes in the software without
* notification. Embedded Artists AB also make no representation or
* warranty that such application will be suitable for the specified
* use without further testing or modification.
*****************************************************************************/
#ifndef __BASE_EEPROM_H
#define __BASE_EEPROM_H
#define BASE_EEPROM_TOTAL_SIZE 8192
void base_eeprom_init (void);
int16_t base_eeprom_read(uint8_t* buf, uint16_t offset, uint16_t len);
int16_t base_eeprom_write(uint8_t* buf, uint16_t offset, uint16_t len);
#endif /* end __BASE_EEPROM_H */
/****************************************************************************
** End Of File
*****************************************************************************/
@@ -0,0 +1,37 @@
/*****************************************************************************
*
* Copyright(C) 2011, Embedded Artists AB
* All rights reserved.
*
******************************************************************************
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* products. This software is supplied "AS IS" without any warranties.
* Embedded Artists AB assumes no responsibility or liability for the
* use of the software, conveys no license or title under any patent,
* copyright, or mask work right to the product. Embedded Artists AB
* reserves the right to make changes in the software without
* notification. Embedded Artists AB also make no representation or
* warranty that such application will be suitable for the specified
* use without further testing or modification.
*****************************************************************************/
#ifndef __JOYSTICK_H
#define __JOYSTICK_H
#define JOYSTICK_CENTER 0x01
#define JOYSTICK_UP 0x02
#define JOYSTICK_DOWN 0x04
#define JOYSTICK_LEFT 0x08
#define JOYSTICK_RIGHT 0x10
void joystick_init (void);
uint8_t joystick_read(void);
#endif /* end __JOYSTICK_H */
/****************************************************************************
** End Of File
*****************************************************************************/
@@ -0,0 +1,29 @@
/*****************************************************************************
*
* Copyright(C) 2011, Embedded Artists AB
* All rights reserved.
*
******************************************************************************
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* products. This software is supplied "AS IS" without any warranties.
* Embedded Artists AB assumes no responsibility or liability for the
* use of the software, conveys no license or title under any patent,
* copyright, or mask work right to the product. Embedded Artists AB
* reserves the right to make changes in the software without
* notification. Embedded Artists AB also make no representation or
* warranty that such application will be suitable for the specified
* use without further testing or modification.
*****************************************************************************/
#ifndef __LM75A_H
#define __LM75A_H
void lm75a_init (void);
int32_t lm75a_readTemp(void);
#endif /* end __LM75A_H */
/****************************************************************************
** End Of File
*****************************************************************************/
@@ -0,0 +1,30 @@
/*****************************************************************************
*
* Copyright(C) 2011, Embedded Artists AB
* All rights reserved.
*
******************************************************************************
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* products. This software is supplied "AS IS" without any warranties.
* Embedded Artists AB assumes no responsibility or liability for the
* use of the software, conveys no license or title under any patent,
* copyright, or mask work right to the product. Embedded Artists AB
* reserves the right to make changes in the software without
* notification. Embedded Artists AB also make no representation or
* warranty that such application will be suitable for the specified
* use without further testing or modification.
*****************************************************************************/
#ifndef __MEMREG_H
#define __MEMREG_H
#define MEMREG_BASE 0x1e000000
extern uint32_t memreg_init (void);
#endif /* end __MEMREG_H */
/****************************************************************************
** End Of File
*****************************************************************************/
@@ -0,0 +1,56 @@
/*****************************************************************************
*
* Copyright(C) 2011, Embedded Artists AB
* All rights reserved.
*
******************************************************************************
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* products. This software is supplied "AS IS" without any warranties.
* Embedded Artists AB assumes no responsibility or liability for the
* use of the software, conveys no license or title under any patent,
* copyright, or mask work right to the product. Embedded Artists AB
* reserves the right to make changes in the software without
* notification. Embedded Artists AB also make no representation or
* warranty that such application will be suitable for the specified
* use without further testing or modification.
*****************************************************************************/
#ifndef __NORFLASH_H
#define __NORFLASH_H
#define NORFLASH_SIZE 0x400000 /*Bytes or 0x200000 16bit words*/
#define NORFLASH_BLOCK_SIZE 0x10000 /*Bytes, or 32K 16bit words*/
#define NORFLASH_BASE 0x1C000000
//16 bit data
#define GET_ADDR(addr) (volatile uint16_t *)(NORFLASH_BASE | ((addr) << 1))
typedef struct
{
uint32_t device_size; /* Device size in bytes */
uint32_t num_sectors; /* Number of sectors */
uint32_t sector_size; /* Sector size in bytes */
uint32_t num_blocks; /* Number of blocks */
uint32_t block_size; /* Block size in bytes */
} geometry_t;
extern uint32_t norflash_init(void);
extern void norflash_getGeometry(geometry_t* geometry);
extern uint32_t norflash_eraseBlock(uint32_t addr);
extern uint32_t norflash_eraseSector(uint32_t addr);
extern uint32_t norflash_eraseEntireChip(void);
extern uint32_t norflash_writeWord(uint32_t addr, uint16_t data);
extern uint32_t norflash_writeBuff(uint32_t addr, uint16_t* data, uint16_t len);
extern void norflash_secid_read(uint16_t SST_SecID[8], uint16_t user_SecID[8]);
extern uint32_t norflash_secid_getLockStatus(void);
extern uint32_t norflash_secid_lockOut(void);
extern uint32_t norflash_secid_writeWord(uint16_t target, uint16_t* data, uint16_t len);
#endif /* end __NORFLASH_H */
/****************************************************************************
** End Of File
*****************************************************************************/
@@ -0,0 +1,94 @@
/*****************************************************************************
*
* Copyright(C) 2011, Embedded Artists AB
* All rights reserved.
*
******************************************************************************
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* products. This software is supplied "AS IS" without any warranties.
* Embedded Artists AB assumes no responsibility or liability for the
* use of the software, conveys no license or title under any patent,
* copyright, or mask work right to the product. Embedded Artists AB
* reserves the right to make changes in the software without
* notification. Embedded Artists AB also make no representation or
* warranty that such application will be suitable for the specified
* use without further testing or modification.
*****************************************************************************/
#ifndef __PCA9532C_H
#define __PCA9532C_H
#define PCA9532_I2C_ADDR (0x60)
#define PCA9532_INPUT0 0x00
#define PCA9532_INPUT1 0x01
#define PCA9532_PSC0 0x02
#define PCA9532_PWM0 0x03
#define PCA9532_PSC1 0x04
#define PCA9532_PWM1 0x05
#define PCA9532_LS0 0x06
#define PCA9532_LS1 0x07
#define PCA9532_LS2 0x08
#define PCA9532_LS3 0x09
#define PCA9532_AUTO_INC 0x10
/*
* The Keys on the base board are mapped to LED0 -> LED3 on
* the PCA9532.
*/
#define KEY1 0x0001
#define KEY2 0x0002
#define KEY3 0x0004
#define KEY4 0x0008
#define KEY_MASK 0x000F
/*
* MMC Card Detect and MMC Write Protect are mapped to LED4
* and LED5 on the PCA9532. Please note that WP is active low.
*/
#define MMC_CD 0x0010
#define MMC_WP 0x0020
#define MMC_MASK 0x30
/* NOTE: LED6 and LED7 on PCA9532 are not connected to anything */
#define PCA9532_NOT_USED 0xC0
/*
* Below are the LED constants to use when enabling/disabling a LED.
* The LED names are the names printed on the base board and not
* the names from the PCA9532 device. base_LED1 -> LED8 on PCA9532,
* base_LED2 -> LED9, and so on.
*/
#define LED1 0x0100
#define LED2 0x0200
#define LED3 0x0400
#define LED4 0x0800
#define LED5 0x1000
#define LED6 0x2000
#define LED7 0x4000
#define LED8 0x8000
#define LED_MASK 0xFF00
void pca9532_init (void);
uint16_t pca9532_getLedState (uint32_t shadow);
void pca9532_setLeds (uint16_t ledOnMask, uint16_t ledOffMask);
void pca9532_setBlink0Period(uint8_t period);
void pca9532_setBlink0Duty(uint8_t duty);
void pca9532_setBlink0Leds(uint16_t ledMask);
void pca9532_setBlink1Period(uint8_t period);
void pca9532_setBlink1Duty(uint8_t duty);
void pca9532_setBlink1Leds(uint16_t ledMask);
#endif /* end __PCA9532C_H */
/****************************************************************************
** End Of File
*****************************************************************************/
@@ -0,0 +1,93 @@
#ifndef _UDA1380_H_
#define _UDA1380_H_
#include "lpc_types.h"
#define UDA1380_SYSCLK_USED 0
#define UDA1380_SLAVE_ADDR 0x1A
#define UDA1380_CMD_BUFF_SIZE 3
/** UDA1380 Registers */
#define UDA1380_REG_EVALCLK 0x00
#define UDA1380_REG_I2S 0x01
#define UDA1380_REG_PWRCTRL 0x02
#define UDA1380_REG_ANAMIX 0x03
#define UDA1380_REG_HEADAMP 0x04
#define UDA1380_REG_MSTRVOL 0x10
#define UDA1380_REG_MIXVOL 0x11
#define UDA1380_REG_MODEBBT 0x12
#define UDA1380_REG_MSTRMUTE 0x13
#define UDA1380_REG_MIXSDO 0x14
#define UDA1380_REG_DECVOL 0x20
#define UDA1380_REG_PGA 0x21
#define UDA1380_REG_ADC 0x22
#define UDA1380_REG_AGC 0x23
#define UDA1380_REG_L3 0x7f
#define UDA1380_REG_HEADPHONE 0x18
#define UDA1380_REG_DEC 0x28
// UDA1380_REG_EVALCLK bit defines
#define EVALCLK_ADC_EN 0x0800 // Enable ADC clock
#define EVALCLK_DEC_EN 0x0400 // Enable decimator clock
#define EVALCLK_DAC_EN 0x0200 // Enable DAC clock
#define EVALCLK_INT_EN 0x0100 // Enable interpolator clock
#define EVALCLK_ADC_SEL_WSPLL 0x0020 // Select SYSCLK input for ADC clock
#define EVALCLK_ADC_SEL_SYSCLK 0x0000 // Select WSPLL clock for ADC clock
#define EVALCLK_DAC_SEL_WSPLL 0x0010 // Select SYSCLK input for DAC clock
#define EVALCLK_DAC_SEL_SYSCLK 0x0000 // Select WSPLL clock for DAC clock
#define EVALCLK_SYSDIV_SEL(n) ((n) << 2) // System clock input divider select
#define EVALCLK_WSPLL_SEL6_12K 0x0000 // WSPLL input freq selection = 6.25 to 12.5K
#define EVALCLK_WSPLL_SEL12_25K 0x0001 // WSPLL input freq selection = 12.5K to 25K
#define EVALCLK_WSPLL_SEL25_50K 0x0002 // WSPLL input freq selection = 25K to 50K
#define EVALCLK_WSPLL_SEL50_100K 0x0003 // WSPLL input freq selection = 50K to 100K
// UDA1380_REG_I2S
#define I2S_SFORI_I2S 0x0000
#define I2S_SFORI_LSB16 0x0100
#define I2S_SFORI_LSB18 0x0200
#define I2S_SFORI_LSB20 0x0300
#define I2S_SFORI_MSB 0x0500
#define I2S_SFORI_MASK 0x0700
#define I2S_SFORO_I2S 0x0000
#define I2S_SFORO_LSB16 0x0001
#define I2S_SFORO_LSB18 0x0002
#define I2S_SFORO_LSB20 0x0003
#define I2S_SFORO_LSB24 0x0004
#define I2S_SFORO_MSB 0x0005
#define I2S_SFORO_MASK 0x0007
#define I2S_SEL_SOURCE 0x0040
#define I2S_SIM 0x0010
// UDA1380_REG_PWRCTRL bit defines
#define PWR_PON_PLL_EN 0x8000 // WSPLL enable
#define PWR_PON_HP_EN 0x2000 // Headphone driver enable
#define PWR_PON_DAC_EN 0x0400 // DAC power enable
#define PWR_PON_BIAS_EN 0x0100 // Power on bias enable (for ADC, AVC, and FSDAC)
#define PWR_EN_AVC_EN 0x0080 // Analog mixer enable
#define PWR_PON_AVC_EN 0x0040 // Analog mixer power enable
#define PWR_EN_LNA_EN 0x0010 // LNA and SDC power enable
#define PWR_EN_PGAL_EN 0x0008 // PGA left power enable
#define PWR_EN_ADCL_EN 0x0004 // ADC left power enable
#define PWR_EN_PGAR_EN 0x0002 // PGA right power enable
#define PWR_EN_ADCR_EN 0x0001 // ADC right power enable
// UDA1380_REG_MSTRMUTE bit defines
#define MSTRMUTE_MTM_MUTE_EN 0x4000 // Master mute enable
#define MSRTMUTE_CHANNEL2_MUTE_EN 0x0800
#define MSRTMUTE_CHANNEL1_MUTE_EN 0x0008
// UDA1380_REG_MODEBBT bit defines
#define MODEBBT_BOOST_FLAT 0x0000 // Bits for selecting flat boost
#define MODEBBT_BOOST_FULL 0xC000 // Bits for selecting maximum boost
#define MODEBBT_BOOST_MASK 0xC000 // Bits for selecting boost mask
#define UDA1380_FUNC_OK 0
#define UDA1380_FUNC_ERR -1
int32_t Uda1380_Init(uint32_t i2cClockFreq, uint32_t i2sClockFreq);
int32_t Uda1380_WriteData(uint8_t reg, uint16_t data);
int32_t Uda1380_ReadData(uint8_t reg, uint16_t *data);
#endif /* _UDA1380_H_ */