Choco OS  V.0.16.9.0
Join to the chocolate world
Low Level Driver (LLD)

Introduction

The LLD is a layer of Portable Space that provides interface for machine independent modules for using peripherals, registers, memory, interrupts and more without knowledge about selected device. Each function, type and macro that is defined as part of the LLD layer must be defined also in other machines in the same type. If some functionality should be visible only in one machine should be defined as Machine Specific Low Level Driver (MSLLD) . It is a part of the layer that can be used only in other modules from the LLD layer in the same machine. These functions cannot be used outside of the Portable Space and must not be defined for other machines.
The layer consist of modules, that are created for drivers from the Core Space. Each module is named as his driver equivalent but with LLD in name, for example #oC_GPIO_LLD_SetSpeed function is LLD equivalent for GPIO driver.
Each module contain at least following files:
File Name Description
oc_[driver_name]_lld.h interface for the driver
oc_[driver_name]_mslld.h machine specific interface for the driver
oc_[driver_name]_lld.c sources for LLD functions
oc_[driver_name]_mslld.c machine specific function sources
The oc_[driver_name]_lld.h file is the main module header. It is common for all machines, and it should contain all common definitions, types, and functions that are required by both of The Core Space and The Portable Space. Each function that is defined in this header, must exists for each machine, also if it will be just empty wrapper. Moreover, functions prototypes in this file should also contain common part of a function description. Note, that in this file cannot be defined any static inline function, because it is common file for each machine, and there is a possibility, that some of architectures will not handle it in the future. Each low level driver should contain at least following functions:
oC_ErrorCode_t oC_[DN]_LLD_TurnOnDriver ( void );
oC_ErrorCode_t oC_[DN]_LLD_TurnOffDriver( void );
The oc_[driver_name]_mslld.h file is the family specific header with functions prototypes that exists only in the specific family. It must not exists in other machines so it can be used only in other modules from the same machine. Each type, definition, macro and function prototype that is defined in this file, must contain MSLLD prefix in the name. It should include main LLD header. To get more, see MSLLD
The oc_[driver_name]_lld.c file is the family specific file, that contains sources for the LLD interface functions. If some function cannot be written common for all machines in the family, then it should use machine definitions from the Machine module to ensure, that part of code will be executed only on the target machine.
The oc_[driver_name]_mslld.c file is the family specific file, that contains sources of functions, that are used only in the given architecture. There is no need to implement these functions for each machine.
Bellow you can find a list of available modules in the LLD layer:

Machine Specific Low Level Driver (MSLLD)

This is the part of LLD layer. It contains functions that are machine specific. All types, definitions and functions from this layer should contain MSLLD in their names.