Infineon MOTIX™ MCU TLE987x Device Family SDK
Macros | Typedefs | Enumerations | Functions
scu.h File Reference

Go to the source code of this file.

Detailed Description

System Control Unit low level access library.

Version
V0.5.7
Date
18. Oct 2022
Note
This file violates [MISRA 2012 Rule 2.2, required]

Include Graph

Include dependency graph for scu.h:

Include Graph

This graph shows which files directly or indirectly include this file:

Macros

#define PASSWD_Open   (0x98U)
 PASSWD Phrases, PASSWD Opened. More...
 
#define PASSWD_Close   (0xA8U)
 PASSWD Phrases, PASSWD Closed. More...
 
#define NVM_DATA_WRITE   (0U)
 NVM Protection indices, DATA WRITE. More...
 
#define NVM_CODE_WRITE   (1U)
 NVM Protection indices, CODE WRITE. More...
 
#define NVM_DATA_READ   (2U)
 NVM Protection indices, DATA READ. More...
 
#define NVM_CODE_READ   (3U)
 NVM Protection indices, CODE READ. More...
 
#define PROTECTION_CLEAR   (1U)
 NVM Protection actions, CLEAR. More...
 
#define PROTECTION_SET   (0U)
 NVM Protection actions, SET. More...
 
#define SLOWDOWN_PRESCALER_1   (0U)
 
#define SLOWDOWN_PRESCALER_2   (1U)
 
#define SLOWDOWN_PRESCALER_3   (2U)
 
#define SLOWDOWN_PRESCALER_4   (3U)
 
#define SLOWDOWN_PRESCALER_8   (4U)
 
#define SLOWDOWN_PRESCALER_16   (5U)
 
#define SLOWDOWN_PRESCALER_24   (6U)
 
#define SLOWDOWN_PRESCALER_32   (7U)
 
#define SLOWDOWN_PRESCALER_48   (8U)
 
#define SLOWDOWN_PRESCALER_64   (9U)
 
#define SLOWDOWN_PRESCALER_96   (10U)
 
#define SLOWDOWN_PRESCALER_128   (11U)
 
#define SLOWDOWN_PRESCALER_192   (12U)
 
#define SLOWDOWN_PRESCALER_256   (13U)
 
#define SLOWDOWN_PRESCALER_384   (14U)
 
#define SLOWDOWN_PRESCALER_512   (15U)
 

Typedefs

typedef enum Scu_Mod TScu_Mod
 

Enumerations

enum  Scu_Mod {
  Mod_ADC1 = 0x00 , Mod_SSC1 = 0x01 , Mod_CCU6 = 0x02 , Mod_Timer2 = 0x03 ,
  Mod_GPT12 = 0x04 , Mod_SSC2 = 0x11 , Mod_Timer21 = 0x13 , Mod_Timer3 = 0x15
}
 

Functions

void SCU_ClkInit (void)
 Initializes the system clocks. More...
 
void SCU_Init (void)
 Initializes the SCU based on the Config Wizard for MOTIX MCU configuration. More...
 
void SCU_EnterSleepMode (void)
 Sets the device into Sleep Mode. More...
 
void SCU_EnterStopMode (void)
 Sets the device into Stop Mode. More...
 
void SCU_EnterSlowMode (uint8 divider_scaled)
 Sets the device into Slow Down Mode. More...
 
void SCU_ExitSlowMode (void)
 Gets the device out of Slow Mode. More...
 
bool SCU_ChangeNVMProtection (uint32 mode, uint32 action)
 Sets the Write/Read Protection for the Code/Data Flash. More...
 
INLINE void SCU_WDT_Start (void)
 Starts the Watchdog of SCU-DM in the Watchdog Timer Control Register The written bit is protected by the Bit Protection Register of SCU. More...
 
INLINE void SCU_WDT_Stop (void)
 Stops the Watchdog of SCU-DM in the Watchdog Timer Control Register The written bit is protected by the Bit Protection Register of SCU. More...
 
INLINE void SCU_WDT_Service (void)
 Services the Watchdog of SCU-DM in the Watchdog Timer Control Register. More...
 
INLINE void SCU_Disable_Module (TScu_Mod Module)
 Disables a given peripheral module in the Peripheral Management Control Registers. More...
 
INLINE void SCU_Enable_Module (TScu_Mod Module)
 Enables a given peripheral module in the Peripheral Management Control Registers. More...
 
INLINE void SCU_OpenPASSWD (void)
 Opens the bit protection by writing PASSWD_Open to the Bit Protection Register. More...
 
INLINE void SCU_ClosePASSWD (void)
 Closes the bit protection by writing PASSWD_Close to the Bit Protection Register. More...
 

Macro Definition Documentation

◆ NVM_CODE_READ

#define NVM_CODE_READ   (3U)

NVM Protection indices, CODE READ.

◆ NVM_CODE_WRITE

#define NVM_CODE_WRITE   (1U)

NVM Protection indices, CODE WRITE.

◆ NVM_DATA_READ

#define NVM_DATA_READ   (2U)

NVM Protection indices, DATA READ.

◆ NVM_DATA_WRITE

