This commit is contained in:
Victor 2018-04-20 10:53:32 +03:00
parent 8529849a5a
commit d1e4ee31f1
70 changed files with 523 additions and 2274 deletions

View file

@ -518,7 +518,7 @@ int wifi_connect(
struct {
u8 bssid[ETH_ALEN + 2];
void * p;
} bs = { 0 };
} bs;
memcpy(bs.bssid, pWifi->bssid.octet, ETH_ALEN);
for(int i = 0; i < ETH_ALEN; i++) {
flg += bs.bssid[i];
@ -529,6 +529,9 @@ int wifi_connect(
}
else {
use_bssid = 1;
bs.bssid[ETH_ALEN] = 0;
bs.bssid[ETH_ALEN+1] = 0;
bs.p = 0;
wext_set_bssid(WLAN0_NAME, bs.bssid);
}
}

View file

@ -75,7 +75,8 @@ int32_t spi_master_write_stream(spi_t *obj, char *tx_buffer, uint32_t length);
int32_t spi_master_write_read_stream(spi_t *obj, char *tx_buffer,
char *rx_buffer, uint32_t length);
int32_t spi_slave_read_stream_timeout(spi_t *obj, char *rx_buffer, uint32_t length, uint32_t timeout_ms);
void spi_flush_rx_fifo (spi_t *obj);
void spi_set_tmod(spi_t *obj, SSI_CTRLR0_TMOD tmod); // 0 Read & Write, 1 Write only, 2 Read Only
#ifdef CONFIG_GDMA_EN
int32_t spi_slave_read_stream_dma(spi_t *obj, char *rx_buffer, uint32_t length);
int32_t spi_slave_write_stream_dma(spi_t *obj, char *tx_buffer, uint32_t length);

View file

