rel_1.6.0 init

This commit is contained in:
guocheng.kgc 2020-06-18 20:06:52 +08:00 committed by shengdong.dsd
commit 27b3e2883d
19359 changed files with 8093121 additions and 0 deletions

View file

@ -0,0 +1,617 @@
/*
* Copyright (C) 2015-2018 ASR Group Holding Limited
*/
#ifndef __LEGARTOS_H__
#define __LEGARTOS_H__
#include <k_api.h>
#include <ctype.h>
#include "port.h"
#define LEGA_NEVER_TIMEOUT (0xFFFFFFFF)
#define LEGA_WAIT_FOREVER (0xFFFFFFFF)
#define LEGA_NO_WAIT (0)
typedef enum
{
kNoErr=0,
kGeneralErr,
kTimeoutErr,
}OSStatus;
typedef enum
{
FALSE=0,
TRUE=1,
}OSBool;
typedef void * lega_semaphore_t;
typedef void * lega_mutex_t;
typedef void * lega_thread_t;
typedef void * lega_queue_t;
//typedef void * lega_event_t;// LEGA OS event: lega_semaphore_t, lega_mutex_t or lega_queue_t
typedef void (*timer_handler_t)( void* arg );
//typedef OSStatus (*event_handler_t)( void* arg );
typedef struct
{
void * handle;
timer_handler_t function;
void * arg;
}lega_timer_t;
typedef uint32_t lega_thread_arg_t;
typedef void (*lega_thread_function_t)( lega_thread_arg_t arg );
/** @defgroup LEGA_RTOS_Thread LEGA RTOS Thread Management Functions
* @brief Provide thread creation, delete, suspend, resume, and other RTOS management API
* @verbatim
* LEGA thread priority table
*
* +----------+-----------------+
* | Priority | Thread |
* |----------|-----------------|
* | 0 | LEGA | Highest priority
* | 1 | Network |
* | 2 | |
* | 3 | Network worker |
* | 4 | |
* | 5 | Default Library |
* | | Default worker |
* | 6 | |
* | 7 | Application |
* | 8 | |
* | 9 | Idle | Lowest priority
* +----------+-----------------+
* @endverbatim
* @{
*/
OSBool lega_rtos_is_in_interrupt_context(void);
/** @brief Creates and starts a new thread
*
* @param thread : Pointer to variable that will receive the thread handle (can be null)
* @param priority : A priority number.
* @param name : a text name for the thread (can be null)
* @param function : the main thread function
* @param stack_size : stack size for this thread
* @param arg : argument which will be passed to thread function
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_create_thread( lega_thread_t* thread, uint8_t priority, const char* name, lega_thread_function_t function, uint32_t stack_size, lega_thread_arg_t arg );
/** @brief Deletes a terminated thread
*
* @param thread : the handle of the thread to delete, , NULL is the current thread
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_delete_thread( lega_thread_t* thread );
/** @defgroup LEGA_RTOS_SEM LEGA RTOS Semaphore Functions
* @brief Provide management APIs for semaphore such as init,set,get and dinit.
* @{
*/
/** @brief Initialises a counting semaphore and set count to 0
*
* @param semaphore : a pointer to the semaphore handle to be initialised
* @param count : the max count number of this semaphore
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_init_semaphore( lega_semaphore_t* semaphore, int count );
/** @brief Set (post/put/increment) a semaphore
*
* @param semaphore : a pointer to the semaphore handle to be set
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_set_semaphore( lega_semaphore_t* semaphore );
/** @brief Get (wait/decrement) a semaphore
*
* @Details Attempts to get (wait/decrement) a semaphore. If semaphore is at zero already,
* then the calling thread will be suspended until another thread sets the
* semaphore with @ref lega_rtos_set_semaphore
*
* @param semaphore : a pointer to the semaphore handle
* @param timeout_ms: the number of milliseconds to wait before returning
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_get_semaphore( lega_semaphore_t* semaphore, uint32_t timeout_ms );
/** @brief De-initialise a semaphore
*
* @Details Deletes a semaphore created with @ref lega_rtos_init_semaphore
*
* @param semaphore : a pointer to the semaphore handle
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_deinit_semaphore( lega_semaphore_t* semaphore );
/**
* @}
*/
#define lega_rtos_declare_critical() CPSR_ALLOC()
/** @brief Enter a critical session, all interrupts are disabled
*
* @return none
*/
#define lega_rtos_enter_critical() RHINO_CRITICAL_ENTER()
//void lega_rtos_enter_critical( void );
/** @brief Exit a critical session, all interrupts are enabled
*
* @return none
*/
#define lega_rtos_exit_critical() RHINO_CRITICAL_EXIT()
//void lega_rtos_exit_critical( void );
/** @defgroup LEGA_RTOS_MUTEX LEGA RTOS Mutex Functions
* @brief Provide management APIs for Mutex such as init,lock,unlock and dinit.
* @{
*/
/** @brief Initialises a mutex
*
* @Details A mutex is different to a semaphore in that a thread that already holds
* the lock on the mutex can request the lock again (nested) without causing
* it to be suspended.
*
* @param mutex : a pointer to the mutex handle to be initialised
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_init_mutex( lega_mutex_t* mutex );
/** @brief Obtains the lock on a mutex
*
* @Details Attempts to obtain the lock on a mutex. If the lock is already held
* by another thead, the calling thread will be suspended until the mutex
* lock is released by the other thread.
*
* @param mutex : a pointer to the mutex handle to be locked
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_lock_mutex( lega_mutex_t* mutex, uint32_t timeout_ms );
/** @brief Releases the lock on a mutex
*
* @Details Releases a currently held lock on a mutex. If another thread
* is waiting on the mutex lock, then it will be resumed.
*
* @param mutex : a pointer to the mutex handle to be unlocked
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_unlock_mutex( lega_mutex_t* mutex );
/** @brief De-initialise a mutex
*
* @Details Deletes a mutex created with @ref lega_rtos_init_mutex
*
* @param mutex : a pointer to the mutex handle
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_deinit_mutex( lega_mutex_t* mutex );
/**
* @}
*/
/** @defgroup LEGA_RTOS_QUEUE LEGA RTOS FIFO Queue Functions
* @brief Provide management APIs for FIFO such as init,push,pop and dinit.
* @{
*/
/** @brief Initialises a FIFO queue
*
* @param queue : a pointer to the queue handle to be initialised
* @param name : a text string name for the queue (NULL is allowed)
* @param message_size : size in bytes of objects that will be held in the queue
* @param number_of_messages : depth of the queue - i.e. max number of objects in the queue
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_init_queue( lega_queue_t* queue, const char* name, uint32_t message_size, uint32_t number_of_messages );
/** @brief Pushes an object onto a queue
*
* @param queue : a pointer to the queue handle
* @param message : the object to be added to the queue. Size is assumed to be
* the size specified in @ref lega_rtos_init_queue
* @param timeout_ms: the number of milliseconds to wait before returning
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error or timeout occurred
*/
OSStatus lega_rtos_push_to_queue( lega_queue_t* queue, void* message, uint32_t timeout_ms );
/** @brief Pops an object off a queue
*
* @param queue : a pointer to the queue handle
* @param message : pointer to a buffer that will receive the object being
* popped off the queue. Size is assumed to be
* the size specified in @ref lega_rtos_init_queue , hence
* you must ensure the buffer is long enough or memory
* corruption will result
* @param timeout_ms: the number of milliseconds to wait before returning
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error or timeout occurred
*/
OSStatus lega_rtos_pop_from_queue( lega_queue_t* queue, void* message, uint32_t timeout_ms );
/** @brief De-initialise a queue created with @ref lega_rtos_init_queue
*
* @param queue : a pointer to the queue handle
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_deinit_queue( lega_queue_t* queue );
/** @brief Check if a queue is empty
*
* @param queue : a pointer to the queue handle
*
* @return true : queue is empty.
* @return false : queue is not empty.
*/
OSBool lega_rtos_is_queue_empty( lega_queue_t* queue );
/** @brief Check if a queue is full
*
* @param queue : a pointer to the queue handle
*
* @return true : queue is empty.
* @return false : queue is not empty.
*/
OSBool lega_rtos_is_queue_full( lega_queue_t* queue );
/**
* @}
*/
/** @defgroup LEGA_RTOS_TIMER LEGA RTOS Timer Functions
* @brief Provide management APIs for timer such as init,start,stop,reload and dinit.
* @{
*/
/**
* @brief Initialize a RTOS timer
*
* @note Timer does not start running until @ref lega_start_timer is called
*
* @param timer : a pointer to the timer handle to be initialised
* @param time_ms : Timer period in milliseconds
* @param function : the callback handler function that is called each time the
* timer expires
* @param arg : an argument that will be passed to the callback function
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_init_timer( lega_timer_t* timer, uint32_t time_ms, timer_handler_t function, void* arg );
/** @brief Starts a RTOS timer running
*
* @note Timer must have been previously initialised with @ref lega_rtos_init_timer
*
* @param timer : a pointer to the timer handle to start
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_start_timer( lega_timer_t* timer );
/** @brief Stops a running RTOS timer
*
* @note Timer must have been previously started with @ref lega_rtos_init_timer
*
* @param timer : a pointer to the timer handle to stop
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_stop_timer( lega_timer_t* timer );
/** @brief Reloads a RTOS timer that has expired
*
* @note This is usually called in the timer callback handler, to
* reschedule the timer for the next period.
*
* @param timer : a pointer to the timer handle to reload
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_reload_timer( lega_timer_t* timer );
/** @brief De-initialise a RTOS timer
*
* @note Deletes a RTOS timer created with @ref lega_rtos_init_timer
*
* @param timer : a pointer to the RTOS timer handle
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_deinit_timer( lega_timer_t* timer );
/** @brief Check if an RTOS timer is running
*
* @param timer : a pointer to the RTOS timer handle
*
* @return true : if running.
* @return false : if not running
*/
OSBool lega_rtos_is_timer_running( lega_timer_t* timer );
/**
* @brief Gets time in miiliseconds since RTOS start
*
* @note: Since this is only 32 bits, it will roll over every 49 days, 17 hours.
*
* @returns Time in milliseconds since RTOS started.
*/
uint32_t lega_rtos_get_time(void);
/**
* @}
*/
/** @brief Suspend current thread for a specific time
*
* @param num_ms : A time interval (Unit: millisecond)
*
* @return kNoErr.
*/
OSStatus lega_rtos_delay_milliseconds( uint32_t num_ms );
#define lega_rtos_malloc(s) _lega_rtos_malloc(s,__FUNCTION__,__LINE__)
void *_lega_rtos_malloc(uint32_t xWantedSize,const char * function,uint32_t line);
void lega_rtos_free(void *mem);
void lega_system_reset();
#if 0
/** @brief Creates a worker thread
*
* Creates a worker thread
* A worker thread is a thread in whose context timed and asynchronous events
* execute.
*
* @param worker_thread : a pointer to the worker thread to be created
* @param priority : thread priority
* @param stack_size : thread's stack size in number of bytes
* @param event_queue_size : number of events can be pushed into the queue
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_create_worker_thread( lega_worker_thread_t* worker_thread, uint8_t priority, uint32_t stack_size, uint32_t event_queue_size );
/** @brief Deletes a worker thread
*
* @param worker_thread : a pointer to the worker thread to be created
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_delete_worker_thread( lega_worker_thread_t* worker_thread );
/** @brief Suspend a thread
*
* @param thread : the handle of the thread to suspend, NULL is the current thread
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
void lega_rtos_suspend_thread(lega_thread_t* thread);
/** @brief Suspend all other thread
*
* @param none
*
* @return none
*/
void lega_rtos_suspend_all_thread(void);
/** @brief Rresume all other thread
*
* @param none
*
* @return none
*/
long lega_rtos_resume_all_thread(void);
/** @brief Sleeps until another thread has terminated
*
* @Details Causes the current thread to sleep until the specified other thread
* has terminated. If the processor is heavily loaded with higher priority
* tasks, this thread may not wake until significantly after the thread termination.
*
* @param thread : the handle of the other thread which will terminate
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_thread_join( lega_thread_t* thread );
/** @brief Forcibly wakes another thread
*
* @Details Causes the specified thread to wake from suspension. This will usually
* cause an error or timeout in that thread, since the task it was waiting on
* is not complete.
*
* @param thread : the handle of the other thread which will be woken
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_thread_force_awake( lega_thread_t* thread );
/** @brief Checks if a thread is the current thread
*
* @Details Checks if a specified thread is the currently running thread
*
* @param thread : the handle of the other thread against which the current thread
* will be compared
*
* @return true : specified thread is the current thread
* @return false : specified thread is not currently running
*/
OSBool lega_rtos_is_current_thread( lega_thread_t* thread );
/** @brief Print Thread status into buffer
*
* @param buffer, point to buffer to store thread status
* @param length, length of the buffer
*
* @return none
*/
OSStatus lega_rtos_print_thread_status( char* buffer, int length );
/**
* @}
*/
/** @defgroup LEGA_RTOS_EVENT LEGA RTOS Event Functions
* @{
*/
/**
* @brief Sends an asynchronous event to the associated worker thread
*
* @param worker_thread :the worker thread in which context the callback should execute from
* @param function : the callback function to be called from the worker thread
* @param arg : the argument to be passed to the callback function
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_send_asynchronous_event( lega_worker_thread_t* worker_thread, event_handler_t function, void* arg );
/** Requests a function be called at a regular interval
*
* This function registers a function that will be called at a regular
* interval. Since this is based on the RTOS time-slice scheduling, the
* accuracy is not high, and is affected by processor load.
*
* @param event_object : pointer to a event handle which will be initialised
* @param worker_thread : pointer to the worker thread in whose context the
* callback function runs on
* @param function : the callback function that is to be called regularly
* @param time_ms : the time period between function calls in milliseconds
* @param arg : an argument that will be supplied to the function when
* it is called
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_register_timed_event( lega_timed_event_t* event_object, lega_worker_thread_t* worker_thread, event_handler_t function, uint32_t time_ms, void* arg );
/** Removes a request for a regular function execution
*
* This function de-registers a function that has previously been set-up
* with @ref lega_rtos_register_timed_event.
*
* @param event_object : the event handle used with @ref lega_rtos_register_timed_event
*
* @return kNoErr : on success.
* @return kGeneralErr : if an error occurred
*/
OSStatus lega_rtos_deregister_timed_event( lega_timed_event_t* event_object );
/**
* @}
*/
int SetTimer(unsigned long ms, void (*psysTimerHandler)(void));
int SetTimer_uniq(unsigned long ms, void (*psysTimerHandler)(void));
int UnSetTimer(void (*psysTimerHandler)(void));
/** @brief Initialize an endpoint for a RTOS event, a file descriptor
* will be created, can be used for select
*
* @param event_handle : lega_semaphore_t, lega_mutex_t or lega_queue_t
*
* @retval On success, a file descriptor for RTOS event is returned.
* On error, -1 is returned.
*/
int lega_rtos_init_event_fd(lega_event_t event_handle);
/** @brief De-initialise an endpoint created from a RTOS event
*
* @param fd : file descriptor for RTOS event
*
* @retval 0 for success. On error, -1 is returned.
*/
int lega_rtos_deinit_event_fd(int fd);
/**
* @}
*/
#endif
#endif //__LEGARTOS_H__