#define NVM_DATA_WRITE   (0U)

NVM Protection indices, DATA WRITE.

◆ PASSWD_Close

#define PASSWD_Close   (0xA8U)

PASSWD Phrases, PASSWD Closed.

◆ PASSWD_Open

#define PASSWD_Open   (0x98U)

PASSWD Phrases, PASSWD Opened.

◆ PROTECTION_CLEAR

#define PROTECTION_CLEAR   (1U)

NVM Protection actions, CLEAR.

◆ PROTECTION_SET

#define PROTECTION_SET   (0U)

NVM Protection actions, SET.

◆ SLOWDOWN_PRESCALER_1

#define SLOWDOWN_PRESCALER_1   (0U)

◆ SLOWDOWN_PRESCALER_128

#define SLOWDOWN_PRESCALER_128   (11U)

◆ SLOWDOWN_PRESCALER_16

#define SLOWDOWN_PRESCALER_16   (5U)

◆ SLOWDOWN_PRESCALER_192

#define SLOWDOWN_PRESCALER_192   (12U)

◆ SLOWDOWN_PRESCALER_2

#define SLOWDOWN_PRESCALER_2   (1U)

◆ SLOWDOWN_PRESCALER_24

#define SLOWDOWN_PRESCALER_24   (6U)

◆ SLOWDOWN_PRESCALER_256

#define SLOWDOWN_PRESCALER_256   (13U)

◆ SLOWDOWN_PRESCALER_3

#define SLOWDOWN_PRESCALER_3   (2U)

◆ SLOWDOWN_PRESCALER_32

#define SLOWDOWN_PRESCALER_32   (7U)

◆ SLOWDOWN_PRESCALER_384

#define SLOWDOWN_PRESCALER_384   (14U)

◆ SLOWDOWN_PRESCALER_4

#define SLOWDOWN_PRESCALER_4   (3U)

◆ SLOWDOWN_PRESCALER_48

#define SLOWDOWN_PRESCALER_48   (8U)

◆ SLOWDOWN_PRESCALER_512

#define SLOWDOWN_PRESCALER_512   (15U)

◆ SLOWDOWN_PRESCALER_64

#define SLOWDOWN_PRESCALER_64   (9U)

◆ SLOWDOWN_PRESCALER_8

#define SLOWDOWN_PRESCALER_8   (4U)

◆ SLOWDOWN_PRESCALER_96

#define SLOWDOWN_PRESCALER_96   (10U)

Typedef Documentation

◆ TScu_Mod

typedef enum Scu_Mod TScu_Mod

Enumeration Type Documentation

◆ Scu_Mod

enum Scu_Mod
Enumerator
Mod_ADC1 

SCU Modules Select: ADC1

Mod_SSC1 

SCU Modules Select: SSC1

Mod_CCU6 

SCU Modules Select: CCU6

Mod_Timer2 

SCU Modules Select: Timer2

Mod_GPT12 

SCU Modules Select: GPT12

Mod_SSC2 

SCU Modules Select: SSC2

Mod_Timer21 

SCU Modules Select: Timer21

Mod_Timer3 

SCU Modules Select: Timer3

Function Documentation

◆ SCU_ChangeNVMProtection()

bool SCU_ChangeNVMProtection ( uint32  mode,
uint32  action 
)

Sets the Write/Read Protection for the Code/Data Flash.

Parameters
modeProtection CODE/DATA, READ/WRITE
actionCLEAR/SET
Return values
falseexecution passes
trueexecution failed, maybe wrong password

Example

This example sets Protection for the Code Write.

void Example_Function(void)
{
bool sts;
return(sts);
}
#define PROTECTION_SET
NVM Protection actions, SET.
Definition: scu.h:167
#define NVM_CODE_WRITE
NVM Protection indices, CODE WRITE.
Definition: scu.h:158
bool SCU_ChangeNVMProtection(uint32 mode, uint32 action)
Sets the Write/Read Protection for the Code/Data Flash.

◆ SCU_ClkInit()

void SCU_ClkInit ( void  )

Initializes the system clocks.

◆ SCU_ClosePASSWD()

INLINE void SCU_ClosePASSWD ( void  )

Closes the bit protection by writing PASSWD_Close to the Bit Protection Register.

Example

This example closes the PASSWD Register protection scheme.

void Example_Function(void)
{
}
INLINE void SCU_ClosePASSWD(void)
Closes the bit protection by writing PASSWD_Close to the Bit Protection Register.
Definition: scu.h:501

◆ SCU_Disable_Module()

INLINE void SCU_Disable_Module ( TScu_Mod  Module)

Disables a given peripheral module in the Peripheral Management Control Registers.

Parameters
Moduleperipheral module (Bit[4] = PMCON1 or PMCON2, Bit[3:0] slects the bit)

Example

This example disables ADC1 Module.

void Example_Function(void)
{
}
@ Mod_ADC1
Definition: scu.h:196
INLINE void SCU_Disable_Module(TScu_Mod Module)
Disables a given peripheral module in the Peripheral Management Control Registers.
Definition: scu.h:423

◆ SCU_Enable_Module()

