|
|
@ -24,8 +24,8 @@ |
|
|
#define DBG_LVL DBG_LOG |
|
|
#define DBG_LVL DBG_LOG |
|
|
#include <rtdbg.h> |
|
|
#include <rtdbg.h> |
|
|
|
|
|
|
|
|
rt_mq_t proc_mq; |
|
|
struct rt_messagequeue *request_mq; // UART → Proc
|
|
|
//static struct proc_request *req;
|
|
|
struct rt_messagequeue *response_mq; // Proc → UART
|
|
|
|
|
|
|
|
|
char cjson_falg=0;//是否解析cjson
|
|
|
char cjson_falg=0;//是否解析cjson
|
|
|
char *json_buffer=NULL;//
|
|
|
char *json_buffer=NULL;//
|
|
|
@ -535,7 +535,7 @@ void proc_thread_entry(void *parameter) |
|
|
while (1) |
|
|
while (1) |
|
|
{ |
|
|
{ |
|
|
// 接收请求指针
|
|
|
// 接收请求指针
|
|
|
if (rt_mq_recv(proc_mq, &req, sizeof(req), RT_WAITING_FOREVER) >= RT_EOK) |
|
|
if (rt_mq_recv(request_mq, &req, sizeof(req), RT_WAITING_FOREVER) >= RT_EOK) |
|
|
{ |
|
|
{ |
|
|
if (!req) continue; |
|
|
if (!req) continue; |
|
|
memcpy(DATA_api,req->input,5); |
|
|
memcpy(DATA_api,req->input,5); |
|
|
@ -565,11 +565,8 @@ void proc_thread_entry(void *parameter) |
|
|
{ |
|
|
{ |
|
|
req->input[i]=0; |
|
|
req->input[i]=0; |
|
|
} |
|
|
} |
|
|
// 通知 UART 线程可以发送了
|
|
|
// 发送到 UART 线程
|
|
|
if (req->sem) |
|
|
rt_mq_send(response_mq, &req, sizeof(req)); |
|
|
{ |
|
|
|
|
|
rt_sem_release(req->sem); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -580,8 +577,9 @@ static void *dat_comm_stack __attribute__((aligned(4)))= RT_NULL ; |
|
|
int data_comm_init(void) |
|
|
int data_comm_init(void) |
|
|
{ |
|
|
{ |
|
|
rt_err_t dat_err; |
|
|
rt_err_t dat_err; |
|
|
proc_mq = rt_mq_create("proc_mq", sizeof(struct proc_request*), 5, RT_IPC_FLAG_FIFO); |
|
|
request_mq = rt_mq_create("request_mq", sizeof(struct proc_request*), 5, RT_IPC_FLAG_FIFO); |
|
|
if (proc_mq == RT_NULL) |
|
|
response_mq = rt_mq_create("response_mq", sizeof(struct proc_request*), 5, RT_IPC_FLAG_FIFO); |
|
|
|
|
|
if ((request_mq == RT_NULL) || (response_mq ==RT_NULL)) |
|
|
{ |
|
|
{ |
|
|
LOG_E("Failed to create message queue!\n"); |
|
|
LOG_E("Failed to create message queue!\n"); |
|
|
return -1; |
|
|
return -1; |
|
|
|