5.15. MCU

5.15.1. Types

Base type

Type Name

Brief

enum

Mcu_PllStatusType

This is a status value returned by the function Mcu_GetPllStatus() of the MCU module.

enum

Mcu_RamStateType

Enumeration of ranstate queried by Mcu_GetRamState()

enum

Mcu_ResetType

This is the type of the reset enumerator containing the subset of reset types. It is not required that all reset types are supported by hardware.

enum

Mcu_ClkModuleIdType

Clock source config modules id enum.

enum

Mcu_ClkSourceIdType

This is the type of the clock source in clock tree that is selectable for peripheral. Please see TRM to map clock source to module.

typedef uint8

Mcu_ClockType

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

typedef uint32

Mcu_RawResetType

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

typedef uint8

Mcu_RamSectionType

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

typedef uint8

Mcu_ModeType

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

typedef const Mcu_RamSectionConfigType *

Mcu_RamConfigPtrType

Pointer to RamConfig structure.

typedef const Mcu_RCMConfigType *

Mcu_RCMConfigPtrType

Pointer to PrcmConfig structure.

typedef const Mcu_ClockConfigType *

Mcu_ClockConfigPtrType

Pointer to Clock Config structure.

typedef const Mcu_PwmConfigType *

Mcu_PwmConfigPtrType

Pointer to PWM Clock Config structure.

typedef const Mcu_AdcConfigType *

Mcu_AdcConfigPtrType

Pointer to ADC buffer Config structure.

5.15.1.1. enum Mcu_PllStatusType

Enumerator

Value

Description

MCU_PLL_LOCKED

0

PLL locked.

MCU_PLL_UNLOCKED

PLL unlocked.

MCU_PLL_STATUS_UNDEFINED

PLL status undefined.

Brief: This is a status value returned by the function Mcu_GetPllStatus() of the MCU module.

5.15.1.2. enum Mcu_RamStateType

Enumerator

Value

Description

MCU_RAMSTATE_INVALID

RAM state invalid.

MCU_RAMSTATE_VALID

RAM state valid.

Brief: Enumeration of ranstate queried by Mcu_GetRamState()

5.15.1.3. enum Mcu_ResetType

Enumerator

Value

Description

MCU_RESET_CLEAR

Reset Reason Cleared.

MCU_POWER_ON_RESET

POR Reset.

MCU_WARM_RESET_WDT0

Warm Reset due to MSS_WDT0.

MCU_WARM_RESET_WDT1

Warm Reset due to MSS_WDT1.

MCU_WARM_RESET_WDT2

Warm Reset due to MSS_WDT2.

MCU_WARM_RESET_WDT3

Warm Reset due to MSS_WDT3.

MCU_WARM_RESET

Warm Reset due to TOPRCM WARM_RESET_CONFIG.

MCU_EXT_PAD_RESET

External Pad Reset.

MCU_HSM_WDT_RESET

Warm Reset due to HSM WDT.

MCU_DEBUGGER_RESET

Warm Reset due to Debugger reset.

MCU_WARM_RESET_TEMP0

Warm Reset due to Temprature sensor 0.

MCU_WARM_RESET_TEMP1

Warm Reset due to Temprature sensor 1.

MCU_RESET_UNDEFINED

UNDEFINED reset.

Brief: This is the type of the reset enumerator containing the subset of reset types. It is not required that all reset types are supported by hardware.

5.15.1.4. enum Mcu_ClkModuleIdType

Enumerator

Value

Description

MCU_CLKSRC_MODULE_ID_SYSCLK

System Clock, clock select is ignored.

MCU_CLKSRC_MODULE_ID_MCAN0

MSS MCAN0 clock.

MCU_CLKSRC_MODULE_ID_MCAN1

MSS MCAN1 clock.

MCU_CLKSRC_MODULE_ID_MCAN2

MSS MCAN2 clock.

MCU_CLKSRC_MODULE_ID_MCAN3

MSS MCAN3 clock.

MCU_CLKSRC_MODULE_ID_RTI0

MSS RTIA clock.

MCU_CLKSRC_MODULE_ID_RTI1

MSS RTIB clock.

MCU_CLKSRC_MODULE_ID_RTI2

MSS RTIC clock.

MCU_CLKSRC_MODULE_ID_RTI3

