Revert "fix(flush,tick): use atomics instead of volatile for synchronization (#3965)" (#3997)

This commit is contained in:
Fabian 2023-02-17 16:09:53 +01:00 committed by GitHub
parent 7c583ac8d6
commit bdf3d4e666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 34 deletions

View File

@ -23,11 +23,6 @@ extern "C" {
#include "../misc/lv_area.h"
#include "../misc/lv_ll.h"
#include "../misc/lv_timer.h"
#include "../misc/lv_types.h"
#if LV_USE_ATOMICS == 1
#include <stdatomic.h>
#endif
/*********************
* DEFINES
@ -52,11 +47,6 @@ struct _lv_disp_t;
struct _lv_disp_drv_t;
struct _lv_theme_t;
#if LV_USE_ATOMICS == 1
#define FLUSHING_TYPE atomic_int
#else
#define FLUSHING_TYPE volatile int
#endif
/**
* Structure for holding display buffer information.
*/
@ -67,13 +57,13 @@ typedef struct _lv_disp_draw_buf_t {
/*Internal, used by the library*/
void * buf_act;
uint32_t size; /*In pixel count*/
FLUSHING_TYPE flushing;
/*It was the last chunk to flush. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
FLUSHING_TYPE flushing_last;
uint32_t last_area : 1; /*1: the last area is being rendered*/
uint32_t last_part : 1; /*1: the last part of the current area is being rendered*/
/*1: flushing is in progress. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
volatile int flushing;
/*1: It was the last chunk to flush. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
volatile int flushing_last;
volatile uint32_t last_area : 1; /*1: the last area is being rendered*/
volatile uint32_t last_part : 1; /*1: the last part of the current area is being rendered*/
} lv_disp_draw_buf_t;
#undef FLUSHING_TYPE
typedef enum {
LV_DISP_ROT_NONE = 0,

View File

@ -7,8 +7,6 @@
* INCLUDES
*********************/
#include "lv_hal_tick.h"
#include "../misc/lv_types.h"
#include <stdatomic.h>
#include <stddef.h>
#if LV_TICK_CUSTOM == 1
@ -31,13 +29,8 @@
* STATIC VARIABLES
**********************/
#if !LV_TICK_CUSTOM
#if LV_USE_ATOMICS == 1
static _Atomic(uint32_t) sys_time = 0;
static atomic_int tick_irq_flag;
#else
static volatile uint32_t sys_time = 0;
static volatile int tick_irq_flag;
#endif
static uint32_t sys_time = 0;
static volatile uint8_t tick_irq_flag;
#endif
/**********************

View File

@ -32,15 +32,6 @@ extern "C" {
#endif
/*Use atomics instead of volatile variables for state which is potentially shared between threads, as long as
*the compiler supports it.*/
#if (defined(__cplusplus) && __cplusplus >= 201103L)\
|| (__STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__))
#define LV_USE_ATOMICS 1
#else
#define LV_USE_ATOMICS 0
#endif
/**********************
* TYPEDEFS
**********************/