mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-20 11:19:56 +00:00
Move mg_task to SimpleLink platform code
It'll be used for MSP432 as well PUBLISHED_FROM=cb5dcda4cc5d9edc6dea71540d51ab00e252186e
This commit is contained in:
1 parent
76364af243
commit
c8b09c2238
8 files changed
+91
-95
No files matched your search
@@ -7,6 +7,9 @@ PORT ?= auto
|
||||
MAKEFLAGS += w
|
||||
|
||||
all clean:
|
||||
rm -rf ccs/*/Debug
|
||||
rm -rf ccs/*/Release
|
||||
rm -rf ccs/*/.launches
|
||||
docker run --rm -i -v $(SRC_DIR):/src $(SDK) \
|
||||
/bin/bash -c "\
|
||||
make -C /src/mongoose mongoose.c mongoose.h && \
|
||||
|
||||
@@ -93,7 +93,7 @@ VPATH += $(SDK_PATH)/driverlib $(SDK_PATH)/example/common $(SDK_PATH)/oslib \
|
||||
$(SDK_PATH)/third_party/FreeRTOS/source/portable/GCC/ARM_CM4 \
|
||||
$(SDK_PATH)/third_party/FreeRTOS/source/portable/MemMang \
|
||||
|
||||
APP_SRCS = main.c bm222.c data.c mongoose.c mg_task.c tmp006.c wifi.c $(SDK_SRCS)
|
||||
APP_SRCS = main.c bm222.c data.c mongoose.c tmp006.c wifi.c $(SDK_SRCS)
|
||||
APP_OBJS = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(APP_SRCS)))
|
||||
|
||||
$(FW_ELF): $(APP_OBJS)
|
||||
|
||||
@@ -25,16 +25,6 @@
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>mg_task.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/mg_task.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>mg_task.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/mg_task.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>mongoose.c</name>
|
||||
<type>1</type>
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
#include "data.h"
|
||||
#include "mongoose.h"
|
||||
#include "mg_task.h"
|
||||
#include "wifi.h"
|
||||
|
||||
/* Set up an AP or connect to existing WiFi network. */
|
||||
@@ -52,8 +51,6 @@
|
||||
#define BM222_ADDR 0x18
|
||||
#define TMP006_ADDR 0x41
|
||||
|
||||
extern int cc3200_fs_init();
|
||||
|
||||
static struct mg_str upload_fname(struct mg_connection *nc,
|
||||
struct mg_str fname) {
|
||||
struct mg_str lfn;
|
||||
@@ -124,7 +121,9 @@ static void mg_init(struct mg_mgr *mgr) {
|
||||
|
||||
data_init_sensors(TMP006_ADDR, BM222_ADDR);
|
||||
|
||||
cc3200_fs_init();
|
||||
sl_fs_init();
|
||||
|
||||
sl_Start(NULL, NULL, NULL);
|
||||
|
||||
#if defined(WIFI_STA_SSID)
|
||||
if (!wifi_setup_sta(WIFI_STA_SSID, WIFI_STA_PASS)) {
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#include "mg_task.h"
|
||||
|
||||
enum mg_q_msg_type {
|
||||
MG_Q_MSG_CB,
|
||||
};
|
||||
struct mg_q_msg {
|
||||
enum mg_q_msg_type type;
|
||||
void (*cb)(struct mg_mgr *mgr, void *arg);
|
||||
void *arg;
|
||||
};
|
||||
static OsiMsgQ_t s_mg_q;
|
||||
static void mg_task(void *arg);
|
||||
|
||||
bool mg_start_task(int priority, int stack_size, mg_init_cb mg_init) {
|
||||
if (osi_MsgQCreate(&s_mg_q, "MG", sizeof(struct mg_q_msg), 16) != OSI_OK) {
|
||||
return false;
|
||||
}
|
||||
if (osi_TaskCreate(mg_task, (const signed char *) "MG", stack_size,
|
||||
(void *) mg_init, priority, NULL) != OSI_OK) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void mg_task(void *arg) {
|
||||
struct mg_mgr mgr;
|
||||
mg_init_cb mg_init = (mg_init_cb) arg;
|
||||
sl_Start(NULL, NULL, NULL);
|
||||
mg_mgr_init(&mgr, NULL);
|
||||
mg_init(&mgr);
|
||||
while (1) {
|
||||
struct mg_q_msg msg;
|
||||
mg_mgr_poll(&mgr, 1);
|
||||
if (osi_MsgQRead(&s_mg_q, &msg, 1) != OSI_OK) continue;
|
||||
switch (msg.type) {
|
||||
case MG_Q_MSG_CB: {
|
||||
msg.cb(&mgr, msg.arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mg_run_in_task(void (*cb)(struct mg_mgr *mgr, void *arg), void *cb_arg) {
|
||||
struct mg_q_msg msg = {MG_Q_MSG_CB, cb, cb_arg};
|
||||
osi_MsgQWrite(&s_mg_q, &msg, OSI_NO_WAIT);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016 Cesanta Software Limited
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
#ifndef CS_MONGOOSE_EXAMPLES_CC3200_MG_TASK_H_
|
||||
#define CS_MONGOOSE_EXAMPLES_CC3200_MG_TASK_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <oslib/osi.h>
|
||||
#include "mongoose.h"
|
||||
|
||||
typedef void (*mg_init_cb)(struct mg_mgr *mgr);
|
||||
bool mg_start_task(int priority, int stack_size, mg_init_cb mg_init);
|
||||
|
||||
void mg_run_in_task(void (*cb)(struct mg_mgr *mgr, void *arg), void *cb_arg);
|
||||
|
||||
#endif /* CS_MONGOOSE_EXAMPLES_CC3200_MG_TASK_H_ */
|
||||
Reference in new issue
Block a user