mirror of
https://github.com/sengeiou/realtek_ameba_mp_sdk.git
synced 2026-04-05 21:15:23 +00:00
ameba micropython sdk first commit
This commit is contained in:
commit
8508ee6139
5619 changed files with 1874619 additions and 0 deletions
5
sdk/component/common/api/at_cmd/atcmd_bt.h
Normal file
5
sdk/component/common/api/at_cmd/atcmd_bt.h
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef __ATCMD_BT_H__
|
||||
#define __ATCMD_BT_H__
|
||||
|
||||
#endif /* __ATCMD_BT_H__ */
|
||||
|
||||
12
sdk/component/common/api/at_cmd/atcmd_bt_ivt.h
Normal file
12
sdk/component/common/api/at_cmd/atcmd_bt_ivt.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __ATCMD_BT_IVT_H__
|
||||
#define __ATCMD_BT_IVT_H__
|
||||
#include "bt_gatt.h"
|
||||
#include "bt_spp.h"
|
||||
|
||||
extern tBT_GattConnIF bt_peer_conn_if;
|
||||
extern tBT_SppConnIF spp_conn_if;
|
||||
extern tBT_GattConnIF gatt_initiator_conn;
|
||||
extern tBT_SppConnIF spp_client_conn;
|
||||
extern tBT_AddressStru bt_paring_dev;
|
||||
|
||||
#endif /* __ATCMD_BT_IVT_H__ */
|
||||
18
sdk/component/common/api/at_cmd/atcmd_fs.h
Normal file
18
sdk/component/common/api/at_cmd/atcmd_fs.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef __ATCMD_FS_H__
|
||||
#define __ATCMD_FS_H__
|
||||
|
||||
#include "diag.h"
|
||||
#define RTW_ENABLE_FATFS_INFO
|
||||
|
||||
#ifdef RTW_ENABLE_FATFS_INFO
|
||||
#define AT_INFO(fmt, args...) DBG_8195A("\r\n" fmt,## args)
|
||||
#define AT_ERROR(fmt, args...) DBG_8195A("\r\n" fmt,## args)
|
||||
#define AT_WARN(fmt, args...) DBG_8195A("\r\n" fmt,## args)
|
||||
#else
|
||||
#define AT_INFO(fmt, args...)
|
||||
#define AT_ERROR(fmt, args...) DBG_8195A("\r\n" fmt,## args)
|
||||
#define AT_WARN(fmt, args...)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
0
sdk/component/common/api/at_cmd/atcmd_haier.h
Normal file
0
sdk/component/common/api/at_cmd/atcmd_haier.h
Normal file
5
sdk/component/common/api/at_cmd/atcmd_internal.h
Normal file
5
sdk/component/common/api/at_cmd/atcmd_internal.h
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef __ATCMD_SYS_H__
|
||||
#define __ATCMD_SYS_H__
|
||||
|
||||
|
||||
#endif
|
||||
106
sdk/component/common/api/at_cmd/atcmd_lwip.h
Normal file
106
sdk/component/common/api/at_cmd/atcmd_lwip.h
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
#ifndef __ATCMD_LWIP_H__
|
||||
#define __ATCMD_LWIP_H__
|
||||
|
||||
#include "main.h"
|
||||
#include "osdep_service.h"
|
||||
#include <lwip/opt.h>
|
||||
#include "lwip/sockets.h"
|
||||
#include "lwip/api.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/igmp.h"
|
||||
#include "lwip/inet.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/raw.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/netdb.h"
|
||||
#include "lwip_netconf.h"
|
||||
|
||||
#define _AT_TRANSPORT_MODE_ "ATP1"
|
||||
#define _AT_TRANSPORT_LOCAL_PORT_ "ATP2"
|
||||
#define _AT_TRANSPORT_REMOTE_IP_ "ATP3"
|
||||
#define _AT_TRANSPORT_REMOTE_PORT_ "ATP4"
|
||||
#define _AT_TRANSPORT_START_SERVER_ "ATP5"
|
||||
#define _AT_TRANSPORT_START_CLIENT_ "ATP6"
|
||||
#define _AT_TRANSPORT_SHOW_SETTING_ "ATP?"
|
||||
#define _AT_TRANSPORT_RECEIVE_DATA_ "ATR0"
|
||||
#define _AT_TRANSPORT_RECEIVE_PACKET_SIZE_ "ATR1"
|
||||
#define _AT_TRANSPORT_WRITE_DATA_ "ATRA"
|
||||
#define _AT_TRANSPORT_WRITE_PACKET_SIZE_ "ATRB"
|
||||
|
||||
#define NODE_MODE_TCP 0
|
||||
#define NODE_MODE_UDP 1
|
||||
#define NODE_MODE_SSL 2
|
||||
|
||||
#define NODE_ROLE_SERVER 0
|
||||
#define NODE_ROLE_CLIENT 1
|
||||
#define NODE_ROLE_SEED 2
|
||||
|
||||
#define INVALID_SOCKET_ID (-1)
|
||||
|
||||
//parameters
|
||||
#ifndef NET_IF_NUM
|
||||
#define NET_IF_NUM 2
|
||||
#endif
|
||||
|
||||
#define ATCMD_LWIP_TASK_PRIORITY (tskIDLE_PRIORITY + 1)
|
||||
|
||||
#if ATCMD_VER == ATVER_2
|
||||
|
||||
#ifndef ATCMD_SUPPORT_SSL
|
||||
#define ATCMD_SUPPORT_SSL 0
|
||||
#endif
|
||||
|
||||
#define SERVER "127.0.0.1"
|
||||
|
||||
#define NUM_NS (MEMP_NUM_NETCONN) //maximum number of node and seed, same as NUM_SOCKETS
|
||||
|
||||
#define ETH_MAX_MTU 1500
|
||||
|
||||
#define INVALID_CON_ID (-1)
|
||||
|
||||
#define RECV_SELECT_TIMEOUT_SEC (0)
|
||||
#define RECV_SELECT_TIMEOUT_USEC (20000) //20ms
|
||||
|
||||
typedef struct ns
|
||||
{
|
||||
int con_id;
|
||||
int sockfd;
|
||||
s8_t role;
|
||||
int protocol;
|
||||
u32_t addr;
|
||||
u16_t port;
|
||||
u32_t local_addr;
|
||||
u16_t local_port;
|
||||
xTaskHandle handletask;
|
||||
struct ns* next;
|
||||
struct ns* nextseed;
|
||||
#if (ATCMD_VER == ATVER_2) && ATCMD_SUPPORT_SSL
|
||||
void *context;
|
||||
#endif
|
||||
} node;
|
||||
|
||||
extern xTaskHandle atcmd_lwip_tt_task;
|
||||
extern _sema atcmd_lwip_tt_sema;
|
||||
extern volatile int atcmd_lwip_tt_datasize;
|
||||
extern volatile int atcmd_lwip_tt_lasttickcnt;
|
||||
#define ATCMD_LWIP_TT_MAX_DELAY_TIME_MS (20) //transparent transmission interval
|
||||
|
||||
extern int atcmd_lwip_is_tt_mode(void);
|
||||
extern void atcmd_lwip_set_tt_mode(int enable);
|
||||
int atcmd_lwip_send_data(node *curnode, u8 *data, u16 data_sz, struct sockaddr_in cli_addr);
|
||||
int atcmd_lwip_receive_data(node *curnode, u8 *buffer, u16 buffer_size, int *recv_size,
|
||||
u8_t *udp_clientaddr, u16_t *udp_clientport);
|
||||
node* create_node(int mode, s8_t role);
|
||||
void init_node_pool(void);
|
||||
void delete_node(node *n);
|
||||
int hang_node(node* insert_node);
|
||||
int hang_seednode(node* main_node ,node* insert_node);
|
||||
node *seek_node(int con_id);
|
||||
node *tryget_node(int n);
|
||||
void atcmd_lwip_set_rx_buffer(unsigned char *buf, int bufsize);
|
||||
#endif
|
||||
|
||||
|
||||
#endif //#ifndef __ATCMD_LWIP_H__
|
||||
14
sdk/component/common/api/at_cmd/atcmd_mp.h
Normal file
14
sdk/component/common/api/at_cmd/atcmd_mp.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef __ATCMD_MP_H__
|
||||
#define __ATCMD_MP_H__
|
||||
|
||||
#define CONFIG_ATCMD_MP_EXT0 0 //support MP ext0 AT command
|
||||
#define CONFIG_ATCMD_MP_EXT1 0 //support MP ext1 AT command
|
||||
#define CONFIG_ATCMD_MP_EXT2 1 //support MP ext2 AT command
|
||||
|
||||
typedef struct _at_command_mp_ext_item_{
|
||||
char *mp_ext_cmd;
|
||||
int (*mp_ext_fun)(void **argv, int argc);
|
||||
char *mp_ext_usage;
|
||||
}at_mp_ext_item_t;
|
||||
|
||||
#endif
|
||||
5
sdk/component/common/api/at_cmd/atcmd_sys.h
Normal file
5
sdk/component/common/api/at_cmd/atcmd_sys.h
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef __ATCMD_SYS_H__
|
||||
#define __ATCMD_SYS_H__
|
||||
|
||||
|
||||
#endif
|
||||
253
sdk/component/common/api/at_cmd/atcmd_wifi.h
Normal file
253
sdk/component/common/api/at_cmd/atcmd_wifi.h
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
#ifndef __ATCMD_WIFI_H__
|
||||
#define __ATCMD_WIFI_H__
|
||||
#include "main.h"
|
||||
#include "lwip_netconf.h"
|
||||
|
||||
#ifndef WLAN0_NAME
|
||||
#define WLAN0_NAME "wlan0"
|
||||
#endif
|
||||
#ifndef WLAN1_NAME
|
||||
#define WLAN1_NAME "wlan1"
|
||||
#endif
|
||||
/* Give default value if not defined */
|
||||
#ifndef NET_IF_NUM
|
||||
#ifdef CONFIG_CONCURRENT_MODE
|
||||
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN) + 1)
|
||||
#else
|
||||
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN))
|
||||
#endif // end of CONFIG_CONCURRENT_MODE
|
||||
#endif // end of NET_IF_NUM
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#ifndef IP_ADDR0
|
||||
#define IP_ADDR0 192
|
||||
#define IP_ADDR1 168
|
||||
#define IP_ADDR2 1
|
||||
#define IP_ADDR3 80
|
||||
#endif
|
||||
|
||||
/*NETMASK*/
|
||||
#ifndef NETMASK_ADDR0
|
||||
#define NETMASK_ADDR0 255
|
||||
#define NETMASK_ADDR1 255
|
||||
#define NETMASK_ADDR2 255
|
||||
#define NETMASK_ADDR3 0
|
||||
#endif
|
||||
|
||||
/*Gateway Address*/
|
||||
#ifndef GW_ADDR0
|
||||
#define GW_ADDR0 192
|
||||
#define GW_ADDR1 168
|
||||
#define GW_ADDR2 1
|
||||
#define GW_ADDR3 1
|
||||
#endif
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#ifndef AP_IP_ADDR0
|
||||
#define AP_IP_ADDR0 192
|
||||
#define AP_IP_ADDR1 168
|
||||
#define AP_IP_ADDR2 43
|
||||
#define AP_IP_ADDR3 1
|
||||
#endif
|
||||
|
||||
/*NETMASK*/
|
||||
#ifndef AP_NETMASK_ADDR0
|
||||
#define AP_NETMASK_ADDR0 255
|
||||
#define AP_NETMASK_ADDR1 255
|
||||
#define AP_NETMASK_ADDR2 255
|
||||
#define AP_NETMASK_ADDR3 0
|
||||
#endif
|
||||
|
||||
/*Gateway Address*/
|
||||
#ifndef AP_GW_ADDR0
|
||||
#define AP_GW_ADDR0 192
|
||||
#define AP_GW_ADDR1 168
|
||||
#define AP_GW_ADDR2 43
|
||||
#define AP_GW_ADDR3 1
|
||||
#endif
|
||||
|
||||
#if (defined(CONFIG_EXAMPLE_UART_ATCMD) && (CONFIG_EXAMPLE_UART_ATCMD))
|
||||
#include "wifi_structures.h"
|
||||
#include <wlan_fast_connect/example_wlan_fast_connect.h>
|
||||
typedef struct _UART_LOG_CONF_{
|
||||
u32 BaudRate;
|
||||
u8 DataBits;
|
||||
u8 StopBits;
|
||||
u8 Parity;
|
||||
u8 FlowControl;
|
||||
}UART_LOG_CONF, *PUART_LOG_CONF;
|
||||
|
||||
#define ATCMD_WIFI_CONN_STORE_MAX_NUM (1)
|
||||
struct atcmd_wifi_conf{
|
||||
int32_t auto_enable;
|
||||
rtw_wifi_setting_t setting;
|
||||
int32_t reconn_num;
|
||||
int32_t reconn_last_index;
|
||||
struct wlan_fast_reconnect reconn[ATCMD_WIFI_CONN_STORE_MAX_NUM];
|
||||
};
|
||||
|
||||
#define ATCMD_LWIP_CONN_STORE_MAX_NUM (1)
|
||||
struct atcmd_lwip_conn_info{
|
||||
int32_t role; //client, server or seed
|
||||
uint32_t protocol; //tcp or udp
|
||||
uint32_t remote_addr; //remote ip
|
||||
uint32_t remote_port; //remote port
|
||||
uint32_t local_addr; //locale ip, not used yet
|
||||
uint32_t local_port; //locale port, not used yet
|
||||
uint32_t reserved; //reserve for further use
|
||||
};
|
||||
struct atcmd_lwip_conf {
|
||||
int32_t enable; //enable or not
|
||||
int32_t conn_num;
|
||||
int32_t last_index;
|
||||
int32_t reserved; //reserve for further use
|
||||
struct atcmd_lwip_conn_info conn[ATCMD_LWIP_CONN_STORE_MAX_NUM];
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
AT_PARTITION_ALL = 0,
|
||||
AT_PARTITION_UART = 1,
|
||||
AT_PARTITION_WIFI = 2,
|
||||
AT_PARTITION_LWIP = 3
|
||||
} AT_PARTITION;
|
||||
|
||||
typedef enum {
|
||||
AT_PARTITION_READ = 0,
|
||||
AT_PARTITION_WRITE = 1,
|
||||
AT_PARTITION_ERASE = 2
|
||||
} AT_PARTITION_OP;
|
||||
|
||||
//first segment for uart
|
||||
#if !defined(UART_SETTING_BACKUP_SECTOR)
|
||||
#define UART_SETTING_BACKUP_SECTOR (0x8000)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8721D)
|
||||
#define UART_SETTING_BACKUP_SECTOR (0x2000)
|
||||
#endif
|
||||
|
||||
#define UART_CONF_DATA_OFFSET (0)
|
||||
#define UART_CONF_DATA_SIZE ((((sizeof(UART_LOG_CONF)-1)>>2) + 1)<<2)
|
||||
|
||||
//second segment for wifi config
|
||||
#define WIFI_CONF_DATA_OFFSET (UART_CONF_DATA_OFFSET+UART_CONF_DATA_SIZE)
|
||||
#define WIFI_CONF_DATA_SIZE ((((sizeof(struct atcmd_wifi_conf)-1)>>2) + 1)<<2)
|
||||
|
||||
//fouth segment for lwip config
|
||||
#define LWIP_CONF_DATA_OFFSET (WIFI_CONF_DATA_OFFSET+WIFI_CONF_DATA_SIZE)
|
||||
#define LWIP_CONF_DATA_SIZE ((((sizeof(struct atcmd_lwip_conf)-1)>>2) + 1)<<2)
|
||||
|
||||
extern void atcmd_update_partition_info(AT_PARTITION id, AT_PARTITION_OP ops, u8 *data, u16 len);
|
||||
|
||||
#define ATSTRING_LEN (LOG_SERVICE_BUFLEN)
|
||||
extern char at_string[ATSTRING_LEN];
|
||||
|
||||
extern unsigned char gAT_Echo; // default echo on
|
||||
//extern void uart_at_lock(void);
|
||||
//extern void uart_at_unlock(void);
|
||||
extern void uart_at_send_string(char *str);
|
||||
extern void uart_at_send_buf(u8 *buf, u32 len);
|
||||
|
||||
#define at_printf(fmt, args...) do{\
|
||||
/*uart_at_lock();*/\
|
||||
snprintf(at_string, ATSTRING_LEN, fmt, ##args); \
|
||||
uart_at_send_string(at_string);\
|
||||
/*uart_at_unlock();*/\
|
||||
}while(0)
|
||||
#define at_print_data(data, size) do{\
|
||||
/*uart_at_lock();*/\
|
||||
uart_at_send_buf(data, size);\
|
||||
/*uart_at_unlock();*/\
|
||||
}while(0)
|
||||
|
||||
#elif (defined(CONFIG_EXAMPLE_SPI_ATCMD) && (CONFIG_EXAMPLE_SPI_ATCMD))
|
||||
|
||||
#include "wifi_structures.h"
|
||||
#include <wlan_fast_connect/example_wlan_fast_connect.h>
|
||||
|
||||
typedef struct _SPI_LOG_CONF_{
|
||||
int frequency;
|
||||
int bits;
|
||||
int mode;
|
||||
}SPI_LOG_CONF, *PSPI_LOG_CONF;
|
||||
|
||||
#define ATCMD_WIFI_CONN_STORE_MAX_NUM (1)
|
||||
struct atcmd_wifi_conf{
|
||||
int32_t auto_enable;
|
||||
rtw_wifi_setting_t setting;
|
||||
int32_t reconn_num;
|
||||
int32_t reconn_last_index;
|
||||
struct wlan_fast_reconnect reconn[ATCMD_WIFI_CONN_STORE_MAX_NUM];
|
||||
};
|
||||
|
||||
#define ATCMD_LWIP_CONN_STORE_MAX_NUM (1)
|
||||
struct atcmd_lwip_conn_info{
|
||||
int32_t role; //client, server or seed
|
||||
uint32_t protocol; //tcp or udp
|
||||
uint32_t remote_addr; //remote ip
|
||||
uint32_t remote_port; //remote port
|
||||
uint32_t local_addr; //locale ip, not used yet
|
||||
uint32_t local_port; //locale port, not used yet
|
||||
uint32_t reserved; //reserve for further use
|
||||
};
|
||||
struct atcmd_lwip_conf {
|
||||
int32_t enable; //enable or not
|
||||
int32_t conn_num;
|
||||
int32_t last_index;
|
||||
int32_t reserved; //reserve for further use
|
||||
struct atcmd_lwip_conn_info conn[ATCMD_LWIP_CONN_STORE_MAX_NUM];
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
AT_PARTITION_ALL = 0,
|
||||
AT_PARTITION_SPI = 1,
|
||||
AT_PARTITION_WIFI = 2,
|
||||
AT_PARTITION_LWIP = 3
|
||||
} AT_PARTITION;
|
||||
|
||||
typedef enum {
|
||||
AT_PARTITION_READ = 0,
|
||||
AT_PARTITION_WRITE = 1,
|
||||
AT_PARTITION_ERASE = 2
|
||||
} AT_PARTITION_OP;
|
||||
|
||||
//first segment for uart
|
||||
#define SPI_SETTING_BACKUP_SECTOR (0x8000)
|
||||
#define SPI_CONF_DATA_OFFSET (0)
|
||||
#define SPI_CONF_DATA_SIZE ((((sizeof(SPI_LOG_CONF)-1)>>2) + 1)<<2)
|
||||
|
||||
//second segment for wifi config
|
||||
#define WIFI_CONF_DATA_OFFSET (SPI_CONF_DATA_OFFSET+SPI_CONF_DATA_SIZE)
|
||||
#define WIFI_CONF_DATA_SIZE ((((sizeof(struct atcmd_wifi_conf)-1)>>2) + 1)<<2)
|
||||
|
||||
//fouth segment for lwip config
|
||||
#define LWIP_CONF_DATA_OFFSET (WIFI_CONF_DATA_OFFSET+WIFI_CONF_DATA_SIZE)
|
||||
#define LWIP_CONF_DATA_SIZE ((((sizeof(struct atcmd_lwip_conf)-1)>>2) + 1)<<2)
|
||||
|
||||
extern void atcmd_update_partition_info(AT_PARTITION id, AT_PARTITION_OP ops, u8 *data, u16 len);
|
||||
|
||||
#define ATSTRING_LEN (LOG_SERVICE_BUFLEN)
|
||||
extern char at_string[ATSTRING_LEN];
|
||||
|
||||
extern void spi_at_send_string(char *str);
|
||||
extern void spi_at_send_buf(u8 *buf, u32 len);
|
||||
|
||||
#define at_printf(fmt, args...) do{\
|
||||
/*spi_at_lock();*/\
|
||||
snprintf(at_string, ATSTRING_LEN, fmt, ##args); \
|
||||
spi_at_send_string(at_string);\
|
||||
/*spi_at_unlock();*/\
|
||||
}while(0)
|
||||
#define at_print_data(data, size) do{\
|
||||
/*spi_at_lock();*/\
|
||||
spi_at_send_buf(data, size);\
|
||||
/*spi_at_unlock();*/\
|
||||
}while(0)
|
||||
|
||||
#else // #elif CONFIG_EXAMPLE_SPI_ATCMD
|
||||
|
||||
#define at_printf(fmt, args...) do{printf(fmt, ##args);}while(0)
|
||||
#define at_print_data(data, size) do{__rtl_memDump(data, size, NULL);}while(0)
|
||||
#endif//#if (defined(CONFIG_EXAMPLE_UART_ATCMD) && CONFIG_EXAMPLE_UART_ATCMD)
|
||||
|
||||
#endif
|
||||
128
sdk/component/common/api/at_cmd/log_service.h
Normal file
128
sdk/component/common/api/at_cmd/log_service.h
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
#ifndef LOG_SERVICE_H
|
||||
#define LOG_SERVICE_H
|
||||
|
||||
#include "dlist.h"
|
||||
/*
|
||||
* Include user defined options first. Anything not defined in these files
|
||||
* will be set to standard values. Override anything you dont like!
|
||||
*/
|
||||
#if defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B) || defined(CONFIG_PLATFORM_8721D)|| defined(CONFIG_PLATFORM_8710C)
|
||||
#include "platform_opts.h"
|
||||
#include "platform_stdlib.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
//#ifdef __ICCARM__
|
||||
//#define STRINGIFY(s) #s
|
||||
//#define SECTION(_name) _Pragma( STRINGIFY(location=_name))
|
||||
//#define log_module_init(fn) \
|
||||
// SECTION(".data.log_init") __root static void* log_##fn = (void*)fn
|
||||
//#elif defined(__CC_ARM)
|
||||
//#define log_module_init(fn) \
|
||||
//static void* log_##fn __attribute__((section(".data.log_init"))) = (void*)fn;
|
||||
//#define DiagPrintf printf
|
||||
//#elif defined(__GNUC__)
|
||||
//#define log_module_init(fn) \
|
||||
//static void* log_##fn __attribute__((section(".data.log_init"))) = (void*)fn;
|
||||
//#else
|
||||
//#error "not implement"
|
||||
//#endif
|
||||
*/
|
||||
#define log_module_init(fn)
|
||||
|
||||
#define ATC_INDEX_NUM 32
|
||||
|
||||
#ifndef SUPPORT_LOG_SERVICE
|
||||
#define SUPPORT_LOG_SERVICE 1
|
||||
#endif
|
||||
|
||||
//LOG_SERVICE_BUFLEN: default, only 63 bytes could be used for keeping input
|
||||
// cmd, the last byte is for string end ('\0').
|
||||
#ifndef LOG_SERVICE_BUFLEN
|
||||
#define LOG_SERVICE_BUFLEN 64
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_LOG_HISTORY
|
||||
#define CONFIG_LOG_HISTORY 0
|
||||
#if CONFIG_LOG_HISTORY
|
||||
#define LOG_HISTORY_LEN 5
|
||||
#endif
|
||||
#endif //#ifndef CONFIG_LOG_HISTORY
|
||||
|
||||
#ifndef MAX_ARGC
|
||||
#define MAX_ARGC 18
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_LOG_SERVICE_LOCK
|
||||
#define CONFIG_LOG_SERVICE_LOCK 0 // //to protect log_buf[], only one command processed per time
|
||||
#endif
|
||||
|
||||
#define AT_BIT(n) (1<<n)
|
||||
#define AT_FLAG_DUMP AT_BIT(0)
|
||||
#define AT_FLAG_EDIT AT_BIT(1)
|
||||
#define AT_FLAG_ADC AT_BIT(2)
|
||||
#define AT_FLAG_GPIO AT_BIT(3)
|
||||
#define AT_FLAG_OTA AT_BIT(4)
|
||||
#define AT_FLAG_NFC AT_BIT(5)
|
||||
#define AT_FLAG_OS AT_BIT(6)
|
||||
#define AT_FLAG_LWIP AT_BIT(7)
|
||||
#define AT_FLAG_COMMON AT_BIT(8)
|
||||
#define AT_FLAG_WIFI AT_BIT(9)
|
||||
#define AT_FLAG_RDP AT_BIT(10)
|
||||
|
||||
enum{
|
||||
AT_DBG_OFF = 0,
|
||||
AT_DBG_ALWAYS,
|
||||
AT_DBG_ERROR,
|
||||
AT_DBG_WARNING,
|
||||
AT_DBG_INFO
|
||||
};
|
||||
|
||||
extern unsigned char gDbgLevel;
|
||||
extern unsigned int gDbgFlag;
|
||||
|
||||
#define AT_PRINTK(...) \
|
||||
do{ \
|
||||
printf(__VA_ARGS__); \
|
||||
printf("\r\n"); \
|
||||
}while(0)
|
||||
#define _AT_PRINTK(...) printf(__VA_ARGS__)
|
||||
#define AT_DBG_MSG(flag, level, ...) \
|
||||
do{ \
|
||||
if(((flag) & gDbgFlag) && (level <= gDbgLevel)){ \
|
||||
AT_PRINTK(__VA_ARGS__); \
|
||||
} \
|
||||
}while(0)
|
||||
#define _AT_DBG_MSG(flag, level, ...) \
|
||||
do{ \
|
||||
if(((flag) & gDbgFlag) && (level <= gDbgLevel)){ \
|
||||
_AT_PRINTK(__VA_ARGS__); \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#ifndef SUPPORT_INTERACTIVE_MODE
|
||||
#define SUPPORT_INTERACTIVE_MODE 0
|
||||
#endif //#ifndef SUPPORT_INTERACTIVE_MODE
|
||||
|
||||
typedef void (*log_init_t)(void);
|
||||
typedef void (*log_act_t)(void*);
|
||||
typedef struct _at_command_item_{
|
||||
char *log_cmd;
|
||||
log_act_t at_act;
|
||||
struct list_head node;
|
||||
}log_item_t;
|
||||
|
||||
void log_service_add_table(log_item_t *tbl, int len);
|
||||
int parse_param(char *buf, char **argv);
|
||||
#if CONFIG_LOG_SERVICE_LOCK
|
||||
void log_service_lock_init(void);
|
||||
void log_service_lock(void);
|
||||
u32 log_service_lock_timeout(u32 ms);
|
||||
void log_service_unlock(void);
|
||||
#endif
|
||||
|
||||
#define C_NUM_AT_CMD 4 //"ATxx", 4 characters
|
||||
#define C_NUM_AT_CMD_DLT 1 //"=", 1 charater
|
||||
#define STR_END_OF_ATCMD_RET "\r\n\n# " //each AT command response will end with this string
|
||||
#define STR_END_OF_ATDATA_RET "\r\n\n> " //data transparent transmission indicator
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue