From eac35630e622d3c270dd1dcf8d108da8fb5aaa10 Mon Sep 17 00:00:00 2001 From: pvvx Date: Fri, 22 Sep 2017 10:44:42 +0300 Subject: [PATCH] update --- .../common/api/platform/platform_stdlib.h | 23 +++++--- USDK/component/common/api/wifi/wifi_promisc.c | 5 +- USDK/component/common/api/wifi_api_scan.c | 2 +- .../drivers/sdio/realtek/sdio_host/src/sd.c | 4 +- .../sdio/realtek/sdio_host/src/sdio_host.c | 9 ++- .../file_system/fatfs/disk_if/src/sdcard.c | 16 ++--- .../file_system/fatfs/r0.10c/include/ff.h | 1 + .../file_system/fatfs/r0.10c/src/diskio.c | 2 +- .../common/file_system/fatfs/r0.10c/src/ff.c | 13 ++-- .../mbed/targets/hal/rtl8195a/sys_api.c | 4 +- USDK/component/common/network/rtsp/rtsp_api.h | 3 +- .../common/video/v4l2/inc/v4l2-osdep.h | 59 ++++++++++--------- USDK/component/os/freertos/cmsis_os.h | 4 +- .../realtek/8195a/fwlib/ram_lib/rtl_boot.c | 35 +++++++---- .../8195a/fwlib/ram_lib/usb_otg/include/usb.h | 4 +- .../rtl8195a/src/rtl8195a_sdio_host_open.c | 30 +++++----- .../realtek/8195a/fwlib/src/hal_sdio_host.c | 2 +- USDK/flasher/gdb_ota.jlink | 3 +- USDK/flasher/gdb_wrflash.jlink | 4 +- USDK/sdkset.mk | 7 ++- project/inc/ina219/ina219buf.h | 2 +- project/inc/ina219/ina219drv.h | 2 +- project/inc/lwipopts.h | 1 + project/inc/tcpsrv/tcp_srv_conn.h | 2 + project/inc/web/websock.h | 2 + project/inc/wifi_user_set.h | 4 +- project/src/console/sd_fat.c | 5 +- project/src/console/wifi_console.c | 2 + project/src/console/wlan_tst.c | 21 ++++++- project/src/driver/i2c_drv.c | 25 ++++---- project/src/ina219/ina219drv.c | 19 +++--- 31 files changed, 185 insertions(+), 130 deletions(-) diff --git a/USDK/component/common/api/platform/platform_stdlib.h b/USDK/component/common/api/platform/platform_stdlib.h index 6eb2a76..7a7f0fd 100644 --- a/USDK/component/common/api/platform/platform_stdlib.h +++ b/USDK/component/common/api/platform/platform_stdlib.h @@ -157,13 +157,22 @@ // // memory management // -#ifndef CONFIG_MBED_ENABLED -extern void *pvPortMalloc( size_t xWantedSize ); -extern void vPortFree( void *pv ); -#define malloc pvPortMalloc -#define zalloc pvPortZalloc -#define free vPortFree -#endif +#undef malloc +extern void *pvPortMalloc(size_t xWantedSize); +#define malloc pvPortMalloc + +#undef zalloc +extern void *pvPortZalloc(size_t xWantedSize); +#define zalloc pvPortZalloc + +#undef realloc +extern void *pvPortReAlloc(void *pv, size_t xWantedSize); +#define realloc pvPortReAlloc + +#undef free +extern void vPortFree(void *pv); +#define free vPortFree + #elif defined (CONFIG_PLATFORM_8711B) #if defined (__IARSTDLIB__) diff --git a/USDK/component/common/api/wifi/wifi_promisc.c b/USDK/component/common/api/wifi/wifi_promisc.c index 7563d42..477ddab 100644 --- a/USDK/component/common/api/wifi/wifi_promisc.c +++ b/USDK/component/common/api/wifi/wifi_promisc.c @@ -19,9 +19,8 @@ extern void _promisc_deinit(_adapter *padapter); extern int _promisc_recv_func(_adapter *padapter, recv_frame *rframe); extern int _promisc_set(rtw_rcr_level_t enabled, void (*callback)(unsigned char *, unsigned int, void *), unsigned char len_used); -extern unsigned char is_promisc_enabled(void); -extern int promisc_get_fixed_channel(void *fixed_bssid, unsigned char *ssid, int *ssid_length); -extern unsigned char is_promisc_enabled(void); +extern unsigned char _is_promisc_enabled(void); +extern int _promisc_get_fixed_channel(void *fixed_bssid, unsigned char *ssid, int *ssid_length); #endif diff --git a/USDK/component/common/api/wifi_api_scan.c b/USDK/component/common/api/wifi_api_scan.c index 999cf58..d676ed2 100644 --- a/USDK/component/common/api/wifi_api_scan.c +++ b/USDK/component/common/api/wifi_api_scan.c @@ -127,7 +127,7 @@ LOCAL int _wifi_scan_networks(rtw_scan_result_handler_t results_handler) { pscan_rec->user_data = NULL; wifi_reg_event_handler(WIFI_EVENT_SCAN_RESULT_REPORT, wifi_scan_each_report_hdl, NULL); wifi_reg_event_handler(WIFI_EVENT_SCAN_DONE, _wifi_scan_done_hdl, NULL); - if(wext_set_scan(WLAN0_NAME, NULL, 0, RTW_SCAN_TYPE_ACTIVE | (RTW_SCAN_COMMAMD << 4) | (RTW_BSS_TYPE_ANY << 8)) == RTW_SUCCESS) { + if(wext_set_scan(WLAN0_NAME, NULL, 0, RTW_SCAN_TYPE_ACTIVE | (RTW_SCAN_COMMAMD << 4) | (RTW_BSS_TYPE_ANY << 8)) == RTW_SUCCESS) { // Только RTW_SCAN_TYPE_ACTIVE ? return RTW_SUCCESS; } }; diff --git a/USDK/component/common/drivers/sdio/realtek/sdio_host/src/sd.c b/USDK/component/common/drivers/sdio/realtek/sdio_host/src/sd.c index 49fc10a..9fa1ab4 100644 --- a/USDK/component/common/drivers/sdio/realtek/sdio_host/src/sd.c +++ b/USDK/component/common/drivers/sdio/realtek/sdio_host/src/sd.c @@ -109,7 +109,7 @@ SD_RESULT SD_GetCapacity(uint32_t *sector_count) { //----- SD_ReadBlocks SD_RESULT SD_ReadBlocks(u32 sector, u8 *data, u32 count) { - int rd_count; + int rd_count = 0; unsigned char * buf; if ((u32) data & 3) { @@ -145,7 +145,7 @@ SD_RESULT SD_ReadBlocks(u32 sector, u8 *data, u32 count) { //----- SD_WriteBlocks SD_RESULT SD_WriteBlocks(u32 sector, const u8 *data, u32 count) { - int wr_count; + int wr_count = 0; unsigned char * buf; if ((u32) data & 3) { diff --git a/USDK/component/common/drivers/sdio/realtek/sdio_host/src/sdio_host.c b/USDK/component/common/drivers/sdio/realtek/sdio_host/src/sdio_host.c index ef7df66..456acc6 100644 --- a/USDK/component/common/drivers/sdio/realtek/sdio_host/src/sdio_host.c +++ b/USDK/component/common/drivers/sdio/realtek/sdio_host/src/sdio_host.c @@ -186,7 +186,7 @@ s8 sdio_write_blocks(uint32_t sector, const uint8_t *buffer, uint32_t count) { rtl_memset(gAdmaTbls, 0, sizeof(ADMA2_DESC_FMT) * count); if (1) { ADMA2_DESC_FMT *p = gAdmaTbls; - u8 * pbuf = buffer; + u8 * pbuf = (u8 *)buffer; int i = 0; while (i < count) { i++; @@ -255,14 +255,14 @@ s8 sdio_sd_setClock(SD_CLK_FREQUENCY SDCLK) { if (sdio_status <= SDIO_SD_NONE) { return -1; } - ADMA2_DESC_FMT * padma = rtw_zmalloc(sizeof(ADMA2_DESC_FMT)); + ADMA2_DESC_FMT * padma = (ADMA2_DESC_FMT *) rtw_zmalloc(sizeof(ADMA2_DESC_FMT)); if (!padma) { DBG_SDIO_ERR("Malloc ADMA2 table fail.\n"); return -1; } DBG_SDIO_INFO("SD card set CLK %d Hz\n", PLATFORM_CLOCK/(2 << (SD_CLK_41_6MHZ - SDCLK))); sta = HalSdioHostOp.HalSdioHostChangeSdClock(&SdioHostAdapter, SDCLK); - rtw_mfree(padma, sizeof(ADMA2_DESC_FMT)); + rtw_mfree((u8 *)padma, sizeof(ADMA2_DESC_FMT)); if (sta) return -1; return 0; @@ -296,11 +296,10 @@ s8 sdio_sd_setProtection(bool protection) { } LABEL_8: sd_protected = protection; -LABEL_7: DBG_SDIO_INFO("Set SD card Protection done.\n"); result = 0; LABEL_17: - rtw_mfree(padma, sizeof(ADMA2_DESC_FMT)); + rtw_mfree((u8 *)padma, sizeof(ADMA2_DESC_FMT)); return result; } return -1; diff --git a/USDK/component/common/file_system/fatfs/disk_if/src/sdcard.c b/USDK/component/common/file_system/fatfs/disk_if/src/sdcard.c index f7ee687..2385832 100644 --- a/USDK/component/common/file_system/fatfs/disk_if/src/sdcard.c +++ b/USDK/component/common/file_system/fatfs/disk_if/src/sdcard.c @@ -6,12 +6,11 @@ * This module is a confidential and proprietary property of RealTek and * possession or use of this module requires written permission of RealTek. */ -#include "integer.h" -#include - -#if FATFS_DISK_SD +//#if FATFS_DISK_SD #include "sd.h" // sd card driver with sdio interface +#include "integer.h" +#include #define SD_BLOCK_SIZE 512 @@ -53,7 +52,7 @@ DRESULT SD_disk_read(BYTE *buff, DWORD sector, UINT count){ /* Write sector(s) --------------------------------------------*/ #if _USE_WRITE == 1 -DRESULT SD_disk_write(const BYTE *buff, DWORD sector, UINT count){ +DRESULT SD_disk_write(const BYTE * buff, DWORD sector, UINT count){ SD_RESULT res; res = SD_WriteBlocks(sector, buff, count); @@ -66,7 +65,6 @@ DRESULT SD_disk_write(const BYTE *buff, DWORD sector, UINT count){ DRESULT SD_disk_ioctl (BYTE cmd, void* buff){ DRESULT res = RES_ERROR; SD_RESULT result; - DWORD last_blk_addr, block_size; switch(cmd){ /* Generic command (used by FatFs) */ @@ -118,7 +116,8 @@ DRESULT SD_disk_ioctl (BYTE cmd, void* buff){ } #endif -ll_diskio_drv SD_disk_Driver ={ + +ll_diskio_drv SD_disk_Driver = { .disk_initialize = SD_disk_initialize, .disk_status = SD_disk_status, .disk_read = SD_disk_read, @@ -130,4 +129,5 @@ ll_diskio_drv SD_disk_Driver ={ #endif .TAG = "SD" }; -#endif + +//#endif // FATFS_DISK_SD diff --git a/USDK/component/common/file_system/fatfs/r0.10c/include/ff.h b/USDK/component/common/file_system/fatfs/r0.10c/include/ff.h index a93d9a2..543588d 100644 --- a/USDK/component/common/file_system/fatfs/r0.10c/include/ff.h +++ b/USDK/component/common/file_system/fatfs/r0.10c/include/ff.h @@ -335,6 +335,7 @@ int ff_del_syncobj (_SYNC_t sobj); /* Delete a sync object */ #define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8); *((BYTE*)(ptr)+2)=(BYTE)((DWORD)(val)>>16); *((BYTE*)(ptr)+3)=(BYTE)((DWORD)(val)>>24) #endif + #ifdef __cplusplus } #endif diff --git a/USDK/component/common/file_system/fatfs/r0.10c/src/diskio.c b/USDK/component/common/file_system/fatfs/r0.10c/src/diskio.c index 0249fcc..7626e11 100644 --- a/USDK/component/common/file_system/fatfs/r0.10c/src/diskio.c +++ b/USDK/component/common/file_system/fatfs/r0.10c/src/diskio.c @@ -87,7 +87,7 @@ DRESULT disk_write ( ) { DRESULT res = RES_PARERR; - int index = 0; +// int index = 0; if (pdrv < 0 || pdrv >= disk.nbr || buff == (void*)0 || count <= 0) return RES_PARERR; // Return if the parameter is invalid diff --git a/USDK/component/common/file_system/fatfs/r0.10c/src/ff.c b/USDK/component/common/file_system/fatfs/r0.10c/src/ff.c index 7096067..aa13c7c 100644 --- a/USDK/component/common/file_system/fatfs/r0.10c/src/ff.c +++ b/USDK/component/common/file_system/fatfs/r0.10c/src/ff.c @@ -119,8 +119,6 @@ #include "diskio.h" /* Declarations of disk I/O functions */ - - /*-------------------------------------------------------------------------- Module Private Definitions @@ -595,9 +593,14 @@ int mem_cmp (const void* dst, const void* src, UINT cnt) { return r; } #else -#define mem_cpy memcpy -#define mem_set memset -#define mem_cmp memcmp +typedef unsigned int size_t; +extern int rtl_memcmp(const void * m1 , const void * m2 , size_t n); +extern void * rtl_memcpy(void * dst0 , const void * src0 , size_t len0); +extern void * rtl_memset(void * m , int c , size_t n); + +#define mem_cpy rtl_memcpy +#define mem_set rtl_memset +#define mem_cmp rtl_memcmp #endif /* Check if chr is contained in the string */ diff --git a/USDK/component/common/mbed/targets/hal/rtl8195a/sys_api.c b/USDK/component/common/mbed/targets/hal/rtl8195a/sys_api.c index fb855b5..47280f1 100644 --- a/USDK/component/common/mbed/targets/hal/rtl8195a/sys_api.c +++ b/USDK/component/common/mbed/targets/hal/rtl8195a/sys_api.c @@ -167,7 +167,7 @@ void sys_adc_calibration(u8 write, u16 *offset, u16 *gain) extern flash_t flash; if(write){ // backup - u8 *pbuf = RtlMalloc(FLASH_SECTOR_SIZE); + u8 *pbuf = malloc(FLASH_SECTOR_SIZE); if(!pbuf) return; device_mutex_lock(RT_DEV_LOCK_FLASH); flash_stream_read(&flash, FLASH_SYSTEM_DATA_ADDR, FLASH_SECTOR_SIZE, pbuf); @@ -180,7 +180,7 @@ extern flash_t flash; flash_erase_sector(&flash, FLASH_SYSTEM_DATA_ADDR); flash_stream_write(&flash, FLASH_SYSTEM_DATA_ADDR, FLASH_SECTOR_SIZE, pbuf); device_mutex_unlock(RT_DEV_LOCK_FLASH); - RtlMfree(pbuf, FLASH_SECTOR_SIZE); + free(pbuf); printf("Store ADC calibration success.\n"); } device_mutex_lock(RT_DEV_LOCK_FLASH); diff --git a/USDK/component/common/network/rtsp/rtsp_api.h b/USDK/component/common/network/rtsp/rtsp_api.h index 7bc7fa5..c8a4636 100644 --- a/USDK/component/common/network/rtsp/rtsp_api.h +++ b/USDK/component/common/network/rtsp/rtsp_api.h @@ -98,6 +98,7 @@ struct stream_context #define RTP_PT_H263 34 #define RTP_PT_RTCP_BASE 72 #define RTP_PT_DYN_BASE 96 +#undef RTP_PT_UNKNOWN #define RTP_PT_UNKNOWN -1 #include "section_config.h" @@ -333,4 +334,4 @@ void fillRtpHeader(rtp_hdr_t *rtphdr, int version, int padding, int extension, i /************************************************************** end of rtp **************************************************************/ -#endif \ No newline at end of file +#endif diff --git a/USDK/component/common/video/v4l2/inc/v4l2-osdep.h b/USDK/component/common/video/v4l2/inc/v4l2-osdep.h index 581fd99..790ac43 100644 --- a/USDK/component/common/video/v4l2/inc/v4l2-osdep.h +++ b/USDK/component/common/video/v4l2/inc/v4l2-osdep.h @@ -291,7 +291,7 @@ /* - * combine the four dirAtypeAnrAsize parameters to one cmd parameter + * combine the four dir�Atype�Anr�Asize parameters to one cmd parameter * */ #ifndef _IOC @@ -511,40 +511,40 @@ found: static inline unsigned long find_next_zero_bit( const unsigned long *addr,unsigned long size, unsigned long offset) { - const unsigned long *p = addr + BIT_WORD(offset); // offset_pVlonga}32? - unsigned long result = offset & ~(BITS_PER_LONG-1); // offsetOresult?4r? + const unsigned long *p = addr + BIT_WORD(offset); // offset��_p���V��long�a�}32���? + unsigned long result = offset & ~(BITS_PER_LONG-1); // offset�O��result?4�r? unsigned long tmp; if (offset >= size) return size; - size -= result; // ?32㭿?W - offset %= BITS_PER_LONG; // offset_32쪺ĤL - if (offset) { // offsetb@?long?u0W,b1-31줤[luther.gliethttp] + size -= result; // ?��32��㭿?�W + offset %= BITS_PER_LONG; // offset��_32�쪺�ĤL�� + if (offset) { // offset���b�@?long?�u����0��W,�b1-31�줤[luther.gliethttp] tmp = *(p++); - tmp |= ~0UL >> (BITS_PER_LONG - offset); // ?0-offset?uRW1. - if (size < BITS_PER_LONG) // 32bits + tmp |= ~0UL >> (BITS_PER_LONG - offset); // ?0-offset?�u��R�W1. + if (size < BITS_PER_LONG) // ����32bits goto found_first; - if (~tmp) // DD0?t0 + if (~tmp) // ���D�D0?���t��0�� goto found_middle; - size -= BITS_PER_LONG; // pGW~tmp_0,\??*p?u?321.[luther.gliethttp] + size -= BITS_PER_LONG; // �p�G�W��~tmp���_0,���\?��?*p?�u?32���1.[luther.gliethttp] result += BITS_PER_LONG; } - while (size & ~(BITS_PER_LONG-1)) { // nF,??,?offsetw??b4r?0W,U? - if (~(tmp = *(p++))) // 4r?ֳtd?.pG~tmpD0,??32?ut0?u,.[luther.gliethttp] + while (size & ~(BITS_PER_LONG-1)) { // �n�F,?���?��,��?��offset�w??�b4�r?����0��W,�U��?�� + if (~(tmp = *(p++))) // 4�r?�ֳt�d?.�p�G~tmp�D0,?��?32��?�u���t��0?�u,���.[luther.gliethttp] goto found_middle; - result += BITS_PER_LONG; // U@?4r?? - size -= BITS_PER_LONG; // ?4r??u + result += BITS_PER_LONG; // ��U�@?4�r?��? + size -= BITS_PER_LONG; // ?��4�r??�u } - if (!size) // size_0,?size_4r?㭿?,䦸Ҧ?uw?d, - return result; // Ҧ?u?1,???0,result_size.[luther.gliethttp] - tmp = *p; // sizeO32㭿?,?ѤL?bit??d,???U?du@.[luther.gliethtp] + if (!size) // size���_0,?������size���_4�r?�㭿?,�䦸�Ҧ�?�u�w?�d��, + return result; // �Ҧ�?�u����?1,?��??0��,result���_size.[luther.gliethttp] + tmp = *p; // size���O32��㭿?,?�ѤL?bit?��?�d,???��U��?�d�u�@.[luther.gliethtp] found_first: - tmp |= ~0UL << size; // ?b0-size??u,size-31?ϥΪ?,ҥH?size-31m1. - if (tmp == ~0UL) /* Are any bits zero? */ // pGtmp1,\?N?1? - return result + size; /* Nope. */ // result+sizeN_??J??sizejp.[luther.gliethttp] + tmp |= ~0UL << size; // ?�b0-size?����?�u,size-31?���ϥΪ�?,�ҥH��?size-31�m����1. + if (tmp == ~0UL) /* Are any bits zero? */ // �p�Gtmp��1,���\?���N?���1? + return result + size; /* Nope. */ // result+size�N���_��??�J��??size�j�p.[luther.gliethttp] found_middle: - return result + ffz(tmp); // ?b32?u0-31??wsb0,?LOĤL.[luther.gliethttp] + return result + ffz(tmp); // ��?�b32��?�u��0-31��??���w�s�b0���,?��L�O�ĤL��.[luther.gliethttp] } //int find_next_zero_bit(const void * p, int size, int offset); @@ -570,7 +570,7 @@ static inline void set_bit(int nr, volatile unsigned long *addr) unsigned long mask = BIT_MASK(nr); unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); unsigned long flags; - + (void)flags; //taskENTER_CRITICAL(); _atomic_spin_lock_irqsave(p, flags); *p |= mask; @@ -593,7 +593,7 @@ static inline void clear_bit(int nr, volatile unsigned long *addr) unsigned long mask = BIT_MASK(nr); unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); unsigned long flags; - + (void)flags; _atomic_spin_lock_irqsave(p, flags); //taskENTER_CRITICAL(); *p &= ~mask; @@ -616,7 +616,7 @@ static inline void change_bit(int nr, volatile unsigned long *addr) unsigned long mask = BIT_MASK(nr); unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); unsigned long flags; - + (void)flags; //taskENTER_CRITICAL(); _atomic_spin_lock_irqsave(p, flags); *p ^= mask; @@ -638,8 +638,8 @@ static inline int test_and_set_bit(int nr, volatile unsigned long *addr) unsigned long mask = BIT_MASK(nr); unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); unsigned long old; - //unsigned long flags; - + unsigned long flags; + (void)flags; //taskENTER_CRITICAL(); _atomic_spin_lock_irqsave(p, flags); @@ -666,7 +666,7 @@ static inline int test_and_clear_bit(int nr, volatile unsigned long *addr) unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); unsigned long old; unsigned long flags; - + (void)flags; //taskENTER_CRITICAL(); _atomic_spin_lock_irqsave(p, flags); old = *p; @@ -691,7 +691,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr) unsigned long old; unsigned long flags; - + (void)flags; _atomic_spin_lock_irqsave(p, flags); old = *p; *p = old ^ mask; @@ -725,6 +725,7 @@ static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, static inline int atomic_inc_return(volatile atomic_t *v) { unsigned long flags; + (void)flags; int retval; cris_atomic_save(v, flags); retval = ++(v->counter); @@ -843,4 +844,4 @@ do { \ #define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM) #endif -#endif /*_V4L2_OSDEP_H_*/ \ No newline at end of file +#endif /*_V4L2_OSDEP_H_*/ diff --git a/USDK/component/os/freertos/cmsis_os.h b/USDK/component/os/freertos/cmsis_os.h index 93f78e3..642fbe8 100644 --- a/USDK/component/os/freertos/cmsis_os.h +++ b/USDK/component/os/freertos/cmsis_os.h @@ -804,9 +804,9 @@ osStatus osMailFree (osMailQId queue_id, void *mail); #endif // Mail Queues available -//#undef malloc +#undef malloc #define malloc(size) pvPortMalloc(size) -//#undef free +#undef free #define free(pbuf) vPortFree(pbuf) extern void *calloc_freertos(size_t nelements, size_t elementSize); diff --git a/USDK/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.c b/USDK/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.c index 60a80c7..dd478e1 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.c +++ b/USDK/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.c @@ -414,7 +414,7 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION get_seg_id(uint32 addr, int32 size) { ptr += 2; } while (ret < SEG_ID_MAX); }; - return 0; + return 0; // UNK } LOCAL uint32 BOOT_RAM_TEXT_SECTION load_img2_head(uint32 faddr, PIMG2HEAD hdr) { @@ -422,13 +422,13 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION load_img2_head(uint32 faddr, PIMG2HEAD hdr) { uint32 ret = get_seg_id(hdr->seg.ldaddr, hdr->seg.size); if (hdr->sign[1] == IMG_SIGN2_RUN) { if (hdr->sign[0] == IMG_SIGN1_RUN) { - ret |= 1 << 9; + ret |= 1 << 9; // есть сигнатура RUN } else if (hdr->sign[0] == IMG_SIGN1_SWP) { - ret |= 1 << 8; + ret |= 1 << 8; // есть сигнатура SWP }; } if (*(u32 *) (&hdr->rtkwin) == IMG2_SIGN_DW1_TXT) { - ret |= 1 << 10; + ret |= 1 << 10; // есть подпись "RTKW" }; return ret; } @@ -474,21 +474,23 @@ LOCAL int BOOT_RAM_TEXT_SECTION loadUserImges(int imgnum) { while (1) { faddr = (faddr + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1)); - uint32 img_id = load_img2_head(faddr, &hdr); - if ((img_id >> 8) > 4 || (uint8) img_id != 0) { - faddr = load_segs(faddr + 0x10, (PIMG2HEAD) &hdr.seg, imagenum == imgnum); - if (imagenum == imgnum) { + uint32 img_id = load_img2_head(faddr, &hdr); // проверить заголовки запись + if ((img_id >> 8) > 4 && (uint8) img_id != 0) { // есть подпись "RTKW" + RUN или SWP, сегмент != unknown + // загрузить, если imagenum == imgnum + faddr = load_segs(faddr + 0x10, (PIMG2HEAD) &hdr.seg, imagenum == imgnum); // faddr == fnextaddr + if (imagenum == imgnum) { // если искомая img // DBG_8195A("Image%d: %s\n", imgnum, hdr.name); break; } - imagenum++; - } else if (imagenum) { + imagenum++; // перейти к следующей + } else if (imagenum) { // нет подписей у заданной imgnum DBG_8195A("No Image%d! Trying Image0...\n", imgnum); // пробуем загрузить image по умолчанию, по записи в секторе установок flashcpy(FLASH_SYSTEM_DATA_ADDR, &faddr, sizeof(faddr)); if (faddr < 0x8000000) faddr += SPI_FLASH_BASE; - if (get_seg_id(faddr, 0x100) == SEG_ID_FLASH) { + if (get_seg_id(faddr, 0x100) == SEG_ID_FLASH) { // указывает в Flash? + // будем пробовать грузить imagenum = 0; imgnum = 0; } else { @@ -497,7 +499,7 @@ LOCAL int BOOT_RAM_TEXT_SECTION loadUserImges(int imgnum) { break; }; } else { - imagenum = -1; + imagenum = -1; // нет записей image break; } }; @@ -605,6 +607,15 @@ LOCAL void BOOT_RAM_TEXT_SECTION EnterImage15(int flg) { }; DBG_8195A("SDR tst end\n"); }; +#endif // test +#ifdef CONFIG_SDR_EN + // Тест и ожидание загрузки Jlink-ом sdram.bin (~7 sec) + if(flg && *((uint32 *)0x1FFF0000) == 0x12345678) { + *((volatile uint32 *)0x1FFF0000) = 0x87654321; + uint32 tt = 0x03ffffff; // ~7 sec + DBG_8195A("Waiting for SDRAM to load...\n"); + while(*((volatile uint32 *)0x1FFF0000) == 0x87654321 && tt--); + } #endif // test HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) | BIT(21)); // Flag SDRAM Init }; diff --git a/USDK/component/soc/realtek/8195a/fwlib/ram_lib/usb_otg/include/usb.h b/USDK/component/soc/realtek/8195a/fwlib/ram_lib/usb_otg/include/usb.h index 4a13afd..e010a1d 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/ram_lib/usb_otg/include/usb.h +++ b/USDK/component/soc/realtek/8195a/fwlib/ram_lib/usb_otg/include/usb.h @@ -1358,7 +1358,7 @@ struct usb_hcd { unsigned long hcd_priv[0]; #elif defined (__GNUC__) unsigned long hcd_priv[0]; - __attribute__ ((aligned(sizeof(s64)))); +//? __attribute__ ((aligned(sizeof(s64)))); #endif }; @@ -2067,7 +2067,7 @@ struct usb_device_id { kernel_ulong_t driver_info; #elif defined (__GNUC__) kernel_ulong_t driver_info; - __attribute__((aligned(sizeof(kernel_ulong_t)))); +//? __attribute__((aligned(sizeof(kernel_ulong_t)))); #endif }; diff --git a/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_sdio_host_open.c b/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_sdio_host_open.c index 0b266cf..a59c379 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_sdio_host_open.c +++ b/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_sdio_host_open.c @@ -73,7 +73,7 @@ HAL_Status SdioHostSdClkCtrl(void *Data, int En, u8 Divisor) { // SD_CLK_DIVISOR static HAL_Status CheckSramAddress(void* address) { // SRAM: 0x10000000... 0x1006ffff - if (address >= 0x10070000 || address < 0x10000000 || ((uint32_t)address & 3) !=0) + if ((uint32_t)address >= 0x10070000 || (uint32_t)address < 0x10000000 || ((uint32_t)address & 3) !=0) return HAL_ERR_PARA; return HAL_OK; } @@ -351,7 +351,7 @@ void SdioHostIsrHandle(void *Data) { */ } } - ir_end: +// ir_end: HAL_SDIOH_REG16(REG_SDIO_HOST_NORMAL_INT_SIG_EN) = NOR_INT_SIG_EN_CMD_COMP | NOR_INT_SIG_EN_XFER_COMP @@ -485,7 +485,7 @@ HAL_Status SdioHostSwitchFunction(void *Data, int Mode, int Fn2Sel, int Fn1Sel, if (result) return result; - HAL_SDIOH_REG32(REG_SDIO_HOST_ADMA_SYS_ADDR) = pAdmaDescTbl; + HAL_SDIOH_REG32(REG_SDIO_HOST_ADMA_SYS_ADDR) = (uint32_t)pAdmaDescTbl; HAL_SDIOH_REG16(REG_SDIO_HOST_BLK_SIZE) = 64; HAL_SDIOH_REG16(REG_SDIO_HOST_BLK_CNT) =1; HAL_SDIOH_REG16(REG_SDIO_HOST_XFER_MODE) = @@ -610,7 +610,7 @@ HAL_Status HalSdioHostChangeSdClockRtl8195a(IN VOID *Data, IN uint8_t Frequency) // а malloc не гарантирует размещение в SRAM в любых ситуациях StatusData = (uint8_t*)pAdmaDescTbl + sizeof(ADMA2_DESC_FMT); - HAL_SDIOH_REG32(REG_SDIO_HOST_ADMA_SYS_ADDR) = pAdmaDescTbl; + HAL_SDIOH_REG32(REG_SDIO_HOST_ADMA_SYS_ADDR) = (uint32_t)pAdmaDescTbl; HAL_SDIOH_REG16(REG_SDIO_HOST_BLK_SIZE) = 8; // v40058004 = 8; HAL_SDIOH_REG16(REG_SDIO_HOST_BLK_CNT) =1; HAL_SDIOH_REG16(REG_SDIO_HOST_XFER_MODE) = @@ -625,7 +625,7 @@ HAL_Status HalSdioHostChangeSdClockRtl8195a(IN VOID *Data, IN uint8_t Frequency) pAdmaDescTbl->Attrib1.Int = 0; pAdmaDescTbl->Attrib1.Act1= 0; pAdmaDescTbl->Attrib1.Act2=1; - pAdmaDescTbl->Addr1 = StatusData; + pAdmaDescTbl->Addr1 = (uint32_t)StatusData; pAdmaDescTbl->Len1 = 8; result = SdioHostChkCmdInhibitCMD(); @@ -797,8 +797,8 @@ HAL_Status HalSdioHostReadBlocksDmaRtl8195a(IN VOID *Data, IN u64 ReadAddr, admadesc_ptr = psha->AdmaDescTbl; // проверка валидности адреса и дескриптора ADMA2 - result = CheckSramAddress(admadesc_ptr) | - CheckSramAddress(admadesc_ptr->Addr1); + result = CheckSramAddress((void*)admadesc_ptr) | + CheckSramAddress((void*)admadesc_ptr->Addr1); if (result) return result; @@ -807,7 +807,7 @@ HAL_Status HalSdioHostReadBlocksDmaRtl8195a(IN VOID *Data, IN u64 ReadAddr, sd_read_addr =ReadAddr >> 9; // sdhc: адрес в блоках - HAL_SDIOH_REG32(REG_SDIO_HOST_ADMA_SYS_ADDR) =admadesc_ptr; + HAL_SDIOH_REG32(REG_SDIO_HOST_ADMA_SYS_ADDR) = (uint32_t)admadesc_ptr; HAL_SDIOH_REG16(REG_SDIO_HOST_BLK_SIZE) = DATA_BLK_LEN; result = SdioHostChkCmdInhibitCMD(); if (result) { @@ -1058,7 +1058,7 @@ HAL_Status HalSdioHostWriteBlocksDmaRtl8195a(IN VOID *Data, IN uint64 WriteAddr, // проверка валидности адреса и дескриптора ADMA2 admadesc_ptr = psha->AdmaDescTbl; // проверим адрес дескриптора ADMA2 - if (CheckSramAddress(admadesc_ptr) || CheckSramAddress(admadesc_ptr->Addr1)) + if (CheckSramAddress((void *)admadesc_ptr) || CheckSramAddress((void *)admadesc_ptr->Addr1)) return HAL_ERR_PARA; // адрес в байтах или блоках ? if (psha->IsSdhc) @@ -1220,7 +1220,7 @@ HAL_Status HalSdioHostGetCardStatusRtl8195a(IN VOID *Data) { if (result) return result; // Send Status command - Cmd.Arg = Cmd.Arg = psha->RCA << 16; + Cmd.Arg = psha->RCA << 16; Cmd.CmdFmt.CmdIdx = CMD_SEND_STATUS; Cmd.CmdFmt.RespType = RSP_LEN_48; Cmd.CmdFmt.CmdCrcChkEn = 1; @@ -1280,7 +1280,7 @@ HAL_Status HalSdioHostGetSdStatusRtl8195a(IN VOID *Data) { pAdmaDescTbl->Attrib1.End=1; pAdmaDescTbl->Attrib1.Act1=0; pAdmaDescTbl->Attrib1.Act2=1; - pAdmaDescTbl->Addr1 = &psha->SdStatus[0]; + pAdmaDescTbl->Addr1 = (uint32_t) &psha->SdStatus[0]; pAdmaDescTbl->Attrib1.Valid =1; //memset(&psha->SdStatus[0], 0x55, SD_STATUS_LEN); @@ -1325,7 +1325,7 @@ HAL_Status HalSdioHostGetSdStatusRtl8195a(IN VOID *Data) { if (result) return result; - HAL_SDIOH_REG32(REG_SDIO_HOST_ADMA_SYS_ADDR) = pAdmaDescTbl; + HAL_SDIOH_REG32(REG_SDIO_HOST_ADMA_SYS_ADDR) = (uint32_t)pAdmaDescTbl; HAL_SDIOH_REG16(REG_SDIO_HOST_BLK_SIZE) = 64; HAL_SDIOH_REG16(REG_SDIO_HOST_XFER_MODE) = @@ -1388,7 +1388,7 @@ HAL_Status HalSdioHostIrqInitRtl8195a(IN VOID *Data) // PIRQ_HANDLE Data HAL_Status result; PIRQ_HANDLE pih = (PIRQ_HANDLE)Data; if (pih) { - pih->Data = Data; + pih->Data = (uint32_t)Data; pih->IrqNum = SDIO_HOST_IRQ; pih->IrqFun = SdioHostIsrHandle; pih->Priority = 6; @@ -1516,7 +1516,7 @@ HAL_Status HalSdioHostDeInitRtl8195a(IN VOID *Data) { //----- HalSdioHostStopTransferRtl8195a HAL_Status HalSdioHostStopTransferRtl8195a(IN VOID *Data) { - HAL_Status result; +// HAL_Status result; SDIO_HOST_CMD Cmd; PHAL_SDIO_HOST_ADAPTER psha = (PHAL_SDIO_HOST_ADAPTER)Data; uint32_t x; @@ -1757,7 +1757,7 @@ IN uint64_t EndAddr) { HAL_Status HalSdioHostGetWriteProtectRtl8195a(IN VOID *Data) { PHAL_SDIO_HOST_ADAPTER psha = (PHAL_SDIO_HOST_ADAPTER)Data; HAL_Status result; - SDIO_HOST_CMD Cmd; // [sp+0h] [bp-18h]@1 +// SDIO_HOST_CMD Cmd; // [sp+0h] [bp-18h]@1 if (!psha) return HAL_ERR_PARA; diff --git a/USDK/component/soc/realtek/8195a/fwlib/src/hal_sdio_host.c b/USDK/component/soc/realtek/8195a/fwlib/src/hal_sdio_host.c index ddfef6c..52215ba 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/src/hal_sdio_host.c +++ b/USDK/component/soc/realtek/8195a/fwlib/src/hal_sdio_host.c @@ -98,7 +98,7 @@ HAL_Status HalSdioHostDisable(IN VOID *Data) { //----- HalSdioHostOpInit(PHAL_SDIO_HOST_ADAPTER) void HalSdioHostOpInit(void *Data) { - PHAL_SDIO_HOST_OP phsha = (PHAL_SDIO_HOST_ADAPTER)Data; + PHAL_SDIO_HOST_OP phsha = (PHAL_SDIO_HOST_OP)Data; phsha->HalSdioHostInitHost = &HalSdioHostInitHostRtl8195a; phsha->HalSdioHostInitCard = &HalSdioHostInitCardRtl8195a; phsha->HalSdioHostDeInit = &HalSdioHostDeInitRtl8195a; diff --git a/USDK/flasher/gdb_ota.jlink b/USDK/flasher/gdb_ota.jlink index 9ed1306..0b349a0 100644 --- a/USDK/flasher/gdb_ota.jlink +++ b/USDK/flasher/gdb_ota.jlink @@ -222,10 +222,11 @@ if $rtl8710_flasher_capacity == 0 monitor go FlasherWait set $id = {int}($rtl8710_flasher_buffer + 0x0C) - set $rtl8710_flasher_capacity = 1 << (($id >> 16) & 0x0ff) if ($id == 0x1420c2) + set $rtl8710_flasher_capacity = 1 << (($id >> 16) & 0x0ff) printf "Flash ID = 0x%08x : MX25L8006E (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10 else + set $rtl8710_flasher_capacity = {int}(1024*1024) printf "Flash ID = 0x%08x : (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10 end printf "RTL8710 flasher initialized\n" diff --git a/USDK/flasher/gdb_wrflash.jlink b/USDK/flasher/gdb_wrflash.jlink index 4a4af92..4b10e60 100644 --- a/USDK/flasher/gdb_wrflash.jlink +++ b/USDK/flasher/gdb_wrflash.jlink @@ -41,8 +41,8 @@ if $rtl8710_flasher_capacity == 0 set $rtl8710_flasher_capacity = 1 << (($id >> 16) & 0x0ff) printf "Flash ID = 0x%08x : MX25L8006E (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10 else - set $rtl8710_flasher_capacity = 1024*1024) - error "Flash ID = 0x%08x : ?\n", $id + set $rtl8710_flasher_capacity = {int}(1024*1024) + printf "Flash ID = 0x%08x : (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10 end printf "RTL8710 flasher initialized\n" else diff --git a/USDK/sdkset.mk b/USDK/sdkset.mk index 766ab6f..23a6c42 100644 --- a/USDK/sdkset.mk +++ b/USDK/sdkset.mk @@ -47,9 +47,13 @@ ifdef USE_SDIOH #LIBS += _sdcard_v2 CFLAGS += -DCONFIG_FATFS_EN=1 endif +ifdef USE_UVC +all: LIBS +=_rtsp _usbh _usbd +mp: LIBS +=_rtsp _usbh _usbd +endif # m c nosys gcc PATHLIBS = sdk/component/soc/realtek/8195a/misc/bsp/lib/common/gcc -LDFILE = rlx8195A-symbol-v04-img2.ld +LDFILE ?= rlx8195A-symbol-v04-img2.ld BOOTS = sdk/component/soc/realtek/8195a/misc/bsp/image # Include folder list @@ -376,6 +380,7 @@ SRC_C += sdk/component/common/file_system/fatfs/r0.10c/src/diskio.c SRC_C += sdk/component/common/file_system/fatfs/r0.10c/src/ff.c SRC_C += sdk/component/common/file_system/fatfs/r0.10c/src/option/ccsbcs.c endif + ifdef USE_SDIOH INCLUDES += sdk/component/common/file_system/fatfs/disk_if/inc SRC_C += sdk/component/common/file_system/fatfs/disk_if/src/sdcard.c diff --git a/project/inc/ina219/ina219buf.h b/project/inc/ina219/ina219buf.h index 2127ea6..67e2b0e 100644 --- a/project/inc/ina219/ina219buf.h +++ b/project/inc/ina219/ina219buf.h @@ -31,7 +31,7 @@ typedef struct _ina219drv { signed short ss[2]; unsigned int ui; } buf_i2c; - volatile i2c_drv_t i2c; + i2c_drv_t i2c; } INA219DRV, *PINA219DRV; diff --git a/project/inc/ina219/ina219drv.h b/project/inc/ina219/ina219drv.h index 017b1cc..7be22af 100644 --- a/project/inc/ina219/ina219drv.h +++ b/project/inc/ina219/ina219drv.h @@ -43,7 +43,7 @@ typedef struct _ina219drv { signed short ss[2]; unsigned int ui; } buf_i2c; - volatile i2c_drv_t i2c; + i2c_drv_t i2c; } INA219DRV, *PINA219DRV; diff --git a/project/inc/lwipopts.h b/project/inc/lwipopts.h index 267fb6c..7babf72 100644 --- a/project/inc/lwipopts.h +++ b/project/inc/lwipopts.h @@ -185,6 +185,7 @@ a lot of data that needs to be copied, this should be set high. */ /* Support Multicast */ #define LWIP_IGMP 1 + extern __attribute__ ((long_call)) unsigned int Rand(void); #define LWIP_RAND() Rand() diff --git a/project/inc/tcpsrv/tcp_srv_conn.h b/project/inc/tcpsrv/tcp_srv_conn.h index b50b110..57ab07f 100644 --- a/project/inc/tcpsrv/tcp_srv_conn.h +++ b/project/inc/tcpsrv/tcp_srv_conn.h @@ -12,9 +12,11 @@ #include "lwip/err.h" +#undef mMIN #define mMIN(a, b) ((a < b)? a : b) #define mMAX(a, b) ((a>b)?a:b) + enum srvconn_state { SRVCONN_NONE =0, SRVCONN_CLOSEWAIT, // ожидает закрытия diff --git a/project/inc/web/websock.h b/project/inc/web/websock.h index 969837e..43c9c3f 100644 --- a/project/inc/web/websock.h +++ b/project/inc/web/websock.h @@ -6,6 +6,8 @@ #ifndef _WEBSOCK_H_ #define _WEBSOCK_H_ +#include "lwip/err.h" +#include "tcpsrv/tcp_srv_conn.h" //#define WS_NONBLOCK 0x02 diff --git a/project/inc/wifi_user_set.h b/project/inc/wifi_user_set.h index b7205d6..6d43340 100644 --- a/project/inc/wifi_user_set.h +++ b/project/inc/wifi_user_set.h @@ -33,7 +33,7 @@ RTW_SECURITY_WPA_TKIP_PSK - WPA Security RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers */ -#define DEF_AP_SECURITY RTW_SECURITY_WPA2_AES_PSK // WEP security is NOT IMPLEMENTED. It is NOT SECURE! +#define DEF_AP_SECURITY RTW_ENCRYPTION_WPA2_MIXED // WEP security is NOT IMPLEMENTED. It is NOT SECURE! #define DEF_AP_BEACON 100 // 100...6000 ms #define DEF_AP_CHANNEL 1 // 1..14 #define DEF_AP_CHANNEL 1 // 1..14 @@ -54,7 +54,7 @@ #define DEF_ST_AUTORECONNECT 1 // 0 - none, 1..254 - count, 255 - all #define DEF_ST_RECONNECT_PAUSE 1 // 5 sec #define DEF_ST_SLEEP 3 // 0 - Off, 1 - IPS, 2 - LPS, 3 - IPS/LPS mode -#define DEF_ST_LPS_DTIM 0 // LPS DTIM +#define DEF_ST_LPS_DTIM 1 // LPS DTIM #define DEF_ST_DHCP_MODE 1 // =0 dhcp off, // =1 - dhcp on, - динамический ip // =2 Static ip, - fixed ip diff --git a/project/src/console/sd_fat.c b/project/src/console/sd_fat.c index d481f46..bf30e32 100644 --- a/project/src/console/sd_fat.c +++ b/project/src/console/sd_fat.c @@ -243,7 +243,6 @@ LOCAL void fATHF(int argc, char *argv[]) { if (pbuf != NULL) { DIR dir; FILINFO fno; - struct os_tm tm; fno.lfname = (TCHAR*) pbuf; fno.lfsize = 512; u8 * sdir; @@ -270,7 +269,7 @@ LOCAL void fATHF(int argc, char *argv[]) { } else printf("FATFS: Open dir fail!\n"); free(pbuf); - if(sdir != logical_drv) free(sdir); + if((void *)sdir != (void *)logical_drv) free(sdir); } } sd_unmount(fs); @@ -348,7 +347,7 @@ LOCAL void fATHS(int argc, char *argv[]) { } else printf("FATFS: Open dir fail!\n"); free(pbuf); - if(sdir != logical_drv) free(sdir); + if((void *)sdir != (void *)logical_drv) free(sdir); } } sd_unmount(fs); diff --git a/project/src/console/wifi_console.c b/project/src/console/wifi_console.c index ad502d5..4cd0c3d 100644 --- a/project/src/console/wifi_console.c +++ b/project/src/console/wifi_console.c @@ -193,7 +193,9 @@ LOCAL void fATWI(int argc, char *argv[]) { show_wifi_st_cfg(); printf("\nWIFI AP clients:\n"); printf(&str_rom_57ch3Dch0A[25]); // "================================\n" +#if SDK_VER_NUM > 0x4000 show_wifi_ap_clients(); +#endif printf("\n"); } diff --git a/project/src/console/wlan_tst.c b/project/src/console/wlan_tst.c index 3681d86..2b625a6 100644 --- a/project/src/console/wlan_tst.c +++ b/project/src/console/wlan_tst.c @@ -20,12 +20,12 @@ //#include "hal_diag.h" #include "rtl8195a/rtl_libc.h" -void dump_bytes(uint32 addr, int size); +extern void dump_bytes(uint32 addr, int size); extern Rltk_wlan_t rltk_wlan_info[2]; // in wrapper.h LOCAL void tst_wlan_struct(int argc, char *argv[]) { - (void) argc; (void) argv; + (void)argc; (void)argv; printf("Test: sizeof(struct _ADAPTER) = %d\n", sizeof(struct _ADAPTER)); //6088 printf("mlmeextpriv\t+%d\n", offsetof(struct _ADAPTER, mlmeextpriv)); //+1256 printf("TSFValue\t+%d\n", offsetof(struct _ADAPTER, mlmeextpriv.TSFValue)); //+1992 @@ -55,6 +55,21 @@ LOCAL void tst_wlan_struct(int argc, char *argv[]) }; } +LOCAL void show_wlan_param(int argc, char *argv[]) { + (void)argc; (void)argv; + _adapter * ad = *(_adapter **)((rltk_wlan_info[0].dev)->priv); +#if 1 + printf("reconnect_deauth_filtered\t%u\n", ad->mlmeextpriv.reconnect_deauth_filtered); + printf("reconnect_times\t%u\n", ad->mlmeextpriv.reconnect_times); + printf("reconnect_cnt\t%u\n", ad->mlmeextpriv.reconnect_cnt); + printf("reconnect_timeout\t%u\n", ad->mlmeextpriv.reconnect_timeout); +#endif + +} + + + MON_RAM_TAB_SECTION COMMAND_TABLE console_wlan_tst[] = { - {"CHKWL", 0, tst_wlan_struct, ": Chk wlan struct"} + {"CHKWL", 0, tst_wlan_struct, ": Chk wlan struct"}, + {"CHKAP", 0, show_wlan_param, ": Chow wlan parm"} }; diff --git a/project/src/driver/i2c_drv.c b/project/src/driver/i2c_drv.c index c85a55b..3acc3ee 100644 --- a/project/src/driver/i2c_drv.c +++ b/project/src/driver/i2c_drv.c @@ -5,6 +5,7 @@ * Author: pvvx */ #include "driver/i2c_drv.h" +#include "rtl_lib.h" #if CONFIG_I2C_EN @@ -44,14 +45,14 @@ static const PinMapI2C PinMap_I2C[] = { }; static void * i2c_base_reg[4] = { - I2C0_REG_BASE, - I2C1_REG_BASE, - I2C2_REG_BASE, - I2C3_REG_BASE + (void *)I2C0_REG_BASE, + (void *)I2C1_REG_BASE, + (void *)I2C2_REG_BASE, + (void *)I2C3_REG_BASE }; #if 1 -#define test_printf +#define test_printf(...) #define i2c_dump_regs(p) #else #define test_printf rtl_printf @@ -87,9 +88,9 @@ LOCAL int i2c_ready(i2c_drv_t *pi2c, unsigned char flg) if(i2c_reg(REG_DW_I2C_IC_RAW_INTR_STAT) & BIT_IC_RAW_INTR_STAT_TX_ABRT) { error_printf("I2C%d Abort!\n", pi2c->idx); // Clear abort status. - (volatile)i2c_reg(REG_DW_I2C_IC_CLR_TX_ABRT); + i2c_reg(REG_DW_I2C_IC_CLR_TX_ABRT); // Be sure that all interrupts flag are cleared. -// (volatile)i2c_reg(REG_DW_I2C_IC_CLR_INTR); +// i2c_reg(REG_DW_I2C_IC_CLR_INTR); pi2c->status = DRV_I2C_ABORT; return DRV_I2C_ABORT; } @@ -116,7 +117,7 @@ LOCAL int i2c_ready(i2c_drv_t *pi2c, unsigned char flg) int _i2c_break(i2c_drv_t *pi2c) { test_printf("%s\n", __func__); -// (volatile)i2c_reg(REG_DW_I2C_IC_CLR_INTR); +// i2c_reg(REG_DW_I2C_IC_CLR_INTR); // ABORT operation int poll_count = DRV_I2C_POOL_TIMEOUT; i2c_reg(REG_DW_I2C_IC_ENABLE) |= 2; @@ -130,7 +131,7 @@ int _i2c_break(i2c_drv_t *pi2c) }; pi2c->status = DRV_I2C_OFF; // All interrupts flag are cleared. - (volatile)i2c_reg(REG_DW_I2C_IC_CLR_INTR); + i2c_reg(REG_DW_I2C_IC_CLR_INTR); return DRV_I2C_OK; } @@ -225,7 +226,7 @@ LOCAL int i2c_enable(i2c_drv_t *pi2c) }; }; // Be sure that all interrupts flag are cleared. - (volatile)i2c_reg(REG_DW_I2C_IC_CLR_INTR); + i2c_reg(REG_DW_I2C_IC_CLR_INTR); pi2c->status = DRV_I2C_IC_ENABLE; return DRV_I2C_OK; } @@ -286,7 +287,7 @@ int _i2c_setup(i2c_drv_t *pi2c, PinName sda, PinName scl, unsigned char mode) return DRV_I2C_ERR; } // Pins -> index - PinMapI2C *p = PinMap_I2C; + PinMapI2C *p = (PinMapI2C *)PinMap_I2C; while(p->sda != 0xFF) { if(p->sda == sda && p->scl == scl) { pi2c->io_sel = RTL_GET_PERI_SEL(p->sel); @@ -432,7 +433,7 @@ int _i2c_read(i2c_drv_t *pi2c, uint32 address, const char *data, int length, int *d++ = i2c_reg(REG_DW_I2C_IC_DATA_CMD); length--; } - else (volatile) i2c_reg(REG_DW_I2C_IC_DATA_CMD); + else i2c_reg(REG_DW_I2C_IC_DATA_CMD); }; } while(length) { diff --git a/project/src/ina219/ina219drv.c b/project/src/ina219/ina219drv.c index 0a86eb7..f8a2ec5 100644 --- a/project/src/ina219/ina219drv.c +++ b/project/src/ina219/ina219drv.c @@ -21,6 +21,8 @@ #include "rtl8195a/rtl_libc.h" #include "driver/i2c_drv.h" #include "platform_stdlib.h" +#include "web_websocket.h" +#include "tcpsrv/tcp_srv_conn.h" #include "hal_com_reg.h" @@ -101,7 +103,7 @@ void ina_tick_handler(void *par) { break; case 4: if (i2c_reg(REG_DW_I2C_IC_RAW_INTR_STAT) & BIT_IC_RAW_INTR_STAT_TX_ABRT) { - uint32 tmp = i2c_reg(REG_DW_I2C_IC_CLR_INTR); + i2c_reg(REG_DW_I2C_IC_CLR_INTR); p->errs++; p->status = 0; break; @@ -121,10 +123,10 @@ void ina_tick_handler(void *par) { else p->buf_rx++; }; } else { - (volatile)i2c_reg(REG_DW_I2C_IC_DATA_CMD); - (volatile)i2c_reg(REG_DW_I2C_IC_DATA_CMD); - (volatile)i2c_reg(REG_DW_I2C_IC_DATA_CMD); - (volatile)i2c_reg(REG_DW_I2C_IC_DATA_CMD); + i2c_reg(REG_DW_I2C_IC_DATA_CMD); + i2c_reg(REG_DW_I2C_IC_DATA_CMD); + i2c_reg(REG_DW_I2C_IC_DATA_CMD); + i2c_reg(REG_DW_I2C_IC_DATA_CMD); }; } case 3: @@ -183,7 +185,8 @@ size_t ina219_getdata(void *pd, uint16 cnt) taskENABLE_INTERRUPTS(); return cnt * sizeof(INA219DATA) + 4; } -#define mMIN(a, b) ((ab)?a:b) #include "web_srv.h" @@ -390,14 +393,14 @@ LOCAL void fATI2C(int argc, char *argv[]) if(argv[1][0] == 'w') { _i2c_write(pi2c, buf[0], &buf[1], i-1, 1); rtl_printf("I2C%d write[%d]:\n", pi2c->idx, i-1); - dump_bytes(&buf[0], i); + dump_bytes((uint32)&buf[0], i); } else if(argv[1][0] == 'r') { i = buf[1]; if(i > sizeof(buf) - 1) i = sizeof(buf) - 1; _i2c_read(pi2c, buf[0], &buf[1], i, 1); rtl_printf("I2C%d read[%d]:\n", pi2c->idx, i); - dump_bytes(&buf[0], i+1); + dump_bytes((uint32)&buf[0], i+1); }; };