INLINE void SCU_Enable_Module ( TScu_Mod  Module)

Enables a given peripheral module in the Peripheral Management Control Registers.

Parameters
Moduleperipheral module (Bit[4] = PMCON1 or PMCON2, Bit[3:0] slects the bit)

Example

This example enables ADC1 Module.

void Example_Function(void)
{
}
INLINE void SCU_Enable_Module(TScu_Mod Module)
Enables a given peripheral module in the Peripheral Management Control Registers.
Definition: scu.h:453

◆ SCU_EnterSleepMode()

void SCU_EnterSleepMode ( void  )

Sets the device into Sleep Mode.

Note
This function violates [MISRA 2012 Rule 2.2, required]

performed steps: Set LIN to sleep mode, clear Main wake status and Wake Source MON Input, stop WDT1 and trigger a short open window, disable interrupts set Sleep Mode Enable flag in Power Mode Control Register 0, execute the WFE instruction twice to enter sleep mode

Example

This example Sets the device into Sleep Mode.

void Example_Function(void)
{
}
void SCU_EnterSleepMode(void)
Sets the device into Sleep Mode.

◆ SCU_EnterSlowMode()

void SCU_EnterSlowMode ( uint8  divider_scaled)

Sets the device into Slow Down Mode.

Warning
At prescalers of 384 or higher the regular Systick execution at an 1ms interval is not possible anymore. The functions WDT1_Init_SlowMode needs to set the Systick interrupt to a lower calling frequency, WDT1_Window_Count also needs to be adapted in this case.
Parameters
divider_scaledDivider from 1 up to 512 scaled to a value from 0 to 15; for scaling see User manual, register CMCON1->CLKREL. The macros SLOWDOWN_PRESCALER_x are recommended as parameter.

Example

This example Sets the device into Slow Mode.

void Example_Function(void)
{
}
#define SLOWDOWN_PRESCALER_16
Definition: scu.h:175
void SCU_EnterSlowMode(uint8 divider_scaled)
Sets the device into Slow Down Mode.

◆ SCU_EnterStopMode()

void SCU_EnterStopMode ( void  )

Sets the device into Stop Mode.

Note
This function violates [MISRA 2012 Rule 2.2, required]

performed steps: clear Main wake status and Wake Source MON Input, stop WDT1 and trigger a short open window, disable interrupts select LP_CLK as sys clk for a defined state, select OSC_PLL async, set Sleep Mode Enable flag in Power Mode Control Register 0, send the event SEV, execute the WFE instruction twice to enter stop mode

  • in case TLE987X doesn't wake up with a reset: reset PLL locking in PLL Control Register, wait until PLL is locked, switch back fSYS (was set to LP_CLK before), enable interrupts, initialize WDT1

Example

This example Sets the device into Stop Mode.

void Example_Function(void)
{
}
void SCU_EnterStopMode(void)
Sets the device into Stop Mode.

◆ SCU_ExitSlowMode()

void SCU_ExitSlowMode ( void  )

Gets the device out of Slow Mode.

Example

This example Gets the device out of Slow Mode.

void Example_Function(void)
{
}
void SCU_ExitSlowMode(void)
Gets the device out of Slow Mode.

◆ SCU_Init()

void SCU_Init ( void  )

Initializes the SCU based on the Config Wizard for MOTIX MCU configuration.

◆ SCU_OpenPASSWD()

INLINE void SCU_OpenPASSWD ( void  )

Opens the bit protection by writing PASSWD_Open to the Bit Protection Register.

Example

This example opens the PASSWD Register protection scheme.

void Example_Function(void)
{
}
INLINE void SCU_OpenPASSWD(void)
Opens the bit protection by writing PASSWD_Open to the Bit Protection Register.
Definition: scu.h:484

◆ SCU_WDT_Service()

INLINE void SCU_WDT_Service ( void  )

Services the Watchdog of SCU-DM in the Watchdog Timer Control Register.

Example

This example starts the internal Watchdog and services the internal Watchdog.

void Example_Function(void)
{
}
INLINE void SCU_WDT_Start(void)
Starts the Watchdog of SCU-DM in the Watchdog Timer Control Register The written bit is protected by ...
Definition: scu.h:364
INLINE void SCU_WDT_Service(void)
Services the Watchdog of SCU-DM in the Watchdog Timer Control Register.
Definition: scu.h:404

◆ SCU_WDT_Start()

INLINE void SCU_WDT_Start ( void  )

Starts the Watchdog of SCU-DM in the Watchdog Timer Control Register The written bit is protected by the Bit Protection Register of SCU.

Example

This example starts the internal Watchdog and services the internal Watchdog.

void Example_Function(void)
{
}

◆ SCU_WDT_Stop()

INLINE void SCU_WDT_Stop ( void  )

Stops the Watchdog of SCU-DM in the Watchdog Timer Control Register The written bit is protected by the Bit Protection Register of SCU.

Example

This example stops the internal Watchdog.

void Example_Function(void)
{
}
INLINE void SCU_WDT_Stop(void)
Stops the Watchdog of SCU-DM in the Watchdog Timer Control Register The written bit is protected by t...
Definition: scu.h:384