CARPLAY版本整理

This commit is contained in:
2025-01-21 16:49:37 +08:00
commit f0fb64e4e6
26542 changed files with 13719676 additions and 0 deletions

View File

@ -0,0 +1,834 @@
/* FreeRTOS includes */
#include <FreeRTOS.h>
#include <task.h>
#include <timers.h>
#include <semphr.h>
//#include <autoconf.h>
#include <osdep_service.h>
#include <stdio.h>
#include <stdarg.h>
//#include <tcm_heap.h>
/********************* os depended utilities ********************/
#ifndef USE_MUTEX_FOR_SPINLOCK
#define USE_MUTEX_FOR_SPINLOCK 1
#endif
//PRIORITIE_OFFSET defined to adjust the priority of threads in wlan_lib
unsigned int g_prioritie_offset = 4;
//----- ------------------------------------------------------------------
// Misc Function
//----- ------------------------------------------------------------------
int rtw_printf(const char *format, ...)
{
va_list args;
va_start(args, format);
int n = vprintf(format, args);
va_end(args);
return n;
}
#if CONFIG_MP_LOG_FUNC_INDEPENDENT
int rtw_mplog(const char *format, ...)
{
va_list args;
va_start(args, format);
int n = vprintf(format, args);
va_end(args);
return n;
}
#endif
void save_and_cli()
{
taskENTER_CRITICAL();
}
void restore_flags()
{
taskEXIT_CRITICAL();
}
void cli()
{
taskDISABLE_INTERRUPTS();
}
/* Not needed on 64bit architectures */
static unsigned int __div64_32(u64 *n, unsigned int base)
{
u64 rem = *n;
u64 b = base;
u64 res, d = 1;
unsigned int high = rem >> 32;
/* Reduce the thing a bit first */
res = 0;
if (high >= base) {
high /= base;
res = (u64) high << 32;
rem -= (u64) (high * base) << 32;
}
while ((u64)b > 0 && b < rem) {
b = b+b;
d = d+d;
}
do {
if (rem >= b) {
rem -= b;
res += d;
}
b >>= 1;
d >>= 1;
} while (d);
*n = res;
return rem;
}
/********************* os depended service ********************/
u8* _freertos_malloc(u32 sz)
{
return pvPortMalloc(sz);
}
u8* _freertos_zmalloc(u32 sz)
{
u8 *pbuf = _freertos_malloc(sz);
if (pbuf != NULL)
memset(pbuf, 0, sz);
return pbuf;
}
void _freertos_mfree(u8 *pbuf, u32 sz)
{
vPortFree(pbuf);
}
static void _freertos_memcpy(void* dst, const void* src, u32 sz)
{
memcpy(dst, src, sz);
}
static int _freertos_memcmp(void *dst, void *src, u32 sz)
{
//under Linux/GNU/GLibc, the return value of memcmp for two same mem. chunk is 0
if (!(memcmp(dst, src, sz)))
return 1;
return 0;
}
static void _freertos_memset(void *pbuf, int c, u32 sz)
{
memset(pbuf, c, sz);
}
static void _freertos_init_sema(_sema *sema, int init_val)
{
*sema = xSemaphoreCreateCounting(0xffffffff, init_val); //Set max count 0xffffffff
}
static void _freertos_free_sema(_sema *sema)
{
if(*sema != NULL)
vSemaphoreDelete(*sema);
*sema = NULL;
}
static void _freertos_up_sema(_sema *sema)
{
xSemaphoreGive(*sema);
}
static void _freertos_up_sema_from_isr(_sema *sema)
{
portBASE_TYPE taskWoken = pdFALSE;
xSemaphoreGiveFromISR(*sema, &taskWoken);
portEND_SWITCHING_ISR(taskWoken);
}
static u32 _freertos_down_sema(_sema *sema, u32 timeout)
{
if(timeout == RTW_MAX_DELAY) {
timeout = portMAX_DELAY;
} else {
timeout = rtw_ms_to_systime(timeout);
}
if(xSemaphoreTake(*sema, timeout) != pdTRUE) {
return pdFALSE;
}
return pdTRUE;
}
static void _freertos_mutex_init(_mutex *pmutex)
{
*pmutex = xSemaphoreCreateMutex();
}
static void _freertos_mutex_free(_mutex *pmutex)
{
if(*pmutex != NULL)
vSemaphoreDelete(*pmutex);
*pmutex = NULL;
}
static void _freertos_mutex_get(_lock *plock)
{
while(xSemaphoreTake(*plock, 60 * 1000 / portTICK_RATE_MS) != pdTRUE)
DBG_INFO("[%s] %s(%p) failed, retry\n", pcTaskGetTaskName(NULL), __FUNCTION__, plock);
}
static int _freertos_mutex_get_timeout(_lock *plock, u32 timeout_ms)
{
if(xSemaphoreTake(*plock, timeout_ms / portTICK_RATE_MS) != pdTRUE){
DBG_INFO("[%s] %s(%p) failed, retry\n", pcTaskGetTaskName(NULL), __FUNCTION__, plock);
return -1;
}
return 0;
}
static void _freertos_mutex_put(_lock *plock)
{
xSemaphoreGive(*plock);
}
static void _freertos_enter_critical(_lock *plock, _irqL *pirqL)
{
taskENTER_CRITICAL();
}
static void _freertos_exit_critical(_lock *plock, _irqL *pirqL)
{
taskEXIT_CRITICAL();
}
static u32 uxSavedInterruptStatus = 0;
static void _freertos_enter_critical_from_isr(_lock *plock, _irqL *pirqL)
{
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
}
static void _freertos_exit_critical_from_isr(_lock *plock, _irqL *pirqL)
{
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
}
static int _freertos_enter_critical_mutex(_mutex *pmutex, _irqL *pirqL)
{
int ret = 0;
while(xSemaphoreTake(*pmutex, 60 * 1000 / portTICK_RATE_MS) != pdTRUE)
DBG_INFO("[%s] %s(%p) failed, retry\n", pcTaskGetTaskName(NULL), __FUNCTION__, pmutex);
return ret;
}
static void _freertos_exit_critical_mutex(_mutex *pmutex, _irqL *pirqL)
{
xSemaphoreGive(*pmutex);
}
static void _freertos_cpu_lock(void)
{
}
static void _freertos_cpu_unlock(void)
{
}
static void _freertos_spinlock_init(_lock *plock)
{
#if USE_MUTEX_FOR_SPINLOCK
*plock = xSemaphoreCreateMutex();
#endif
}
static void _freertos_spinlock_free(_lock *plock)
{
#if USE_MUTEX_FOR_SPINLOCK
if(*plock != NULL)
vSemaphoreDelete(*plock);
*plock = NULL;
#endif
}
static void _freertos_spinlock(_lock *plock)
{
#if USE_MUTEX_FOR_SPINLOCK
while(xSemaphoreTake(*plock, 60 * 1000 / portTICK_RATE_MS) != pdTRUE)
DBG_INFO("[%s] %s(%p) failed, retry\n", pcTaskGetTaskName(NULL), __FUNCTION__, plock);
#endif
}
static void _freertos_spinunlock(_lock *plock)
{
#if USE_MUTEX_FOR_SPINLOCK
xSemaphoreGive(*plock);
#endif
}
static void _freertos_spinlock_irqsave(_lock *plock, _irqL *irqL)
{
taskENTER_CRITICAL();
#if USE_MUTEX_FOR_SPINLOCK
while(xSemaphoreTake(*plock, 60 * 1000 / portTICK_RATE_MS) != pdTRUE)
DBG_INFO("[%s] %s(%p) failed, retry\n", pcTaskGetTaskName(NULL), __FUNCTION__, plock);
#endif
}
static void _freertos_spinunlock_irqsave(_lock *plock, _irqL *irqL)
{
#if USE_MUTEX_FOR_SPINLOCK
xSemaphoreGive(*plock);
#endif
taskEXIT_CRITICAL();
}
static int _freertos_init_xqueue( _xqueue* queue, const char* name, u32 message_size, u32 number_of_messages )
{
if ( ( *queue = xQueueCreate( number_of_messages, message_size ) ) == NULL )
{
return -1;
}
return 0;
}
static int _freertos_push_to_xqueue( _xqueue* queue, void* message, u32 timeout_ms )
{
if(timeout_ms == RTW_MAX_DELAY) {
timeout_ms = portMAX_DELAY;
} else {
timeout_ms = rtw_ms_to_systime(timeout_ms);
}
if ( xQueueSendToBack( *queue, message, timeout_ms ) != pdPASS )
{
return -1;
}
return 0;
}
static int _freertos_pop_from_xqueue( _xqueue* queue, void* message, u32 timeout_ms )
{
if(timeout_ms == RTW_WAIT_FOREVER) {
timeout_ms = portMAX_DELAY;
} else {
timeout_ms = rtw_ms_to_systime(timeout_ms);
}
if ( xQueueReceive( *queue, message, timeout_ms ) != pdPASS )
{
return -1;
}
return 0;
}
static int _freertos_deinit_xqueue( _xqueue* queue )
{
int result = 0;
if( uxQueueMessagesWaiting( *queue ) )
{
result = -1;
}
vQueueDelete( *queue );
return result;
}
static u32 _freertos_get_current_time(void)
{
return xTaskGetTickCount(); //The count of ticks since vTaskStartScheduler was called.
}
static u32 _freertos_systime_to_ms(u32 systime)
{
return systime * portTICK_RATE_MS;
}
static u32 _freertos_systime_to_sec(u32 systime)
{
return systime / configTICK_RATE_HZ;
}
static u32 _freertos_ms_to_systime(u32 ms)
{
return ms / portTICK_RATE_MS;
}
static u32 _freertos_sec_to_systime(u32 sec)
{
return sec * configTICK_RATE_HZ;
}
static void _freertos_msleep_os(int ms)
{
vTaskDelay(ms / portTICK_RATE_MS);
}
static void _freertos_usleep_os(int us)
{
// FreeRTOS does not provide us level delay. Use busy wait
WLAN_BSP_UsLoop(us);
}
static void _freertos_mdelay_os(int ms)
{
vTaskDelay(ms / portTICK_RATE_MS);
}
static void _freertos_udelay_os(int us)
{
// FreeRTOS does not provide us level delay. Use busy wait
WLAN_BSP_UsLoop(us);
}
static void _freertos_yield_os(void)
{
taskYIELD();
}
static void _freertos_ATOMIC_SET(ATOMIC_T *v, int i)
{
atomic_set(v,i);
}
static int _freertos_ATOMIC_READ(ATOMIC_T *v)
{
return atomic_read(v);
}
static void _freertos_ATOMIC_ADD(ATOMIC_T *v, int i)
{
save_and_cli();
v->counter += i;
restore_flags();
}
static void _freertos_ATOMIC_SUB(ATOMIC_T *v, int i)
{
save_and_cli();
v->counter -= i;
restore_flags();
}
static void _freertos_ATOMIC_INC(ATOMIC_T *v)
{
_freertos_ATOMIC_ADD(v, 1);
}
static void _freertos_ATOMIC_DEC(ATOMIC_T *v)
{
_freertos_ATOMIC_SUB(v, 1);
}
static int _freertos_ATOMIC_ADD_RETURN(ATOMIC_T *v, int i)
{
int temp;
save_and_cli();
temp = v->counter;
temp += i;
v->counter = temp;
restore_flags();
return temp;
}
static int _freertos_ATOMIC_SUB_RETURN(ATOMIC_T *v, int i)
{
int temp;
save_and_cli();
temp = v->counter;
temp -= i;
v->counter = temp;
restore_flags();
return temp;
}
static int _freertos_ATOMIC_INC_RETURN(ATOMIC_T *v)
{
return _freertos_ATOMIC_ADD_RETURN(v, 1);
}
static int _freertos_ATOMIC_DEC_RETURN(ATOMIC_T *v)
{
return _freertos_ATOMIC_SUB_RETURN(v, 1);
}
static u64 _freertos_modular64(u64 n, u64 base)
{
unsigned int __base = (base);
unsigned int __rem;
if (((n) >> 32) == 0) {
__rem = (unsigned int)(n) % __base;
(n) = (unsigned int)(n) / __base;
}
else
__rem = __div64_32(&(n), __base);
return __rem;
}
/* Refer to ecos bsd tcpip codes */
static int _freertos_arc4random(void)
{
u32 res = xTaskGetTickCount();
static unsigned long seed = 0xDEADB00B;
seed = ((seed & 0x007F00FF) << 7) ^
((seed & 0x0F80FF00) >> 8) ^ // be sure to stir those low bits
(res << 13) ^ (res >> 9); // using the clock too!
return (int)seed;
}
static int _freertos_get_random_bytes(void *buf, size_t len)
{
#if 1 //becuase of 4-byte align, we use the follow code style.
unsigned int ranbuf;
unsigned int *lp;
int i, count;
count = len / sizeof(unsigned int);
lp = (unsigned int *) buf;
for(i = 0; i < count; i ++) {
lp[i] = _freertos_arc4random();
len -= sizeof(unsigned int);
}
if(len > 0) {
ranbuf = _freertos_arc4random();
_freertos_memcpy(&lp[i], &ranbuf, len);
}
return 0;
#else
unsigned long ranbuf, *lp;
lp = (unsigned long *)buf;
while (len > 0) {
ranbuf = _freertos_arc4random();
*lp++ = ranbuf; //this op need the pointer is 4Byte-align!
len -= sizeof(ranbuf);
}
return 0;
#endif
}
static u32 _freertos_GetFreeHeapSize(void)
{
return (u32)xPortGetFreeHeapSize();
}
void *tcm_heap_malloc(int size);
static int _freertos_create_task(struct task_struct *ptask, const char *name,
u32 stack_size, u32 priority, thread_func_t func, void *thctx)
{
thread_func_t task_func = NULL;
void *task_ctx = NULL;
int ret = 0;
ptask->task_name = name;
if(func){
task_func = func;
task_ctx = thctx;
}
priority += tskIDLE_PRIORITY;
#if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK)
if(rtw_if_wifi_thread((char*)name) == 0){
#if CONFIG_USE_TCM_HEAP
void *stack_addr = tcm_heap_malloc(stack_size*sizeof(int));
//void *stack_addr = rtw_malloc(stack_size*sizeof(int));
if(stack_addr == NULL){
DBG_INFO("Out of TCM heap in \"%s\" ", ptask->task_name);
}
ret = xTaskGenericCreate(
task_func,
(const char *)name,
stack_size,
task_ctx,
priority,
&ptask->task,
stack_addr,
NULL);
#else
ret = xTaskCreate(
task_func,
(const char *)name,
stack_size,
task_ctx,
priority,
&ptask->task);
#endif
}
else
#endif
{
ret = xTaskCreate(
task_func,
(const char *)name,
stack_size,
task_ctx,
priority,
(TaskHandle_t * const)&ptask->task);
}
if(ret != pdPASS){
DBG_INFO("Create Task \"%s\" Failed! ret=%d\n", ptask->task_name, ret);
}
DBG_TRACE("Create Task \"%s\"\n", ptask->task_name);
return ret;
}
static void _freertos_delete_task(struct task_struct *ptask)
{
if (!ptask->task){
DBG_INFO("_freertos_delete_task(): ptask is NULL!\n");
return;
}
vTaskDelete(ptask->task);
ptask->task = 0;
DBG_TRACE("Delete Task \"%s\"\n", ptask->task_name);
}
static void _freertos_wakeup_task(struct task_struct *ptask)
{
xSemaphoreGive(ptask->wakeup_sema);
}
static void _freertos_thread_enter(char *name)
{
DBG_TRACE("RTKTHREAD %s\n", name);
}
static void _freertos_thread_exit(void)
{
DBG_TRACE("RTKTHREAD exit %s\n", __FUNCTION__);
vTaskDelete(NULL);
}
_timerHandle _freertos_timerCreate( const signed char *pcTimerName,
osdepTickType xTimerPeriodInTicks,
u32 uxAutoReload,
void * pvTimerID,
TIMER_FUN pxCallbackFunction )
{
if(xTimerPeriodInTicks == TIMER_MAX_DELAY) {
xTimerPeriodInTicks = portMAX_DELAY;
}
return xTimerCreate((const char *)pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, (TimerCallbackFunction_t)pxCallbackFunction);
}
u32 _freertos_timerDelete( _timerHandle xTimer,
osdepTickType xBlockTime )
{
return (u32)xTimerDelete(xTimer, xBlockTime);
}
u32 _freertos_timerIsTimerActive( _timerHandle xTimer )
{
return (u32)xTimerIsTimerActive(xTimer);
}
u32 _freertos_timerStop( _timerHandle xTimer,
osdepTickType xBlockTime )
{
return (u32)xTimerStop(xTimer, xBlockTime);
}
u32 _freertos_timerChangePeriod( _timerHandle xTimer,
osdepTickType xNewPeriod,
osdepTickType xBlockTime )
{
if(xNewPeriod == 0)
xNewPeriod += 1;
return (u32)xTimerChangePeriod(xTimer, xNewPeriod, xBlockTime);
}
void *_freertos_timerGetID( _timerHandle xTimer ){
return pvTimerGetTimerID(xTimer);
}
u32 _freertos_timerStart( _timerHandle xTimer,
osdepTickType xBlockTime )
{
return (u32)xTimerStart(xTimer, xBlockTime);
}
u32 _freertos_timerStartFromISR( _timerHandle xTimer,
osdepBASE_TYPE *pxHigherPriorityTaskWoken )
{
return (u32)xTimerStartFromISR(xTimer, pxHigherPriorityTaskWoken);
}
u32 _freertos_timerStopFromISR( _timerHandle xTimer,
osdepBASE_TYPE *pxHigherPriorityTaskWoken )
{
return (u32)xTimerStopFromISR(xTimer, pxHigherPriorityTaskWoken);
}
u32 _freertos_timerResetFromISR( _timerHandle xTimer,
osdepBASE_TYPE *pxHigherPriorityTaskWoken )
{
return (u32)xTimerResetFromISR(xTimer, pxHigherPriorityTaskWoken);
}
u32 _freertos_timerChangePeriodFromISR( _timerHandle xTimer,
osdepTickType xNewPeriod,
osdepBASE_TYPE *pxHigherPriorityTaskWoken )
{
if(xNewPeriod == 0)
xNewPeriod += 1;
return (u32)xTimerChangePeriodFromISR(xTimer, xNewPeriod, pxHigherPriorityTaskWoken);
}
u32 _freertos_timerReset( _timerHandle xTimer,
osdepTickType xBlockTime )
{
return (u32)xTimerReset(xTimer, xBlockTime);
}
void _freertos_acquire_wakelock()
{
}
void _freertos_release_wakelock()
{
}
void _freertos_wakelock_timeout(uint32_t timeout)
{
}
u8 _freertos_get_scheduler_state(void)
{
u8 state = xTaskGetSchedulerState();
switch(state){
case taskSCHEDULER_NOT_STARTED: state = OS_SCHEDULER_NOT_STARTED; break;
case taskSCHEDULER_RUNNING: state = OS_SCHEDULER_RUNNING; break;
case taskSCHEDULER_SUSPENDED: state = OS_SCHEDULER_SUSPENDED; break;
}
return state;
}
const struct osdep_service_ops osdep_service = {
_freertos_malloc, //rtw_vmalloc
_freertos_zmalloc, //rtw_zvmalloc
_freertos_mfree, //rtw_vmfree
_freertos_malloc, //rtw_malloc
_freertos_zmalloc, //rtw_zmalloc
_freertos_mfree, //rtw_mfree
_freertos_memcpy, //rtw_memcpy
_freertos_memcmp, //rtw_memcmp
_freertos_memset, //rtw_memset
_freertos_init_sema, //rtw_init_sema
_freertos_free_sema, //rtw_free_sema
_freertos_up_sema, //rtw_up_sema
_freertos_up_sema_from_isr, //rtw_up_sema_from_isr
_freertos_down_sema, //rtw_down_sema
_freertos_mutex_init, //rtw_mutex_init
_freertos_mutex_free, //rtw_mutex_free
_freertos_mutex_get, //rtw_mutex_get
_freertos_mutex_get_timeout,//rtw_mutex_get_timeout
_freertos_mutex_put, //rtw_mutex_put
_freertos_enter_critical, //rtw_enter_critical
_freertos_exit_critical, //rtw_exit_critical
_freertos_enter_critical_from_isr, //rtw_enter_critical_from_isr
_freertos_exit_critical_from_isr, //rtw_exit_critical_from_isr
NULL, //rtw_enter_critical_bh
NULL, //rtw_exit_critical_bh
_freertos_enter_critical_mutex, //rtw_enter_critical_mutex
_freertos_exit_critical_mutex, //rtw_exit_critical_mutex
_freertos_cpu_lock,
_freertos_cpu_unlock,
_freertos_spinlock_init, //rtw_spinlock_init
_freertos_spinlock_free, //rtw_spinlock_free
_freertos_spinlock, //rtw_spin_lock
_freertos_spinunlock, //rtw_spin_unlock
_freertos_spinlock_irqsave, //rtw_spinlock_irqsave
_freertos_spinunlock_irqsave, //rtw_spinunlock_irqsave
_freertos_init_xqueue, //rtw_init_xqueue
_freertos_push_to_xqueue, //rtw_push_to_xqueue
_freertos_pop_from_xqueue, //rtw_pop_from_xqueue
_freertos_deinit_xqueue, //rtw_deinit_xqueue
_freertos_get_current_time, //rtw_get_current_time
_freertos_systime_to_ms, //rtw_systime_to_ms
_freertos_systime_to_sec, //rtw_systime_to_sec
_freertos_ms_to_systime, //rtw_ms_to_systime
_freertos_sec_to_systime, //rtw_sec_to_systime
_freertos_msleep_os, //rtw_msleep_os
_freertos_usleep_os, //rtw_usleep_os
_freertos_mdelay_os, //rtw_mdelay_os
_freertos_udelay_os, //rtw_udelay_os
_freertos_yield_os, //rtw_yield_os
_freertos_ATOMIC_SET, //ATOMIC_SET
_freertos_ATOMIC_READ, //ATOMIC_READ
_freertos_ATOMIC_ADD, //ATOMIC_ADD
_freertos_ATOMIC_SUB, //ATOMIC_SUB
_freertos_ATOMIC_INC, //ATOMIC_INC
_freertos_ATOMIC_DEC, //ATOMIC_DEC
_freertos_ATOMIC_ADD_RETURN, //ATOMIC_ADD_RETURN
_freertos_ATOMIC_SUB_RETURN, //ATOMIC_SUB_RETURN
_freertos_ATOMIC_INC_RETURN, //ATOMIC_INC_RETURN
_freertos_ATOMIC_DEC_RETURN, //ATOMIC_DEC_RETURN
_freertos_modular64, //rtw_modular64
_freertos_get_random_bytes, //rtw_get_random_bytes
_freertos_GetFreeHeapSize, //rtw_getFreeHeapSize
_freertos_create_task, //rtw_create_task
_freertos_delete_task, //rtw_delete_task
_freertos_wakeup_task, //rtw_wakeup_task
_freertos_thread_enter, //rtw_thread_enter
_freertos_thread_exit, //rtw_thread_exit
_freertos_timerCreate, //rtw_timerCreate,
_freertos_timerDelete, //rtw_timerDelete,
_freertos_timerIsTimerActive, //rtw_timerIsTimerActive,
_freertos_timerStop, //rtw_timerStop,
_freertos_timerChangePeriod, //rtw_timerChangePeriod
_freertos_timerGetID, //rtw_timerGetID
_freertos_timerStart, //rtw_timerStart
_freertos_timerStartFromISR, //rtw_timerStartFromISR
_freertos_timerStopFromISR, //rtw_timerStopFromISR
_freertos_timerResetFromISR, //rtw_timerResetFromISR
_freertos_timerChangePeriodFromISR, //rtw_timerChangePeriodFromISR
_freertos_timerReset, //rtw_timerReset
_freertos_acquire_wakelock, //rtw_acquire_wakelock
_freertos_release_wakelock, //rtw_release_wakelock
_freertos_wakelock_timeout, //rtw_wakelock_timeout
_freertos_get_scheduler_state //rtw_get_scheduler_state
};

View File

@ -0,0 +1,237 @@
#ifndef _CUSTOMER_RTOS_SERVICE_H_
#define _CUSTOMER_RTOS_SERVICE_H_
//----- ------------------------------------------------------------------
// Include Files
//----- ------------------------------------------------------------------
#include "dlist.h"
/* For SPI interface transfer and us delay implementation */
#include <rtwlan_bsp.h>
#ifdef CONFIG_USB_HCI
typedef struct urb * PURB;
#endif
//----- ------------------------------------------------------------------
#include "basic_types.h"
//----- ------------------------------------------------------------------
// --------------------------------------------
// Platform dependent type define
// --------------------------------------------
#define FIELD_OFFSET(s,field) ((SSIZE_T)&((s*)(0))->field)
// os types
typedef char osdepCHAR;
typedef float osdepFLOAT;
typedef double osdepDOUBLE;
typedef long osdepLONG;
typedef short osdepSHORT;
typedef unsigned long osdepSTACK_TYPE;
typedef long osdepBASE_TYPE;
typedef unsigned long osdepTickType;
typedef void* _timerHandle;
typedef void* _sema;
typedef void* _mutex;
typedef void* _lock;
typedef void* _queueHandle;
typedef void* _xqueue;
typedef struct timer_list _timer;
typedef struct sk_buff _pkt;
typedef unsigned char _buffer;
typedef unsigned int systime;
#ifndef __LIST_H
#warning "DLIST_NOT_DEFINE!!!!!!"
struct list_head {
struct list_head *next, *prev;
};
#endif
struct __queue {
struct list_head queue;
_lock lock;
};
typedef struct __queue _queue;
typedef struct list_head _list;
typedef unsigned long _irqL;
typedef void* _thread_hdl_;
typedef void thread_return;
typedef void* thread_context;
typedef struct { volatile int counter; } atomic_t;
#define ATOMIC_T atomic_t
#define HZ configTICK_RATE_HZ
#define rtw_timer_list timer_list
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
/* emulate a modern version */
#define LINUX_VERSION_CODE KERNEL_VERSION(2, 6, 17)
static __inline _list *get_next(_list *list)
{
return list->next;
}
static __inline _list *get_list_head(_queue *queue)
{
return (&(queue->queue));
}
#define LIST_CONTAINOR(ptr, type, member) \
((type *)((char *)(ptr)-(SIZE_T)((char *)&((type *)ptr)->member - (char *)ptr)))
//#define container_of(p,t,n) (t*)((p)-&(((t*)0)->n))
#define container_of(ptr, type, member) \
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
#ifndef TASK_PRORITY_LOW
#define TASK_PRORITY_LOW 1
#endif
#ifndef TASK_PRORITY_MIDDLE
#define TASK_PRORITY_MIDDLE 2
#endif
#ifndef TASK_PRORITY_HIGH
#define TASK_PRORITY_HIGH 3
#endif
#ifndef TASK_PRORITY_SUPER
#define TASK_PRORITY_SUPER 4
#endif
#define TIMER_MAX_DELAY 0xFFFFFFFF
extern unsigned int g_prioritie_offset;
#ifdef PRIORITIE_OFFSET
#undef PRIORITIE_OFFSET
#endif
#define PRIORITIE_OFFSET (g_prioritie_offset)
void save_and_cli(void);
void restore_flags(void);
void cli(void);
#if 0
#ifndef mdelay
#define mdelay(t) ((t/portTICK_RATE_MS)>0)?(vTaskDelay(t/portTICK_RATE_MS)):(vTaskDelay(1))
#endif
#ifndef udelay
#define udelay(t) ((t/(portTICK_RATE_MS*1000))>0)?vTaskDelay(t/(portTICK_RATE_MS*1000)):(vTaskDelay(1))
#endif
#endif
//----- ------------------------------------------------------------------
// Common Definition
//----- ------------------------------------------------------------------
#define __init
#define __exit
#define __devinit
#define __devexit
#define KERN_ERR
#define KERN_INFO
#define KERN_NOTICE
#undef GFP_KERNEL
#define GFP_KERNEL 1
#define GFP_ATOMIC 1
#define SET_MODULE_OWNER(some_struct) do { } while (0)
#define SET_NETDEV_DEV(dev, obj) do { } while (0)
#define register_netdev(dev) (0)
#define unregister_netdev(dev) do { } while (0)
#define netif_queue_stopped(dev) (0)
#define netif_wake_queue(dev) do { } while (0)
int rtw_printf(const char *format, ...);
#define printk rtw_printf
#ifndef __CC_ARM
#define DBG_INFO(fmt, args...) printk("\n\rRTL871X: " fmt, ## args)
#if WLAN_INTF_DBG
#define DBG_TRACE(fmt, args...) printk("\n\rRTL871X: [%s] " fmt, __FUNCTION__, ## args)
#else
#define DBG_TRACE(fmt, args...)
#endif
#else
#define DBG_INFO(...) do {printk("\n\rRTL871X: ");printk(__VA_ARGS__);} while(0)
#if WLAN_INTF_DBG
#define DBG_TRACE(...) do {printk("\n\rRTL871X: [%s] ", __FUNCTION__);printk(__VA_ARGS__);} while(0)
#else
#define DBG_TRACE(...)
#endif
#endif
#define HALT() do { cli(); for(;;);} while(0)
#undef ASSERT
#define ASSERT(x) do { \
if((x) == 0){\
printk("\n\rRTL871X: Assert(" #x ") failed on line %d in file %s", __LINE__, __FILE__); \
HALT();}\
} while(0)
#undef DBG_ASSERT
#define DBG_ASSERT(x, msg) do { \
if((x) == 0) \
printk("\n\rRTL871X: %s, Assert(" #x ") failed on line %d in file %s", msg, __LINE__, __FILE__); \
} while(0)
//----- ------------------------------------------------------------------
// Atomic Operation
//----- ------------------------------------------------------------------
/*
* atomic_read - read atomic variable
* @v: pointer of type atomic_t
*
* Atomically reads the value of @v. Note that the guaranteed
* useful range of an atomic_t is only 24 bits.
*/
#undef atomic_read
#define atomic_read(v) ((v)->counter)
/*
* atomic_set - set atomic variable
* @v: pointer of type atomic_t
* @i: required value
*
* Atomically sets the value of @v to @i. Note that the guaranteed
* useful range of an atomic_t is only 24 bits.
*/
#undef atomic_set
#define atomic_set(v,i) ((v)->counter = (i))
/*
* These inlines deal with timer wrapping correctly. You are
* strongly encouraged to use them
* 1. Because people otherwise forget
* 2. Because if the timer wrap changes in future you wont have to
* alter your driver code.
*
* time_after(a,b) returns true if the time a is after time b.
*
* Do this with "<0" and ">=0" to only test the sign of the result. A
* good compiler would generate better code (and a really good compiler
* wouldn't care). Gcc is currently neither.
*/
#define time_after(a,b) ((long)(b) - (long)(a) < 0)
#define time_before(a,b) time_after(b,a)
#define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0)
#define time_before_eq(a,b) time_after_eq(b,a)
extern void rtw_init_listhead(_list *list);
extern u32 rtw_is_list_empty(_list *phead);
extern void rtw_list_insert_head(_list *plist, _list *phead);
extern void rtw_list_insert_tail(_list *plist, _list *phead);
extern void rtw_list_delete(_list *plist);
#endif /* _CUSTOMER_RTOS_SERVICE_H_ */

