5.6. Database¶
The database
module is part of the Engine
layer.
The database
module allows the user to store and retrieve data.
The database along with the diag
module runs in the highest priority. This
must not be changed.
A quick introduction on how to add additional information to the database is found here.
5.6.1. Module Files¶
- Driver:
embedded-software\mcu-common\src\engine\database\database.c
(database.c (common))embedded-software\mcu-common\src\engine\database\database.h
(database.h (common))
- Driver Configuration:
embedded-software\mcu-primary\src\engine\config\database_cfg.c
(database_cfg.c (primary))embedded-software\mcu-primary\src\engine\config\database_cfg.h
(database_cfg.h (primary))embedded-software\mcu-secondary\src\engine\config\database_cfg.c
(database_cfg.c (secondary))embedded-software\mcu-secondary\src\engine\config\database_cfg.h
(database_cfg.h (secondary))
5.6.2. Detailed Description¶
The DATA_Task()
task is running with the highest priority inside the
ENG_TSK_Engine
.
To store and read data the database introduces two functions:
DB_WriteBlock(..)
andDB_ReadBlock(..)
.
5.6.3. Configuration¶
The configuration of the database consists of the following parts:
5.6.3.1. database_cfg.h
¶
Number of data blocks in
DATA_BLOCK_ID_TYPE_e
Human understandable alias for the datablocks (e.g.,
DATA_BLOCK_ID_ALLGPIOVOLTAGE
forDATA_BLOCK_22
).Typedefed struct of the actual data. This always consists of a timestamp, the previous timestamp and then the arbitrary data.
5.6.3.2. database_cfg.c
¶
A variable for the database block
DATA_BLOCK_ALLGPIOVOLTAGE_s data_block_ltc_allgpiovoltages[DOUBLE_BUFFERING];
The variable must be introduced to the database header variable
DATA_BASE_HEADER_s data_base_header[] = {..}
.
5.6.4. Usage/Examples¶
For examples of usage and adaptions see:
function
BAL_Activate_Balancing_Voltage()
inembedded-software\mcu-primary\src\application\bal\bal.c