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
3ec252df
Unverified
Commit
3ec252df
authored
Apr 27, 2018
by
Terry Ellison
Committed by
GitHub
Apr 27, 2018
Browse files
Merge pull request #2357 from dnc40085/dev_cb_register_task_id_fix
Fixed coding errors in app/pm/swtimer.c
parents
45fea23d
da2bc739
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/pm/swtimer.c
View file @
3ec252df
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
//this section specifies which lua registry to use. LUA_GLOBALSINDEX or LUA_REGISTRYINDEX
//this section specifies which lua registry to use. LUA_GLOBALSINDEX or LUA_REGISTRYINDEX
#ifdef SWTMR_DEBUG
#ifdef SWTMR_DEBUG
#define SWTMR_DBG(fmt, ...)
c
_printf("\n SWTMR_DBG(%s): "fmt"\n", __FUNCTION__, ##__VA_ARGS__)
#define SWTMR_DBG(fmt, ...)
dbg
_printf("\n SWTMR_DBG(%s): "fmt"\n", __FUNCTION__, ##__VA_ARGS__)
#define L_REGISTRY LUA_GLOBALSINDEX
#define L_REGISTRY LUA_GLOBALSINDEX
#define CB_LIST_STR "timer_cb_ptrs"
#define CB_LIST_STR "timer_cb_ptrs"
#define SUSP_LIST_STR "suspended_tmr_LL_head"
#define SUSP_LIST_STR "suspended_tmr_LL_head"
...
@@ -83,7 +83,7 @@ typedef struct cb_registry_item{
...
@@ -83,7 +83,7 @@ typedef struct cb_registry_item{
/* Internal variables */
/* Internal variables */
static
tmr_cb_queue_t
*
register_queue
=
NULL
;
static
tmr_cb_queue_t
*
register_queue
=
NULL
;
static
task_handle_t
cb_register_task_id
=
NULL
;
//variable to hold task id for task handler(process_cb_register_queue)
static
task_handle_t
cb_register_task_id
=
0
;
//variable to hold task id for task handler(process_cb_register_queue)
/* Function declarations */
/* Function declarations */
//void swtmr_cb_register(void* timer_cb_ptr, uint8 resume_policy);
//void swtmr_cb_register(void* timer_cb_ptr, uint8 resume_policy);
...
@@ -173,7 +173,7 @@ void swtmr_suspend_timers(){
...
@@ -173,7 +173,7 @@ void swtmr_suspend_timers(){
*/
*/
while
(
timer_ptr
!=
NULL
){
while
(
timer_ptr
!=
NULL
){
os_timer_t
*
next_timer
=
(
os_timer_t
*
)
0xffffffff
;
os_timer_t
*
next_timer
=
(
os_timer_t
*
)
0xffffffff
;
for
(
in
t
i
=
0
;
i
<
registered_cb_qty
;
i
++
){
for
(
size_
t
i
=
0
;
i
<
registered_cb_qty
;
i
++
){
if
(
timer_ptr
->
timer_func
==
cb_reg_array
[
i
]
->
tmr_cb_ptr
){
if
(
timer_ptr
->
timer_func
==
cb_reg_array
[
i
]
->
tmr_cb_ptr
){
//current timer will be suspended, next timer's pointer will be needed to continue processing timer_list
//current timer will be suspended, next timer's pointer will be needed to continue processing timer_list
...
@@ -394,9 +394,8 @@ static void add_to_reg_queue(void* timer_cb_ptr, uint8 suspend_policy){
...
@@ -394,9 +394,8 @@ static void add_to_reg_queue(void* timer_cb_ptr, uint8 suspend_policy){
tmr_cb_queue_t
*
queue_temp
=
c_zalloc
(
sizeof
(
tmr_cb_queue_t
));
tmr_cb_queue_t
*
queue_temp
=
c_zalloc
(
sizeof
(
tmr_cb_queue_t
));
if
(
!
queue_temp
){
if
(
!
queue_temp
){
//it's boot time currently and we're already out of memory, something is very wrong...
//it's boot time currently and we're already out of memory, something is very wrong...
c_printf
(
"
\n\t
%s:out of memory, system halted!
\n
"
,
__FUNCTION__
);
dbg_printf
(
"
\n\t
%s:out of memory, rebooting."
,
__FUNCTION__
);
while
(
1
)
system_restart
();
system_soft_wdt_feed
();
}
}
queue_temp
->
tmr_cb_ptr
=
timer_cb_ptr
;
queue_temp
->
tmr_cb_ptr
=
timer_cb_ptr
;
queue_temp
->
suspend_policy
=
suspend_policy
;
queue_temp
->
suspend_policy
=
suspend_policy
;
...
@@ -476,8 +475,8 @@ int print_timer_list(lua_State* L){
...
@@ -476,8 +475,8 @@ int print_timer_list(lua_State* L){
os_timer_t
*
timer_list_ptr
=
timer_list
;
os_timer_t
*
timer_list_ptr
=
timer_list
;
c
_printf
(
"
\n\t
Current FRC2: %u
\n
"
,
RTC_REG_READ
(
FRC2_COUNT_ADDRESS
));
dbg
_printf
(
"
\n\t
Current FRC2: %u
\n
"
,
RTC_REG_READ
(
FRC2_COUNT_ADDRESS
));
c
_printf
(
"
\t
timer_list:
\n
"
);
dbg
_printf
(
"
\t
timer_list:
\n
"
);
while
(
timer_list_ptr
!=
NULL
){
while
(
timer_list_ptr
!=
NULL
){
bool
registered_flag
=
FALSE
;
bool
registered_flag
=
FALSE
;
for
(
int
i
=
0
;
i
<
registered_cb_qty
;
i
++
){
for
(
int
i
=
0
;
i
<
registered_cb_qty
;
i
++
){
...
@@ -486,7 +485,7 @@ int print_timer_list(lua_State* L){
...
@@ -486,7 +485,7 @@ int print_timer_list(lua_State* L){
break
;
break
;
}
}
}
}
c
_printf
(
"
\t
ptr:%p
\t
cb:%p
\t
expire:%8u
\t
period:%8u
\t
next:%p
\t
%s
\n
"
,
dbg
_printf
(
"
\t
ptr:%p
\t
cb:%p
\t
expire:%8u
\t
period:%8u
\t
next:%p
\t
%s
\n
"
,
timer_list_ptr
,
timer_list_ptr
->
timer_func
,
timer_list_ptr
->
timer_expire
,
timer_list_ptr
->
timer_period
,
timer_list_ptr
->
timer_next
,
registered_flag
?
"Registered"
:
""
);
timer_list_ptr
,
timer_list_ptr
->
timer_func
,
timer_list_ptr
->
timer_expire
,
timer_list_ptr
->
timer_period
,
timer_list_ptr
->
timer_next
,
registered_flag
?
"Registered"
:
""
);
timer_list_ptr
=
timer_list_ptr
->
timer_next
;
timer_list_ptr
=
timer_list_ptr
->
timer_next
;
}
}
...
@@ -513,9 +512,9 @@ int print_susp_timer_list(lua_State* L){
...
@@ -513,9 +512,9 @@ int print_susp_timer_list(lua_State* L){
}
}
os_timer_t
*
susp_timer_list_ptr
=
lua_touserdata
(
L
,
-
1
);
os_timer_t
*
susp_timer_list_ptr
=
lua_touserdata
(
L
,
-
1
);
c
_printf
(
"
\n\t
suspended_timer_list:
\n
"
);
dbg
_printf
(
"
\n\t
suspended_timer_list:
\n
"
);
while
(
susp_timer_list_ptr
!=
NULL
){
while
(
susp_timer_list_ptr
!=
NULL
){
c
_printf
(
"
\t
ptr:%p
\t
cb:%p
\t
expire:%8u
\t
period:%8u
\t
next:%p
\n
"
,
susp_timer_list_ptr
,
susp_timer_list_ptr
->
timer_func
,
susp_timer_list_ptr
->
timer_expire
,
susp_timer_list_ptr
->
timer_period
,
susp_timer_list_ptr
->
timer_next
);
dbg
_printf
(
"
\t
ptr:%p
\t
cb:%p
\t
expire:%8u
\t
period:%8u
\t
next:%p
\n
"
,
susp_timer_list_ptr
,
susp_timer_list_ptr
->
timer_func
,
susp_timer_list_ptr
->
timer_expire
,
susp_timer_list_ptr
->
timer_period
,
susp_timer_list_ptr
->
timer_next
);
susp_timer_list_ptr
=
susp_timer_list_ptr
->
timer_next
;
susp_timer_list_ptr
=
susp_timer_list_ptr
->
timer_next
;
}
}
return
0
;
return
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