View file

@ -0,0 +1,452 @@
/**
****************************************************************************************
*
* @file lega_wifi_api.h
*
* @brief WiFi API.
*
* Copyright (C) ASR
*
****************************************************************************************
*/
#ifndef _LEGA_WIFI_API_H_
#define _LEGA_WIFI_API_H_
#include <stdint.h>
#include "lega_cm4.h"
/**
* @brief wlan network interface enumeration definition.
*/
typedef enum {
SOFTAP, /*Act as an access point, and other station can connect, 4 stations Max*/
STA, /*Act as a station which can connect to an access point*/
} lega_wlan_type_e;
enum {
WLAN_DHCP_DISABLE = 0,
WLAN_DHCP_CLIENT,
WLAN_DHCP_SERVER,
};
typedef enum {
EVENT_STATION_UP = 1, /*used in station mode,
indicate station associated in open mode or 4-way-handshake done in WPA/WPA2*/
EVENT_STATION_DOWN, /*used in station mode, indicate station deauthed*/
EVENT_AP_UP, /*used in softap mode, indicate softap enabled*/
EVENT_AP_DOWN, /*used in softap mode, indicate softap disabled*/
} lega_wifi_event_e;
typedef enum {
CONNECT_SUCC,
CONNECT_SCAN_FAIL,
CONNECT_CONN_FAIL,
} lega_start_adv_results_e;
/**
* @brief Scan result using normal scan.
*/
typedef struct {
uint8_t is_scan_adv;
char ap_num; /**< The number of access points found in scanning. */
struct {
char ssid[32+1]; /*ssid max len:32. +1 is for '\0'. when ssidlen is 32 */
char ap_power; /**< Signal strength, min:0, max:100. */
char bssid[6]; /* The BSSID of an access point. */
char channel; /* The RF frequency, 1-13 */
uint8_t security; /* Security type, @ref wlan_sec_type_t */
} * ap_list;
} lega_wlan_scan_result_t;
typedef enum {
WLAN_SECURITY_OPEN, //NONE
WLAN_SECURITY_WEP, //WEP
WLAN_SECURITY_WPA, //WPA
WLAN_SECURITY_WPA2, //WPA2
WLAN_SECURITY_AUTO, //WPA or WPA2
WLAN_SECURITY_MAX,
} lega_wlan_security_e;
/*used in event callback of station mode, indicate softap informatino which is connected*/
typedef struct {
int rssi; /* rssi */
char ssid[32+1]; /* ssid max len:32. +1 is for '\0' when ssidlen is 32 */
char pwd[64+1]; /* pwd max len:64. +1 is for '\0' when pwdlen is 64 */
char bssid[6]; /* BSSID of the wlan needs to be connected.*/
char ssid_len; /*ssid length*/
char pwd_len; /*password length*/
char channel; /* wifi channel 0-13.*/
char security; /*refer to lega_wlan_security_e*/
} lega_wlan_ap_info_adv_t;
/*only used in station mode*/
typedef struct {
char dhcp; /* no use currently */
char macaddr[16]; /* mac address on the target wlan interface, ASCII*/
char ip[16]; /* Local IP address on the target wlan interface, ASCII*/
char gate[16]; /* Router IP address on the target wlan interface, ASCII */
char mask[16]; /* Netmask on the target wlan interface, ASCII*/
char dns[16]; /* no use currently , ASCII*/
char broadcastip[16]; /* no use currently , ASCII*/
} lega_wlan_ip_stat_t;
/*only used in station mode*/
typedef struct {
int is_connected; /* The link to wlan is established or not, 0: disconnected, 1: connected. */
int wifi_strength; /* Signal strength of the current connected AP */
char ssid[32+1]; /* ssid max len:32. +1 is for '\0'. when ssidlen is 32 */
char bssid[6]; /* BSSID of the current connected wlan */
int channel; /* Channel of the current connected wlan */
} lega_wlan_link_stat_t;
/*used in open cmd of hal_wifi_module_t*/
typedef struct {
char wifi_mode; /* refer to hal_wifi_type_t*/
char security; /* security mode */
char wifi_ssid[32]; /* in station mode, indicate SSID of the wlan needs to be connected.
in softap mode, indicate softap SSID*/
char wifi_key[64]; /* in station mode, indicate Security key of the wlan needs to be connected,
in softap mode, indicate softap password.(ignored in an open system.) */
char local_ip_addr[16]; /* used in softap mode to config ip for dut */
char net_mask[16]; /* used in softap mode to config gateway for dut */
char gateway_ip_addr[16]; /* used in softap mode to config netmask for dut */
char dns_server_ip_addr[16]; /* no use currently */
char dhcp_mode; /* no use currently */
char channel; /* softap channel in softap mode; connect channel in sta mode*/
char mac_addr[6]; /* connect bssid in sta mode*/
char reserved[32]; /* no use currently */
int wifi_retry_interval; /* no use currently */
int interval; /* used in softap mode to config beacon listen interval */
int hide; /* used in softap mode to config hidden SSID */
} lega_wlan_init_type_t;
/** @brief wifi init functin, user should call it before use any wifi cmd
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_init(void);
/** @brief wifi deinit functin, call it when donot use wifi any more to free resources
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_deinit(void);
/** @brief used in station and softap mode, open wifi cmd
*
* @param init_info : refer to lega_wlan_init_type_t
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_open(lega_wlan_init_type_t* init_info);
/** @brief used in station and softap mode, close wifi cmd
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_close(void);
/** @brief used in station mode, scan cmd
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_start_scan(void);
/** @brief used in station mode, scan cmd
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_start_scan_adv(void);
/** @brief used in station mode, scan cmd
*
* @param ssid : target ssid to scan
* @param is_scan_advance :scan to get bssid, channel and security
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_start_scan_active(const char *ssid, uint8_t is_scan_advance);
/** @brief used in station and softap mode, get mac address(in hex mode) of WIFI device
*
* @param mac_addr : pointer to get the mac address
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_get_mac_address(uint8_t *mac_addr);
/** @brief used in station and softap mode, set mac address for WIFI device
*
* @param mac_addr : src mac address pointer to set
*
*/
void lega_wlan_set_mac_address(uint8_t *mac_addr);
/** @brief used in station mode, get the ip information
*
* @param void
* @return NULL : error occurred.
* @return pointer : ip status got.
*/
lega_wlan_ip_stat_t * lega_wlan_get_ip_status(void);
/** @brief used in station mode, get link status information
*
* @param link_status : refer to lega_wlan_link_stat_t
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_get_link_status(lega_wlan_link_stat_t *link_status);
/** @brief used in station mode, get the associated ap information
*
* @param void
* @return NULL : error occurred.
* @return pointer : associated ap info got.
*/
lega_wlan_ap_info_adv_t *lega_wlan_get_associated_apinfo(void);
/*used in sniffer mode, open sniffer mode
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_start_monitor(void);
/*used in sniffer mode, close sniffer mode
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_stop_monitor(void);
/** @brief used in sniffer mode, set the sniffer channel, should call this cmd after call start_monitor cmd
*
* @param channel : WIFI channel(1-13)
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_monitor_set_channel(int channel);
/** @brief used to get current channel both in sta and ap mode
*
* @return 1-14 : channel number.
* @return 0 : no valid channel
*/
int lega_wlan_get_channel(void);
/** @brief used in sta mode, set the ps bc mc and listen interval, called before connect to ap.
*
* @param listen_bc_mc : true or false
* @param listen_interval :1, 3, 10
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_set_ps_options(uint8_t listen_bc_mc, uint16_t listen_interval);
/** @brief used in sta mode, set ps mode on/off
*
* @param ps_on : true or false
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_set_ps_mode(uint8_t ps_on);
/*when use monitor mode, user should register this type of callback function to get the received MPDU*/
typedef void (*monitor_cb_t)(uint8_t*data, int len, int rssi);
/*when use monitor-ap mode, user should register this type of callback function */
typedef void (*monitor_ap_cb_t)();
/** @brief used in sniffer mode, callback function to get received MPDU, should register before start_monitor
*
* @param fn : refer to monitor_data_cb_t
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_register_monitor_cb(monitor_cb_t fn);
/** @brief used in sniffer-ap mode, callback function for application
*
* @param fn : refer to monitor_ap_cb_t
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_register_monitor_ap_cb(monitor_ap_cb_t fn);
/* start adv callback function, notify the connect results*/
typedef void (*start_adv_cb_t)(lega_start_adv_results_e status);
/** @brief used in sta mode, callback function to notify the connecting results
*
* @param fn : refer to start_adv_cb_t
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_register_start_adv_cb(start_adv_cb_t fn);
/** @brief used in station mode or sniffer mode, call this cmd to send a MPDU constructed by user
*
* @param buf : mac header pointer of the MPDU
* @param len : length of the MPDU
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_send_raw_frame(uint8_t *buf, int len);
/*enable WIFI stack log, will be output by uart
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_start_debug_mode(void);
/*disable WIFI stack log
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_stop_debug_mode(void);
/*
* The event callback function called at specific wifi events occurred by wifi stack.
* user should register these callback if want to use the informatin.
*
* @note For HAL implementors, these callbacks must be
* called under normal task context, not from interrupt.
*/
typedef void (*lega_wlan_cb_ip_got)(lega_wlan_ip_stat_t *ip_status);
/** @brief used in station mode, WIFI stack call this cb when get ip
*
* @param fn : cb function type, refer to lega_wlan_ip_stat_t
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_ip_got_cb_register(lega_wlan_cb_ip_got fn);
typedef void (*lega_wlan_cb_stat_chg)(lega_wifi_event_e wlan_event);
/** @brief used in station and softap mode,
* WIFI stack call this cb when status change, refer to lega_wifi_event_e
*
* @param fn : cb function type
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_stat_chg_cb_register(lega_wlan_cb_stat_chg fn);
typedef void (*lega_wlan_cb_scan_compeleted)(lega_wlan_scan_result_t *result);
/** @brief used in station mode,
* WIFI stack call this cb when scan complete
*
* @param fn : cb function type
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_scan_compeleted_cb_register(lega_wlan_cb_scan_compeleted fn);
typedef void (*lega_wlan_cb_associated_ap)(lega_wlan_ap_info_adv_t *ap_info);
/** @brief used in station mode,
* WIFI stack call this cb when associated with an AP, and tell the AP information
*
* @param fn : cb function type
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_associated_ap_cb_register(lega_wlan_cb_associated_ap fn);
/** @brief calibration RCO clock for RTC
*
*/
void lega_drv_rco_cal(void);
/** @brief config to close DCDC PFM mode
*
*/
void lega_drv_close_dcdc_pfm(void);
/** @brief config to support smartconfig in MIMO scenario
*
*/
void lega_wlan_smartconfig_mimo_enable(void);
/** @brief set country code to update country code, different country may have different channel list
* called after hal_wifi_init
*/
void lega_wlan_set_country_code(char *country);
/** @brief start monitor and ap coexist mode
*
* @param init_info : refer to lega_wlan_init_type_t
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_start_monitor_ap(lega_wlan_init_type_t* init_info);
/** @brief stop monitor and ap coexist mode
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_stop_monitor_ap();
/** @brief get current temperature (C degree)
* called after hal_wifi_init
*
* @param p_temp : input param to get temperature, memory managed by caller
*
* @return 0 : on success.
* @return other : error occurred
*/
int16_t lega_rf_get_temperature(int16_t *p_temp);
/* temperature get callback function, notify the current temperature*/
typedef void (*temperature_get_cb_t)(int16_t temperature);
/** @brief set the timer to get temperature (in second)
* called after hal_wifi_init
*
* @param timer_in_sec : the timer in second
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_set_temperature_get_timer(uint64_t timer_in_sec);
/** @brief register the temperature get callback function
* called after hal_wifi_init
*
* @param func : the function will called to notify the temperature.
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_register_temperature_get_cb(temperature_get_cb_t func);
/* efuse info update callback function, pass customer efuse info to ASR*/
typedef void (*efuse_info_update_cb_t)(efuse_info_t *efuse_info);
/** @brief register the efuse info update callback function if efuse layout not same as ASR
* called before hal_wifi_init
*
* @param func : the function will be called to pass customer efuse info to ASR.
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_register_efuse_info_update_cb(efuse_info_update_cb_t func);
#endif //_LEGA_WIFI_API_H_

View file

@ -0,0 +1,64 @@
#ifndef _LEGA_WIFI_API_AOS_H_
#define _LEGA_WIFI_API_AOS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "lega_wlan_api.h"
typedef enum
{
WLAN_EVENT_SCAN_COMPLETED,
WLAN_EVENT_ASSOCIATED,
WLAN_EVENT_CONNECTED,
WLAN_EVENT_IP_GOT,
WLAN_EVENT_DISCONNECTED,
WLAN_EVENT_AP_UP,
WLAN_EVENT_AP_DOWN,
WLAN_EVENT_MAX,
}lega_wlan_event_e;
/**
* @brief Input network precise paras in lega_wlan_start_adv function.
*/
typedef struct
{
lega_wlan_ap_info_adv_t ap_info; /**< @ref apinfo_adv_t. */
char key[64]; /**< Security key or PMK of the wlan. */
int key_len; /**< The length of the key. */
char local_ip_addr[16]; /**< Static IP configuration, Local IP address. */
char net_mask[16]; /**< Static IP configuration, Netmask. */
char gateway_ip_addr[16]; /**< Static IP configuration, Router IP address. */
char dns_server_ip_addr[16]; /**< Static IP configuration, DNS server IP address. */
char dhcp_mode; /**< DHCP mode, @ref DHCP_Disable, @ref DHCP_Client and @ref DHCP_Server. */
char reserved[32];
int wifi_retry_interval; /**< Retry interval if an error is occured when connecting an access point,
time unit is millisecond. */
} lega_wlan_init_info_adv_st;
/** @brief used in station and softap mode, get mac address(in char mode) of WIFI device
*
* @param mac_addr : pointer to get the mac address
*
* @return 0 : on success.
* @return other : error occurred
*/
int lega_wlan_get_mac_address_inchar(char *puc_mac);
int lega_wlan_suspend_sta(void);
int lega_wlan_suspend_ap(void);
int lega_wlan_suspend(void);
void lega_wlan_register_mgmt_monitor_cb(monitor_cb_t fn);
/*Wifi event callback interface
*
* @return void
*/
extern void wifi_event_cb(lega_wlan_event_e evt, void* info);
#ifdef __cplusplus
}
#endif
#endif //_LEGA_WIFI_API_AOS_H_

View file

@ -0,0 +1,108 @@
/*
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Adam Dunkels <adam@sics.se>
*
*/
#ifndef __CC_H__
#define __CC_H__
#include "stdio.h"
#include "stdlib.h"
#include <sys/time.h>
#define LWIP_MAILBOX_QUEUE 1
#define LWIP_TIMEVAL_PRIVATE 0
#define LWIP_NO_INTTYPES_H 1
#if LWIP_NO_INTTYPES_H
#define X8_F "02x"
#define U16_F "u"
#define S16_F "d"
#define X16_F "x"
#define U32_F "u"
#define S32_F "d"
#define X32_F "x"
#define SZT_F U32_F
#endif
/* define compiler specific symbols */
#if defined (__ICCARM__)
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_STRUCT
#define PACK_STRUCT_END
#define PACK_STRUCT_FIELD(x) x
#define PACK_STRUCT_USE_INCLUDES
#elif defined (__CC_ARM)
#define PACK_STRUCT_BEGIN __packed
#define PACK_STRUCT_STRUCT
#define PACK_STRUCT_END
#define PACK_STRUCT_FIELD(x) x
#elif defined (__GNUC__)
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_STRUCT __attribute__ ((packed))
#define PACK_STRUCT_END
#define PACK_STRUCT_FIELD(x) x
#elif defined (__TASKING__)
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_STRUCT
#define PACK_STRUCT_END
#define PACK_STRUCT_FIELD(x) x
#endif
#ifndef LWIP_PLATFORM_ASSERT
#define LWIP_PLATFORM_ASSERT(x) \
do \
{ printf("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__); \
} while(0)
#endif
#ifndef LWIP_PLATFORM_DIAG
#define LWIP_PLATFORM_DIAG(x) do {printf x ;} while(0)
#endif
// cup byte order
#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#define LWIP_RAND() ((u32_t)rand())
#endif /* __CC_H__ */

View file

@ -0,0 +1,322 @@
/**
* @file
*
* lwIP Options Configuration
*/
/*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Adam Dunkels <adam@sics.se>
*
*/
#ifndef LWIP_LWIPOPTS_H
#define LWIP_LWIPOPTS_H
#include "lwip/arch.h"
#define LWIP_NETIF_API 1
#define LWIP_PRIVATE_FD_SET
/**
* Include user defined options first. Anything not defined in these files
* will be set to standard values. Override anything you dont like!
*/
#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1
/*
-------------- NO SYS --------------
*/
#define NO_SYS 0
#define SYS_LIGHTWEIGHT_PROT (NO_SYS == 0)
#ifndef LWIP_NETIF_API
#define LWIP_NETIF_API 1
#endif
/*
---------- Memory options ----------
*/
#define MEM_ALIGNMENT 4
#define MEM_SIZE (3*1024) //(10*1024)
#define MEM_LIBC_MALLOC 1
#if MEM_LIBC_MALLOC
#include <aos/kernel.h>
#define mem_clib_malloc aos_malloc
#define mem_clib_free aos_free
#define mem_clib_calloc(n, m) aos_zalloc( (n) * (m) )
#endif
#define MEMP_MEM_MALLOC 1
#define MEMP_OVERFLOW_CHECK 1
/*
---------- Internal Memory Pool Sizes ----------
*/
#define MEMP_NUM_PBUF 8
#define MEMP_NUM_RAW_PCB 8
#define MEMP_NUM_UDP_PCB 8
#define MEMP_NUM_TCP_PCB 8
#define MEMP_NUM_TCP_PCB_LISTEN 8
#define MEMP_NUM_TCP_SEG 12
#define MEMP_NUM_REASSDATA 4
#define MEMP_NUM_FRAG_PBUF 8
#define MEMP_NUM_ARP_QUEUE 8
#define MEMP_NUM_NETBUF 8
#define MEMP_NUM_NETCONN 10
#define MEMP_NUM_TCPIP_MSG_API 8
#define MEMP_NUM_TCPIP_MSG_INPKT 12
#define PBUF_POOL_SIZE 10
/*
---------- ARP options ----------
*/
#define LWIP_ARP 1
/*
---------- IP options ----------
*/
#define LWIP_IPV4 1
#define LWIP_IPV6 0
#define IP_FORWARD 0
#define IP_OPTIONS_ALLOWED 1
#define IP_REASSEMBLY 0
#define IP_FRAG 0
#define IP_REASS_MAXAGE 3
#define IP_REASS_MAX_PBUFS 4
#define IP_FRAG_USES_STATIC_BUF 0
#define IP_DEFAULT_TTL 255
/*
---------- ICMP options ----------
*/
#define LWIP_ICMP 1
#define LWIP_ICMP6 1
#define CHECKSUM_CHECK_ICMP6 0
#define LWIP_MULTICAST_PING 1
/*
---------- RAW options ----------
*/
#define LWIP_RAW 1
/*
---------- DHCP options ----------
*/
#define LWIP_DHCP 1
#define LWIP_NETIF_STATUS_CALLBACK 1
#define DHCP_DOES_ARP_CHECK 0
/*
---------- AUTOIP options ----------
*/
#define LWIP_AUTOIP 0
/*
---------- SNMP options ----------
*/
#define LWIP_SNMP 0
/*
---------- IGMP options ----------
*/
#define LWIP_IGMP 1
/*
---------- DNS options -----------
*/
#define LWIP_DNS 1
/*
---------- UDP options ----------
*/
#define LWIP_UDP 1
/*
---------- TCP options ----------
*/
#define LWIP_TCP 1
#define LWIP_LISTEN_BACKLOG 0
#define TCP_MSS 1460 //1792
#define TCP_WND (2 * TCP_MSS)
#define TCP_SND_BUF (4 * TCP_MSS)
#define TCP_MAXRTX 12
#define TCP_SYNMAXRTX 12
/*
---------- Pbuf options ----------
*/
#define PBUF_LINK_HLEN 16
//#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
#define PBUF_POOL_BUFSIZE 512 //1500
/*
---------- Network Interfaces options ----------
*/
#ifdef CHECKSUM_BY_HARDWARE
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
#define CHECKSUM_GEN_IP 0
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
#define CHECKSUM_GEN_UDP 0
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
#define CHECKSUM_GEN_TCP 0
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
#define CHECKSUM_CHECK_IP 0
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
#define CHECKSUM_CHECK_UDP 0
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
#define CHECKSUM_CHECK_TCP 0
#define CHECKSUM_GEN_ICMP 0
#else
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
#define CHECKSUM_GEN_IP 1
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
#define CHECKSUM_GEN_UDP 1
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
#define CHECKSUM_GEN_TCP 1
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
#define CHECKSUM_CHECK_IP 1
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
#define CHECKSUM_CHECK_UDP 1
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
#define CHECKSUM_CHECK_TCP 1
#endif
/*
---------- LOOPIF options ----------
*/
#define LWIP_NETIF_LOOPBACK 1
#define LWIP_HAVE_LOOPIF 1
#define LWIP_NETIF_LOOPBACK_MULTITHREADING 1
#define LWIP_LOOPBACK_MAX_PBUFS 8
/*
---------- Thread options ----------
*/
#define TCPIP_MBOX_SIZE 60
#define DEFAULT_ACCEPTMBOX_SIZE 10
#define DEFAULT_RAW_RECVMBOX_SIZE 10
#define DEFAULT_UDP_RECVMBOX_SIZE 20
#define DEFAULT_TCP_RECVMBOX_SIZE 10
#define LWIP_TCPIP_CORE_LOCKING 0
#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
#define ETHIF_IN_TASK_STACKSIZE 512 /* unit 4 byte */
#define ETHIF_IN_TASK_PRIO 10
#define TCPIP_THREAD_STACKSIZE 2048//10240/* unit 4 byte */
#define TCPIP_THREAD_PRIO 4//0
/*
---------- Sequential layer options ----------
*/
#define LWIP_NETCONN 8
/*
---------- Socket options ----------
*/
#define LWIP_SOCKET 1
#define LWIP_COMPAT_SOCKETS 1
#define LWIP_POSIX_SOCKETS_IO_NAMES 1
#if !defined(FD_SET) && defined(RHINO_CONFIG_VFS_DEV_NODES)
#define LWIP_SOCKET_OFFSET RHINO_CONFIG_VFS_DEV_NODES
#endif
#define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVTIMEO 1
#define SO_REUSE 1
/*
---------- Statistics options ----------
*/
#define LWIP_STATS 1
#define LWIP_STATS_DISPLAY 1
/*
---------- Checksum options ----------
*/
/*
---------- IPv6 options ---------------
*/
/*
---------- Hook options ---------------
*/
#ifdef CONFIG_AOS_MESH
#define LWIP_DECLARE_HOOK \
struct netif *lwip_hook_ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest); \
int lwip_hook_mesh_is_mcast_subscribed(const ip6_addr_t *dest);
#define LWIP_HOOK_IP6_ROUTE(src, dest) lwip_hook_ip6_route(src, dest)
#define LWIP_HOOK_MESH_IS_MCAST_SUBSCRIBED(dest) lwip_hook_mesh_is_mcast_subscribed(dest)
#endif
/*
---------- Debugging options ----------
*/
//#define LWIP_DEBUG 1
#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
#define MEM_DEBUG LWIP_DBG_OFF
#define MEMP_DEBUG LWIP_DBG_OFF
#define PBUF_DEBUG LWIP_DBG_OFF
#define API_LIB_DEBUG LWIP_DBG_ON
#define API_MSG_DEBUG LWIP_DBG_ON
#define TCPIP_DEBUG LWIP_DBG_OFF
#define NETIF_DEBUG LWIP_DBG_OFF
#define SOCKETS_DEBUG LWIP_DBG_ON
#define IP_DEBUG LWIP_DBG_OFF
#define IP_REASS_DEBUG LWIP_DBG_OFF
#define RAW_DEBUG LWIP_DBG_OFF
#define ICMP_DEBUG LWIP_DBG_OFF
#define UDP_DEBUG LWIP_DBG_OFF
#define TCP_DEBUG LWIP_DBG_OFF
#define TCP_INPUT_DEBUG LWIP_DBG_ON
#define TCP_OUTPUT_DEBUG LWIP_DBG_ON
#define TCP_RTO_DEBUG LWIP_DBG_OFF
#define TCP_CWND_DEBUG LWIP_DBG_OFF
#define TCP_WND_DEBUG LWIP_DBG_OFF
#define TCP_FR_DEBUG LWIP_DBG_OFF
#define TCP_QLEN_DEBUG LWIP_DBG_OFF
#define TCP_RST_DEBUG LWIP_DBG_OFF
/*
---------- Performance tracking options ----------
*/
/*
---------- PPP options ----------
*/
#define PPP_SUPPORT 0
#define LWIP_NETCONN_SEM_PER_THREAD 1
#endif /* LWIP_LWIPOPTS_H */

View file

@ -0,0 +1,23 @@
/**
******************************************************************************
*
* @file system_version.h
*
* @brief lega version info provide
*
* Copyright (C) ASR
*
******************************************************************************
*/
#ifndef __SYSTEM_VERSION_H__
#define __SYSTEM_VERSION_H__
/**
* Get wifi version.
*
* @return wifi version success, 0 failure.
*/
const char *lega_get_wifi_version(void);
#endif //__SYSTEM_VERSION_H__