MCUSW
MCU Driver API

Introduction

Data Structures

struct  Mcu_ClockConfigType
 Structure for module clock setting. More...
 
struct  Mcu_ConfigType
 MCU CONFIG ROOT structure. More...
 

Variables

Mcu_ClkModuleIdType Mcu_ClockConfigType::Mcu_ClockModuleId
 
Mcu_ClkSourceIdType Mcu_ClockConfigType::Mcu_ClockSourceId
 
Mcu_ModuleName Mcu_ClockConfigType::ModuleName
 
Mcu_DomainType Mcu_ClockConfigType::Domain
 
boolean Mcu_ClockConfigType::Mcu_InitCfg
 
uint64 Mcu_ClockConfigType::Mcu_ClockFrequency
 
Mcu_ModeType Mcu_ConfigType::Mcu_Mode
 
uint8 Mcu_ConfigType::Mcu_ResetMode
 
Mcu_ClockConfigPtrType Mcu_ConfigType::Mcu_ClockConfig
 
uint8 Mcu_ConfigType::Mcu_NumberOfClockConfig
 
Mcu_CBKFunctionPtrType Mcu_ConfigType::Mcu_CBK_Function
 
Mcu_SoftResetCBKFunctionPtrType Mcu_ConfigType::Mcu_SoftReset_CBK_Function
 

Macros

#define ARRAYSIZE(array)
 

MCU Driver Module SW Version Info

Defines for MCU Driver version used for compatibility checks

#define MCU_SW_MAJOR_VERSION   (10U)
 Driver Implementation Major Version. More...
 
#define MCU_SW_MINOR_VERSION   (1U)
 Driver Implementation Minor Version. More...
 
#define MCU_SW_PATCH_VERSION   (1U)
 Driver Implementation Patch Version. More...
 

MCU Driver Module AUTOSAR Version Info

Defines for MCU Driver AUTOSAR version used for compatibility checks

#define MCU_AR_RELEASE_MAJOR_VERSION   (4U)
 AUTOSAR Major version specification implemented by MCU Driver. More...
 
#define MCU_AR_RELEASE_MINOR_VERSION   (3U)
 AUTOSAR Minor version specification implemented by MCU Driver. More...
 
#define MCU_AR_RELEASE_REVISION_VERSION   (1U)
 AUTOSAR Patch version specification implemented by MCU Driver. More...
 

MCU Driver ID Info

#define MCU_VENDOR_ID   ((uint16) 44U)
 Texas Instruments Vendor ID. More...
 
#define MCU_MODULE_ID   ((uint16) 101U)
 MCU Driver Module ID. More...
 
#define MCU_INSTANCE_ID   ((uint8) 0U)
 MCU Driver Instance ID. More...
 

MCU Error Codes

Error codes returned by MCU functions

#define MCU_E_PARAM_CONFIG   (0x0AU)
 ERROR Description: API service called with wrong configuration parameter. More...
 
#define MCU_E_PARAM_CLOCK   (0x0BU)
 ERROR Description: API service used with wrong clock value. More...
 
#define MCU_E_PARAM_MODE   (0x0CU)
 ERROR Description: API service used with wrong mode. More...
 
#define MCU_E_PARAM_RAMSECTION   (0x0DU)
 ERROR Description: API service called with invalid/wrong RAM section. More...
 
#define MCU_E_PLL_NOT_LOCKED   (0x0EU)
 ERROR Description: API service is called while PLL is not locked. More...
 
#define MCU_E_UNINIT   (0x0FU)
 ERROR Description: Mcu Driver API service is called before initialization of MCU Driver. More...
 
#define MCU_E_PARAM_POINTER   (0x10U)
 ERROR Description: API service is called with NULL/Wrong pointer. More...
 
#define MCU_E_INIT_FAILED   (0x11U)
 ERROR Description: Initialization of the MCU Driver Failed. More...
 

MCU Driver State Values

The MCU Driver State Values

