Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
75dbc59b
Commit
75dbc59b
authored
May 31, 2016
by
Johny Mattsson
Browse files
Fixes to task reimplementation to make UART work.
parent
56789592
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/task/task.c
View file @
75dbc59b
...
...
@@ -54,12 +54,13 @@ bool task_init_handler(task_prio_t priority, uint8 qlen) {
task_handle_t
task_get_id
(
task_callback_t
t
)
{
int
p
=
TASK_PRIORITY_COUNT
;
/* Initialise and uninitialised Qs with the default Q len */
while
(
p
--
)
/* Initialise any uninitialised Qs with the default Q len */
for
(
task_prio_t
p
=
TASK_PRIORITY_LOW
;
p
!=
TASK_PRIORITY_COUNT
;
++
p
)
{
if
(
!
task_Q
[
p
])
{
CHECK
(
task_init_handler
(
p
,
TASK_DEFAULT_QUEUE_LEN
),
0
,
"Task initialisation failed"
);
}
}
if
(
(
task_count
&
(
TASK_HANDLE_ALLOCATION_BRICK
-
1
))
==
0
)
{
/* With a brick size of 4 this branch is taken at 0, 4, 8 ... and the new size is +4 */
...
...
@@ -71,8 +72,8 @@ task_handle_t task_get_id(task_callback_t t) {
memset
(
task_func
+
task_count
,
0
,
sizeof
(
task_callback_t
)
*
TASK_HANDLE_ALLOCATION_BRICK
);
}
task_func
[
task_count
++
]
=
t
;
return
TASK_HANDLE_MONIKER
+
(
task_count
-
1
)
;
task_func
[
task_count
]
=
t
;
return
TASK_HANDLE_MONIKER
|
task_count
++
;
}
...
...
@@ -80,7 +81,7 @@ bool task_post (task_prio_t priority, task_handle_t handle, task_param_t param)
{
if
(
priority
>=
TASK_PRIORITY_COUNT
||
!
task_Q
[
priority
]
||
(
handle
&
TASK_HANDLE_MASK
!=
TASK_HANDLE_MONIKER
)
)
(
handle
&
TASK_HANDLE_MASK
)
!=
TASK_HANDLE_MONIKER
)
return
false
;
task_event_t
ev
=
{
handle
,
param
};
...
...
@@ -95,11 +96,12 @@ bool task_post (task_prio_t priority, task_handle_t handle, task_param_t param)
static
bool
next_event
(
task_event_t
*
ev
,
task_prio_t
*
prio
)
{
for
(
task_prio_t
p
=
TASK_PRIORITY_COUNT
;
p
!=
TASK_PRIORITY_LOW
;
--
p
)
for
(
task_prio_t
p
r
=
TASK_PRIORITY_COUNT
;
p
r
!=
TASK_PRIORITY_LOW
;
--
p
r
)
{
if
(
task_Q
[
p
-
1
]
&&
xQueueReceive
(
task_Q
[
p
-
1
],
ev
,
0
)
==
pdTRUE
)
task_prio_t
p
=
pr
-
1
;
if
(
task_Q
[
p
]
&&
xQueueReceive
(
task_Q
[
p
],
ev
,
0
)
==
pdTRUE
)
{
*
prio
=
p
-
1
;
*
prio
=
p
;
return
true
;
}
}
...
...
app/user/user_main.c
View file @
75dbc59b
...
...
@@ -54,6 +54,7 @@ void TEXT_SECTION_ATTR user_start_trampoline (void)
// +================== New task interface ==================+
static
void
start_lua
(
task_param_t
param
,
task_prio_t
prio
)
{
(
void
)
param
;
(
void
)
prio
;
char
*
lua_argv
[]
=
{
(
char
*
)
"lua"
,
(
char
*
)
"-i"
,
NULL
};
NODE_DBG
(
"Task task_lua started.
\n
"
);
...
...
@@ -115,7 +116,7 @@ void nodemcu_init(void)
// test_spiffs();
#endif
task_post_low
(
task_get_id
(
start_lua
),
's'
);
task_post_low
(
task_get_id
(
start_lua
),
0
);
}
...
...
@@ -142,13 +143,10 @@ void user_init(void)
rtctime_late_startup
();
#endif
#if 0
// TODO: fix uart driver to work with RTOS SDK
UartBautRate
br
=
BIT_RATE_DEFAULT
;
input_sig
=
task_get_id
(
handle_input
);
uart_init
(
br
,
br
,
input_sig
);
#endif
#ifndef NODE_DEBUG
system_set_os_print
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment