mirror of
https://github.com/xushoucai/RTL8710_SDK_GCC_VERSION.git
synced 2026-03-21 18:04:47 +00:00
GCC SDK RTL8710 basic version (including the window platform cygwin installation and Ubuntu platform Linux Installation routines),
including cross compilation of the installation, compile, link, run, debug, and so on. SDK implementation of the function: 1, WiFi connection settings (including AP mode and STA mode). 2, peripheral resource control (including GPIO, SPI, UART, IIC, etc.). 3, the user uses the sample method.
This commit is contained in:
parent
36b1b0dcd9
commit
905d81784e
2094 changed files with 779991 additions and 0 deletions
92
component/common/api/at_cmd/atcmd_ethernet.c
Normal file
92
component/common/api/at_cmd/atcmd_ethernet.c
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
#include <stdio.h>
|
||||
#include "log_service.h"
|
||||
#include "platform_opts.h"
|
||||
#include <lwip_netconf.h>
|
||||
#include "cmsis_os.h"
|
||||
#include <platform/platform_stdlib.h>
|
||||
#include <lwip/sockets.h>
|
||||
#include <lwip/tcpip.h>
|
||||
#include "wifi_conf.h"
|
||||
|
||||
|
||||
#define _AT_DHCP_ETHERNET_MII_ "ATE0"
|
||||
#define _AT_SET_DEFAULT_INTERFACE "ATE1"
|
||||
|
||||
#if CONFIG_ETHERNET
|
||||
extern int dhcp_ethernet_mii;
|
||||
extern int ethernet_if_default;
|
||||
extern struct netif xnetif[NET_IF_NUM];
|
||||
|
||||
void fATE0(void *arg)
|
||||
{
|
||||
int argc;
|
||||
char *argv[MAX_ARGC] = {0};
|
||||
printf("[ATE0]:DHCP configure for ethernet\n\r");
|
||||
if(!arg){
|
||||
printf("[ATE0]Usage to disable DHCP: ATE0=0\n");
|
||||
printf("[ATE0]Usage to enable DHCP: ATE0=1\n");
|
||||
return;
|
||||
}
|
||||
if('0' == *(char *)arg)
|
||||
{
|
||||
dhcp_ethernet_mii = 0;
|
||||
}
|
||||
|
||||
else if('1' == *(char *)arg)
|
||||
{
|
||||
dhcp_ethernet_mii = 1;
|
||||
LwIP_DHCP(NET_IF_NUM - 1, DHCP_START);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
printf("[ATE0]Usage to disable DHCP: ATE0=0\n");
|
||||
printf("[ATE0]Usage to enable DHCP: ATE0=1\n");
|
||||
}
|
||||
}
|
||||
|
||||
void fATE1(void *arg)
|
||||
{
|
||||
int argc;
|
||||
char *argv[MAX_ARGC] = {0};
|
||||
printf("[ATE1]:Set/check the default interface\n\r");
|
||||
if(!arg){
|
||||
if(ethernet_if_default)
|
||||
printf("Ethernet is the default interface\n");
|
||||
else
|
||||
printf("wlan is the default interface\n");
|
||||
return;
|
||||
}
|
||||
if('0' == *(char *)arg)
|
||||
{
|
||||
ethernet_if_default = 0;
|
||||
printf("wlan is set to the default interface\n");
|
||||
}
|
||||
|
||||
else if('1' == *(char *)arg)
|
||||
{
|
||||
ethernet_if_default = 1;
|
||||
printf("ethernet is set to the default interface\n");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
printf("[ATE0]Usage to check the default interface: ATE1\n");
|
||||
printf("[ATE0]Usage to set ethernet as default interface: ATE1=1\n");
|
||||
printf("[ATE0]Usage to set wlan as default interface: ATE1=0\n");
|
||||
}
|
||||
}
|
||||
|
||||
log_item_t at_ethernet_items[ ] = {
|
||||
{"ATE0", fATE0,},
|
||||
{"ATE1", fATE1,}
|
||||
};
|
||||
|
||||
void at_ethernet_init(void)
|
||||
{
|
||||
log_service_add_table(at_ethernet_items, sizeof(at_ethernet_items)/sizeof(at_ethernet_items[0]));
|
||||
}
|
||||
|
||||
log_module_init(at_ethernet_init);
|
||||
|
||||
#endif
|
||||
196
component/common/api/at_cmd/atcmd_google.c
Normal file
196
component/common/api/at_cmd/atcmd_google.c
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
#include <lwip_netconf.h>
|
||||
#include <stdio.h>
|
||||
#include "log_service.h"
|
||||
#include "cmsis_os.h"
|
||||
#include <platform/platform_stdlib.h>
|
||||
#include <lwip/sockets.h>
|
||||
#include <lwip/tcpip.h>
|
||||
#include "wifi_conf.h"
|
||||
#include "google/google_nest.h"
|
||||
#include <cJSON.h>
|
||||
#include <platform_opts.h>
|
||||
|
||||
#define GN_PORT 443
|
||||
|
||||
|
||||
#define _AT_GOOGLE_NEST_ "ATG0"
|
||||
|
||||
//functions that using Google Nest's API
|
||||
void google_data_retrieve_cb(char *response_buf);
|
||||
|
||||
void googlenest_get(char *host_addr, char *host_file)
|
||||
{
|
||||
unsigned char buffer[512];
|
||||
googlenest_context googlenest;
|
||||
char *googlenest_host = host_addr;
|
||||
char *googlenest_uri = host_file;
|
||||
|
||||
|
||||
memset(&googlenest, 0, sizeof(googlenest_context));
|
||||
if(gn_connect(&googlenest, googlenest_host, GN_PORT) == 0) {
|
||||
if(gn_get(&googlenest, googlenest_uri, buffer, sizeof(buffer)) == 0)
|
||||
printf("\r\n\r\nGet data from googlenest: %s", buffer);
|
||||
gn_close(&googlenest);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void google_data_retrieve_cb(char *response_buf) {
|
||||
printf("\r\nResponse_buf:\r\n%s\r\n", response_buf);
|
||||
|
||||
}
|
||||
|
||||
void googlenest_stream(char *host_addr, char *host_file)
|
||||
{
|
||||
googlenest_context googlenest;
|
||||
char *googlenest_host = host_addr;
|
||||
char *googlenest_uri = host_file;
|
||||
|
||||
memset(&googlenest, 0, sizeof(googlenest_context));
|
||||
if(gn_connect(&googlenest, googlenest_host, GN_PORT) == 0) {
|
||||
google_retrieve_data_hook_callback(google_data_retrieve_cb);
|
||||
gn_stream(&googlenest, googlenest_uri);
|
||||
gn_close(&googlenest);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void googlenest_delete(char *host_addr, char *host_file)
|
||||
{
|
||||
googlenest_context googlenest;
|
||||
char *googlenest_host = host_addr;
|
||||
char *googlenest_uri = host_file;
|
||||
|
||||
|
||||
memset(&googlenest, 0, sizeof(googlenest_context));
|
||||
if(gn_connect(&googlenest, googlenest_host, GN_PORT) == 0) {
|
||||
if(gn_delete(&googlenest, googlenest_uri) == 0)
|
||||
printf("\r\n\r\nDelete the data is successful!");
|
||||
gn_close(&googlenest);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void googlenest_put(char *host_addr, char *host_file, char *data)
|
||||
{
|
||||
googlenest_context googlenest;
|
||||
char *googlenest_host = host_addr;
|
||||
char *googlenest_uri = host_file;
|
||||
|
||||
memset(&googlenest, 0, sizeof(googlenest_context));
|
||||
if(gn_connect(&googlenest, googlenest_host, GN_PORT) == 0) {
|
||||
if(gn_put(&googlenest, googlenest_uri, data) == 0)
|
||||
printf("\r\n\r\nSaving data in firebase is successful!");
|
||||
gn_close(&googlenest);
|
||||
}
|
||||
}
|
||||
|
||||
void googlenest_patch(char *host_addr, char *host_file, char *data)
|
||||
{
|
||||
googlenest_context googlenest;
|
||||
char *googlenest_host = host_addr;
|
||||
char *googlenest_uri = host_file;
|
||||
|
||||
memset(&googlenest, 0, sizeof(googlenest_context));
|
||||
if(gn_connect(&googlenest, googlenest_host, GN_PORT) == 0) {
|
||||
if(gn_patch(&googlenest, googlenest_uri, data) == 0)
|
||||
printf("\r\n\r\nUpdating data in firebase is successful!");
|
||||
gn_close(&googlenest);
|
||||
}
|
||||
}
|
||||
|
||||
void googlenest_post(char *host_addr, char *host_file, char *data)
|
||||
{
|
||||
googlenest_context googlenest;
|
||||
char *googlenest_host = host_addr;
|
||||
char *googlenest_uri = host_file;
|
||||
unsigned char buffer[64];
|
||||
|
||||
memset(&googlenest, 0, sizeof(googlenest_context));
|
||||
if(gn_connect(&googlenest, googlenest_host, GN_PORT) == 0) {
|
||||
if(gn_post(&googlenest, googlenest_uri, data, buffer, sizeof(buffer)) == 0)
|
||||
printf("\r\n\r\nInserting data to firebase is successful!\r\n\r\nThe unique name for this list of data is: %s", buffer);
|
||||
gn_close(&googlenest);
|
||||
}
|
||||
}
|
||||
|
||||
void cmd_googlenest(int argc, char **argv)
|
||||
{
|
||||
if(strcmp(argv[1], "get") == 0) {
|
||||
if(argc != 4)
|
||||
printf("\n\rUsage: gn get address file");
|
||||
else {
|
||||
googlenest_get(argv[2], argv[3]);
|
||||
}
|
||||
}
|
||||
else if(strcmp(argv[1], "delete") ==0){
|
||||
if(argc != 4)
|
||||
printf("\n\rUsage: gn delete address file");
|
||||
else {
|
||||
googlenest_delete(argv[2], argv[3]);
|
||||
}
|
||||
}
|
||||
else if(strcmp(argv[1], "put") ==0){
|
||||
if(argc != 5)
|
||||
printf("\n\rUsage: gn put address file data");
|
||||
else {
|
||||
googlenest_put(argv[2], argv[3], argv[4]);
|
||||
}
|
||||
}
|
||||
else if(strcmp(argv[1], "patch") ==0){
|
||||
if(argc != 5)
|
||||
printf("\n\rUsage: gn patch address file data");
|
||||
else {
|
||||
googlenest_patch(argv[2], argv[3], argv[4]);
|
||||
}
|
||||
}
|
||||
else if(strcmp(argv[1], "post") ==0){
|
||||
if(argc != 5)
|
||||
printf("\n\rUsage: gn post address file data");
|
||||
else {
|
||||
googlenest_post(argv[2], argv[3], argv[4]);
|
||||
}
|
||||
}
|
||||
else if(strcmp(argv[1], "stream") ==0){
|
||||
if(argc != 4)
|
||||
printf("\n\rUsage: gn stream address file");
|
||||
else {
|
||||
googlenest_stream(argv[2], argv[3]);
|
||||
}
|
||||
}
|
||||
else
|
||||
printf("\n\rUsage: gn method addr file (data)");
|
||||
}
|
||||
|
||||
//AT Command function
|
||||
|
||||
void fATG0(void *arg){
|
||||
int argc;
|
||||
char *argv[MAX_ARGC] = {0};
|
||||
printf("[ATG0]: _AT_WLAN_GOOGLENEST_\n\r");
|
||||
if(!arg){
|
||||
printf("[ATG0]Usage: ATWG=[method,address,file,data] or ATG0=[method,address,file]\n\r");
|
||||
return;
|
||||
}
|
||||
argv[0] = "gn";
|
||||
if((argc = parse_param(arg, argv)) > 1){
|
||||
cmd_googlenest(argc, argv);
|
||||
}
|
||||
else
|
||||
printf("[ATG0]Usage: ATG0=[method,address,file,data] or ATG0=[method,address,file]\n\r");
|
||||
}
|
||||
|
||||
#if CONFIG_GOOGLE_NEST
|
||||
log_item_t at_google_items[ ] = {
|
||||
|
||||
{"ATG0", fATG0,}
|
||||
|
||||
};
|
||||
|
||||
void at_google_init(void)
|
||||
{
|
||||
log_service_add_table(at_google_items, sizeof(at_google_items)/sizeof(at_google_items[0]));
|
||||
}
|
||||
|
||||
log_module_init(at_google_init);
|
||||
#endif
|
||||
2136
component/common/api/at_cmd/atcmd_lwip.c
Normal file
2136
component/common/api/at_cmd/atcmd_lwip.c
Normal file
File diff suppressed because it is too large
Load diff
96
component/common/api/at_cmd/atcmd_lwip.h
Normal file
96
component/common/api/at_cmd/atcmd_lwip.h
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
#ifndef __ATCMD_LWIP_H__
|
||||
#define __ATCMD_LWIP_H__
|
||||
|
||||
#include "main.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_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
|
||||
|
||||
#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;
|
||||
} node;
|
||||
|
||||
extern xTaskHandle atcmd_lwip_tt_task;
|
||||
extern xSemaphoreHandle 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);
|
||||
#endif
|
||||
|
||||
|
||||
#endif //#ifndef __ATCMD_LWIP_H__
|
||||
1137
component/common/api/at_cmd/atcmd_sys.c
Normal file
1137
component/common/api/at_cmd/atcmd_sys.c
Normal file
File diff suppressed because it is too large
Load diff
5
component/common/api/at_cmd/atcmd_sys.h
Normal file
5
component/common/api/at_cmd/atcmd_sys.h
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef __ATCMD_SYS_H__
|
||||
#define __ATCMD_SYS_H__
|
||||
|
||||
|
||||
#endif
|
||||
2690
component/common/api/at_cmd/atcmd_wifi.c
Normal file
2690
component/common/api/at_cmd/atcmd_wifi.c
Normal file
File diff suppressed because it is too large
Load diff
161
component/common/api/at_cmd/atcmd_wifi.h
Normal file
161
component/common/api/at_cmd/atcmd_wifi.h
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
#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 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
|
||||
#define UART_SETTING_BACKUP_SECTOR (0x8000)
|
||||
#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)
|
||||
|
||||
#else
|
||||
#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 CONFIG_EXAMPLE_UART_ATCMD
|
||||
|
||||
#endif
|
||||
473
component/common/api/at_cmd/log_service.c
Normal file
473
component/common/api/at_cmd/log_service.c
Normal file
|
|
@ -0,0 +1,473 @@
|
|||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "FreeRTOS.h"
|
||||
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
|
||||
#include "freertos_pmu.h"
|
||||
#endif
|
||||
#include "log_service.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
#include "main.h"
|
||||
//#include "wifi_util.h"
|
||||
#include "atcmd_wifi.h"
|
||||
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||
#include "atcmd_lwip.h"
|
||||
#endif
|
||||
|
||||
#if SUPPORT_LOG_SERVICE
|
||||
//======================================================
|
||||
struct list_head log_hash[ATC_INDEX_NUM];
|
||||
|
||||
extern void at_wifi_init(void);
|
||||
extern void at_fs_init(void);
|
||||
extern void at_sys_init(void);
|
||||
extern void at_ethernet_init(void);
|
||||
extern void at_google_init(void);
|
||||
extern void at_transport_init(void);
|
||||
//extern void at_app_init(void);
|
||||
#if CONFIG_ALINK
|
||||
extern void at_cloud_init(void);
|
||||
#endif
|
||||
|
||||
|
||||
char log_buf[LOG_SERVICE_BUFLEN];
|
||||
#if CONFIG_LOG_HISTORY
|
||||
char log_history[LOG_HISTORY_LEN][LOG_SERVICE_BUFLEN];
|
||||
static unsigned int log_history_count = 0;
|
||||
#endif
|
||||
xSemaphoreHandle log_rx_interrupt_sema = NULL;
|
||||
#if CONFIG_LOG_SERVICE_LOCK
|
||||
xSemaphoreHandle log_service_sema = NULL;
|
||||
#endif
|
||||
extern xSemaphoreHandle uart_rx_interrupt_sema;
|
||||
|
||||
#if CONFIG_INIC_EN
|
||||
extern unsigned char inic_cmd_ioctl;
|
||||
#endif
|
||||
|
||||
#if defined (__ICCARM__)
|
||||
#pragma section=".data.log_init"
|
||||
|
||||
unsigned int __log_init_begin__;
|
||||
unsigned int __log_init_end__;
|
||||
#elif defined ( __CC_ARM ) || defined(__GNUC__)
|
||||
//#pragma section=".data.log_init"
|
||||
log_init_t* __log_init_begin__;
|
||||
log_init_t* __log_init_end__;
|
||||
log_init_t log_init_table[] = {
|
||||
at_wifi_init,
|
||||
// at_fs_init,
|
||||
at_sys_init,
|
||||
|
||||
#if CONFIG_ETHERNET
|
||||
at_ethernet_init
|
||||
#endif
|
||||
|
||||
#if CONFIG_GOOGLE_NEST
|
||||
at_google_init
|
||||
#endif
|
||||
|
||||
#if CONFIG_TRANSPORT
|
||||
at_transport_init
|
||||
#endif
|
||||
|
||||
#if CONFIG_ALINK
|
||||
at_cloud_init
|
||||
#endif
|
||||
|
||||
// at_app_init
|
||||
};
|
||||
#else
|
||||
#error "not implement, add to linker script"
|
||||
extern unsigned int __log_init_begin__;
|
||||
extern unsigned int __log_init_end__;
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define USE_STRSEP
|
||||
#endif
|
||||
|
||||
//======================================================
|
||||
int hash_index(char *str)
|
||||
{
|
||||
unsigned int seed = 131; // 31 131 1313 13131 131313 etc..
|
||||
unsigned int hash = 0;
|
||||
|
||||
while (*str)
|
||||
{
|
||||
hash = hash * seed + (*str++);
|
||||
}
|
||||
|
||||
return (hash & 0x7FFFFFFF);
|
||||
}
|
||||
|
||||
void log_add_new_command(log_item_t *new)
|
||||
{
|
||||
int index = hash_index(new->log_cmd)%ATC_INDEX_NUM;
|
||||
|
||||
list_add(&new->node, &log_hash[index]);
|
||||
}
|
||||
void start_log_service(void);
|
||||
void log_service_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
#if defined (__ICCARM__)
|
||||
log_init_t *log_init_table;
|
||||
__log_init_begin__ = (unsigned int)__section_begin(".data.log_init");
|
||||
__log_init_end__ = (unsigned int)__section_end(".data.log_init");
|
||||
log_init_table = (log_init_t *)__log_init_begin__;
|
||||
#elif defined(__CC_ARM) || defined(__GNUC__)
|
||||
__log_init_begin__ = log_init_table;
|
||||
__log_init_end__ = log_init_table + sizeof(log_init_table);
|
||||
#else
|
||||
#error "not implement"
|
||||
#endif
|
||||
|
||||
|
||||
for(i=0;i<ATC_INDEX_NUM;i++)
|
||||
INIT_LIST_HEAD(&log_hash[i]);
|
||||
|
||||
for(i=0;i<(__log_init_end__-__log_init_begin__)/sizeof(log_init_t); i++)
|
||||
log_init_table[i]();
|
||||
|
||||
/* Initial uart rx swmaphore*/
|
||||
vSemaphoreCreateBinary(log_rx_interrupt_sema);
|
||||
xSemaphoreTake(log_rx_interrupt_sema, 1/portTICK_RATE_MS);
|
||||
#if CONFIG_LOG_SERVICE_LOCK
|
||||
log_service_lock_init();
|
||||
#endif
|
||||
start_log_service();
|
||||
}
|
||||
|
||||
//sizeof(log_items)/sizeof(log_items[0])
|
||||
void log_service_add_table(log_item_t *tbl, int len)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<len;i++)
|
||||
log_add_new_command(&tbl[i]);
|
||||
}
|
||||
|
||||
void* log_action(char *cmd)
|
||||
{
|
||||
int search_cnt=0;
|
||||
int index = hash_index(cmd)%ATC_INDEX_NUM;
|
||||
struct list_head *head = &log_hash[index];
|
||||
struct list_head *iterator;
|
||||
log_item_t *item;
|
||||
void *act = NULL;
|
||||
|
||||
list_for_each(iterator, head) {
|
||||
item = list_entry(iterator, log_item_t, node);
|
||||
search_cnt++;
|
||||
if( strcmp(item->log_cmd, cmd) == 0){
|
||||
//printf("%s match %s, search cnt %d\n\r", cmd, item->log_cmd, search_cnt);
|
||||
act = (void*)item->at_act;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return act;
|
||||
}
|
||||
|
||||
void* log_handler(char *cmd)
|
||||
{
|
||||
log_act_t action=NULL;
|
||||
char buf[LOG_SERVICE_BUFLEN] = {0};
|
||||
char *copy=buf;
|
||||
char *token = NULL;
|
||||
char *param = NULL;
|
||||
char tok[5] = {0};//'\0'
|
||||
#if CONFIG_LOG_HISTORY
|
||||
strcpy(log_history[((log_history_count++)%LOG_HISTORY_LEN)], log_buf);
|
||||
#endif
|
||||
strncpy(copy, cmd,LOG_SERVICE_BUFLEN-1);
|
||||
|
||||
#if defined(USE_STRSEP)
|
||||
token = _strsep(©, "=");
|
||||
param = copy;
|
||||
#else
|
||||
token = strtok(copy, "=");
|
||||
param = strtok(NULL, NULL);
|
||||
#endif
|
||||
if(token && (strlen(token) <= 4))
|
||||
strcpy(tok, token);
|
||||
else{
|
||||
//printf("\n\rAT Cmd format error!\n");
|
||||
return NULL;
|
||||
};
|
||||
//printf(" Command %s \n\r ", tok);
|
||||
//printf(" Param %s \n\r", param);
|
||||
action = (log_act_t)log_action(tok);
|
||||
|
||||
if(action){
|
||||
action(param);
|
||||
}
|
||||
return (void*)action;
|
||||
|
||||
}
|
||||
|
||||
int parse_param(char *buf, char **argv)
|
||||
{
|
||||
int argc = 1;
|
||||
char str_buf[LOG_SERVICE_BUFLEN] = "\0";
|
||||
int str_count = 0;
|
||||
int buf_cnt = 0;
|
||||
|
||||
if(buf == NULL)
|
||||
goto exit;
|
||||
|
||||
while((argc < MAX_ARGC) && (*buf != '\0')) {
|
||||
while((*buf == ',') || (*buf == '[') || (*buf == ']')){
|
||||
if((*buf == ',') && (*(buf+1) == ',')){
|
||||
argv[argc] = NULL;
|
||||
argc++;
|
||||
}
|
||||
*buf = '\0';
|
||||
buf++;
|
||||
}
|
||||
|
||||
if(*buf == '\0')
|
||||
break;
|
||||
else if(*buf == '"'){
|
||||
memset(str_buf,'\0',LOG_SERVICE_BUFLEN);
|
||||
str_count = 0;
|
||||
buf_cnt = 0;
|
||||
*buf = '\0';
|
||||
buf ++;
|
||||
if(*buf == '\0')
|
||||
break;
|
||||
argv[argc] = buf;
|
||||
while((*buf != '"')&&(*buf != '\0')){
|
||||
if(*buf == '\\'){
|
||||
buf ++;
|
||||
buf_cnt++;
|
||||
}
|
||||
str_buf[str_count] = *buf;
|
||||
str_count++;
|
||||
buf_cnt++;
|
||||
buf ++;
|
||||
}
|
||||
*buf = '\0';
|
||||
memcpy(buf-buf_cnt,str_buf,buf_cnt);
|
||||
}
|
||||
else{
|
||||
argv[argc] = buf;
|
||||
}
|
||||
argc++;
|
||||
buf++;
|
||||
|
||||
while( (*buf != ',')&&(*buf != '\0')&&(*buf != '[')&&(*buf != ']') )
|
||||
buf++;
|
||||
}
|
||||
exit:
|
||||
return argc;
|
||||
}
|
||||
|
||||
unsigned char gDbgLevel = AT_DBG_ERROR;
|
||||
unsigned int gDbgFlag = 0xFFFFFFFF;
|
||||
void at_set_debug_level(unsigned char newDbgLevel)
|
||||
{
|
||||
gDbgLevel = newDbgLevel;
|
||||
}
|
||||
|
||||
void at_set_debug_mask(unsigned int newDbgFlag)
|
||||
{
|
||||
gDbgFlag = newDbgFlag;
|
||||
}
|
||||
|
||||
#if SUPPORT_INTERACTIVE_MODE
|
||||
extern char uart_buf[64];
|
||||
void legency_interactive_handler(unsigned char argc, unsigned char **argv)
|
||||
{
|
||||
#if 0 //defined(CONFIG_PLATFORM_8195A)
|
||||
if(argc<1)
|
||||
{
|
||||
DiagPrintf("Wrong argument number!\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DiagPrintf("Wlan Normal Mode\n");
|
||||
|
||||
WlanNormal( argc, argv);
|
||||
#else
|
||||
strncpy(uart_buf, log_buf, 63);//uart_buf[64]
|
||||
xSemaphoreGive(uart_rx_interrupt_sema);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_WLAN
|
||||
#ifndef WLAN0_NAME
|
||||
#define WLAN0_NAME "wlan0"
|
||||
#endif
|
||||
#ifndef WLAN1_NAME
|
||||
#define WLAN1_NAME "wlan1"
|
||||
#endif
|
||||
int mp_commnad_handler(char *cmd)
|
||||
{
|
||||
char buf[64] = {0};
|
||||
char *token = NULL;
|
||||
|
||||
//strcpy(buf, cmd);
|
||||
strncpy(buf, cmd, (64-1));
|
||||
token = strtok(buf, " ");
|
||||
if(token && (strcmp(buf, "iwpriv") == 0)){
|
||||
token = strtok(NULL, "");
|
||||
wext_private_command(WLAN0_NAME, token, 1);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
void print_help_msg(void){
|
||||
#if CONFIG_WLAN
|
||||
extern void print_wlan_help(void);
|
||||
print_wlan_help();
|
||||
#endif
|
||||
//add other help message print here
|
||||
}
|
||||
|
||||
int print_help_handler(char *cmd){
|
||||
if(strcmp(cmd, "help") == 0){
|
||||
print_help_msg();
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if CONFIG_LOG_SERVICE_LOCK
|
||||
void log_service_lock(void)
|
||||
{
|
||||
RtlDownSema(&log_service_sema);
|
||||
}
|
||||
|
||||
u32 log_service_lock_timeout(u32 ms)
|
||||
{
|
||||
return RtlDownSemaWithTimeout(&log_service_sema, ms);
|
||||
}
|
||||
|
||||
void log_service_unlock(void)
|
||||
{
|
||||
RtlUpSema(&log_service_sema);
|
||||
}
|
||||
|
||||
void log_service_lock_init(void){
|
||||
RtlInitSema(&log_service_sema, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void log_service(void *param)
|
||||
{
|
||||
_AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\n\rStart LOG SERVICE MODE\n\r");
|
||||
_AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\n\r# ");
|
||||
while(1){
|
||||
while(xSemaphoreTake(log_rx_interrupt_sema, portMAX_DELAY) != pdTRUE);
|
||||
#if CONFIG_LOG_SERVICE_LOCK
|
||||
log_service_lock();
|
||||
#endif
|
||||
if(log_handler((char *)log_buf) == NULL){
|
||||
#if CONFIG_WLAN
|
||||
if(mp_commnad_handler((char *)log_buf) < 0)
|
||||
#endif
|
||||
{
|
||||
#if SUPPORT_INTERACTIVE_MODE
|
||||
print_help_handler((char *)log_buf);
|
||||
legency_interactive_handler(NULL, NULL);
|
||||
#if CONFIG_LOG_SERVICE_LOCK
|
||||
log_service_unlock();
|
||||
#endif
|
||||
continue;
|
||||
#else
|
||||
if(print_help_handler((char *)log_buf) < 0){
|
||||
at_printf("\r\nunknown command '%s'", log_buf);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
log_buf[0] = '\0';
|
||||
#if CONFIG_INIC_EN
|
||||
inic_cmd_ioctl = 0;
|
||||
#endif
|
||||
_AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\n\r[MEM] After do cmd, available heap %d\n\r", xPortGetFreeHeapSize());
|
||||
_AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\r\n\n# "); //"#" is needed for mp tool
|
||||
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||
if(atcmd_lwip_is_tt_mode())
|
||||
at_printf(STR_END_OF_ATDATA_RET);
|
||||
else
|
||||
at_printf(STR_END_OF_ATCMD_RET);
|
||||
#endif
|
||||
#if CONFIG_LOG_SERVICE_LOCK
|
||||
log_service_unlock();
|
||||
#endif
|
||||
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
|
||||
release_wakelock(WAKELOCK_LOGUART);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#define STACKSIZE 1280
|
||||
void start_log_service(void)
|
||||
{
|
||||
xTaskHandle CreatedTask;
|
||||
int result;
|
||||
|
||||
#if CONFIG_USE_TCM_HEAP
|
||||
extern void *tcm_heap_malloc(int size);
|
||||
void *stack_addr = tcm_heap_malloc(STACKSIZE * sizeof(int));
|
||||
|
||||
if(stack_addr == NULL){
|
||||
}
|
||||
|
||||
result = xTaskGenericCreate(
|
||||
log_service,
|
||||
( signed portCHAR * ) "log_service",
|
||||
STACKSIZE,
|
||||
NULL,
|
||||
tskIDLE_PRIORITY + 5,
|
||||
&CreatedTask,
|
||||
stack_addr,
|
||||
NULL);
|
||||
#else
|
||||
result = xTaskCreate( log_service, ( signed portCHAR * ) "log_service", STACKSIZE, NULL, tskIDLE_PRIORITY + 5, &CreatedTask );
|
||||
#endif
|
||||
|
||||
if(result != pdPASS) {
|
||||
printf("\n\r%s xTaskCreate failed", __FUNCTION__);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void fAT_exit(void *arg){
|
||||
printf("\n\rLeave LOG SERVICE");
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
#if CONFIG_LOG_HISTORY
|
||||
void fAT_log(void *arg){
|
||||
int i = 0;
|
||||
printf("[AT]log history:\n\n\r");
|
||||
if(log_history_count > LOG_HISTORY_LEN){
|
||||
for(i=0; i<4; i++)
|
||||
printf(" %s\n\r", log_history[((log_history_count+i)%LOG_HISTORY_LEN)]);
|
||||
}
|
||||
else{
|
||||
for(i=0; i<(log_history_count-1); i++)
|
||||
printf(" %s\n\r", log_history[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
log_item_t at_log_items[ ] = {
|
||||
{"AT--", fAT_exit,},
|
||||
#if CONFIG_LOG_HISTORY
|
||||
{"AT??", fAT_log,},
|
||||
#endif
|
||||
{"ATxx", fAT_exit,}
|
||||
};
|
||||
void at_log_init(void)
|
||||
{
|
||||
log_service_add_table(at_log_items, sizeof(at_log_items)/sizeof(at_log_items[0]));
|
||||
}
|
||||
log_module_init(at_log_init);
|
||||
#endif
|
||||
120
component/common/api/at_cmd/log_service.h
Normal file
120
component/common/api/at_cmd/log_service.h
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
#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)
|
||||
#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 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 12
|
||||
#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)
|
||||
|
||||
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(fmt, args...) printf(fmt"\r\n",## args)
|
||||
#define _AT_PRINTK(fmt, args...) printf(fmt,## args)
|
||||
#define AT_DBG_MSG(flag, level, fmt, args...) \
|
||||
do{ \
|
||||
if(((flag) & gDbgFlag) && (level <= gDbgLevel)){ \
|
||||
AT_PRINTK(fmt,## args); \
|
||||
} \
|
||||
}while(0)
|
||||
#define _AT_DBG_MSG(flag, level, fmt, args...) \
|
||||
do{ \
|
||||
if(((flag) & gDbgFlag) && (level <= gDbgLevel)){ \
|
||||
_AT_PRINTK(fmt,## 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