add '_lv_' prefix to global roots

This commit is contained in:
Amir Gonnen
2019-01-18 22:18:56 +02:00
parent 1e8ea6b15b
commit 473c2276dd
8 changed files with 80 additions and 80 deletions

View File

@@ -56,7 +56,7 @@ static bool anim_list_changed;
*/
void lv_anim_init(void)
{
lv_ll_init(&LV_GC_ROOT(_anim_ll), sizeof(lv_anim_t));
lv_ll_init(&LV_GC_ROOT(_lv_anim_ll), sizeof(lv_anim_t));
last_task_run = lv_tick_get();
lv_task_create(anim_task, LV_REFR_PERIOD, LV_TASK_PRIO_MID, NULL);
}
@@ -72,7 +72,7 @@ void lv_anim_create(lv_anim_t * anim_p)
if(anim_p->fp != NULL) lv_anim_del(anim_p->var, anim_p->fp); /*fp == NULL would delete all animations of var*/
/*Add the new animation to the animation linked list*/
lv_anim_t * new_anim = lv_ll_ins_head(&LV_GC_ROOT(_anim_ll));
lv_anim_t * new_anim = lv_ll_ins_head(&LV_GC_ROOT(_lv_anim_ll));
lv_mem_assert(new_anim);
if(new_anim == NULL) return;
@@ -102,13 +102,13 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp)
lv_anim_t * a;
lv_anim_t * a_next;
bool del = false;
a = lv_ll_get_head(&LV_GC_ROOT(_anim_ll));
a = lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));
while(a != NULL) {
/*'a' might be deleted, so get the next object while 'a' is valid*/
a_next = lv_ll_get_next(&LV_GC_ROOT(_anim_ll), a);
a_next = lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a);
if(a->var == var && (a->fp == fp || fp == NULL)) {
lv_ll_rem(&LV_GC_ROOT(_anim_ll), a);
lv_ll_rem(&LV_GC_ROOT(_lv_anim_ll), a);
lv_mem_free(a);
anim_list_changed = true; /*Read by `anim_task`. It need to know if a delete occurred in the linked list*/
del = true;
@@ -357,12 +357,12 @@ static void anim_task(void * param)
(void)param;
lv_anim_t * a;
LL_READ(LV_GC_ROOT(_anim_ll), a) {
LL_READ(LV_GC_ROOT(_lv_anim_ll), a) {
a->has_run = 0;
}
uint32_t elaps = lv_tick_elaps(last_task_run);
a = lv_ll_get_head(&LV_GC_ROOT(_anim_ll));
a = lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));
while(a != NULL) {
/*It can be set by `lv_anim_del()` typically in `end_cb`. If set then an animation delete happened in `anim_ready_handler`
@@ -390,8 +390,8 @@ static void anim_task(void * param)
/* If the linked list changed due to anim. delete then it's not safe to continue
* the reading of the list from here -> start from the head*/
if(anim_list_changed) a = lv_ll_get_head(&LV_GC_ROOT(_anim_ll));
else a = lv_ll_get_next(&LV_GC_ROOT(_anim_ll), a);
if(anim_list_changed) a = lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));
else a = lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a);
}
last_task_run = lv_tick_get();
@@ -401,7 +401,7 @@ static void anim_task(void * param)
* Called when an animation is ready to do the necessary thinks
* e.g. repeat, play back, delete etc.
* @param a pointer to an animation descriptor
* @return true: animation delete occurred nnd the `LV_GC_ROOT(_anim_ll)` has changed
* @return true: animation delete occurred nnd the `LV_GC_ROOT(_lv_anim_ll)` has changed
* */
static bool anim_ready_handler(lv_anim_t * a)
{
@@ -413,7 +413,7 @@ static bool anim_ready_handler(lv_anim_t * a)
(a->repeat == 0 && a->playback == 1 && a->playback_now == 1)) {
void (*cb)(void *) = a->end_cb;
void * p = a->var;
lv_ll_rem(&LV_GC_ROOT(_anim_ll), a);
lv_ll_rem(&LV_GC_ROOT(_lv_anim_ll), a);
lv_mem_free(a);
anim_list_changed = true;

View File

@@ -49,7 +49,7 @@ static lv_fs_drv_t * lv_fs_get_drv(char letter);
*/
void lv_fs_init(void)
{
lv_ll_init(&LV_GC_ROOT(_drv_ll), sizeof(lv_fs_drv_t));
lv_ll_init(&LV_GC_ROOT(_lv_drv_ll), sizeof(lv_fs_drv_t));
}
@@ -453,7 +453,7 @@ void lv_fs_add_drv(lv_fs_drv_t * drv_p)
{
/*Save the new driver*/
lv_fs_drv_t * new_drv;
new_drv = lv_ll_ins_head(&LV_GC_ROOT(_drv_ll));
new_drv = lv_ll_ins_head(&LV_GC_ROOT(_lv_drv_ll));
lv_mem_assert(new_drv);
if(new_drv == NULL) return;
@@ -470,7 +470,7 @@ char * lv_fs_get_letters(char * buf)
lv_fs_drv_t * drv;
uint8_t i = 0;
LL_READ(LV_GC_ROOT(_drv_ll), drv) {
LL_READ(LV_GC_ROOT(_lv_drv_ll), drv) {
buf[i] = drv->letter;
i++;
}
@@ -593,7 +593,7 @@ static lv_fs_drv_t * lv_fs_get_drv(char letter)
{
lv_fs_drv_t * drv;
LL_READ(LV_GC_ROOT(_drv_ll), drv) {
LL_READ(LV_GC_ROOT(_lv_drv_ll), drv) {
if(drv->letter == letter) {
return drv;
}

View File

@@ -31,17 +31,17 @@ extern "C" {
#define LV_GC_ROOTS(prefix) \
prefix lv_ll_t _lv_task_ll; /*Linked list to store the lv_tasks*/ \
prefix lv_ll_t _scr_ll; /*Linked list of screens*/ \
prefix lv_ll_t _drv_ll;\
prefix lv_ll_t _file_ll;\
prefix lv_ll_t _anim_ll;\
prefix void * _def_scr;\
prefix void * _act_scr;\
prefix void * _top_layer;\
prefix void * _sys_layer;\
prefix void * _task_act;\
prefix void * _indev_list;\
prefix void * _disp_list;\
prefix lv_ll_t _lv_scr_ll; /*Linked list of screens*/ \
prefix lv_ll_t _lv_drv_ll;\
prefix lv_ll_t _lv_file_ll;\
prefix lv_ll_t _lv_anim_ll;\
prefix void * _lv_def_scr;\
prefix void * _lv_act_scr;\
prefix void * _lv_top_layer;\
prefix void * _lv_sys_layer;\
prefix void * _lv_task_act;\
prefix void * _lv_indev_list;\
prefix void * _lv_disp_list;\
#define LV_NO_PREFIX

View File

@@ -87,33 +87,33 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
end_flag = true;
task_deleted = false;
task_created = false;
LV_GC_ROOT(_task_act) = lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll));
while(LV_GC_ROOT(_task_act)) {
LV_GC_ROOT(_lv_task_act) = lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll));
while(LV_GC_ROOT(_lv_task_act)) {
/* The task might be deleted if it runs only once ('once = 1')
* So get next element until the current is surely valid*/
next = lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), LV_GC_ROOT(_task_act));
next = lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), LV_GC_ROOT(_lv_task_act));
/*We reach priority of the turned off task. There is nothing more to do.*/
if(((lv_task_t *)LV_GC_ROOT(_task_act))->prio == LV_TASK_PRIO_OFF) {
if(((lv_task_t *)LV_GC_ROOT(_lv_task_act))->prio == LV_TASK_PRIO_OFF) {
break;
}
/*Here is the interrupter task. Don't execute it again.*/
if(LV_GC_ROOT(_task_act) == task_interrupter) {
if(LV_GC_ROOT(_lv_task_act) == task_interrupter) {
task_interrupter = NULL; /*From this point only task after the interrupter comes, so the interrupter is not interesting anymore*/
LV_GC_ROOT(_task_act) = next;
LV_GC_ROOT(_lv_task_act) = next;
continue; /*Load the next task*/
}
/*Just try to run the tasks with highest priority.*/
if(((lv_task_t *)LV_GC_ROOT(_task_act))->prio == LV_TASK_PRIO_HIGHEST) {
lv_task_exec(LV_GC_ROOT(_task_act));
if(((lv_task_t *)LV_GC_ROOT(_lv_task_act))->prio == LV_TASK_PRIO_HIGHEST) {
lv_task_exec(LV_GC_ROOT(_lv_task_act));
}
/*Tasks with higher priority then the interrupted shall be run in every case*/
else if(task_interrupter) {
if(((lv_task_t *)LV_GC_ROOT(_task_act))->prio > task_interrupter->prio) {
if(lv_task_exec(LV_GC_ROOT(_task_act))) {
task_interrupter = LV_GC_ROOT(_task_act); /*Check all tasks again from the highest priority */
if(((lv_task_t *)LV_GC_ROOT(_lv_task_act))->prio > task_interrupter->prio) {
if(lv_task_exec(LV_GC_ROOT(_lv_task_act))) {
task_interrupter = LV_GC_ROOT(_lv_task_act); /*Check all tasks again from the highest priority */
end_flag = false;
break;
}
@@ -122,8 +122,8 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
/* It is no interrupter task or we already reached it earlier.
* Just run the remaining tasks*/
else {
if(lv_task_exec(LV_GC_ROOT(_task_act))) {
task_interrupter = LV_GC_ROOT(_task_act); /*Check all tasks again from the highest priority */
if(lv_task_exec(LV_GC_ROOT(_lv_task_act))) {
task_interrupter = LV_GC_ROOT(_lv_task_act); /*Check all tasks again from the highest priority */
end_flag = false;
break;
}
@@ -132,7 +132,7 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
if(task_deleted) break; /*If a task was deleted then this or the next item might be corrupted*/
if(task_created) break; /*If a task was deleted then this or the next item might be corrupted*/
LV_GC_ROOT(_task_act) = next; /*Load the next task*/
LV_GC_ROOT(_lv_task_act) = next; /*Load the next task*/
}
} while(!end_flag);
@@ -212,7 +212,7 @@ void lv_task_del(lv_task_t * lv_task_p)
lv_mem_free(lv_task_p);
if(LV_GC_ROOT(_task_act) == lv_task_p) task_deleted = true; /*The active task was deleted*/
if(LV_GC_ROOT(_lv_task_act) == lv_task_p) task_deleted = true; /*The active task was deleted*/
}
/**

View File

@@ -53,7 +53,7 @@ static bool inited = false;
*/
void lv_ufs_init(void)
{
lv_ll_init(&LV_GC_ROOT(_file_ll), sizeof(lv_ufs_ent_t));
lv_ll_init(&LV_GC_ROOT(_lv_file_ll), sizeof(lv_ufs_ent_t));
lv_fs_drv_t ufs_drv;
memset(&ufs_drv, 0, sizeof(lv_fs_drv_t)); /*Initialization*/
@@ -207,7 +207,7 @@ lv_fs_res_t lv_ufs_remove(const char * fn)
/*Can not be deleted is opened*/
if(ent->oc != 0) return LV_FS_RES_DENIED;
lv_ll_rem(&LV_GC_ROOT(_file_ll), ent);
lv_ll_rem(&LV_GC_ROOT(_lv_file_ll), ent);
lv_mem_free(ent->fn_d);
ent->fn_d = NULL;
if(ent->const_data == 0) {
@@ -417,9 +417,9 @@ lv_fs_res_t lv_ufs_dir_read(void * dir_p, char * fn)
lv_ufs_dir_t * ufs_dir_p = dir_p;
if(ufs_dir_p->last_ent == NULL) {
ufs_dir_p->last_ent = lv_ll_get_head(&LV_GC_ROOT(_file_ll));
ufs_dir_p->last_ent = lv_ll_get_head(&LV_GC_ROOT(_lv_file_ll));
} else {
ufs_dir_p->last_ent = lv_ll_get_next(&LV_GC_ROOT(_file_ll), ufs_dir_p->last_ent);
ufs_dir_p->last_ent = lv_ll_get_next(&LV_GC_ROOT(_lv_file_ll), ufs_dir_p->last_ent);
}
if(ufs_dir_p->last_ent != NULL) {
@@ -477,7 +477,7 @@ static lv_ufs_ent_t * lv_ufs_ent_get(const char * fn)
{
lv_ufs_ent_t * fp;
LL_READ(LV_GC_ROOT(_file_ll), fp) {
LL_READ(LV_GC_ROOT(_lv_file_ll), fp) {
if(strcmp(fp->fn_d, fn) == 0) {
return fp;
}
@@ -495,7 +495,7 @@ static lv_ufs_ent_t * lv_ufs_ent_get(const char * fn)
static lv_ufs_ent_t * lv_ufs_ent_new(const char * fn)
{
lv_ufs_ent_t * new_ent = NULL;
new_ent = lv_ll_ins_head(&LV_GC_ROOT(_file_ll)); /*Create a new file*/
new_ent = lv_ll_ins_head(&LV_GC_ROOT(_lv_file_ll)); /*Create a new file*/
lv_mem_assert(new_ent);
if(new_ent == NULL) return NULL;