The Common driver contains a set of different system functions. These functions can be called in the application routine.
◆ XMC_DIV_ROUND
#define XMC_DIV_ROUND |
( |
|
a, |
|
|
|
b |
|
) |
| (((a) + ((b) / 2U)) / (b)) |
Calculates a / b with rounding to the nearest integer, a and b must have the same sign.
◆ XMC_DIV_ROUNDUP
#define XMC_DIV_ROUNDUP |
( |
|
a, |
|
|
|
b |
|
) |
| ((((a) - 1U) / (b)) + 1U) |
Calculates a / b with rounding up if remainder != 0, both a and b must be positive.
◆ XMC_Delay()
void XMC_Delay |
( |
uint32_t |
milliseconds | ) |
|
The function delays by the specified number of milliseconds. The number of cycles to delay is calculated based on the SystemCoreClock.
- Parameters
-
milliseconds | The number of milliseconds to delay. |
- Note
- The function calls XMC_DelayCycles() API to generate a delay. If the desired delay is bigger than 0xFFFFFFFD CPU cycles, then an additional loop runs to prevent an overflow in parameter passed to XMC_DelayCycles() API.
◆ XMC_DelayCycles()
void XMC_DelayCycles |
( |
uint32_t |
cycles | ) |
|
The function delays by the specified number of CPU clock cycles.
- Note
- There is memory reading timing limitation in XMC1xxx device family (see section Memory Read in the device TRM) this may significantly stretch this function execution, especially at high CPU speeds.
- Parameters
-
cycles | The number of CPU clock cycles to delay. Valid range: 0x0 .. 0xFFFFFFFD. |
◆ XMC_DelayUs()
void XMC_DelayUs |
( |
uint16_t |
microseconds | ) |
|
The function delays by the specified number of microseconds. The number of cycles to delay is calculated based on the SystemCoreClock.
- Parameters
-
microseconds | The number of microseconds to delay. |
- Note
- If the CPU frequency in MHz is a small number, the actual delay can be significantly bigger than the desired value. The actual delay cannot be shorter than the desired one.
◆ XMC_EnterCriticalSection()
uint32_t XMC_EnterCriticalSection |
( |
void |
| ) |
|
XMC_EnterCriticalSection disables interrupts and returns a value indicating whether the interrupts were previously enabled.
- Returns
- Returns the current interrupt status. Returns 0 if the interrupts were previously enabled or 1 if the interrupts were previously disabled.
- Note
- Implementation of XMC_EnterCriticalSection manipulates the IRQ enable bit with interrupts still enabled.
◆ XMC_ExitCriticalSection()
void XMC_ExitCriticalSection |
( |
uint32_t |
savedIntrStatus | ) |
|