Macros | |
#define | MAKE_STATUS(group, code) ((((group)*100) + (code))) |
Construct a status code value from a group and code number. More... | |
#define | MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix)) |
Construct the version number for drivers. More... | |
Min/max macros | |
#define | MIN(a, b) (((a) < (b)) ? (a) : (b)) |
#define | MAX(a, b) (((a) > (b)) ? (a) : (b)) |
#define | ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
Computes the number of elements in an array. More... | |
UINT16_MAX/UINT32_MAX value | |
#define | UINT16_MAX ((uint16_t)-1) |
#define | UINT32_MAX ((uint32_t)-1) |
Timer utilities | |
#define | USEC_TO_COUNT(us, clockFreqInHz) (uint64_t)(((uint64_t)(us) * (clockFreqInHz)) / 1000000U) |
#define | COUNT_TO_USEC(count, clockFreqInHz) (uint64_t)((uint64_t)(count) * 1000000U / (clockFreqInHz)) |
#define | MSEC_TO_COUNT(ms, clockFreqInHz) (uint64_t)((uint64_t)(ms) * (clockFreqInHz) / 1000U) |
#define | COUNT_TO_MSEC(count, clockFreqInHz) (uint64_t)((uint64_t)(count) * 1000U / (clockFreqInHz)) |
ISR exit barrier | |
ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping exception return operation might vector to incorrect interrupt. For Cortex-M7, if core speed much faster than peripheral register write speed, the peripheral interrupt flags may be still set after exiting ISR, this results to the same error similar with errata 83869. | |
#define | SDK_ISR_EXIT_BARRIER |
Alignment variable definition macros | |
#define | SDK_ALIGN(var, alignbytes) var |
#define | SDK_SIZEALIGN(var, alignbytes) ((unsigned int)((var) + ((alignbytes)-1U)) & (unsigned int)(~(unsigned int)((alignbytes)-1U))) |
Non-cacheable region definition macros | |
#define | AT_NONCACHEABLE_SECTION(var) var |
#define | AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) var |
#define | AT_NONCACHEABLE_SECTION_INIT(var) var |
#define | AT_NONCACHEABLE_SECTION_ALIGN_INIT(var, alignbytes) var |
Suppress fallthrough warning macro | |
static status_t | EnableIRQ (IRQn_Type interrupt) |
Enable specific interrupt. More... | |
static status_t | DisableIRQ (IRQn_Type interrupt) |
Disable specific interrupt. More... | |
static uint32_t | DisableGlobalIRQ (void) |
Disable the global IRQ. More... | |
static void | EnableGlobalIRQ (uint32_t primask) |
Enable the global IRQ. More... | |
void * | SDK_Malloc (size_t size, size_t alignbytes) |
Allocate memory with given alignment and aligned size. More... | |
void | SDK_Free (void *ptr) |
Free memory. More... | |
void | SDK_DelayAtLeastUs (uint32_t delay_us, uint32_t coreClock_Hz) |
Delay at least for some time. Please note that, this API uses while loop for delay, different run-time environments make the time not precise, if precise delay count was needed, please implement a new delay function with hardware timer. More... | |
#define | SUPPRESS_FALL_THROUGH_WARNING() |
#define ARRAY_SIZE | ( | x | ) | (sizeof(x) / sizeof((x)[0])) |
Computes the number of elements in an array.
Definition at line 211 of file fsl_common.h.
#define AT_NONCACHEABLE_SECTION | ( | var | ) | var |
Definition at line 378 of file fsl_common.h.
#define AT_NONCACHEABLE_SECTION_ALIGN | ( | var, | |
alignbytes | |||
) | var |
Definition at line 379 of file fsl_common.h.
#define AT_NONCACHEABLE_SECTION_ALIGN_INIT | ( | var, | |
alignbytes | |||
) | var |
Definition at line 381 of file fsl_common.h.
#define AT_NONCACHEABLE_SECTION_INIT | ( | var | ) | var |
Definition at line 380 of file fsl_common.h.
#define COUNT_TO_MSEC | ( | count, | |
clockFreqInHz | |||
) | (uint64_t)((uint64_t)(count) * 1000U / (clockFreqInHz)) |
Macro to convert a raw count value to millisecond
Definition at line 235 of file fsl_common.h.
#define COUNT_TO_USEC | ( | count, | |
clockFreqInHz | |||
) | (uint64_t)((uint64_t)(count) * 1000000U / (clockFreqInHz)) |
Macro to convert a raw count value to microsecond
Definition at line 230 of file fsl_common.h.
#define DEBUG_CONSOLE_DEVICE_TYPE_FLEXCOMM 5U |
Debug console based on FLEXCOMM.
Definition at line 60 of file fsl_common.h.
#define DEBUG_CONSOLE_DEVICE_TYPE_IUART 6U |
Debug console based on i.MX UART.
Definition at line 61 of file fsl_common.h.
#define DEBUG_CONSOLE_DEVICE_TYPE_LPSCI 3U |
Debug console based on LPSCI.
Definition at line 58 of file fsl_common.h.
#define DEBUG_CONSOLE_DEVICE_TYPE_LPUART 2U |
Debug console based on LPUART.
Definition at line 57 of file fsl_common.h.
#define DEBUG_CONSOLE_DEVICE_TYPE_MINI_USART 8U |
Debug console based on LPC_USART.
Definition at line 63 of file fsl_common.h.
#define DEBUG_CONSOLE_DEVICE_TYPE_NONE 0U |
No debug console.
Definition at line 55 of file fsl_common.h.
#define DEBUG_CONSOLE_DEVICE_TYPE_SWO 9U |
Debug console based on SWO.
Definition at line 64 of file fsl_common.h.
#define DEBUG_CONSOLE_DEVICE_TYPE_UART 1U |
Debug console based on UART.
Definition at line 56 of file fsl_common.h.
#define DEBUG_CONSOLE_DEVICE_TYPE_USBCDC 4U |
Debug console based on USBCDC.
Definition at line 59 of file fsl_common.h.
#define DEBUG_CONSOLE_DEVICE_TYPE_VUSART 7U |
Debug console based on LPC_VUSART.
Definition at line 62 of file fsl_common.h.
#define FSL_COMMON_DRIVER_VERSION (MAKE_VERSION(2, 2, 4)) |
common driver version 2.2.4.
Definition at line 51 of file fsl_common.h.
#define FSL_DRIVER_TRANSFER_DOUBLE_WEAK_IRQ 1 |
Definition at line 195 of file fsl_common.h.
#define MAKE_STATUS | ( | group, | |
code | |||
) | ((((group)*100) + (code))) |
Construct a status code value from a group and code number.
Definition at line 43 of file fsl_common.h.
#define MAKE_VERSION | ( | major, | |
minor, | |||
bugfix | |||
) | (((major) << 16) | ((minor) << 8) | (bugfix)) |
Construct the version number for drivers.
Definition at line 46 of file fsl_common.h.
#define MAX | ( | a, | |
b | |||
) | (((a) > (b)) ? (a) : (b)) |
Definition at line 205 of file fsl_common.h.
#define MIN | ( | a, | |
b | |||
) | (((a) < (b)) ? (a) : (b)) |
Definition at line 201 of file fsl_common.h.
#define MSEC_TO_COUNT | ( | ms, | |
clockFreqInHz | |||
) | (uint64_t)((uint64_t)(ms) * (clockFreqInHz) / 1000U) |
Macro to convert a millisecond period to raw count value
Definition at line 233 of file fsl_common.h.
#define SDK_ALIGN | ( | var, | |
alignbytes | |||
) | var |
Definition at line 299 of file fsl_common.h.
#define SDK_ISR_EXIT_BARRIER |
Definition at line 250 of file fsl_common.h.
#define SDK_SIZEALIGN | ( | var, | |
alignbytes | |||
) | ((unsigned int)((var) + ((alignbytes)-1U)) & (unsigned int)(~(unsigned int)((alignbytes)-1U))) |
Macro to change a value to a given size aligned value
Definition at line 309 of file fsl_common.h.
#define SUPPRESS_FALL_THROUGH_WARNING | ( | ) |
Definition at line 438 of file fsl_common.h.
#define UINT16_MAX ((uint16_t)-1) |
Definition at line 217 of file fsl_common.h.
#define UINT32_MAX ((uint32_t)-1) |
Definition at line 221 of file fsl_common.h.
#define USEC_TO_COUNT | ( | us, | |
clockFreqInHz | |||
) | (uint64_t)(((uint64_t)(us) * (clockFreqInHz)) / 1000000U) |
Macro to convert a microsecond period to raw count value
Definition at line 228 of file fsl_common.h.
typedef int32_t status_t |
Type used for all status and error return values.
Definition at line 189 of file fsl_common.h.
anonymous enum |
Generic status return codes.
Definition at line 177 of file fsl_common.h.
enum _status_groups |
Status group numbers.
Definition at line 67 of file fsl_common.h.
|
inlinestatic |
Disable the global IRQ.
Disable the global interrupt and return the current primask register. User is required to provided the primask register for the EnableGlobalIRQ().
Definition at line 552 of file fsl_common.h.
Disable specific interrupt.
Disable LEVEL1 interrupt. For some devices, there might be multiple interrupt levels. For example, there are NVIC and intmux. Here the interrupts connected to NVIC are the LEVEL1 interrupts, because they are routed to the core directly. The interrupts connected to intmux are the LEVEL2 interrupts, they are routed to NVIC first then routed to core.
This function only disables the LEVEL1 interrupts. The number of LEVEL1 interrupts is indicated by the feature macro FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS.
interrupt | The IRQ number. |
kStatus_Success | Interrupt disabled successfully |
kStatus_Fail | Failed to disable the interrupt |
Definition at line 522 of file fsl_common.h.
|
inlinestatic |
Enable the global IRQ.
Set the primask register with the provided primask value but not just enable the primask. The idea is for the convenience of integration of RTOS. some RTOS get its own management mechanism of primask. User is required to use the EnableGlobalIRQ() and DisableGlobalIRQ() in pair.
primask | value of primask register to be restored. The primask value is supposed to be provided by the DisableGlobalIRQ(). |
Definition at line 583 of file fsl_common.h.
Enable specific interrupt.
Enable LEVEL1 interrupt. For some devices, there might be multiple interrupt levels. For example, there are NVIC and intmux. Here the interrupts connected to NVIC are the LEVEL1 interrupts, because they are routed to the core directly. The interrupts connected to intmux are the LEVEL2 interrupts, they are routed to NVIC first then routed to core.
This function only enables the LEVEL1 interrupts. The number of LEVEL1 interrupts is indicated by the feature macro FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS.
interrupt | The IRQ number. |
kStatus_Success | Interrupt enabled successfully |
kStatus_Fail | Failed to enable the interrupt |
Definition at line 484 of file fsl_common.h.
void SDK_DelayAtLeastUs | ( | uint32_t | delay_us, |
uint32_t | coreClock_Hz | ||
) |
Delay at least for some time. Please note that, this API uses while loop for delay, different run-time environments make the time not precise, if precise delay count was needed, please implement a new delay function with hardware timer.
delay_us | Delay time in unit of microsecond. |
coreClock_Hz | Core clock frequency with Hz. |
Delay at least for some time. Please note that, this API uses while loop for delay, different run-time environments make the time not precise, if precise delay count was needed, please implement a new delay function with hardware timer.
count | Counts of loop needed for dalay. |
Delay at least for some time. Please note that, if not uses DWT, this API will use while loop for delay, different run-time environments have effect on the delay time. If precise delay is needed, please enable DWT delay. The two parmeters delay_us and coreClock_Hz have limitation. For example, in the platform with 1GHz coreClock_Hz, the delay_us only supports up to 4294967 in current code. If long time delay is needed, please implement a new delay function.
delay_us | Delay time in unit of microsecond. |
coreClock_Hz | Core clock frequency with Hz. |
Definition at line 241 of file fsl_common.c.
void SDK_Free | ( | void * | ptr | ) |
void* SDK_Malloc | ( | size_t | size, |
size_t | alignbytes | ||
) |
Allocate memory with given alignment and aligned size.
This is provided to support the dynamically allocated memory used in cache-able region.
size | The length required to malloc. |
alignbytes | The alignment size. |
The | allocated memory. |
Definition at line 111 of file fsl_common.c.