@ -28,7 +28,7 @@ s8 spdio_tx_done_cb(void *padapter, u8 *data, u16 offset, u16 pktsize, u8 type){
s8 spdio_tx(struct spdio_t *obj, struct spdio_buf_t *pbuf){
extern s8 HalSdioRxCallback(PHAL_SDIO_ADAPTER pSDIODev, VOID *pData, u16 Offset, u16 PktSize, u8 CmdType);
//extern s8 HalSdioRxCallback(PHAL_SDIO_ADAPTER pSDIODev, VOID *pData, u16 Offset, u16 PktSize, u8 CmdType);
return HalSdioRxCallback((u8 *)pbuf, 0, pbuf->buf_size, pbuf->type); // ?????????
}

View file

@ -554,6 +554,7 @@ int32_t spi_master_write_stream(spi_t *obj, char *tx_buffer, uint32_t length)
pHalSsiOp = &obj->spi_op;
obj->state |= SPI_STATE_TX_BUSY;
/* as Master mode, sending data will receive data at sametime, so we need to
drop those received dummy data */
if ((ret=pHalSsiOp->HalSsiWriteInterrupt(pHalSsiAdaptor, (u8 *) tx_buffer, length)) != HAL_OK) {
@ -562,6 +563,14 @@ int32_t spi_master_write_stream(spi_t *obj, char *tx_buffer, uint32_t length)
return ret;
}
VOID HalSsiTModRtl8195a(VOID *Adaptor, SSI_CTRLR0_TMOD tmod);
// SSI_CTRLR0_TMOD tmod
void spi_set_tmod(spi_t *obj, SSI_CTRLR0_TMOD tmod)
{
PHAL_SSI_ADAPTOR pHalSsiAdaptor = &obj->spi_adp;
HalSsiTModRtl8195a(pHalSsiAdaptor, tmod);
}
// Master mode write a sequence of data by interrupt mode
// The length unit is byte, for both 16-bits and 8-bits mode
int32_t spi_master_write_read_stream(spi_t *obj, char *tx_buffer,

View file

@ -165,9 +165,9 @@ time_t sntp_gen_system_time(int timezone)
sntp_get_lasttime(&update_sec, &update_usec, &update_tick);
unsigned int current_tick = xTaskGetTickCount();
if(update_tick) {
unsigned int current_tick = xTaskGetTickCount();
long tick_diff_sec, tick_diff_ms;
tick_diff_sec = (current_tick - update_tick) / configTICK_RATE_HZ;
@ -176,10 +176,9 @@ time_t sntp_gen_system_time(int timezone)
update_usec += (tick_diff_ms * 1000);
current_sec = update_sec + update_usec / 1000000 + timezone * 3600;
}
else {
// else {
// current_sec = current_tick / configTICK_RATE_HZ;
current_sec = update_usec;
}
// }
return current_sec;
/*
current_tm = *(localtime(&current_sec));

View file

@ -13,27 +13,27 @@
/*
* in hal_platform.h
#define BITBAND_REG_BASE 0x40001000
#define GPIO_REG_BASE 0x40001000
*/
/*
* in rtl8195a_gpio.h
*
#define BITBAND_PORTA_DR 0x00 // data register
#define BITBAND_PORTA_DDR 0x04 // data direction
#define BITBAND_PORTA_CTRL 0x08 // data source control, we should keep it as default: data source from software
#define REG_PORTA_DR 0x00 // data register
#define REG_PORTA_DDR 0x04 // data direction
#define REG_PORTA_CTRL 0x08 // data source control, we should keep it as default: data source from software
#define BITBAND_PORTB_DR 0x0c // data register
#define BITBAND_PORTB_DDR 0x10 // data direction
#define BITBAND_PORTB_CTRL 0x14 // data source control, we should keep it as default: data source from software
#define REG_PORTB_DR 0x0c // data register
#define REG_PORTB_DDR 0x10 // data direction
#define REG_PORTB_CTRL 0x14 // data source control, we should keep it as default: data source from software
#define BITBAND_PORTC_DR 0x18 // data register
#define BITBAND_PORTC_DDR 0x1c // data direction
#define BITBAND_PORTC_CTRL 0x20 // data source control, we should keep it as default: data source from software
#define REG_PORTC_DR 0x18 // data register
#define REG_PORTC_DDR 0x1c // data direction
#define REG_PORTC_CTRL 0x20 // data source control, we should keep it as default: data source from software
#define BITBAND_EXT_PORTA 0x50 // GPIO IN read or OUT read back
#define BITBAND_EXT_PORTB 0x54 // GPIO IN read or OUT read back
#define BITBAND_EXT_PORTC 0x58 // GPIO IN read or OUT read back
#define REG_EXT_PORTA 0x50 // GPIO IN read or OUT read back
#define REG_EXT_PORTB 0x54 // GPIO IN read or OUT read back
#define REG_EXT_PORTC 0x58 // GPIO IN read or OUT read back
*/
#define BITBAND_PERI_REF 0x40000000
@ -147,7 +147,8 @@
volatile uint8_t * BitBandAddr(void *addr, uint8_t bit);
volatile uint8_t * BitBandPeriAddr(void *addr, uint8_t bit);
volatile uint8_t * GetOutPinBitBandAddr(PinName pin);
#define GetDirPinBitBandAddr(pin) (GetOutPinBitBandAddr(pin) + 4*32)
volatile uint8_t * GetInPinBitBandAddr(PinName pin);
volatile uint8_t * HardSetPin(PinName pin, HAL_GPIO_PIN_MODE pmode, uint8_t val);
volatile uint8_t * HardSetPin(PinName pin, HAL_GPIO_PIN_MODE pmode, uint8_t val); /* return pointer bit out register */
#endif // _BITBAND_IO_H_

View file

@ -794,6 +794,15 @@ VOID HalSsiTxFIFOThresholdRtl8195a(VOID *Adaptor, u32 txftl)
HAL_SSI_WRITE32(Index, REG_DW_SSI_TXFTLR, TxftlrValue);
}
VOID HalSsiTModRtl8195a(VOID *Adaptor, SSI_CTRLR0_TMOD tmod)
{
PHAL_SSI_ADAPTOR pHalSsiAdaptor = (PHAL_SSI_ADAPTOR) Adaptor;
u8 Index = pHalSsiAdaptor->Index;
/* REG_DW_SSI_CTRLR0 */
u32 Ctrlr0Value = HAL_SSI_READ32(Index, REG_DW_SSI_CTRLR0) & BIT_INVC_CTRLR0_TMOD;
Ctrlr0Value |= BIT_CTRLR0_TMOD(pHalSsiAdaptor->TransferMode);
HAL_SSI_WRITE32(Index, REG_DW_SSI_CTRLR0, Ctrlr0Value);
}
HAL_Status
HalSsiIntWriteRtl8195a(

View file

@ -45,14 +45,15 @@ volatile uint8_t * HardSetPin(PinName pin, HAL_GPIO_PIN_MODE pmode, uint8_t val)
extern HAL_GPIO_ADAPTER gBoot_Gpio_Adapter;
_pHAL_Gpio_Adapter = &gBoot_Gpio_Adapter;
}
if(_pHAL_Gpio_Adapter->Gpio_Func_En == 0) GPIO_FuncOn_8195a();
wait_us(100);
// delayMicroseconds(100);
if(_pHAL_Gpio_Adapter->Gpio_Func_En == 0) {
GPIO_FuncOn_8195a();
HalDelayUs(100); // delayMicroseconds(100); wait_us(100);
}
// paddr = 0x42000000 + (0x40001000 + 0x0c * (ippin >> 5) - 0x40000000) * 32 + ((ippin & 0x1f) * 4);
#if CONFIG_DEBUG_LOG > 3
GpioFunctionChk(ippin, ENABLE);
#endif
GPIO_PullCtrl_8195a(ippin, HAL_GPIO_HIGHZ); // Make the pin pull control default as High-Z
GPIO_PullCtrl_8195a(pin, HAL_GPIO_HIGHZ); // Make the pin pull control default as High-Z
paddr = BitBandPeriAddr((void *)(GPIO_REG_BASE + GPIO_PORTB_DR * (ippin >> 5)), ippin & 0x1f);
*paddr = val; // data register
HAL_GPIO_PIN gpio;
@ -61,7 +62,7 @@ volatile uint8_t * HardSetPin(PinName pin, HAL_GPIO_PIN_MODE pmode, uint8_t val)
HAL_GPIO_Init_8195a(&gpio);
*paddr = val; // data register
// paddr[(GPIO_PORTB_DDR - GPIO_PORTB_DR) * 32] = pmode == DOUT_PUSH_PULL; // data direction
// GPIO_PullCtrl_8195a(ippin, pmode); // set GPIO_PULL_CTRLx
// GPIO_PullCtrl_8195a(pin, pmode); // set GPIO_PULL_CTRLx
// paddr[(GPIO_PORTB_CTRL - GPIO_PORTB_DR) * 32] = 0; // data source control, we should keep it as default: data source from software
}
return paddr;

