STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
|
Complex Device Driver (CDD). More...
Macros | |
#define | Det_ReportError(ModuleId, InstanceId, ApiId, ErrorId) |
#define | BIT_SHIFT(irq) |
#define | IP_IDX(irq) |
#define | NVIC_MIN_IRQ 16u |
#define | NVIC_MAX_IRQ 30u |
#define | NVIC_MAX_PRIORITY 3u |
#define | IRQ_MASK 0x1FUL |
#define | IRQ_NOT_PENDING 0UL |
#define | INVALID_PRIORITY 0xFFU |
#define | FIRST_INDEX 0U |
Functions | |
void | CDD_Nvic_SetPriority (Nvic_IrqType Irq, uint32 Priority) |
Sets the priority for a specific peripheral interrupt in the NVIC. | |
uint32 | CDD_Nvic_GetPriority (Nvic_IrqType Irq) |
Return the priority of a specific peripheral interrupt from the NVIC. | |
void | CDD_Nvic_EnableIrq (Nvic_IrqType Irq) |
Enables a specific peripheral interrupt in the NVIC. | |
void | CDD_Nvic_DisableIrq (Nvic_IrqType Irq) |
Disables a specific peripheral interrupt in the NVIC. | |
uint32 | CDD_Nvic_GetPendingIrq (Nvic_IrqType Irq) |
Return the pending status of a specific peripheral interrupt in the NVIC. | |
void | CDD_Nvic_SetPendingIrq (Nvic_IrqType Irq) |
Sets a specific peripheral interrupt as pending in the NVIC. | |
void | CDD_Nvic_ClearPendingIrq (Nvic_IrqType Irq) |
Clears the pending status of a specific peripheral interrupt in the NVIC. | |
Complex Device Driver (CDD).
Complex Nvic Driver controls the NVIC (Nested Vectored Interrupt Controller) functionality. It specifically controls the activation of interrupts in ARM microcontrollers via the NVIC peripheral, providing functionalities including setting priorities, enabling/disabling interrupts, and handling interrupt pending statuses.
#define Det_ReportError | ( | ModuleId, | |
InstanceId, | |||
ApiId, | |||
ErrorId ) |
ModuleId | module id number |
InstanceId | Instance Id |
ApiId | Pai id |
ErrorId | Error code |
#define FIRST_INDEX 0U |
Starting index for NVIC register
void CDD_Nvic_ClearPendingIrq | ( | Nvic_IrqType | Irq | ) |
Clears the pending status of a specific peripheral interrupt in the NVIC.
The function checks if the interrupt number belongs to the microcontroller's peripherals. If the number is valid, it uses the Bfx_PutBit_u32u8u8 function to clear the pending status of that interrupt in the NVIC's ICPR register.
Irq | Interrupt number whose pending status is to be cleared. |
< Minimum IQR value
< Maximum IRQ value
< Starting index for NVIC register
< Mask to obtain bits from an IRQ value
void CDD_Nvic_DisableIrq | ( | Nvic_IrqType | Irq | ) |
Disables a specific peripheral interrupt in the NVIC.
The function checks if the interrupt number belongs to the microcontroller's peripherals. If the number is valid, it uses the Bfx_PutBit_u32u8u8 function to disable the interrupt in the NVIC's ICER register.
Irq | Interrupt number to be disabled. |
< Minimum IQR value
< Maximum IRQ value
< Starting index for NVIC register
< Mask to obtain bits from an IRQ value
void CDD_Nvic_EnableIrq | ( | Nvic_IrqType | Irq | ) |
Enables a specific peripheral interrupt in the NVIC.
The function checks if the interrupt number belongs to the microcontroller's peripherals. If the number is valid, it uses the Bfx_SetBit_u32u8 function to enable the interrupt in the NVIC's ISER register.
Irq | Interrupt number to be enabled. |
< Minimum IQR value
< Maximum IRQ value
< Starting index for NVIC register
< Mask to obtain bits from an IRQ value
uint32 CDD_Nvic_GetPendingIrq | ( | Nvic_IrqType | Irq | ) |
Return the pending status of a specific peripheral interrupt in the NVIC.
The function checks if the interrupt number belongs to the microcontroller's peripherals. If the number is valid, it uses the Bfx_GetBit_u32u8_u8 function to determine if the interrupt is pending in the NVIC's ISPR register.
Irq | Interrupt number whose pending status is to be checked. |
< Value to specifie IRQ is not pending
< Minimum IQR value
< Maximum IRQ value
< Starting index for NVIC register
< Mask to obtain bits from an IRQ value
uint32 CDD_Nvic_GetPriority | ( | Nvic_IrqType | Irq | ) |
Return the priority of a specific peripheral interrupt from the NVIC.
The function checks if the interrupt number belongs to the microcontroller's peripherals. If the number is valid, it uses the Bfx_GetBits_u32u8u8_u32 function to extract the priority from the NVIC's IP register. Otherwise, it returns an INVALID_PRIORITY value.
Irq | Interrupt number whose priority is to be retrieved. |
Priority | value of the interrupt. Returns INVALID_PRIORITY if the interrupt number is not a valid peripheral interrupt. |
< Invalid priority indicator
< Minimum IQR value
< Maximum IRQ value
< Calculate the index for IRQ priority register
< Calculate the bit shift for IRQ priority
void CDD_Nvic_SetPendingIrq | ( | Nvic_IrqType | Irq | ) |
Sets a specific peripheral interrupt as pending in the NVIC.
The function checks if the interrupt number belongs to the microcontroller's peripherals. If the number is valid, it utilizes the Bfx_SetBit_u32u8 function to set the interrupt as pending in the NVIC's ISPR register.
Irq | Interrupt number to set as pending. |
< Minimum IQR value
< Maximum IRQ value
< Starting index for NVIC register
< Mask to obtain bits from an IRQ value
void CDD_Nvic_SetPriority | ( | Nvic_IrqType | Irq, |
uint32 | Priority ) |
Sets the priority for a specific peripheral interrupt in the NVIC.
The function checks if the interrupt number belongs to the microcontroller's peripherals. If valid, it utilizes the Bfx_PutBitsMask_u32u32u32 function to update the NVIC's IP register with the desired priority.
Irq | Interrupt number to set. |
Priority | Priority value to assign to the interrupt. |
< Minimum IQR value
< Maximum IRQ value
< Maximum priority value
< Calculate the index for IRQ priority register
< Calculate the bit shift for IRQ priority
< Calculate the index for IRQ priority register
< Calculate the bit shift for IRQ priority