ChibiOS  21.6.0
HAL Driver

Hardware Abstraction Layer. More...

Collaboration diagram for HAL Driver:

Detailed Description

Hardware Abstraction Layer.

The HAL (Hardware Abstraction Layer) driver performs the system initialization and includes the platform support code shared by the other drivers. This driver does contain any API function except for a general initialization function halInit() that must be invoked before any HAL service can be used, usually the HAL initialization should be performed immediately before the kernel initialization.
Some HAL driver implementations also offer a custom early clock setup function that can be invoked before the C runtime initialization in order to accelerate the startup time.

Macros

#define __CHIBIOS_HAL__
 ChibiOS/HAL identification macro. More...
 
#define CH_HAL_STABLE   0
 Stable release flag. More...
 
#define HAL_LLD_USE_CLOCK_MANAGEMENT
 Specifies implementation of dynamic clock management. More...
 

ChibiOS/HAL version identification

#define HAL_VERSION   "7.2.0"
 HAL version string. More...
 
#define CH_HAL_MAJOR   7
 HAL version major number. More...
 
#define CH_HAL_MINOR   2
 HAL version minor number. More...
 
#define CH_HAL_PATCH   0
 HAL version patch number. More...
 

Return codes

#define HAL_SUCCESS   false
 HAL operation success. More...
 
#define HAL_FAILED   true
 HAL operation failed. More...
 

Platform identification macros

#define PLATFORM_NAME   "templates"
 

Typedefs

typedef unsigned halclkpt_t
 Type of a clock point identifier. More...
 
typedef uint32_t halfreq_t
 Type of a clock point frequency in Hz. More...
 

Data Structures

struct  halclkcfg_t
 Type of a clock configuration structure. More...
 

Functions

void halInit (void)
 HAL initialization. More...
 
static bool halClockSwitchMode (const halclkcfg_t *ccp)
 Switches to a different clock configuration. More...
 
static halfreq_t halClockGetPointX (halclkpt_t clkpt)
 Returns the frequency of a clock point in Hz. More...
 
void hal_lld_init (void)
 Low level HAL driver initialization. More...
 
bool hal_lld_clock_switch_mode (const halclkcfg_t *ccp)
 Switches to a different clock configuration. More...
 
halfreq_t hal_lld_get_clock_point (halclkpt_t clkpt)
 Returns the frequency of a clock point in Hz. More...
 

Macro Definition Documentation

◆ __CHIBIOS_HAL__

#define __CHIBIOS_HAL__

ChibiOS/HAL identification macro.

Definition at line 42 of file hal.h.

◆ CH_HAL_STABLE

#define CH_HAL_STABLE   0

Stable release flag.

Definition at line 47 of file hal.h.

◆ HAL_VERSION

#define HAL_VERSION   "7.2.0"

HAL version string.

Definition at line 56 of file hal.h.

◆ CH_HAL_MAJOR

#define CH_HAL_MAJOR   7

HAL version major number.

Definition at line 61 of file hal.h.

◆ CH_HAL_MINOR

#define CH_HAL_MINOR   2

HAL version minor number.

Definition at line 66 of file hal.h.

◆ CH_HAL_PATCH

#define CH_HAL_PATCH   0

HAL version patch number.

Definition at line 71 of file hal.h.

◆ HAL_SUCCESS

#define HAL_SUCCESS   false

HAL operation success.

Definition at line 81 of file hal.h.

◆ HAL_FAILED

#define HAL_FAILED   true

HAL operation failed.

Definition at line 85 of file hal.h.

◆ HAL_LLD_USE_CLOCK_MANAGEMENT

#define HAL_LLD_USE_CLOCK_MANAGEMENT

Specifies implementation of dynamic clock management.

Definition at line 35 of file hal_lld.h.

Typedef Documentation

◆ halclkpt_t

typedef unsigned halclkpt_t

Type of a clock point identifier.

Definition at line 72 of file hal_lld.h.

◆ halfreq_t

typedef uint32_t halfreq_t

Type of a clock point frequency in Hz.

Definition at line 78 of file hal_lld.h.

Function Documentation

◆ halInit()

void halInit ( void  )

HAL initialization.

This function invokes the low level initialization code then initializes all the drivers enabled in the HAL. Finally the board-specific initialization is performed by invoking boardInit() (usually defined in board.c).

Function Class:
Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 56 of file hal.c.

References adcInit(), canInit(), cryInit(), dacInit(), eflInit(), gptInit(), hal_lld_init(), i2cInit(), i2sInit(), icuInit(), macInit(), mmcInit(), osalInit(), palInit, pwmInit(), rtcInit(), sdcInit(), sdInit(), sduInit(), sioInit(), spiInit(), stInit(), trngInit(), uartInit(), usbInit(), wdgInit(), and wspiInit().

Here is the call graph for this function:

◆ halClockSwitchMode()

static bool halClockSwitchMode ( const halclkcfg_t ccp)
inlinestatic

Switches to a different clock configuration.

Parameters
[in]ccppointer to clock a halclkcfg_t structure
Returns
The clock switch result.
Return values
falseif the clock switch succeeded
trueif the clock switch failed
Function Class:
Special function, this function has special requirements see the notes.

Definition at line 229 of file hal.h.

References hal_lld_clock_switch_mode().

Here is the call graph for this function:

◆ halClockGetPointX()

static halfreq_t halClockGetPointX ( halclkpt_t  clkpt)
inlinestatic

Returns the frequency of a clock point in Hz.

Parameters
[in]clkptclock point to be returned
Returns
The clock point frequency in Hz or zero if the frequency is unknown.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 243 of file hal.h.

References hal_lld_get_clock_point().

Here is the call graph for this function:

◆ hal_lld_init()

void hal_lld_init ( void  )

Low level HAL driver initialization.

Function Class:
Not an API, this function is for internal use only.

Definition at line 72 of file hal_lld.c.

Referenced by halInit().

◆ hal_lld_clock_switch_mode()

bool hal_lld_clock_switch_mode ( const halclkcfg_t ccp)

Switches to a different clock configuration.

Parameters
[in]ccppointer to clock a halclkcfg_t structure
Returns
The clock switch result.
Return values
falseif the clock switch succeeded
trueif the clock switch failed
Function Class:
Not an API, this function is for internal use only.

Definition at line 87 of file hal_lld.c.

Referenced by halClockSwitchMode().

◆ hal_lld_get_clock_point()

halfreq_t hal_lld_get_clock_point ( halclkpt_t  clkpt)

Returns the frequency of a clock point in Hz.

Parameters
[in]clkptclock point to be returned
Returns
The clock point frequency in Hz or zero if the frequency is unknown.
Function Class:
Not an API, this function is for internal use only.

Definition at line 103 of file hal_lld.c.

Referenced by halClockGetPointX().