#define MCU_STATUS_UNINIT   ((uint8)(0U))
 MCU driver Status uninitialized. More...
 
#define MCU_STATUS_INIT   ((uint8)(1U))
 MCU driver Status Initialized. More...
 

MCU Service Ids

The Service Id is one of the argument to Det_ReportError function and is used to identify the source of the error

#define MCU_SID_INIT   (0x00U)
 Mcu_Init() API Service ID. More...
 
#define MCU_SID_INIT_RAM_SECTION   (0x01U)
 Mcu_InitRamSection() API Service ID. More...
 
#define MCU_SID_INIT_CLOCK   (0x02U)
 Mcu_InitClock() API Service ID. More...
 
#define MCU_SID_DISTRIBUTE_PLL_CLOCK   (0x03U)
 Mcu_DistributePllClock() API Service ID. More...
 
#define MCU_SID_GET_PLL_STATUS   (0x04U)
 Mcu_GetPllStatus() API Service ID. More...
 
#define MCU_SID_GET_RESET_REASON   (0x05U)
 Mcu_GetResetReason() API Service ID. More...
 
#define MCU_SID_GET_RESET_RAW_VALUE   (0x06U)
 Mcu_GetResetRawValue() API Service ID. More...
 
#define MCU_SID_PERFORM_RESET   (0x07U)
 Mcu_PerformReset() API Service ID. More...
 
#define MCU_SID_SETMODE   (0x08U)
 Mcu_SetMode() API Service ID. More...
 
#define MCU_SID_GET_VERSION_INFO   (0x09U)
 Mcu_GetVersionInfo() API Service ID. More...
 
#define MCU_SID_GET_RAM_STATE   (0x0AU)
 Mcu_GetRamState() API Service ID. More...
 

MCU Reset Modes

Reset mode enum which can be used in Mcu_PerformReset()

typedef uint8 Mcu_ClockType
 This type specifies the identification (ID) for a ClockType status used by Mcu_InitClock() More...
 
typedef uint32 Mcu_RawResetType
 This type specifies the identification (ID) for a RAW MCU reset status returned by Mcu_GetResetRawValue() More...
 
typedef uint8 Mcu_RamSectionType
 This type specifies the identification (ID) for a RAM section used in Mcu_InitRamSection() More...
 
typedef uint8 Mcu_ModeType
 This type specifies the identification (ID) for a MCU mode used in Mcu_SetMode() More...
 
const struct Mcu_ConfigType_s McuModuleConfiguration_0
 MCU Configuration struct declaration. More...
 
 AUTOMATIC
 
MCU_PBCFG ConfigPtr
 
MCU_APPL_DATA versioninfo
 
typedef P2CONST (Mcu_ClockConfigType, AUTOMATIC, MCU_PBCFG) Mcu_ClockConfigPtrType
 Pointer to Clock Config structure. More...
 
 FUNC (void, MCU_CODE) Mcu_Init(P2CONST(Mcu_ConfigType
 This service initializes the MCU driver. More...
 
 FUNC (Std_ReturnType, MCU_CODE) Mcu_InitClock(Mcu_ClockType ClockSetting)
 This service initializes the PLL and other MCU specific clock options. More...
 
 FUNC (Mcu_PllStatusType, MCU_CODE) Mcu_GetPllStatus(void)
 This service provides the lock status of the PLL. More...
 
 FUNC (Mcu_ResetType, MCU_CODE) Mcu_GetResetReason(void)
 The service reads the reset type from the hardware, if supported. More...
 
 FUNC (Mcu_RawResetType, MCU_CODE) Mcu_GetResetRawValue(void)
 The service reads the reset type from the hardware register, if supported. More...
 
 FUNC (Mcu_RamStateType, MCU_CODE) Mcu_GetRamState(void)
 This service provides the actual status of the microcontroller Ram. (if supported) More...
 
#define MCU_PERFORM_RESET_MODE_COLD   ((uint8) 0U)
 Initiate SW COLD RESET sequence. More...
 
#define MCU_PERFORM_RESET_MODE_WARM   ((uint8) 1U)
 Initiate SW WARM RESET sequence. More...
 
#define MCU_E_MODE_FAILURE   0U
 

Macro Definition Documentation

◆ ARRAYSIZE

#define ARRAYSIZE (   array)
Value:
((sizeof (array) / \
sizeof ((array)[0])))

◆ MCU_SW_MAJOR_VERSION

#define MCU_SW_MAJOR_VERSION   (10U)

Driver Implementation Major Version.

◆ MCU_SW_MINOR_VERSION

#define MCU_SW_MINOR_VERSION   (1U)

Driver Implementation Minor Version.

◆ MCU_SW_PATCH_VERSION

#define MCU_SW_PATCH_VERSION   (1U)

Driver Implementation Patch Version.

◆ MCU_AR_RELEASE_MAJOR_VERSION

#define MCU_AR_RELEASE_MAJOR_VERSION   (4U)

AUTOSAR Major version specification implemented by MCU Driver.

◆ MCU_AR_RELEASE_MINOR_VERSION

#define MCU_AR_RELEASE_MINOR_VERSION   (3U)

AUTOSAR Minor version specification implemented by MCU Driver.

◆ MCU_AR_RELEASE_REVISION_VERSION

#define MCU_AR_RELEASE_REVISION_VERSION   (1U)

AUTOSAR Patch version specification implemented by MCU Driver.

◆ MCU_VENDOR_ID

#define MCU_VENDOR_ID   ((uint16) 44U)

Texas Instruments Vendor ID.

◆ MCU_MODULE_ID

#define MCU_MODULE_ID   ((uint16) 101U)

MCU Driver Module ID.

◆ MCU_INSTANCE_ID

#define MCU_INSTANCE_ID   ((uint8) 0U)

MCU Driver Instance ID.

◆ MCU_E_PARAM_CONFIG

#define MCU_E_PARAM_CONFIG   (0x0AU)

ERROR Description: API service called with wrong configuration parameter.

◆ MCU_E_PARAM_CLOCK

#define MCU_E_PARAM_CLOCK   (0x0BU)

ERROR Description: API service used with wrong clock value.

◆ MCU_E_PARAM_MODE

#define MCU_E_PARAM_MODE   (0x0CU)

ERROR Description: API service used with wrong mode.

◆ MCU_E_PARAM_RAMSECTION

#define MCU_E_PARAM_RAMSECTION   (0x0DU)

ERROR Description: API service called with invalid/wrong RAM section.

◆ MCU_E_PLL_NOT_LOCKED

#define MCU_E_PLL_NOT_LOCKED   (0x0EU)

ERROR Description: API service is called while PLL is not locked.

◆ MCU_E_UNINIT

#define MCU_E_UNINIT   (0x0FU)

ERROR Description: Mcu Driver API service is called before initialization of MCU Driver.

◆ MCU_E_PARAM_POINTER

#define MCU_E_PARAM_POINTER   (0x10U)

ERROR Description: API service is called with NULL/Wrong pointer.

◆ MCU_E_INIT_FAILED

#define MCU_E_INIT_FAILED   (0x11U)

ERROR Description: Initialization of the MCU Driver Failed.

◆ MCU_STATUS_UNINIT

#define MCU_STATUS_UNINIT   ((uint8)(0U))

MCU driver Status uninitialized.

◆ MCU_STATUS_INIT

#define MCU_STATUS_INIT   ((uint8)(1U))

MCU driver Status Initialized.

◆ MCU_SID_INIT

#define MCU_SID_INIT   (0x00U)

Mcu_Init() API Service ID.

◆ MCU_SID_INIT_RAM_SECTION

#define MCU_SID_INIT_RAM_SECTION   (0x01U)

Mcu_InitRamSection() API Service ID.

◆ MCU_SID_INIT_CLOCK

#define MCU_SID_INIT_CLOCK   (0x02U)

Mcu_InitClock() API Service ID.

◆ MCU_SID_DISTRIBUTE_PLL_CLOCK

#define MCU_SID_DISTRIBUTE_PLL_CLOCK   (0x03U)

Mcu_DistributePllClock() API Service ID.

◆ MCU_SID_GET_PLL_STATUS

#define MCU_SID_GET_PLL_STATUS   (0x04U)

Mcu_GetPllStatus() API Service ID.

◆ MCU_SID_GET_RESET_REASON

#define MCU_SID_GET_RESET_REASON   (0x05U)

Mcu_GetResetReason() API Service ID.

◆ MCU_SID_GET_RESET_RAW_VALUE

#define MCU_SID_GET_RESET_RAW_VALUE   (0x06U)

Mcu_GetResetRawValue() API Service ID.

◆ MCU_SID_PERFORM_RESET

#define MCU_SID_PERFORM_RESET   (0x07U)

Mcu_PerformReset() API Service ID.

◆ MCU_SID_SETMODE

#define MCU_SID_SETMODE   (0x08U)

Mcu_SetMode() API Service ID.

◆ MCU_SID_GET_VERSION_INFO

#define MCU_SID_GET_VERSION_INFO   (0x09U)

Mcu_GetVersionInfo() API Service ID.

◆ MCU_SID_GET_RAM_STATE

#define MCU_SID_GET_RAM_STATE   (0x0AU)

Mcu_GetRamState() API Service ID.

◆ MCU_PERFORM_RESET_MODE_COLD

#define MCU_PERFORM_RESET_MODE_COLD   ((uint8) 0U)

Initiate SW COLD RESET sequence.

◆ MCU_PERFORM_RESET_MODE_WARM

#define MCU_PERFORM_RESET_MODE_WARM   ((uint8) 1U)

Initiate SW WARM RESET sequence.

◆ MCU_E_MODE_FAILURE

#define MCU_E_MODE_FAILURE   0U

Typedef Documentation

◆ Mcu_ClockType

typedef uint8 Mcu_ClockType

This type specifies the identification (ID) for a ClockType status used by Mcu_InitClock()

◆ Mcu_RawResetType

typedef uint32 Mcu_RawResetType

This type specifies the identification (ID) for a RAW MCU reset status returned by Mcu_GetResetRawValue()

◆ Mcu_RamSectionType

typedef uint8 Mcu_RamSectionType

This type specifies the identification (ID) for a RAM section used in Mcu_InitRamSection()

◆ Mcu_ModeType

typedef uint8 Mcu_ModeType

This type specifies the identification (ID) for a MCU mode used in Mcu_SetMode()

Function Documentation

◆ P2CONST()

typedef P2CONST ( Mcu_ClockConfigType  ,
AUTOMATIC  ,
MCU_PBCFG   
)

Pointer to Clock Config structure.

◆ FUNC() [1/6]

FUNC ( void  ,
MCU_CODE   
)

This service initializes the MCU driver.

This service activates the MCU power modes.

This service returns the version information of this module.

Clear the Mcu Reset reason by clearing the reset reason register.

The service performs a microcontroller reset.

*  Service name      : Mcu_Init
*  Syntax            : void Mcu_Init( const Mcu_ConfigType* ConfigPtr )
*  Service ID[hex]   : 0x0
*  Sync/Async        : Synchronous
*  Reentrancy        : Non Reentrant
*  Parameters (in)   : ConfigPtr - Pointer to MCU driver configuration set.
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : None
*  Description       : This service initializes the MCU driver
*  
*  Service name      : Mcu_PerformReset
*  Syntax            : void Mcu_PerformReset( void )
*  Service ID[hex]   : 0x07
*  Sync/Async        : Synchronous
*  Reentrancy        : Non Reentrant
*  Parameters (in)   : None
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : None
*  Description       : The service performs a microcontroller reset
*  
*  Service name      : Mcu_ClearResetReason
*  Syntax            : void Mcu_ClearResetReason(void)
*  Service ID[hex]   : N/A
*  Sync/Async        : Synchronous
*  Reentrancy        : Reentrant
*  Parameters (in)   : None
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : None
*  Description       : Clear the Mcu Reset reason by clearing the reset reason
*                      register
*  
*  Service name      : Mcu_GetVersionInfo
*  Syntax            : void Mcu_GetVersionInfo(Std_VersionInfoType*
*                              versioninfo)
*  Service ID[hex]   : 0x09
*  Sync/Async        : Synchronous
*  Reentrancy        : Reentrant
*  Parameters (in)   : None
*  Parameters (inout): None
*  Parameters (out)  : versioninfo - Pointer to where to store the
*                      version information of this module.
*  Return value      : None
*  Description       : This service returns the version information of this
*                      module
*  
*  Service name      : Mcu_SetMode
*  Syntax            : void Mcu_SetMode(Mcu_ModeType McuMode)
*  Service ID[hex]   : 0x08
*  Sync/Async        : Synchronous
*  Reentrancy        : Reentrant
*  Parameters (in)   : McuMode : Set different MCU power modes configured in the configuration set
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : None
*  Description       : This service activates the MCU power modes.
*  

◆ FUNC() [2/6]

FUNC ( Std_ReturnType  ,
MCU_CODE   
)

This service initializes the PLL and other MCU specific clock options.

This service initializes the RAM section wise.

This service activates the PLL clock to the MCU clock distribution.

*  Service name      : Mcu_InitClock
*  Syntax            : Std_ReturnType Mcu_InitClock(
*                           Mcu_ClockType ClockSetting )
*  Service ID[hex]   : 0x02
*  Sync/Async        : Synchronous
*  Reentrancy        : Non Reentrant
*  Parameters (in)   : ClockSetting - Clock setting
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : Std_ReturnType
*                    - E_OK: Command has been accepted
*                    - E_NOT_OK: Command has not been accepted
*  Description       : This service initializes the PLL and other MCU specific
*                      clock options
* 
*  Service name      : Mcu_DistributePllClock
*  Syntax            : Std_ReturnType Mcu_DistributePllClock(void)
*  Service ID[hex]   : 0x03
*  Sync/Async        : Synchronous
*  Reentrancy        : Reentrant
*  Parameters (in)   : None
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : Std_ReturnType : E_OK: Command has been accepted
*                       E_NOT_OK: Command has not been accepted
*  Description       : This service activates the PLL clock to the MCU clock distribution.
*  
*  Service name      : Mcu_InitRamSection
*  Syntax            : Std_ReturnType Mcu_InitRamSection(
*                                  Mcu_RamSectionType RamSection )
*  Service ID[hex]   : 0x01
*  Sync/Async        : Synchronous
*  Reentrancy        : Non Reentrant
*  Parameters (in)   : RamSection - Selects RAM memory section provided
*                      in configuration set
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : Std_ReturnType
*                    - E_OK: command has been accepted
*                    - E_NOT_OK: command has not been accepted e.g. due to
*                      parameter error
*  Description       : This service initializes the RAM section wise
*  

◆ FUNC() [3/6]

FUNC ( Mcu_PllStatusType  ,
MCU_CODE   
)

This service provides the lock status of the PLL.

*  Service name      : Mcu_GetPllStatus
*  Syntax            : Mcu_PllStatusType Mcu_GetPllStatus( void )
*  Service ID[hex]   : 0x04
*  Sync/Async        : Synchronous
*  Reentrancy        : Reentrant
*  Parameters (in)   : None
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : Mcu_PllStatusType - PLL Status
*  Description       : This service provides the lock status of the PLL.
*  

◆ FUNC() [4/6]

FUNC ( Mcu_ResetType  ,
MCU_CODE   
)

The service reads the reset type from the hardware, if supported.

*  Service name      : Mcu_GetResetReason
*  Syntax            : Mcu_ResetType Mcu_GetResetReason( void )
*  Service ID[hex]   : 0x05
*  Sync/Async        : Synchronous
*  Reentrancy        : Reentrant
*  Parameters (in)   : None
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : Mcu_ResetType
*  Description       : The service reads the reset type from the hardware, if
*                      supported
*  

◆ FUNC() [5/6]

FUNC ( Mcu_RawResetType  ,
MCU_CODE   
)

The service reads the reset type from the hardware register, if supported.

*  Service name      : Mcu_GetResetRawValue
*  Syntax            : Mcu_RawResetType Mcu_GetResetRawValue( void )
*  Service ID[hex]   : 0x06
*  Sync/Async        : Synchronous
*  Reentrancy        : Reentrant
*  Parameters (in)   : nONE
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : Mcu_RawResetType - Reset raw value
*  Description       : The service reads the reset type from the hardware
*                      register, if supported
*  

◆ FUNC() [6/6]

FUNC ( Mcu_RamStateType  ,
MCU_CODE   
)

This service provides the actual status of the microcontroller Ram. (if supported)

*  Service name      : Mcu_GetRamState
*  Syntax            : Mcu_RamStateType Mcu_GetRamState(void)
*  Service ID[hex]   : 0x0a
*  Sync/Async        : Synchronous
*  Reentrancy        : Reentrant
*  Parameters (in)   : None
*  Parameters (inout): None
*  Parameters (out)  : None
*  Return value      : Mcu_RamStateType - Status of the Ram Content
*  Description       : This service provides the actual status of the
*                      microcontroller Ram. (if supported)
*  

Variable Documentation

◆ Mcu_ClockModuleId

Mcu_ClkModuleIdType Mcu_ClockConfigType::Mcu_ClockModuleId

ModuleId for which clock setting to be applied

◆ Mcu_ClockSourceId

Mcu_ClkSourceIdType Mcu_ClockConfigType::Mcu_ClockSourceId

Clock source Id for the module

◆ ModuleName

Mcu_ModuleName Mcu_ClockConfigType::ModuleName

Module Name

◆ Domain

Mcu_DomainType Mcu_ClockConfigType::Domain

Operating Domain

◆ Mcu_InitCfg

boolean Mcu_ClockConfigType::Mcu_InitCfg

Apply this configuration at Mcu_init time

◆ Mcu_ClockFrequency

uint64 Mcu_ClockConfigType::Mcu_ClockFrequency

Clock Frequency for the module

◆ Mcu_Mode

Mcu_ModeType Mcu_ConfigType::Mcu_Mode

Mcu mode to be used

See also
MCU Driver API:McuModes

◆ Mcu_ResetMode

uint8 Mcu_ConfigType::Mcu_ResetMode

Reset mode to be used

See also
MCU Driver API:ResetModes

◆ Mcu_ClockConfig

Mcu_ClockConfigPtrType Mcu_ConfigType::Mcu_ClockConfig

Configuration of Module functional clock source

◆ Mcu_NumberOfClockConfig

uint8 Mcu_ConfigType::Mcu_NumberOfClockConfig

Number of entries in Mcu_ClockConfig

◆ Mcu_CBK_Function

Mcu_CBKFunctionPtrType Mcu_ConfigType::Mcu_CBK_Function

Callback function pointer for Applications

◆ Mcu_SoftReset_CBK_Function

Mcu_SoftResetCBKFunctionPtrType Mcu_ConfigType::Mcu_SoftReset_CBK_Function

Callback function pointer for Applications

◆ McuModuleConfiguration_0

const struct Mcu_ConfigType_s McuModuleConfiguration_0
extern

MCU Configuration struct declaration.

◆ AUTOMATIC

AUTOMATIC

◆ ConfigPtr

MCU_PBCFG ConfigPtr

◆ versioninfo

MCU_APPL_DATA versioninfo