MSS RTIC clock.

MCU_CLKSRC_MODULE_ID_WDT0

MSS WDT clock.

MCU_CLKSRC_MODULE_ID_WDT1

MSS WDT clock.

MCU_CLKSRC_MODULE_ID_WDT2

MSS WDT clock.

MCU_CLKSRC_MODULE_ID_WDT3

MSS WDT clock.

MCU_CLKSRC_MODULE_ID_QSPI

MSS QSPI clock.

MCU_CLKSRC_MODULE_ID_MCSPI0

MSS SPIA clock.

MCU_CLKSRC_MODULE_ID_MCSPI1

MSS SPIA clock.

MCU_CLKSRC_MODULE_ID_MCSPI2

MSS SPIA clock.

MCU_CLKSRC_MODULE_ID_MCSPI3

MSS SPIA clock.

MCU_CLKSRC_MODULE_ID_MCSPI4

MSS SPIA clock.

MCU_CLKSRC_MODULE_ID_SPIB

MSS SPIB clock.

MCU_CLKSRC_MODULE_ID_I2C

MSS I2C clock.

MCU_CLKSRC_MODULE_ID_SCI0

MSS SCIA clock.

MCU_CLKSRC_MODULE_ID_SCI1

MSS SCIB clock.

MCU_CLKSRC_MODULE_ID_SCI2

MSS SCIB clock.

MCU_CLKSRC_MODULE_ID_SCI3

MSS SCIB clock.

MCU_CLKSRC_MODULE_ID_SCI4

MSS SCIB clock.

MCU_CLKSRC_MODULE_ID_SCI5

MSS SCIB clock.

MCU_CLKSRC_MODULE_ID_CPSW

MSS CPSW clock.

MCU_CLKSRC_MODULE_ID_CPTS

MSS CPTS clock.

MCU_CLKSRC_MODULE_ID_MCU_CLKOUT0

MSS MCU CLKOUT0 clock.

MCU_CLKSRC_MODULE_ID_MCU_CLKOUT1

MSS MCU CLKOUT1 clock.

MCU_CLKSRC_MODULE_ID_PMIC_CLKOUT

MSS PMIC CLKOUT clock.

MCU_CLKSRC_MODULE_ID_MII100_CLK

MSS MII 100 CLK clock.

MCU_CLKSRC_MODULE_ID_MII10_CLK

MSS MII 10 CLK clock.

MCU_CLKSRC_MODULE_ID_RGMI_CLK

MSS RGMI CLK clock.

MCU_CLKSRC_MODULE_ID_CONTROLSS_CLK

MSS CONTROLSS CLK clock.

MCU_CLKSRC_MODULE_ID_MAX

MSS Module ID max.

Brief: Clock source config modules id enum.

Clock source config ids defines are used to set clock source for specific modules

5.15.1.5. enum Mcu_ClkSourceIdType

Enumerator

Value

Description

MCU_CLKSRC_0

0

Clock source 0.

MCU_CLKSRC_1

Clock source 1.

MCU_CLKSRC_2

Clock source 2.

MCU_CLKSRC_3

Clock source 3.

MCU_CLKSRC_4

Clock source 4.

MCU_CLKSRC_5

Clock source 5.

MCU_CLKSRC_6

Clock source 6.

MCU_CLKSRC_7

Clock source 7.

MCU_CLKSRC_MAX

Clock source Max.

Brief: This is the type of the clock source in clock tree that is selectable for peripheral. Please see TRM to map clock source to module.

5.15.1.6. typedef Mcu_ClockType

typedef uint8 Mcu_ClockType;

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

5.15.1.7. typedef Mcu_RawResetType

typedef uint32 Mcu_RawResetType;

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

5.15.1.8. typedef Mcu_RamSectionType

typedef uint8 Mcu_RamSectionType;

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

5.15.1.9. typedef Mcu_ModeType

typedef uint8 Mcu_ModeType;

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

5.15.1.10. typedef Mcu_RamConfigPtrType

typedef const Mcu_RamSectionConfigType* Mcu_RamConfigPtrType;

Brief: Pointer to RamConfig structure.

5.15.1.11. typedef Mcu_RCMConfigPtrType

typedef const Mcu_RCMConfigType* Mcu_RCMConfigPtrType;