View File

@ -0,0 +1,64 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is proprietary property of RealTek and
* possession or use of this module requires release permission of RealTek.
*/
#include "osdep_service.h"
#include "device_lock.h"
//------------------------------------------------------
#define DEVICE_MUTEX_IS_INIT(device) (mutex_init & (1<<device))
#define DEVICE_MUTEX_SET_INIT(device) (mutex_init |= (1<<device))
#define DEVICE_MUTEX_CLR_INIT(device) (mutex_init &= (~(1<<device)))
static u32 mutex_init = 0;
static _mutex device_mutex[RT_DEV_LOCK_MAX];
//======================================================
static void device_mutex_init(RT_DEV_LOCK_E device)
{
if(!DEVICE_MUTEX_IS_INIT(device)){
_lock lock;
_irqL irqL;
rtw_enter_critical(&lock, &irqL);
if(!DEVICE_MUTEX_IS_INIT(device)){
rtw_mutex_init(&device_mutex[device]);
DEVICE_MUTEX_SET_INIT(device);
}
rtw_exit_critical(&lock, &irqL);
}
}
//======================================================
void device_mutex_free(RT_DEV_LOCK_E device)
{
if(DEVICE_MUTEX_IS_INIT(device)){
_lock lock;
_irqL irqL;
rtw_enter_critical(&lock, &irqL);
if(DEVICE_MUTEX_IS_INIT(device)){
rtw_mutex_free(&device_mutex[device]);
DEVICE_MUTEX_CLR_INIT(device);
}
rtw_exit_critical(&lock, &irqL);
}
}
//======================================================
void device_mutex_lock(RT_DEV_LOCK_E device)
{
device_mutex_init(device);
while(rtw_mutex_get_timeout(&device_mutex[device], 10000)<0)
DBG_INFO("device lock timeout: %d\n", (int)device);
}
//======================================================
void device_mutex_unlock(RT_DEV_LOCK_E device)
{
device_mutex_init(device);
rtw_mutex_put(&device_mutex[device]);
}

