This commit is contained in:
pvvx 2017-02-01 14:37:57 +03:00
parent 929dc6d329
commit 0557a41f1a
13 changed files with 99 additions and 69 deletions

View file

@ -235,10 +235,7 @@ inline int i2c_stop(i2c_t *obj) {
return 0;
}
extern u32
HalDelayUs(
IN u32 us
);
// extern u32 HalDelayUs(IN u32 us);
int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {

View file

@ -23,41 +23,41 @@ static const PinMap PinMap_UART_TX[] = {
{PC_3, RTL_PIN_PERI(UART0, 0, S0), RTL_PIN_FUNC(UART0, S0)},
{PE_0, RTL_PIN_PERI(UART0, 0, S1), RTL_PIN_FUNC(UART0, S1)},
{PA_7, RTL_PIN_PERI(UART0, 0, S2), RTL_PIN_FUNC(UART0, S2)}, // None RTL8710AF
{PD_3, RTL_PIN_PERI(UART1, 1, S0), RTL_PIN_FUNC(UART1, S0)}, // None RTL8710AF
{PD_3, RTL_PIN_PERI(UART1, 1, S0), RTL_PIN_FUNC(UART1, S0)}, // None RTL8710AF, RTL8711AM
{PE_4, RTL_PIN_PERI(UART1, 1, S1), RTL_PIN_FUNC(UART1, S1)},
{PB_5, RTL_PIN_PERI(UART1, 1, S2), RTL_PIN_FUNC(UART1, S2)}, // None RTL8710AF
{PA_4, RTL_PIN_PERI(UART2, 2, S0), RTL_PIN_FUNC(UART2, S0)},
{PC_9, RTL_PIN_PERI(UART2, 2, S1), RTL_PIN_FUNC(UART2, S1)}, // None RTL8710AF
{PD_7, RTL_PIN_PERI(UART2, 2, S2), RTL_PIN_FUNC(UART2, S2)}, // None RTL8710AF
{PB_5, RTL_PIN_PERI(UART1, 1, S2), RTL_PIN_FUNC(UART1, S2)}, // None RTL8710AF, RTL8711AM
{PA_4, RTL_PIN_PERI(UART2, 2, S0), RTL_PIN_FUNC(UART2, S0)}, // None RTL8711AM
{PC_9, RTL_PIN_PERI(UART2, 2, S1), RTL_PIN_FUNC(UART2, S1)}, // None RTL8710AF, RTL8711AM
{PD_7, RTL_PIN_PERI(UART2, 2, S2), RTL_PIN_FUNC(UART2, S2)}, // None RTL8710AF, RTL8711AM
{NC, NC, 0}
};
static const PinMap PinMap_UART_RX[] = {
{PC_0, RTL_PIN_PERI(UART0, 0, S0), RTL_PIN_FUNC(UART0, S0)},
{PE_3, RTL_PIN_PERI(UART0, 0, S1), RTL_PIN_FUNC(UART0, S1)},
{PA_6, RTL_PIN_PERI(UART0, 0, S2), RTL_PIN_FUNC(UART0, S2)}, // None RTL8710AF
{PD_0, RTL_PIN_PERI(UART1, 1, S0), RTL_PIN_FUNC(UART1, S0)}, // None RTL8710AF
{PE_7, RTL_PIN_PERI(UART1, 1, S1), RTL_PIN_FUNC(UART1, S1)}, // None RTL8710AF
{PB_4, RTL_PIN_PERI(UART1, 1, S2), RTL_PIN_FUNC(UART1, S2)}, // None RTL8710AF
{PA_0, RTL_PIN_PERI(UART2, 2, S0), RTL_PIN_FUNC(UART2, S0)},
{PC_6, RTL_PIN_PERI(UART2, 2, S1), RTL_PIN_FUNC(UART2, S1)}, // None RTL8710AF
{PD_4, RTL_PIN_PERI(UART2, 2, S2), RTL_PIN_FUNC(UART2, S2)}, // None RTL8710AF
{PC_0, RTL_PIN_PERI(UART0, 0, S0), RTL_PIN_FUNC(UART0, S0)}, // No Interrupt Source?
{PE_3, RTL_PIN_PERI(UART0, 0, S1), RTL_PIN_FUNC(UART0, S1)},
{PA_6, RTL_PIN_PERI(UART0, 0, S2), RTL_PIN_FUNC(UART0, S2)}, // None RTL8710AF, // No Interrupt Source?
{PD_0, RTL_PIN_PERI(UART1, 1, S0), RTL_PIN_FUNC(UART1, S0)}, // None RTL8710AF, RTL8711AM
{PE_7, RTL_PIN_PERI(UART1, 1, S1), RTL_PIN_FUNC(UART1, S1)}, // None RTL8710AF, RTL8711AM
{PB_4, RTL_PIN_PERI(UART1, 1, S2), RTL_PIN_FUNC(UART1, S2)}, // None RTL8710AF, RTL8711AM
{PA_0, RTL_PIN_PERI(UART2, 2, S0), RTL_PIN_FUNC(UART2, S0)}, // None RTL8711AM
{PC_6, RTL_PIN_PERI(UART2, 2, S1), RTL_PIN_FUNC(UART2, S1)}, // None RTL8710AF, RTL8711AM
{PD_4, RTL_PIN_PERI(UART2, 2, S2), RTL_PIN_FUNC(UART2, S2)}, // None RTL8710AF, RTL8711AM
{NC, NC, 0}
};
#define UART_NUM (2) //pvvx! RTL8710 !
#define UART_NUM (3)
#define SERIAL_TX_IRQ_EN 0x01
#define SERIAL_RX_IRQ_EN 0x02
#define SERIAL_TX_DMA_EN 0x01
#define SERIAL_RX_DMA_EN 0x02
static uint32_t serial_irq_ids[UART_NUM] = {0, 0}; // , 0
static uint32_t serial_irq_ids[UART_NUM] = {0, 0, 0}; // , 0
static uart_irq_handler irq_handler[UART_NUM];
static uint32_t serial_irq_en[UART_NUM] = {0, 0}; // , 0
static uint32_t serial_irq_en[UART_NUM] = {0, 0, 0}; // , 0
#ifdef CONFIG_GDMA_EN
static uint32_t serial_dma_en[UART_NUM] = {0, 0}; // , 0
static uint32_t serial_dma_en[UART_NUM] = {0, 0, 0}; // , 0
static HAL_GDMA_OP UartGdmaOp;
#endif

View file

@ -42,6 +42,20 @@ void spdio_structinit(struct spdio_t *obj){
obj->tx_done_cb = NULL;
}
///////// Add pvvx, no ...
void HalSdioRegisterRxCallback(char (*rx_done_cb)(void *priv, void* pbuf, u8 *pdata, u16 size, u8 type), void *obj)
{
struct spdio_t * sp = (struct spdio_t *) obj;
sp->rx_done_cb = rx_done_cb;
}
void HalSdioRegisterTxDoneCallback(char (*tx_done_cb)(void *priv, void* pbuf), void *obj)
{
struct spdio_t * sp = (struct spdio_t *) obj;
sp->tx_done_cb = tx_done_cb;
}
///////
void spdio_init(struct spdio_t *obj)
{
if(obj == NULL){
@ -56,8 +70,8 @@ void spdio_init(struct spdio_t *obj)
}
g_spdio_priv = obj;
HalSdioInit();
HalSdioRegisterTxCallback(spdio_rx_done_cb, (void *)obj); // ??????????
HalSdioRegisterRxDoneCallback(spdio_tx_done_cb, (void *)obj); // ?????????
HalSdioRegisterRxCallback(spdio_rx_done_cb, (void *)obj); // ??????????
HalSdioRegisterTxDoneCallback(spdio_tx_done_cb, (void *)obj); // ?????????
}
void spdio_deinit(struct spdio_t *obj)

View file

@ -360,7 +360,7 @@ void spi_slave_select_bypin(spi_t *obj, PinName pinname)
}
}
else
DBG_SSI_ERR("Wrong Chip Seleect Pin.\n");
DBG_SSI_ERR("Wrong Chip Select Pin.\n");
}
else{

View file

@ -39,10 +39,11 @@ extern VOID HalJtagPinOff(VOID);
extern void HalInitLogUart(void);
extern void HalDeinitLogUart(void);
#if defined ( __ICCARM__ )
#ifdef CONFIG_SDR_EN
//#if defined ( __ICCARM__ )
extern u8 IsSdrPowerOn();
//#endif
#endif
/**
* @brief Turn off the JTAG function
*
@ -206,20 +207,26 @@ void sys_reset(void)
u8 sys_is_sdram_power_on(void)
{
u8 ison = 0;
#ifdef CONFIG_SDR_EN
// u8 ison = 0;
#if defined ( __ICCARM__ )
ison = IsSdrPowerOn();
//#if defined ( __ICCARM__ )
return IsSdrPowerOn();
//#endif
// return ison;
#else
return 0;
#endif
return ison;
}
void sys_sdram_off(void)
{
#if defined ( __ICCARM__ )
if (sys_is_sdram_power_on()) {
#ifdef CONFIG_SDR_EN
//#if defined ( __ICCARM__ )
if (IsSdrPowerOn()) {
SdrPowerOff();
}
//#endif
#endif
}
}

View file

@ -17,15 +17,15 @@
#define APP_TIM_ID 6 // the G-Timer ID for Application
static int us_ticker_inited = 0;
static TIMER_ADAPTER TimerAdapter;
static TIMER_ADAPTER Timer6Adapter;
extern HAL_TIMER_OP HalTimerOp;
/*
VOID _us_ticker_irq_handler(IN VOID *Data)
{
us_ticker_irq_handler();
}
*/
void us_ticker_init(void)
{
@ -33,17 +33,17 @@ void us_ticker_init(void)
us_ticker_inited = 1;
// Initial a G-Timer
TimerAdapter.IrqDis = 1; // Disable Irq
TimerAdapter.IrqHandle.IrqFun = (IRQ_FUN) _us_ticker_irq_handler;
TimerAdapter.IrqHandle.IrqNum = TIMER2_7_IRQ;
TimerAdapter.IrqHandle.Priority = 10;
TimerAdapter.IrqHandle.Data = (u32)NULL;
TimerAdapter.TimerId = APP_TIM_ID;
TimerAdapter.TimerIrqPriority = 0;
TimerAdapter.TimerLoadValueUs = 1;
TimerAdapter.TimerMode = FREE_RUN_MODE; // Countdown Free Run
Timer6Adapter.IrqDis = 1; // Disable Irq
Timer6Adapter.IrqHandle.IrqFun = (IRQ_FUN) us_ticker_irq_handler;
Timer6Adapter.IrqHandle.IrqNum = TIMER2_7_IRQ;
Timer6Adapter.IrqHandle.Priority = 10;
Timer6Adapter.IrqHandle.Data = (u32)NULL;
Timer6Adapter.TimerId = APP_TIM_ID;
Timer6Adapter.TimerIrqPriority = 0;
Timer6Adapter.TimerLoadValueUs = 1;
Timer6Adapter.TimerMode = FREE_RUN_MODE; // Countdown Free Run
HalTimerOp.HalTimerInit((VOID*) &TimerAdapter);
HalTimerOp.HalTimerInit((VOID*) &Timer6Adapter);
DBG_TIMER_INFO("%s: Timer_Id=%d\n", __FUNCTION__, APP_TIM_ID);
}
@ -119,19 +119,19 @@ void us_ticker_set_interrupt(timestamp_t timestamp)
time_def = TIMER_TICK_US; // at least 1 tick
}
TimerAdapter.IrqDis = 0; // Enable Irq
TimerAdapter.TimerLoadValueUs = time_def;
TimerAdapter.TimerMode = USER_DEFINED; // Countdown Free Run
Timer6Adapter.IrqDis = 0; // Enable Irq
Timer6Adapter.TimerLoadValueUs = time_def;
Timer6Adapter.TimerMode = USER_DEFINED; // Countdown Free Run
HalTimerOp.HalTimerInit((VOID*) &TimerAdapter);
HalTimerOp.HalTimerInit((VOID*) &Timer6Adapter);
}
void us_ticker_disable_interrupt(void)
{
HalTimerOp.HalTimerDis((u32)TimerAdapter.TimerId);
HalTimerOp.HalTimerDis((u32)Timer6Adapter.TimerId);
}
void us_ticker_clear_interrupt(void)
{
HalTimerOp.HalTimerIrqClear((u32)TimerAdapter.TimerId);
HalTimerOp.HalTimerIrqClear((u32)Timer6Adapter.TimerId);
}

View file

@ -15,8 +15,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************
*/
#include "wdt_api.h"
#include "cmsis.h"
#include "wdt_api.h"
extern VOID WDGInitial(u32 Period);
extern VOID WDGStart(VOID);