Brief: Pointer to PrcmConfig structure.

5.15.1.12. typedef Mcu_ClockConfigPtrType

typedef const Mcu_ClockConfigType* Mcu_ClockConfigPtrType;

Brief: Pointer to Clock Config structure.

5.15.1.13. typedef Mcu_PwmConfigPtrType

typedef const Mcu_PwmConfigType* Mcu_PwmConfigPtrType;

Brief: Pointer to PWM Clock Config structure.

5.15.1.14. typedef Mcu_AdcConfigPtrType

typedef const Mcu_AdcConfigType* Mcu_AdcConfigPtrType;

Brief: Pointer to ADC buffer Config structure.

5.15.2. Structures

Name

Brief

Mcu_RamSectionConfigType

Structure for data pre-setting to be initialized.

Mcu_ClockConfigType

Structure for module clock setting.

Mcu_PwmConfigType

Structure for PWM clock configuration.

Mcu_AdcConfigType

Structure for ADC Buffer configuration.

Mcu_RCMConfigType

Structure for PRCM configuration.

Mcu_RegisterReadbackType

MCU CONFIG Register READBACK structure.

Mcu_ConfigType

MCU CONFIG ROOT structure.

5.15.3. Defines

Name

Brief

MCU_SW_MAJOR_VERSION

Driver Implementation Major Version.

MCU_SW_MINOR_VERSION

Driver Implementation Minor Version.

MCU_SW_PATCH_VERSION

Driver Implementation Patch Version.

MCU_AR_RELEASE_MAJOR_VERSION

AUTOSAR Major version specification implemented by MCU Driver.

MCU_AR_RELEASE_MINOR_VERSION

AUTOSAR Minor version specification implemented by MCU Driver.

MCU_AR_RELEASE_REVISION_VERSION

AUTOSAR Patch version specification implemented by MCU Driver.

MCU_VENDOR_ID

Texas Instruments Vendor ID.

MCU_MODULE_ID

MCU Driver Module ID.

MCU_INSTANCE_ID

MCU Driver Instance ID.

MCU_SID_INIT

Mcu_Init() API Service ID.

MCU_SID_INIT_RAMSECTION

Mcu_InitRamSection() API Service ID.

MCU_SID_INIT_CLOCK

Mcu_InitClock() API Service ID.

MCU_SID_DISTRIBUTE_PLL_CLOCK

Mcu_DistributePllClock() API Service ID.

MCU_SID_GET_PLL_STATUS

Mcu_GetPllStatus() API Service ID.

MCU_SID_GET_RESET_REASON

Mcu_GetResetReason() API Service ID.

MCU_SID_GET_RESET_RAW_VALUE

Mcu_GetResetRawValue() API Service ID.

MCU_SID_PERFORM_RESET

Mcu_PerformReset() API Service ID.

MCU_SID_SET_MODE

Mcu_SetMode() API Service ID.

MCU_SID_GET_VERSION_INFO

Mcu_GetVersionInfo() API Service ID.

MCU_SID_GET_RAM_STATE

Mcu_GetRamState() API Service ID.

MCU_SID_PLL_INIT_ALL

Mcu_PLLInitAll() API Service ID.

MCU_SID_REGISTER_READBACK

Mcu_RegisterReadback() API Service ID.

MCU_E_PARAM_CONFIG

ERROR:Mcu_init config param invalid.

MCU_E_PARAM_CLOCK

ERROR:Mcu_InitClock clockid param invalid.

MCU_E_PARAM_MODE

ERROR:Mcu_SetMode modeid param invalid.

MCU_E_PARAM_RAMSECTION

ERROR:Mcu_InitRamSection ramSect param invalid.

MCU_E_PLL_NOT_LOCKED

ERROR:PLL not locked.

MCU_E_UNINIT

ERROR:API invoked without performing Mcu_Init.

MCU_E_PARAM_POINTER

ERROR:NULL_PTR passed to MCU driver APIs.

MCU_E_RUNTIME_ASSERT

ERROR:Runtime assert failure.

MCU_PERFORM_RESET_MODE_WARM

Initiate SW WARM RESET sequence.

MCU_ERRORRST_MASK

Reset Reason Error Mask.

RESETREASON_NRESET

Reset Reason

