add '_lv_' prefix to global roots
This commit is contained in:
committed by
Gabor Kiss-Vamosi
parent
0935110284
commit
a6c89ee54f
@@ -62,10 +62,10 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
*/
|
||||
void lv_init(void)
|
||||
{
|
||||
LV_GC_ROOT(_def_scr) = NULL;
|
||||
LV_GC_ROOT(_act_scr) = NULL;
|
||||
LV_GC_ROOT(_top_layer) = NULL;
|
||||
LV_GC_ROOT(_sys_layer) = NULL;
|
||||
LV_GC_ROOT(_lv_def_scr) = NULL;
|
||||
LV_GC_ROOT(_lv_act_scr) = NULL;
|
||||
LV_GC_ROOT(_lv_top_layer) = NULL;
|
||||
LV_GC_ROOT(_lv_sys_layer) = NULL;
|
||||
|
||||
LV_LOG_TRACE("lv_init started");
|
||||
|
||||
@@ -90,19 +90,19 @@ void lv_init(void)
|
||||
lv_refr_init();
|
||||
|
||||
/*Create the default screen*/
|
||||
lv_ll_init(&LV_GC_ROOT(_scr_ll), sizeof(lv_obj_t));
|
||||
LV_GC_ROOT(_def_scr) = lv_obj_create(NULL, NULL);
|
||||
lv_ll_init(&LV_GC_ROOT(_lv_scr_ll), sizeof(lv_obj_t));
|
||||
LV_GC_ROOT(_lv_def_scr) = lv_obj_create(NULL, NULL);
|
||||
|
||||
LV_GC_ROOT(_act_scr) = LV_GC_ROOT(_def_scr);
|
||||
LV_GC_ROOT(_lv_act_scr) = LV_GC_ROOT(_lv_def_scr);
|
||||
|
||||
LV_GC_ROOT(_top_layer) = lv_obj_create(NULL, NULL);
|
||||
lv_obj_set_style(LV_GC_ROOT(_top_layer), &lv_style_transp_fit);
|
||||
LV_GC_ROOT(_lv_top_layer) = lv_obj_create(NULL, NULL);
|
||||
lv_obj_set_style(LV_GC_ROOT(_lv_top_layer), &lv_style_transp_fit);
|
||||
|
||||
LV_GC_ROOT(_sys_layer) = lv_obj_create(NULL, NULL);
|
||||
lv_obj_set_style(LV_GC_ROOT(_sys_layer), &lv_style_transp_fit);
|
||||
LV_GC_ROOT(_lv_sys_layer) = lv_obj_create(NULL, NULL);
|
||||
lv_obj_set_style(LV_GC_ROOT(_lv_sys_layer), &lv_style_transp_fit);
|
||||
|
||||
/*Refresh the screen*/
|
||||
lv_obj_invalidate(LV_GC_ROOT(_act_scr));
|
||||
lv_obj_invalidate(LV_GC_ROOT(_lv_act_scr));
|
||||
|
||||
#if LV_INDEV_READ_PERIOD != 0
|
||||
/*Init the input device handling*/
|
||||
@@ -132,7 +132,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
if(parent == NULL) {
|
||||
LV_LOG_TRACE("Screen create started");
|
||||
|
||||
new_obj = lv_ll_ins_head(&LV_GC_ROOT(_scr_ll));
|
||||
new_obj = lv_ll_ins_head(&LV_GC_ROOT(_lv_scr_ll));
|
||||
lv_mem_assert(new_obj);
|
||||
if(new_obj == NULL) return NULL;
|
||||
|
||||
@@ -355,7 +355,7 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
|
||||
/*Remove the object from parent's children list*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
if(par == NULL) { /*It is a screen*/
|
||||
lv_ll_rem(&LV_GC_ROOT(_scr_ll), obj);
|
||||
lv_ll_rem(&LV_GC_ROOT(_lv_scr_ll), obj);
|
||||
} else {
|
||||
lv_ll_rem(&(par->child_ll), obj);
|
||||
}
|
||||
@@ -411,7 +411,7 @@ void lv_obj_invalidate(const lv_obj_t * obj)
|
||||
{
|
||||
if(lv_obj_get_hidden(obj)) return;
|
||||
|
||||
/*Invalidate the object only if it belongs to the 'LV_GC_ROOT(_act_scr)'*/
|
||||
/*Invalidate the object only if it belongs to the 'LV_GC_ROOT(_lv_act_scr)'*/
|
||||
lv_obj_t * obj_scr = lv_obj_get_screen(obj);
|
||||
if(obj_scr == lv_scr_act() ||
|
||||
obj_scr == lv_layer_top() ||
|
||||
@@ -456,9 +456,9 @@ void lv_obj_invalidate(const lv_obj_t * obj)
|
||||
*/
|
||||
void lv_scr_load(lv_obj_t * scr)
|
||||
{
|
||||
LV_GC_ROOT(_act_scr) = scr;
|
||||
LV_GC_ROOT(_lv_act_scr) = scr;
|
||||
|
||||
lv_obj_invalidate(LV_GC_ROOT(_act_scr));
|
||||
lv_obj_invalidate(LV_GC_ROOT(_lv_act_scr));
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
@@ -1005,7 +1005,7 @@ void lv_obj_refresh_style(lv_obj_t * obj)
|
||||
void lv_obj_report_style_mod(lv_style_t * style)
|
||||
{
|
||||
lv_obj_t * i;
|
||||
LL_READ(LV_GC_ROOT(_scr_ll), i) {
|
||||
LL_READ(LV_GC_ROOT(_lv_scr_ll), i) {
|
||||
if(i->style_p == style || style == NULL) {
|
||||
lv_obj_refresh_style(i);
|
||||
}
|
||||
@@ -1302,7 +1302,7 @@ void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint1
|
||||
*/
|
||||
lv_obj_t * lv_scr_act(void)
|
||||
{
|
||||
return LV_GC_ROOT(_act_scr);
|
||||
return LV_GC_ROOT(_lv_act_scr);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1311,7 +1311,7 @@ lv_obj_t * lv_scr_act(void)
|
||||
*/
|
||||
lv_obj_t * lv_layer_top(void)
|
||||
{
|
||||
return LV_GC_ROOT(_top_layer);
|
||||
return LV_GC_ROOT(_lv_top_layer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1321,7 +1321,7 @@ lv_obj_t * lv_layer_top(void)
|
||||
*/
|
||||
lv_obj_t * lv_layer_sys(void)
|
||||
{
|
||||
return LV_GC_ROOT(_sys_layer);
|
||||
return LV_GC_ROOT(_lv_sys_layer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,7 +54,7 @@ static lv_disp_t * active;
|
||||
*/
|
||||
void lv_disp_drv_init(lv_disp_drv_t * driver)
|
||||
{
|
||||
LV_GC_ROOT(_disp_list) = NULL;
|
||||
LV_GC_ROOT(_lv_disp_list) = NULL;
|
||||
driver->disp_fill = NULL;
|
||||
driver->disp_map = NULL;
|
||||
driver->disp_flush = NULL;
|
||||
@@ -87,12 +87,12 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
||||
node->next = NULL;
|
||||
|
||||
/* Set first display as active by default */
|
||||
if(LV_GC_ROOT(_disp_list) == NULL) {
|
||||
LV_GC_ROOT(_disp_list) = node;
|
||||
if(LV_GC_ROOT(_lv_disp_list) == NULL) {
|
||||
LV_GC_ROOT(_lv_disp_list) = node;
|
||||
active = node;
|
||||
lv_obj_invalidate(lv_scr_act());
|
||||
} else {
|
||||
((lv_disp_t*)LV_GC_ROOT(_disp_list))->next = node;
|
||||
((lv_disp_t*)LV_GC_ROOT(_lv_disp_list))->next = node;
|
||||
}
|
||||
|
||||
return node;
|
||||
@@ -126,10 +126,10 @@ lv_disp_t * lv_disp_get_active(void)
|
||||
lv_disp_t * lv_disp_next(lv_disp_t * disp)
|
||||
{
|
||||
if(disp == NULL) {
|
||||
return LV_GC_ROOT(_disp_list);
|
||||
return LV_GC_ROOT(_lv_disp_list);
|
||||
} else {
|
||||
if(((lv_disp_t*)LV_GC_ROOT(_disp_list))->next == NULL) return NULL;
|
||||
else return ((lv_disp_t*)LV_GC_ROOT(_disp_list))->next;
|
||||
if(((lv_disp_t*)LV_GC_ROOT(_lv_disp_list))->next == NULL) return NULL;
|
||||
else return ((lv_disp_t*)LV_GC_ROOT(_lv_disp_list))->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
*/
|
||||
void lv_indev_drv_init(lv_indev_drv_t * driver)
|
||||
{
|
||||
LV_GC_ROOT(_indev_list) = NULL;
|
||||
LV_GC_ROOT(_lv_indev_list) = NULL;
|
||||
driver->read = NULL;
|
||||
driver->type = LV_INDEV_TYPE_NONE;
|
||||
driver->user_data = NULL;
|
||||
@@ -76,10 +76,10 @@ lv_indev_t * lv_indev_drv_register(lv_indev_drv_t * driver)
|
||||
node->group = NULL;
|
||||
node->btn_points = NULL;
|
||||
|
||||
if(LV_GC_ROOT(_indev_list) == NULL) {
|
||||
LV_GC_ROOT(_indev_list) = node;
|
||||
if(LV_GC_ROOT(_lv_indev_list) == NULL) {
|
||||
LV_GC_ROOT(_lv_indev_list) = node;
|
||||
} else {
|
||||
lv_indev_t * last = LV_GC_ROOT(_indev_list);
|
||||
lv_indev_t * last = LV_GC_ROOT(_lv_indev_list);
|
||||
while(last->next)
|
||||
last = last->next;
|
||||
|
||||
@@ -98,7 +98,7 @@ lv_indev_t * lv_indev_next(lv_indev_t * indev)
|
||||
{
|
||||
|
||||
if(indev == NULL) {
|
||||
return LV_GC_ROOT(_indev_list);
|
||||
return LV_GC_ROOT(_lv_indev_list);
|
||||
} else {
|
||||
if(indev->next == NULL) return NULL;
|
||||
else return indev->next;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user