10000 apps; main() is now the entry point to default task. · runtimeco/mynewt_arduino_zero@f012124 · GitHub
[go: up one dir, main page]

Skip to content

Commit f012124

Browse files
author
Marko Kiiskila
committed
apps; main() is now the entry point to default task.
1 parent 27bdf21 commit f012124

File tree

6 files changed

+22
-56
lines changed

6 files changed

+22
-56
lines changed

apps/arduino_test/src/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ main(int argc, char **argv)
5353
rc = arduino_test_init();
5454
assert(rc == 0);
5555

56-
os_start();
57-
58-
/* os start should never return. If it does, this should be an error */
56+
while (1) {
57+
os_eventq_run(os_eventq_dflt_get());
58+
}
5959
assert(0);
6060

6161
return rc;

apps/arduino_test/syscfg.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ syscfg.vals:
2121
# Enable the shell task.
2222
SHELL_TASK: 1
2323
CONFIG_NFFS: 1
24+
25+
# Default task settings
26+
OS_MAIN_TASK_PRIO: 10
27+
OS_MAIN_STACK_SIZE: 512

apps/espduino_test/src/main.c

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@
4444
#include <mcu/mcu_sim.h>
4545
#endif
4646

47-
#define WORKER_PRIO (3)
48-
#define WORKER_STACK_SIZE (OS_STACK_ALIGN(1024))
49-
os_stack_t worker_stack[WORKER_STACK_SIZE];
50-
static struct os_eventq worker_evq;
51-
static struct os_task worker_task;
52-
53-
54-
5547
int esp_cmd_send(int argc, char **argv);
5648

5749
static struct shell_cmd esp_cli_cmd = {
@@ -165,14 +157,6 @@ espduino_test_init(void)
165157
shell_cmd_register(&esp_cli_cmd);
166158
}
167159

168-
static void
169-
worker_func(void *unused)
170-
{
171< 8000 span class="diff-text-marker">-
while (1) {
172-
os_eventq_run(&worker_evq);
173-
}
174-
}
175-
176160
/**
177161
* main
178162
*
@@ -192,23 +176,12 @@ main(int argc, char **argv)
192176

193177
sysinit();
194178

195-
/* Initialize eventq */
196-
os_eventq_init(&worker_evq);
197-
198-
/* Create the bleprph task. All application logic and NimBLE host
199-
* operations are performed in this task.
200-
*/
201-
os_task_init(&worker_task, "worker", worker_func,
202-
NULL, WORKER_PRIO, OS_WAIT_FOREVER,
203-
worker_stack, WORKER_STACK_SIZE);
204-
os_eventq_dflt_set(&worker_evq);
205-
206179
espduino_test_init();
207180
console_printf("\nEspduino testing\n");
208181

209-
os_start();
210-
211-
/* os start should never return. If it does, this should be an error */
182+
while (1) {
183+
os_eventq_run(os_eventq_dflt_get());
184+
}
212185
assert(0);
213186

214187
return rc;

apps/espduino_test/syscfg.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@
2020
syscfg.vals:
2121
# Enable the shell task.
2222
SHELL_TASK: 1
23+
24+
# Default task settings
25+
OS_MAIN_TASK_PRIO: 3
26+
OS_MAIN_STACK_SIZE: 1024

apps/winc1500_wifi/src/main.c

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@
4242
#define WIFI_STACK_SZ 512
4343
static os_stack_t wifi_stack[WIFI_STACK_SZ];
4444

45-
#define NET_SVC_PRIO 5
46-
#define NET_SVC_STACK_SIZE 1024
47-
static struct os_task net_svc_task_struct;
48-
static struct os_eventq net_svc_evq;
49-
static os_stack_t net_svc_stack[NET_SVC_STACK_SIZE];
50-
5145
static int net_cli(int argc, char **argv);
5246
struct shell_cmd net_test_cmd = {
5347
.sc_cmd = "net",
@@ -280,21 +274,13 @@ net_cli(int argc, char **argv)
280274
}
281275
}
282276
} else if (!strcmp(argv[1], "service")) {
283-
inet_def_service_init(&net_svc_evq);
277+
inet_def_service_init(os_eventq_dflt_get());
284278
} else {
285279
console_printf("unknown cmd\n");
286280
}
287281
return 0;
288282
}
289283

290-
static void
291-
net_svc_task(void *arg)
292-
{
293-
while (1) {
294-
os_eventq_run(&net_svc_evq);
295-
}
296-
}
297-
298284
/**
299285
* main
300286
*
@@ -323,14 +309,9 @@ main(int argc, char **argv)
323309
winc1500_init();
324310
shell_cmd_register(&net_test_cmd);
325311

326-
os_eventq_init(&net_svc_evq);
327-
os_task_init(&net_svc_task_struct, "inetdef", net_svc_task, NULL,
328-
NET_SVC_PRIO, OS_WAIT_FOREVER, net_svc_stack, NET_SVC_STACK_SIZE);
329-
330-
os_eventq_dflt_set(&net_svc_evq);
331-
332-
os_start();
333-
312+
while (1) {
313+
os_eventq_run(os_eventq_dflt_get());
314+
}
334315
/* os start should never return. If it does, this should be an error */
335316
assert(0);
336317

apps/winc1500_wifi/syscfg.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ syscfg.vals:
99
SHELL_TASK: 1
1010
WIFI_MGMT_CLI: 1
1111
CONFIG_NFFS: 1
12+
13+
# Default task settings
14+
OS_MAIN_TASK_PRIO: 5
15+
OS_MAIN_STACK_SIZE: 1024

0 commit comments

Comments
 (0)
0