MCU_RCM_MODULE_ID_FIRST

ModuleId for First.

MCU_RCM_MODULE_ID_DCAN

ModuleId for DCAN.

MCU_RCM_MODULE_ID_MIBSPI1

ModuleId for MIBSPI1.

MCU_RCM_MODULE_ID_MIBSPI2

ModuleId for MIBSPI2.

MCU_RCM_MODULE_ID_QSPI

ModuleId for QSPI.

MCU_RCM_MODULE_ID_GPIOA

ModuleId for GPIOA.

MCU_RCM_MODULE_ID_WDTIMER

ModuleId for Watchdog.

MCU_RCM_MODULE_ID_UART

ModuleId for UART.

MCU_RCM_MODULE_ID_GPTIMER

ModuleId for GPTIMER.

MCU_RCM_MODULE_ID_LAST

ModuleId for Last.

MCU_STATE_UNINIT

Specifief the status of un-initialization.

MCU_STATE_INIT

Specifief the status of un-initialization.

MCU_INCORRECT_DSP_FREQ_SEL

Specifies the DSP SoC supported frequency vs Selected frequency from configuration Cfg.h file Mismatch This Error is thrown when user selects more frequency for DSP core than what the SoC supports. Ex: In the configuration if McuDSPDPLLClockout_HSDIV1 is selected as 550Mhz but if SoC supports only 300MHz as the maximum frequency this error is thrown.

5.15.4. Functions

Return type

Function Name

Brief

void

Mcu_Init(const Mcu_ConfigType * ConfigPtr)

This service initializes the MCU driver.

Std_ReturnType

Mcu_InitRamSection(Mcu_RamSectionType RamSection)

This service initializes the RAM section wise.

Std_ReturnType

Mcu_InitClock(Mcu_ClockType ClockSetting)

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

void

Mcu_PerformReset(void )

The service performs a microcontroller reset.

Std_ReturnType

Mcu_DistributePllClock(void )

This service provides the lock status of the PLL. This function is provided as dummy. All PLL distribution activities are being performed in Mcu_Init() to improve performance.

Mcu_PllStatusType

Mcu_GetPllStatus(void )

This service provides the lock status of the PLL.

Mcu_ResetType

Mcu_GetResetReason(void )

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

Mcu_RawResetType

Mcu_GetResetRawValue(void )

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

void

Mcu_SetMode(Mcu_ModeType McuMode)

This service activates the MCU power modes. Supported low power modes - None.

Mcu_RamStateType

Mcu_GetRamState(void )

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

void

Mcu_GetVersionInfo(Std_VersionInfoType * versioninfo)

This service returns the version information of this module.

void

Mcu_DeInit(void )

This service is only used for UT testing and not for app use This service sets the internal MCU initDone flag to FALSE so that Mcu_Init can be invoked again. This is required for negative UT test cases.

Std_ReturnType

Mcu_RegisterReadback(Mcu_RegisterReadbackType * RegisterReadbackPtr)

This service is to read some of the config registers.

5.15.4.1. function Mcu_Init

void Mcu_Init(
    const Mcu_ConfigType * ConfigPtr
)

Brief: This service initializes the MCU driver.

Service ID[hex] : 0x0

Sync/Async : Synchronous

Reentrancy : Non Reentrant

Parameters:

  • ConfigPtr - Pointer to MCU driver configuration set.

Returns:

  • None

Return: None

5.15.4.2. function Mcu_InitRamSection

Std_ReturnType Mcu_InitRamSection(
    Mcu_RamSectionType RamSection
)

Brief: This service initializes the RAM section wise.

Service ID[hex] : 0x01

Sync/Async : Synchronous

Reentrancy : Non Reentrant

Parameters:

  • RamSection - Selects RAM memory section provided in configuration set

Returns:

  • E_OK - command has been accepted

  • E_NOT_OK - command has not been accepted e.g. due to parameter error

Return: Std_ReturnType

5.15.4.3. function Mcu_InitClock

Std_ReturnType Mcu_InitClock(
    Mcu_ClockType ClockSetting
)

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

Service ID[hex] : 0x02

Sync/Async : Synchronous

Reentrancy : Non Reentrant

Parameters:

  • ClockSetting - Clock setting

