Skip to content

Commit

Permalink
Fix compile error when make is
Browse files Browse the repository at this point in the history
  • Loading branch information
hanksuu committed Jul 1, 2021
1 parent 6f0c528 commit ed40706
Show file tree
Hide file tree
Showing 12 changed files with 3,064 additions and 2,810 deletions.
196 changes: 98 additions & 98 deletions component/common/api/at_cmd/atcmd_mp_ext2.c
Original file line number Diff line number Diff line change
@@ -1,98 +1,98 @@
#include <platform_stdlib.h>
#include <platform_opts.h>
#include <gpio_api.h>
#include "log_service.h"
#include "osdep_service.h"
#include "atcmd_mp.h"
#ifdef CONFIG_PLATFORM_8710C
#include "rtl8710c_pin_name.h"
#endif

#if CONFIG_ATCMD_MP_EXT2

#define MP_EXT2_PREFIX "[ATM2]: "
#define MP_EXT2_PRINTF(...) \
do{ \
_AT_PRINTK(MP_EXT2_PREFIX); \
_AT_PRINTK(__VA_ARGS__); \
}while(0)

#define UART_BRIDGE_USAGE "ATM2=bridge\n"
#define BT_POWER_USAGE "ATM2=bt_power,ACT <ACT: on/off>\n"
#define GNT_BT_USAGE "ATM2=gnt_bt,TARGET <TARGET: wifi/bt>\n"

#ifdef CONFIG_PLATFORM_8710C
#define UART_BRIDGE_TX PIN_UART3_TX
#define UART_BRIDGE_RX PIN_UART3_RX
#endif

#ifdef CONFIG_PLATFORM_8721D
#define UART_BRIDGE_TX _PA_7//Add TX for further use
#define UART_BRIDGE_RX _PA_8//Add RX for further use
#endif

extern void bt_uart_bridge_set(uint32_t baudrate_0, uint32_t baudrate_1, uint8_t parity, uint8_t debug);
extern void bt_uart_bridge_close(void);
extern void bt_uart_bridge_open(PinName tx, PinName rx);
extern void console_reinit_uart(void);
extern bool bte_init(void);
extern void bte_deinit(void);
extern bool bt_trace_init(void);
extern bool bt_trace_uninit(void);


static int mp_ext2_uart_bridge(void **argv, int argc)
{
return 0;
}

static int mp_ext2_bt_power(void **argv, int argc)
{
return 0;
}

static int mp_ext2_gnt_bt(void **argv, int argc)
{
(void)argc;
if(strcmp(argv[0], "wifi" ) == 0){
MP_EXT2_PRINTF("Switch GNT_BT to WIFI.\n\r");
}else if(strcmp(argv[0], "bt" ) == 0){
MP_EXT2_PRINTF("Switch GNT_BT to BT.\n\r");
}
return 0;
}

at_mp_ext_item_t at_mp_ext2_items[] = {
{"bridge", mp_ext2_uart_bridge, UART_BRIDGE_USAGE},
{"bt_power", mp_ext2_bt_power, BT_POWER_USAGE},
{"gnt_bt", mp_ext2_gnt_bt, GNT_BT_USAGE},
};


void fATM2(void *arg)
{
int argc = 0, idx, cmd_cnt;
char *argv[MAX_ARGC] = {0};
cmd_cnt = sizeof(at_mp_ext2_items)/sizeof(at_mp_ext2_items[0]);
argc = parse_param(arg, argv);
if(argc == 1){
_AT_PRINTK("\n");
MP_EXT2_PRINTF("Command usage :\n");
for(idx = 0; idx < cmd_cnt; idx++)
_AT_PRINTK("%s", at_mp_ext2_items[idx].mp_ext_usage);
}else{
for(idx = 0; idx < cmd_cnt; idx++){
if(strcmp(argv[1], at_mp_ext2_items[idx].mp_ext_cmd) == 0){
int (*fun)(void **argv, int argc) = at_mp_ext2_items[idx].mp_ext_fun;
fun((void**)&argv[2], argc-2);
return;
}
}
MP_EXT2_PRINTF("unknown command %s.\n", argv[1]);
}
}

#endif //#if CONFIG_ATCMD_MP_EXT2
#include <platform_stdlib.h>
#include <platform_opts.h>
#include <gpio_api.h>
#include "log_service.h"
#include "osdep_service.h"
#include "atcmd_mp.h"
#ifdef CONFIG_PLATFORM_8710C
#include "rtl8710c_pin_name.h"
#endif

#if CONFIG_ATCMD_MP_EXT2

#define MP_EXT2_PREFIX "[ATM2]: "
#define MP_EXT2_PRINTF(...) \
do{ \
_AT_PRINTK(MP_EXT2_PREFIX); \
_AT_PRINTK(__VA_ARGS__); \
}while(0)

#define UART_BRIDGE_USAGE "ATM2=bridge\n"
#define BT_POWER_USAGE "ATM2=bt_power,ACT <ACT: on/off>\n"
#define GNT_BT_USAGE "ATM2=gnt_bt,TARGET <TARGET: wifi/bt>\n"


#ifdef CONFIG_PLATFORM_8710C
#define UART_BRIDGE_TX PIN_UART3_TX
#define UART_BRIDGE_RX PIN_UART3_RX
#endif

#ifdef CONFIG_PLATFORM_8721D
#define UART_BRIDGE_TX _PA_7//Add TX for further use
#define UART_BRIDGE_RX _PA_8//Add RX for further use
#endif

extern void bt_uart_bridge_set(uint32_t baudrate_0, uint32_t baudrate_1, uint8_t parity, uint8_t debug);
extern void bt_uart_bridge_close(void);
extern void bt_uart_bridge_open(PinName tx, PinName rx);
extern void console_reinit_uart(void);
extern BOOL bte_init(void);
extern void bte_deinit(void);
extern BOOL bt_trace_init(void);
extern BOOL bt_trace_uninit(void);


static int mp_ext2_uart_bridge(void **argv, int argc)
{
return 0;
}

static int mp_ext2_bt_power(void **argv, int argc)
{
return 0;
}

static int mp_ext2_gnt_bt(void **argv, int argc)
{
(void)argc;
if(strcmp(argv[0], "wifi" ) == 0){
MP_EXT2_PRINTF("Switch GNT_BT to WIFI.\n\r");

}else if(strcmp(argv[0], "bt" ) == 0){
MP_EXT2_PRINTF("Switch GNT_BT to BT.\n\r");
}
return 0;
}

at_mp_ext_item_t at_mp_ext2_items[] = {
{"bridge", mp_ext2_uart_bridge, UART_BRIDGE_USAGE},
{"bt_power", mp_ext2_bt_power, BT_POWER_USAGE},
{"gnt_bt", mp_ext2_gnt_bt, GNT_BT_USAGE},
};


void fATM2(void *arg)
{
int argc = 0, idx, cmd_cnt;
char *argv[MAX_ARGC] = {0};

cmd_cnt = sizeof(at_mp_ext2_items)/sizeof(at_mp_ext2_items[0]);
argc = parse_param(arg, argv);
if(argc == 1){
_AT_PRINTK("\n");
MP_EXT2_PRINTF("Command usage :\n");
for(idx = 0; idx < cmd_cnt; idx++)
_AT_PRINTK("%s", at_mp_ext2_items[idx].mp_ext_usage);
}else{
for(idx = 0; idx < cmd_cnt; idx++){
if(strcmp(argv[1], at_mp_ext2_items[idx].mp_ext_cmd) == 0){
int (*fun)(void **argv, int argc) = at_mp_ext2_items[idx].mp_ext_fun;
fun((void**)&argv[2], argc-2);
return;
}
}
MP_EXT2_PRINTF("unknown command %s.\n", argv[1]);
}
}

#endif //#if CONFIG_ATCMD_MP_EXT2
34 changes: 22 additions & 12 deletions component/common/api/at_cmd/atcmd_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,10 @@ void fATWx(void *arg){
#if CONFIG_LWIP_LAYER
u8 *mac = LwIP_GetMAC(&xnetif[0]);
u8 *ip = LwIP_GetIP(&xnetif[0]);
#if LWIP_VERSION_MAJOR >= 2
#if LWIP_VERSION_MAJOR >= 2 && LWIP_VERSION_MINOR >= 1
#if LWIP_IPV6
u8 *ipv6 = LwIP_GetIPv6(&xnetif[0]);
u8 *ipv6_0 = LwIP_GetIPv6_linklocal(&xnetif[0]);
u8 *ipv6_1 = LwIP_GetIPv6_global(&xnetif[0]);
#endif
#endif
u8 *gw = LwIP_GetGW(&xnetif[0]);
Expand All @@ -499,9 +500,10 @@ void fATWx(void *arg){
#if CONFIG_LWIP_LAYER
mac = LwIP_GetMAC(&xnetif[i]);
ip = LwIP_GetIP(&xnetif[i]);
#if LWIP_VERSION_MAJOR >= 2
#if LWIP_VERSION_MAJOR >= 2 && LWIP_VERSION_MINOR >= 1
#if LWIP_IPV6
ipv6 = LwIP_GetIPv6(&xnetif[i]);
ipv6_0 = LwIP_GetIPv6_linklocal(&xnetif[i]);
ipv6_1 = LwIP_GetIPv6_global(&xnetif[i]);
#endif
#endif
gw = LwIP_GetGW(&xnetif[i]);
Expand Down Expand Up @@ -529,17 +531,20 @@ void fATWx(void *arg){
#endif
printf("\n\rInterface (%s)", ifname[i]);
printf("\n\r==============================");
printf("\n\r\tMAC => %02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]) ;
printf("\n\r\tIP => %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
#if LWIP_VERSION_MAJOR >= 2
printf("\n\r\tMAC => %02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]) ;
printf("\n\r\tIP => %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
#if LWIP_VERSION_MAJOR >= 2 && LWIP_VERSION_MINOR >= 1
#if LWIP_IPV6
printf("\n\r\tIPV6=> %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
ipv6[0], ipv6[1], ipv6[2], ipv6[3], ipv6[4], ipv6[5], ipv6[6], ipv6[7],
ipv6[8], ipv6[9], ipv6[10], ipv6[11], ipv6[12], ipv6[13], ipv6[14], ipv6[15]);
printf("\n\r\tLink-local IPV6 => %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
ipv6_0[0], ipv6_0[1], ipv6_0[2], ipv6_0[3], ipv6_0[4], ipv6_0[5], ipv6_0[6], ipv6_0[7],
ipv6_0[8], ipv6_0[9], ipv6_0[10], ipv6_0[11], ipv6_0[12], ipv6_0[13], ipv6_0[14], ipv6_0[15]);
printf("\n\r\tIPV6 => %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
ipv6_1[0], ipv6_1[1], ipv6_1[2], ipv6_1[3], ipv6_1[4], ipv6_1[5], ipv6_1[6], ipv6_1[7],
ipv6_1[8], ipv6_1[9], ipv6_1[10], ipv6_1[11], ipv6_1[12], ipv6_1[13], ipv6_1[14], ipv6_1[15]);
#endif
#endif
printf("\n\r\tGW => %d.%d.%d.%d", gw[0], gw[1], gw[2], gw[3]);
printf("\n\r\tmsk => %d.%d.%d.%d\n\r", msk[0], msk[1], msk[2], msk[3]);
printf("\n\r\tGW => %d.%d.%d.%d\n\r", gw[0], gw[1], gw[2], gw[3]);
printf("\n\r\tmsk => %d.%d.%d.%d\n\r", msk[0], msk[1], msk[2], msk[3]);
#endif
if(setting.mode == RTW_MODE_AP || i == 1)
{
Expand Down Expand Up @@ -1122,6 +1127,11 @@ void fATWC(void *arg){
#if CONFIG_LWIP_LAYER
/* Start DHCPClient */
LwIP_DHCP(0, DHCP_START);
#if LWIP_VERSION_MAJOR >= 2 && LWIP_VERSION_MINOR >= 1
#if LWIP_IPV6
LwIP_DHCP6(0, DHCP6_START);
#endif
#endif
tick3 = xTaskGetTickCount();
printf("\r\n\nGot IP after %dms.\n", (tick3-tick1));
#endif
Expand Down
Loading

0 comments on commit ed40706

Please sign in to comment.