|
@@ -22,6 +22,13 @@
|
|
|
|
|
|
|
|
#include <rtdbg.h>
|
|
#include <rtdbg.h>
|
|
|
|
|
|
|
|
|
|
+#ifdef PPP_DEVICE_DEBUG
|
|
|
|
|
+#define PPP_THREAD_STACK_SIZE 2048
|
|
|
|
|
+#else
|
|
|
|
|
+#define PPP_THREAD_STACK_SIZE 768
|
|
|
|
|
+#endif
|
|
|
|
|
+#define PPP_THREAD_PRIORITY 9
|
|
|
|
|
+
|
|
|
enum
|
|
enum
|
|
|
{
|
|
{
|
|
|
PPP_STATE_PREPARE,
|
|
PPP_STATE_PREPARE,
|
|
@@ -35,9 +42,6 @@ enum
|
|
|
#define PPP_RECONNECT_TIME 2500
|
|
#define PPP_RECONNECT_TIME 2500
|
|
|
#define PPP_RECV_READ_MAX 32
|
|
#define PPP_RECV_READ_MAX 32
|
|
|
|
|
|
|
|
-#define PPP_RECEIVE_THREAD_STACK_SIZE 768
|
|
|
|
|
-#define PPP_RECEIVE_THREAD_PRIORITY 7
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
#define PPP_EVENT_RX_NOTIFY 1 // serial incoming a byte
|
|
#define PPP_EVENT_RX_NOTIFY 1 // serial incoming a byte
|
|
|
#define PPP_EVENT_LOST 2 // PPP connection is lost
|
|
#define PPP_EVENT_LOST 2 // PPP connection is lost
|
|
@@ -59,6 +63,7 @@ static struct ppp_device *_g_ppp_device = RT_NULL;
|
|
|
#ifdef PPP_DEVICE_DEBUG
|
|
#ifdef PPP_DEVICE_DEBUG
|
|
|
static void ppp_debug_hexdump(const void *data, size_t len)
|
|
static void ppp_debug_hexdump(const void *data, size_t len)
|
|
|
{
|
|
{
|
|
|
|
|
+ rt_uint16_t maxlen = 16;
|
|
|
rt_uint32_t offset = 0;
|
|
rt_uint32_t offset = 0;
|
|
|
size_t curlen = 0, i = 0;
|
|
size_t curlen = 0, i = 0;
|
|
|
char line[16 * 4 + 3] = {0};
|
|
char line[16 * 4 + 3] = {0};
|
|
@@ -466,8 +471,8 @@ static int ppp_recv_entry_creat(struct ppp_device *device)
|
|
|
device->recv_tid = rt_thread_create("ppp_recv",
|
|
device->recv_tid = rt_thread_create("ppp_recv",
|
|
|
(void (*)(void *parameter))ppp_recv_entry,
|
|
(void (*)(void *parameter))ppp_recv_entry,
|
|
|
device,
|
|
device,
|
|
|
- PPP_RECEIVE_THREAD_STACK_SIZE,
|
|
|
|
|
- PPP_RECEIVE_THREAD_PRIORITY,
|
|
|
|
|
|
|
+ PPP_THREAD_STACK_SIZE,
|
|
|
|
|
+ PPP_THREAD_PRIORITY,
|
|
|
20);
|
|
20);
|
|
|
if (device->recv_tid == RT_NULL)
|
|
if (device->recv_tid == RT_NULL)
|
|
|
{
|
|
{
|
|
@@ -581,10 +586,10 @@ static rt_err_t ppp_device_open(struct rt_device *device, rt_uint16_t oflag)
|
|
|
ppp_set_usepeerdns(ppp_device->pcb, 1);
|
|
ppp_set_usepeerdns(ppp_device->pcb, 1);
|
|
|
LOG_D("ppp_set_usepeerdns has set a dns number.");
|
|
LOG_D("ppp_set_usepeerdns has set a dns number.");
|
|
|
|
|
|
|
|
-#ifdef USING_PPP_AUTHORIZE
|
|
|
|
|
|
|
+#ifdef USING_PRIVATE_APN
|
|
|
/* set authorize */
|
|
/* set authorize */
|
|
|
#if PAP_SUPPORT
|
|
#if PAP_SUPPORT
|
|
|
- ppp_set_auth(ppp_device->pcb , PPPAUTHTYPE_PAP, ppp_device->config.user_name, ppp_device->config.user_name);
|
|
|
|
|
|
|
+ ppp_set_auth(ppp_device->pcb , PPPAUTHTYPE_PAP, PRIVATE_APN_ACCOUNT, PRIVATE_APN_PASSWORD);
|
|
|
#elif CHAP_SUPPORT
|
|
#elif CHAP_SUPPORT
|
|
|
ppp_set_auth(ppp_device->pcb, PPPAUTHTYPE_CHAP, ppp_device->config.user_name, ppp_device->config.user_name);
|
|
ppp_set_auth(ppp_device->pcb, PPPAUTHTYPE_CHAP, ppp_device->config.user_name, ppp_device->config.user_name);
|
|
|
#else
|
|
#else
|