View File

@ -0,0 +1,28 @@
/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is proprietary property of RealTek and
* possession or use of this module requires release permission of RealTek.
*/
#ifndef _DEVICE_LOCK_H_
#define _DEVICE_LOCK_H_
enum _RT_DEV_LOCK_E
{
RT_DEV_LOCK_EFUSE = 0,
RT_DEV_LOCK_FLASH = 1,
RT_DEV_LOCK_CRYPTO = 2,
RT_DEV_LOCK_PTA = 3,
RT_DEV_LOCK_WLAN = 4,
RT_DEV_LOCK_MAX = 5
};
typedef uint32_t RT_DEV_LOCK_E;
void device_mutex_lock(RT_DEV_LOCK_E device);
void device_mutex_unlock(RT_DEV_LOCK_E device);
void device_mutex_free(RT_DEV_LOCK_E device);
#endif //_DEVICE_LOCK_H_

View File

@ -0,0 +1,83 @@
/* mbed Microcontroller Library
* Copyright (c) 2013-2016 Realtek Semiconductor Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __NET_STACK_INTF_H__
#define __NET_STACK_INTF_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <wireless.h>
#include <skbuff.h>
struct netif;
//----- ------------------------------------------------------------------
// Ethernet Buffer
//----- ------------------------------------------------------------------
#if (CONFIG_LWIP_LAYER == 1)
#include "ethernetif.h"
#else
struct eth_drv_sg {
unsigned int buf;
unsigned int len;
};
#endif
//----- ------------------------------------------------------------------
// Wlan Interface Provided
//----- ------------------------------------------------------------------
unsigned char rltk_wlan_check_isup(int idx);
void rltk_wlan_tx_inc(int idx);
void rltk_wlan_tx_dec(int idx);
struct sk_buff * rltk_wlan_get_recv_skb(int idx);
struct sk_buff * rltk_wlan_alloc_skb(unsigned int total_len);
void rltk_wlan_set_netif_info(int idx_wlan, void * dev, unsigned char * dev_addr);
void rltk_wlan_send_skb(int idx, struct sk_buff *skb); //struct sk_buff as defined above comment line
int rltk_wlan_send(int idx, struct eth_drv_sg *sg_list, int sg_len, int total_len);
int rltk_wlan_recv(int idx, struct eth_drv_sg *sg_list, int sg_len);
unsigned char rltk_wlan_running(unsigned char idx); // interface is up. 0: interface is down
//----- ------------------------------------------------------------------
// Network Interface provided
//----- ------------------------------------------------------------------
int netif_is_valid_IP(int idx,unsigned char * ip_dest);
int netif_get_idx(struct netif *pnetif);
unsigned char *netif_get_hwaddr(int idx_wlan);
void netif_rx(int idx, unsigned int len);
void netif_post_sleep_processing(void);
void netif_pre_sleep_processing(void);
#if (CONFIG_LWIP_LAYER == 1)
extern void ethernetif_recv(struct netif *netif, int total_len);
extern void lwip_PRE_SLEEP_PROCESSING(void);
extern void lwip_POST_SLEEP_PROCESSING(void);
#endif //CONFIG_LWIP_LAYER == 1
#if CONFIG_WOWLAN
extern unsigned char *rltk_wlan_get_ip(int idx);
extern unsigned char *rltk_wlan_get_gw(int idx);
extern unsigned char *rltk_wlan_get_gwmask(int idx);
#endif
int rltk_wlan_wait_recv_data_ready(uint32_t timeout, uint32_t * recv_len);
int rltk_wlan_ctx_init(void);
#ifdef __cplusplus
}
#endif
#endif //#ifndef __NET_STACK_INTF_H__

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,397 @@
/* mbed Microcontroller Library
* Copyright (c) 2013-2016 Realtek Semiconductor Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//#define _NET_STACK_INTF_C_
#include <stdint.h>
#include <autoconf.h>
#include <net_stack_intf.h>
#if (CONFIG_LWIP_LAYER == 1)
#include <lwip/netif.h>
#include <lwip_netconf.h>
#include <ethernetif.h>
#endif
#include <osdep_service.h>
#include <wifi/wifi_util.h>
//----- ------------------------------------------------------------------
// External Reference
//----- ------------------------------------------------------------------
#if (CONFIG_LWIP_LAYER == 1)
extern struct netif xnetif[]; //LWIP netif
#endif
#include "board.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "timers.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Private.h"
/*#include "FreeRTOS_DNS.h" */
#include "NetworkBufferManagement.h"
#include "NetworkInterface.h"
#if USE_LWIP
#include "ethernet.h"
struct netif *wlan_netif = NULL;
void rltk_wlan_set_intf(void* intf)
{
wlan_netif = (struct netif*)intf;
}
#endif
//#define DUMP_NETWORK_RX_DATA
/**
* rltk_wlan_set_netif_info - set netif hw address and register dev pointer to netif device
* @idx_wlan: netif index
* 0 for STA only or SoftAP only or STA in STA+SoftAP concurrent mode,
* 1 for SoftAP in STA+SoftAP concurrent mode
* @dev: register netdev pointer to LWIP. Reserved.
* @dev_addr: set netif hw address
*
* Return Value: None
*/
void rltk_wlan_set_netif_info(int idx_wlan, void * dev, unsigned char * dev_addr)
{
#if (CONFIG_LWIP_LAYER == 1)
rtw_memcpy(xnetif[idx_wlan].hwaddr, dev_addr, 6);
xnetif[idx_wlan].state = dev;
#else
printf("\r\ndev_addr: %02x:%02x:%02x:%02x:%02x:%02x\r\n", dev_addr[0], dev_addr[1], dev_addr[2], dev_addr[3], dev_addr[4], dev_addr[5]);
#if !defined(USE_LWIP) || (USE_LWIP == 0)
FreeRTOS_UpdateMACAddress(dev_addr);
#else
#endif
#endif
}
/**
* rltk_wlan_send - send IP packets to WLAN. Called by low_level_output().
* @idx: netif index
* @sg_list: data buffer list
* @sg_len: size of each data buffer
* @total_len: total data len
*
* Return Value: None
*/
int rltk_wlan_send(int idx, struct eth_drv_sg *sg_list, int sg_len, int total_len)
{
//#if (CONFIG_LWIP_LAYER == 1)
struct eth_drv_sg *last_sg;
struct sk_buff *skb = NULL;
int ret = 0;
#ifdef CONFIG_TX_ZERO_COPY
u8 *data = NULL;
u8 *Mac_data = NULL;
#endif
if(idx == -1){
DBG_INFO("netif is DOWN");
return -1;
}
DBG_TRACE("%s is called", __FUNCTION__);
save_and_cli();
if (rltk_wlan_check_isup(idx)) {
rltk_wlan_tx_inc(idx);
} else {
DBG_INFO("netif is DOWN");printf("%s is called\r\n", __FUNCTION__);
restore_flags();
return -1;
}
restore_flags();
#ifdef CONFIG_TX_ZERO_COPY
data = rtw_malloc(1640);
if(data == NULL){
DBG_INFO("###########ERR_MEM at %s\r\n",__func__);
ret = -1;
goto exit;
}
Mac_data = data + 80;
for (last_sg = &sg_list[sg_len]; sg_list < last_sg; ++sg_list) {
rtw_memcpy(Mac_data, (void *)(sg_list->buf), sg_list->len);
Mac_data+=sg_list->len;
}
skb = (struct sk_buff *)rltk_wlan_alloc_skb_0copy();
if (skb == NULL) {
DBG_INFO("rltk_wlan_alloc_skb()failed!\r\n");
goto exit;
}
skb->data = data + 80;
skb->head = data;
skb->end = data + 1640;
skb->tail = data + 80 + total_len;
skb->len = total_len;
ret = 0;
#else
skb = rltk_wlan_alloc_skb(total_len);
#endif
if (skb == NULL) {
DBG_INFO("rltk_wlan_alloc_skb() for data len=%d failed!", total_len);
ret = -1;
goto exit;
}
#ifndef CONFIG_TX_ZERO_COPY
for (last_sg = &sg_list[sg_len]; sg_list < last_sg; ++sg_list) {
//printf("sg_list len :%d \r\n", sg_list->len);
rtw_memcpy(skb->tail, (void *)(sg_list->buf), sg_list->len);
skb_put(skb, sg_list->len);
}
#endif
rltk_wlan_send_skb(idx, skb);
exit:
save_and_cli();
rltk_wlan_tx_dec(idx);
restore_flags();
return ret;
//#endif
}
/**
* rltk_wlan_recv - indicate packets to LWIP. Called by ethernetif_recv().
* @idx: netif index
* @sg_list: data buffer list
* @sg_len: size of each data buffer
*
* Return Value: None
*/
int rltk_wlan_recv(int idx, struct eth_drv_sg *sg_list, int sg_len)
{
//#if (CONFIG_LWIP_LAYER == 1)
struct eth_drv_sg *last_sg;
struct sk_buff *skb;
DBG_TRACE("%s is called", __FUNCTION__);
if(idx == -1){
DBG_INFO("skb is NULL");
return 0;
}//printf("\r\n%s is called at:%d\r\n", __FUNCTION__, __LINE__);
skb = rltk_wlan_get_recv_skb(idx);
if (NULL == skb) {printf("\r\n%s is called at:%d\r\n", __FUNCTION__, __LINE__);
//mdelay(10);
return 0;
}
DBG_ASSERT(skb, "No pending rx skb");
for (last_sg = &sg_list[sg_len]; sg_list < last_sg; ++sg_list) {
if (sg_list->buf != 0) {
rtw_memcpy((void *)(sg_list->buf), skb->data, sg_list->len);
skb_pull(skb, sg_list->len);
}
}
return 1;
//#endif
}
int netif_is_valid_IP(int idx, unsigned char *ip_dest)
{
#if CONFIG_LWIP_LAYER == 1
struct netif * pnetif = &xnetif[idx];
ip_addr_t addr = { 0 };
#if CONFIG_MEMORY_ACCESS_ALIGNED
unsigned int temp;
memcpy(&temp, ip_dest, sizeof(unsigned int));
u32_t *ip_dest_addr = &temp;
#else
u32_t *ip_dest_addr = (u32_t*)ip_dest;
#endif
#if LWIP_VERSION_MAJOR >= 2
ip_addr_set_ip4_u32(&addr, *ip_dest_addr);
#else
addr.addr = *ip_dest_addr;
#endif
#if LWIP_VERSION_MAJOR >= 2
if((ip_addr_get_ip4_u32(netif_ip_addr4(pnetif))) == 0)
return 1;
#else
if(pnetif->ip_addr.addr == 0)
return 1;
#endif
if(ip_addr_ismulticast(&addr) || ip_addr_isbroadcast(&addr,pnetif)){
return 1;
}
//if(ip_addr_netcmp(&(pnetif->ip_addr), &addr, &(pnetif->netmask))) //addr&netmask
// return 1;
if(ip_addr_cmp(&(pnetif->ip_addr),&addr))
return 1;
DBG_TRACE("invalid IP: %d.%d.%d.%d ",ip_dest[0],ip_dest[1],ip_dest[2],ip_dest[3]);
#endif
//printf("\r\nnet id:%d IP: %d.%d.%d.%d \r\n", idx, ip_dest[0], ip_dest[1], ip_dest[2], ip_dest[3]);
return 1;
}
int netif_get_idx(struct netif* pnetif)
{
#if (CONFIG_LWIP_LAYER == 1)
int idx = pnetif - xnetif;
switch(idx) {
case 0:
return 0;
case 1:
return 1;
default:
return -1;
}
#else
return 0;
#endif
}
unsigned char *netif_get_hwaddr(int idx_wlan)
{
#if (CONFIG_LWIP_LAYER == 1)
return xnetif[idx_wlan].hwaddr;
#else
return (unsigned char *)FreeRTOS_GetMACAddress();
#endif
}
#if USE_LWIP
void wlan_ethernetif_input(void *h, size_t len);
#endif
void netif_rx(int idx, unsigned int len)
{
//printf("%s idx:%d len:%d\r\n", __func__, idx, len);
#if (CONFIG_LWIP_LAYER == 1)
ethernetif_recv(&xnetif[idx], len);
#else
#if USE_LWIP
wlan_ethernetif_input(wlan_netif, len);
#else
NetworkBufferDescriptor_t * pxBufferDescriptor;
IPStackEvent_t xRxEvent;
int32_t xBytesReceived = len;
int ret = -1;
pxBufferDescriptor = pxGetNetworkBufferWithDescriptor( ( size_t ) xBytesReceived, 0 );
if( pxBufferDescriptor != NULL )
{
struct eth_drv_sg sg_list = {0};
sg_list.buf = (unsigned int)pxBufferDescriptor->pucEthernetBuffer;
sg_list.len = (unsigned int)xBytesReceived;
ret = rltk_wlan_recv(0, &sg_list, 1);
if (ret == 0) {
printf("no rcv data\r\n");
vReleaseNetworkBufferAndDescriptor( pxBufferDescriptor );
return;
}
#ifdef DUMP_NETWORK_RX_DATA
if (1) {
int i;
char* tmp = (char *)pxBufferDescriptor->pucEthernetBuffer;
printf("\r\n recv:");
for (i = 0; i < sg_list.len; i++) {
printf("%02x ", tmp[i]);
}printf("recv end\r\n");
}
#endif
//memcpy( pxBufferDescriptor->pucEthernetBuffer, buffer_pointer, ( size_t ) xBytesReceived );
pxBufferDescriptor->xDataLength = ( size_t ) xBytesReceived;
if( eConsiderFrameForProcessing( pxBufferDescriptor->pucEthernetBuffer ) == eProcessBuffer )
{//printf("send eNetworkRxEvent\r\n");
xRxEvent.eEventType = eNetworkRxEvent;
xRxEvent.pvData = ( void * ) pxBufferDescriptor;
if( xSendEventStructToIPTask( &xRxEvent, 0 ) == pdFALSE )
{
vReleaseNetworkBufferAndDescriptor( pxBufferDescriptor );
iptraceETHERNET_RX_EVENT_LOST();
}
else
{
iptraceNETWORK_INTERFACE_RECEIVE();
}
}
else
{
vReleaseNetworkBufferAndDescriptor( pxBufferDescriptor );
}
}
else
{
iptraceETHERNET_RX_EVENT_LOST();
FreeRTOS_printf( ( "R_ETHER_Read_ZC2: Cleared descriptors\n" ) );
}
#endif
#endif
}
void netif_post_sleep_processing(void)
{
#if (CONFIG_LWIP_LAYER == 1)
lwip_POST_SLEEP_PROCESSING(); //For FreeRTOS tickless to enable Lwip ARP timer when leaving IPS - Alex Fang
#endif
}
void netif_pre_sleep_processing(void)
{
#if (CONFIG_LWIP_LAYER == 1)
lwip_PRE_SLEEP_PROCESSING();
#endif
}
#if CONFIG_WOWLAN
unsigned char *rltk_wlan_get_ip(int idx){
#if (CONFIG_LWIP_LAYER == 1)
return LwIP_GetIP(&xnetif[idx]);
#else
printf("rltk_wlan_get_ip\r\n");
return NULL;
#endif
}
unsigned char *rltk_wlan_get_gw(int idx){
#if (CONFIG_LWIP_LAYER == 1)
return LwIP_GetGW(&xnetif[idx]);
#else
printf("rltk_wlan_get_gw\r\n");
return NULL;
#endif
}
unsigned char *rltk_wlan_get_gwmask(int idx){
#if (CONFIG_LWIP_LAYER == 1)
return LwIP_GetMASK(&xnetif[idx]);
#else
printf("rltk_wlan_get_gwmask\r\n");
return NULL;
#endif
}
#endif

File diff suppressed because it is too large Load Diff