Returns:

  • E_OK - command has been accepted

  • E_NOT_OK - command has not been accepted

Return: Std_ReturnType

5.15.4.4. function Mcu_PerformReset

void Mcu_PerformReset(
    void 
)

Brief: The service performs a microcontroller reset.

This function is the watchdog trigger and is invoked from WdgIsr

Service ID[hex] : 0x07

Sync/Async : Synchronous

Reentrancy : Non Reentrant

Parameters:

  • None

Returns:

  • None

Return: None

5.15.4.5. function Mcu_DistributePllClock

Std_ReturnType Mcu_DistributePllClock(
    void 
)

Brief: This service provides the lock status of the PLL. This function is provided as dummy. All PLL distribution activities are being performed in Mcu_Init() to improve performance.

Service ID[hex] : 0x03

Sync/Async : Synchronous

Reentrancy : Reentrant

Parameters:

  • None

Returns:

  • E_OK - Success

  • E_NOT_OK - Failure

Return: Std_ReturnType

5.15.4.6. function Mcu_GetPllStatus

Mcu_PllStatusType Mcu_GetPllStatus(
    void 
)

Brief: This service provides the lock status of the PLL.

Service ID[hex] : 0x04

Sync/Async : Synchronous

Reentrancy : Reentrant

Parameters:

  • None

Returns:

  • Refer enum Mcu_PllStatusType

Return: Mcu_PllStatusType - PLL Status

5.15.4.7. function Mcu_GetResetReason

Mcu_ResetType Mcu_GetResetReason(
    void 
)

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

Service ID[hex] : 0x05

Sync/Async : Synchronous

Reentrancy : Reentrant

Parameters:

  • None

Returns:

  • Refer enum Mcu_ResetType

Return: Mcu_ResetType

5.15.4.8. function Mcu_GetResetRawValue

Mcu_RawResetType Mcu_GetResetRawValue(
    void 
)

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

Service ID[hex] : 0x06

Sync/Async : Synchronous

Reentrancy : Reentrant

Parameters:

  • None

Returns:

  • Refer Mcu_RawResetType

Return: Mcu_RawResetType - Reset raw value

5.15.4.9. function Mcu_SetMode

void Mcu_SetMode(
    Mcu_ModeType McuMode
)

Brief: This service activates the MCU power modes. Supported low power modes - None.

Service ID[hex] : 0x08

Sync/Async : Synchronous

Reentrancy : Reentrant

Parameters:

  • McuMode - MCU mode

Returns:

  • None

Return: None

5.15.4.10. function Mcu_GetRamState

Mcu_RamStateType Mcu_GetRamState(
    void 
)

Brief: This service provides the actual status of the microcontroller Ram, if supported.

Service ID[hex] : 0x0a

Sync/Async : Synchronous

Reentrancy : Reentrant

Parameters:

  • None

Returns:

  • Refer enum Mcu_RamStateType

Return: Mcu_RamStateType - Status of the Ram Content

5.15.4.11. function Mcu_GetVersionInfo

void Mcu_GetVersionInfo(
    Std_VersionInfoType * versioninfo
)

Brief: This service returns the version information of this module.

Service ID[hex] : 0x0B

Sync/Async : Synchronous

Reentrancy : Reentrant

Parameters:

  • versioninfo - Pointer to where to store the version information of this module.

Returns:

  • None

Return: None

5.15.4.12. function Mcu_DeInit

void Mcu_DeInit(
    void 
)

Brief: This service is only used for UT testing and not for app use This service sets the internal MCU initDone flag to FALSE so that Mcu_Init can be invoked again. This is required for negative UT test cases.

Service ID[hex] : 0x09

Sync/Async : Synchronous

Reentrancy : Non-Reentrant

Parameters:

  • None

Returns:

  • None

Return: None

5.15.4.13. function Mcu_RegisterReadback

Std_ReturnType Mcu_RegisterReadback(
    Mcu_RegisterReadbackType * RegisterReadbackPtr
)

Brief: This service is to read some of the config registers.

Service ID[hex] : N/A

Sync/Async : Synchronous

Reentrancy : Non-Reentrant

Parameters:

  • RegisterReadbackPtr - Pointer to Register readback data

Returns:

  • E_OK Success

  • E_NOT_OK Failure

Return: None