APP_Framework/Framework/:update ethernet driver and update the connection files,and the mcu can communicate with the ethernet module correctly, but the module can't connect the local server.
This commit is contained in:
@@ -446,11 +446,13 @@ int DeleteATAgent(ATAgentType agent)
|
||||
PrivMutexDelete(&agent->lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ADD_XIZI_FETURES
|
||||
if (agent->entm_rx_notice) {
|
||||
printf("delete agent entm_rx_notice = %d\n",agent->entm_rx_notice);
|
||||
PrivSemaphoreDelete(&agent->entm_rx_notice);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
#ifdef ADD_XIZI_FETURES
|
||||
if (agent->rsp_sem) {
|
||||
printf("delete agent rsp_sem = %d\n",agent->rsp_sem);
|
||||
|
||||
@@ -74,7 +74,11 @@ struct ATAgent
|
||||
char entm_recv_buf[ENTM_RECV_MAX];
|
||||
uint32 entm_recv_len;
|
||||
enum ReceiveMode receive_mode;
|
||||
#ifdef ADD_XIZI_FETURES
|
||||
int entm_rx_notice;
|
||||
#else
|
||||
sem_t entm_rx_notice;
|
||||
#endif
|
||||
};
|
||||
typedef struct ATAgent *ATAgentType;
|
||||
|
||||
|
||||
@@ -97,28 +97,33 @@ int AdapterEthernetTest(void)
|
||||
|
||||
AdapterDeviceSetUp(adapter);
|
||||
|
||||
const char *ip = "10.10.100.50";
|
||||
const char *port = "12345";
|
||||
const char *ip = "192.168.131.26";
|
||||
const char *port = "9999";
|
||||
enum NetRoleType net_role = CLIENT;//SERVER
|
||||
enum IpType ip_type = IPV4;
|
||||
AdapterDeviceConnect(adapter, net_role, ip, port, ip_type);
|
||||
|
||||
printf("ready to test data transfer\n");
|
||||
|
||||
PrivTaskDelay(2000);
|
||||
len = strlen(ethernet_msg);
|
||||
for (i = 0;i < 10; i ++) {
|
||||
printf("AdapterEthernetTest send %s\n", ethernet_msg);
|
||||
AdapterDeviceSend(adapter, ethernet_msg, len);
|
||||
PrivTaskDelay(4000);
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
AdapterDeviceRecv(adapter, ethernet_recv_msg, 128);
|
||||
printf("AdapterEthernetTest recv %s\n", ethernet_recv_msg);
|
||||
memset(ethernet_recv_msg, 0, 128);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#ifdef ADD_RTTHREAD_FETURES
|
||||
MSH_CMD_EXPORT(AdapterEthernetTest,a ethernet adpter sample);
|
||||
#elif definded ADD_XIZI_FETURES
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, AdapterEthernetTest, AdapterEthernetTest, show adapter ethernet information);
|
||||
#endif
|
||||
|
||||
@@ -72,7 +72,7 @@ static int Hfa21EthernetOpen(struct Adapter *adapter)
|
||||
/*step2: init AT agent*/
|
||||
if (!adapter->agent) {
|
||||
char *agent_name = "ethernet_uart_client";
|
||||
if (EOK != InitATAgent(agent_name, adapter->fd, 512)) {
|
||||
if (0 != InitATAgent(agent_name, adapter->fd, 512)) {
|
||||
printf("at agent init failed !\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -168,19 +168,20 @@ static int Hfa21EthernetSetUp(struct Adapter *adapter)
|
||||
|
||||
Hfa21EthernetInitAtCmd(adapter->agent);
|
||||
|
||||
/*Step3 : FEPHY enable phy function*/
|
||||
/*Step3 : FEPHY enable phy function*/
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_FEPHY_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
if (ret < 0) {
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
PrivTaskDelay(2000);
|
||||
/*Step4 : FVEW disable WANN function, ethernet work at LANN mode*/
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_DISABLE_WANN_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
if (ret < 0) {
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
/*Step5 : RELD enable F-AT cmd*/
|
||||
PrivTaskDelay(2000);
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_RELD_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
if (ret < 0) {
|
||||
goto __exit;
|
||||
@@ -195,13 +196,13 @@ static int Hfa21EthernetSetUp(struct Adapter *adapter)
|
||||
if (ret < 0) {
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
PrivTaskDelay(2000);
|
||||
/*Step7 : AT+WANN check if get ip、netmask、gateway*/
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_WANN_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
if (ret < 0) {
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
PrivTaskDelay(2000);
|
||||
/*Step8 : AT+Z reboot hfa21 device*/
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_REBOOT_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
if (ret < 0) {
|
||||
@@ -209,7 +210,6 @@ static int Hfa21EthernetSetUp(struct Adapter *adapter)
|
||||
}
|
||||
|
||||
PrivTaskDelay(10000);
|
||||
|
||||
return ret;
|
||||
|
||||
__exit:
|
||||
@@ -365,6 +365,7 @@ static int Hfa21EthernetConnect(struct Adapter *adapter, enum NetRoleType net_ro
|
||||
}
|
||||
|
||||
adapter->net_role = net_role;
|
||||
PrivTaskDelay(2000);
|
||||
|
||||
/*Step3 : AT+Z reboot hfa21 device*/
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_REBOOT_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
|
||||
Reference in New Issue
Block a user