STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
Loading...
Searching...
No Matches
Mcu.c File Reference

Mcu Driver More...

#include "Std_Types.h"
#include "Mcu.h"
#include "Mcu_Arch.h"

Macros

#define Det_ReportError(ModuleId, InstanceId, ApiId, ErrorId)
 

Functions

void Mcu_Init (Mcu_ConfigType *ConfigPtr)
 MCU Initialization
 
Std_ReturnType Mcu_InitRamSection (Mcu_RamSectionType RamSection)
 MCU RAM Initialization
 
Std_ReturnType Mcu_InitClock (Mcu_ClkConfigType ClockSetting)
 MCU Clock Initialization
 
Std_ReturnType Mcu_DistributePllClock (void)
 PLL to MCU Clock distribution
 
Mcu_PllStatusType Mcu_GetPllStatus (void)
 Get PLL lock status
 
Mcu_ResetType Mcu_GetResetReason (void)
 Get MCU reset type
 
Mcu_RawResetType Mcu_GetResetRawValue (void)
 Get reset raw value
 
void Mcu_PerformReset (void)
 Reset the MCU
 
void Mcu_SetMode (Mcu_ModeType McuMode)
 Set MCU power mode
 
void Mcu_GetVersionInfo (Std_VersionInfoType *versioninfo)
 Get version information
 
Mcu_RamStateType Mcu_GetRamState (void)
 Get status of MCU RAM
 

Variables

static Mcu_HwUnit HwUnit_Mcu
 Variable for the initial value of the port configuration array.
 

Detailed Description

Mcu Driver

Author
Angel Lozano

The MCU driver provides services for basic microcontroller initialization, power down functionality, reset and microcontroller specific functions required by other MCAL software modules. The initialization services allow a flexible and application related MCU initialization in addition to the start-up code.

Macro Definition Documentation

◆ Det_ReportError

#define Det_ReportError ( ModuleId,
InstanceId,
ApiId,
ErrorId )
Value:
(void)0
Parameters
ModuleIdModule ID number
InstanceIdInstance Id
ApiIdApi id
ErrorIdError code

Function Documentation

◆ Mcu_DistributePllClock()

Std_ReturnType Mcu_DistributePllClock ( void )

PLL to MCU Clock distribution

Service to activate the PLL clock to the MCU clock distribution.

Return values
Std_ReturnTypeE_OK if the command has been accepted, E_NOT_OK if the command has not been accepted e.g. due to parameter error
Requirement
SWS_Mcu_00156, SWS_Mcu_00017, SWS_Mcu_00122, SWS_Mcu_00125

◆ Mcu_GetPllStatus()

Mcu_PllStatusType Mcu_GetPllStatus ( void )

Get PLL lock status

Service which provides the lock status of the PLL

Return values
Mcu_PllStatusTypeMCU_PLL_LOCKED when the PLL is locked, MCU_PLL_UNLOCKED, MCU_PLL_STATUS_UNDEFINED when status is unknown
Requirement
SWS_Mcu_00157, SWS_Mcu_00017, SWS_Mcu_00125

◆ Mcu_GetRamState()

Mcu_RamStateType Mcu_GetRamState ( void )

Get status of MCU RAM

Service which provides the actual status of the microcontroller RAM. (if supported)

Return values
Mcu_RamStateTypeStatus of the RAM Content
Requirement
SWS_Mcu_00207, SWS_Mcu_00017, SWS_Mcu_00125

◆ Mcu_GetResetRawValue()

Mcu_RawResetType Mcu_GetResetRawValue ( void )

Get reset raw value

Service which reads the reset type from the hardware register, if supported

Return values
Mcu_RawResetTypeReset raw value
Requirement
SWS_Mcu_00159, SWS_Mcu_00017, SWS_Mcu_00125

◆ Mcu_GetResetReason()

Mcu_ResetType Mcu_GetResetReason ( void )

Get MCU reset type

Service which reads the reset type from the hardware, if supported

Return values
Mcu_ResetTypeMCU_POWER_ON_RESET, MCU_WATCHDOG_RESET, MCU_SW_RESET, MCU_RESET_UNDEFINED
Requirement
SWS_Mcu_00158, SWS_Mcu_00017, SWS_Mcu_00125

◆ Mcu_GetVersionInfo()

void Mcu_GetVersionInfo ( Std_VersionInfoType * versioninfo)

Get version information

Service to return the version information of this module

Parameters
versioninfoPointer to where to store the version information of this module
Requirement
SWS_Mcu_00162, SWS_Mcu_00125

◆ Mcu_Init()

void Mcu_Init ( Mcu_ConfigType * ConfigPtr)

MCU Initialization

Service to initialize the MCU driver

Parameters
ConfigPtrPointer to MCU driver configuration set
Requirement
SWS_Mcu_00153

◆ Mcu_InitClock()

Std_ReturnType Mcu_InitClock ( Mcu_ClkConfigType ClockSetting)

MCU Clock Initialization

Service to initialize the PLL and other MCU specific clock options.

Parameters
ClockSettingPass the settings to configure Mcu clock
Return values
Std_ReturnTypeE_OK if the command has been accepted, E_NOT_OK if the command has not been accepted e.g. due to parameter error
Requirement
SWS_Mcu_00155, SWS_Mcu_00017, SWS_Mcu_00125

◆ Mcu_InitRamSection()

Std_ReturnType Mcu_InitRamSection ( Mcu_RamSectionType RamSection)

MCU RAM Initialization

Service to initialize the RAM section wise

Parameters
RamSectionSelects RAM memory section provided in configuration set
Return values
Std_ReturnTypeE_OK if the command has been accepted, E_NOT_OK if the command has not been accepted e.g. due to parameter error
Requirement
SWS_Mcu_00154, SWS_Mcu_00017, SWS_Mcu_00125

◆ Mcu_PerformReset()

void Mcu_PerformReset ( void )

Reset the MCU

Service to perform a microcontroller reset

Requirement
SWS_Mcu_00160, SWS_Mcu_00017, SWS_Mcu_00125

◆ Mcu_SetMode()

void Mcu_SetMode ( Mcu_ModeType McuMode)

Set MCU power mode

Service to activate the MCU power modes

Parameters
McuModeSet different MCU power modes configured in the configuration set
Requirement
SWS_Mcu_00161, SWS_Mcu_00017, SWS_Mcu_00125

Variable Documentation

◆ HwUnit_Mcu

Mcu_HwUnit HwUnit_Mcu
static
Initial value:
=
{
.HwUnitState = MCU_STATE_UNINIT,
.Config = NULL_PTR
}
@ MCU_STATE_UNINIT
Definition Mcu_Types.h:413
#define NULL_PTR
null pointer definition
Definition Std_Types.h:165

Variable for the initial value of the port configuration array.

< Add static when no testing