View file

@ -2,9 +2,10 @@
* ram_libgloss_retarget.o
* pvvx 2016
*/
#ifdef SWO_DEBUG_OUT_ENA
#include "device.h"
#endif
#include "rtl_bios_data.h"
//-------------------------------------------------------------------------
// Function declarations
@ -86,6 +87,15 @@ char *ram_libgloss_sbrk(int incr) {
return prev_heap_end;
}
#ifdef SWO_DEBUG_OUT_ENA
//----- ram_libgloss_write()
int ram_libgloss_write(int file, const char *ptr, int len) {
int i;
for (i = 0; i < len; ++i)
ITM_SendChar(ptr[i]);
return len;
}
#else
//----- ram_libgloss_write()
int ram_libgloss_write(int file, const char *ptr, int len) {
int i;
@ -93,6 +103,7 @@ int ram_libgloss_write(int file, const char *ptr, int len) {
HalSerialPutcRtl8195a(ptr[i]);
return len;
}
#endif
//----- ram_libgloss_open()
int ram_libgloss_open(char *file, int flags, int mode) {
@ -115,6 +126,9 @@ int ram_libgloss_open(char *file, int flags, int mode) {
//----- init_rom_libgloss_ram_map()
void init_rom_libgloss_ram_map(void) {
#ifdef SWO_DEBUG_OUT_ENA
//#error @TODO: Not init SWO!
#endif
rom_libgloss_ram_map.libgloss_close = ram_libgloss_close;
rom_libgloss_ram_map.libgloss_fstat = ram_libgloss_fstat;
rom_libgloss_ram_map.libgloss_isatty = ram_libgloss_isatty;