COMMON driver APIs. More...
Macros | |
| #define | ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
| #define | MAX(a, b) ((a) > (b) ? (a) : (b)) |
| #define | MIN(a, b) ((a) < (b) ? (a) : (b)) |
| #define | HPM_ALIGN_DOWN(a, n) ((uint32_t)(a) & ~(n-1U)) |
| #define | HPM_ALIGN_UP(a, n) (((uint32_t)(a) + (n-1U)) & ~(n-1U)) |
| #define | HPM_BITSMASK(val, offset) ((uint32_t)(val) << (offset)) |
| #define | IS_HPM_BITMASK_SET(val, mask) (((uint32_t)(val) & (uint32_t)(mask)) != 0U) |
| #define | IS_HPM_BIT_SET(val, offset) (((uint32_t)(val) & (1UL << (offset))) != 0U) |
| #define | IS_HPM_BITMASK_CLR(val, mask) (((uint32_t)(val) & (uint32_t)(mask)) == 0U) |
| #define | IS_HPM_BIT_CLR(val, offset) (((uint32_t)(val) & (1UL << (offset))) == 0U) |
| #define | HPM_BREAK_IF(cond) if (cond) { break; } |
| #define | HPM_CONTINUE_IF(cond) if (cond) { continue; } |
| #define | HPM_DIV_ROUND_CLOSEST(x, div) (((x) + (div) / 2) / (div)) |
| #define | HPM_DIV_ROUND_UP(x, div) (((x) + (div) - 1) / (div)) |
| #define | HPM_NUM_TO_EVEN_CEILING(x) ((x + 1) & 0xFFFFFFFEUL) |
| #define | HPM_NUM_TO_EVEN_FLOOR(x) ((x) & 0xFFFFFFFEUL) |
| #define | HPM_CHECK_RET(x) |
| #define | HPM_STRINGIFY(x) _HPM_STRINGIFY(x) |
| #define | SIZE_1KB (1024UL) |
| #define | SIZE_1MB (1048576UL) |
| #define | BIT0_MASK (0x00000001UL) |
| #define | BIT1_MASK (0x00000002UL) |
| #define | BIT2_MASK (0x00000004UL) |
| #define | BIT3_MASK (0x00000008UL) |
| #define | BIT4_MASK (0x00000010UL) |
| #define | BIT5_MASK (0x00000020UL) |
| #define | BIT6_MASK (0x00000040UL) |
| #define | BIT7_MASK (0x00000080UL) |
| #define | BIT8_MASK (0x00000100UL) |
| #define | BIT9_MASK (0x00000200UL) |
| #define | BIT10_MASK (0x00000400UL) |
| #define | BIT11_MASK (0x00000800UL) |
| #define | BIT12_MASK (0x00001000UL) |
| #define | BIT13_MASK (0x00002000UL) |
| #define | BIT14_MASK (0x00004000UL) |
| #define | BIT15_MASK (0x00008000UL) |
| #define | BIT16_MASK (0x00010000UL) |
| #define | BIT17_MASK (0x00020000UL) |
| #define | BIT18_MASK (0x00040000UL) |
| #define | BIT19_MASK (0x00080000UL) |
| #define | BIT20_MASK (0x00100000UL) |
| #define | BIT21_MASK (0x00200000UL) |
| #define | BIT22_MASK (0x00400000UL) |
| #define | BIT23_MASK (0x00800000UL) |
| #define | BIT24_MASK (0x01000000UL) |
| #define | BIT25_MASK (0x02000000UL) |
| #define | BIT26_MASK (0x04000000UL) |
| #define | BIT27_MASK (0x08000000UL) |
| #define | BIT28_MASK (0x10000000UL) |
| #define | BIT29_MASK (0x20000000UL) |
| #define | BIT30_MASK (0x40000000UL) |
| #define | BIT31_MASK (0x80000000UL) |
| #define | HPM_PI (3.14159265358979323846) |
| #define | HPM_2_PI (6.28318530717958647692) |
| #define | HPM_HALF_PI (1.57079632679489661923) |
| #define | MAKE_STATUS(group, code) ((uint32_t)(group)*1000U + (uint32_t)(code)) |
Typedefs | |
| typedef uint32_t | hpm_stat_t |
Functions | |
| static uint32_t | count_set_bits (uint32_t value) |
| Count bits set to 1. More... | |
| static uint32_t | get_first_set_bit_from_lsb (uint32_t value) |
| Count bits set to 1 from least significant bit. More... | |
| static uint32_t | get_first_set_bit_from_msb (uint32_t value) |
| Count bits set to 1 from most significant bit. More... | |
| static uint32_t | hpm_convert_ticks_to_us (uint32_t ticks, uint32_t src_clk_freq) |
| Convert the elapsed ticks to microseconds according to the source clock frequency. More... | |
| static uint32_t | hpm_convert_ticks_to_ms (uint32_t ticks, uint32_t src_clk_freq) |
| Convert the elapsed ticks to milliseconds according to the source clock frequency. More... | |
COMMON driver APIs.
| #define ARRAY_SIZE | ( | a | ) | (sizeof(a) / sizeof((a)[0])) |
#include <drivers/inc/hpm_common.h>
| #define BIT0_MASK (0x00000001UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT10_MASK (0x00000400UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT11_MASK (0x00000800UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT12_MASK (0x00001000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT13_MASK (0x00002000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT14_MASK (0x00004000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT15_MASK (0x00008000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT16_MASK (0x00010000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT17_MASK (0x00020000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT18_MASK (0x00040000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT19_MASK (0x00080000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT1_MASK (0x00000002UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT20_MASK (0x00100000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT21_MASK (0x00200000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT22_MASK (0x00400000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT23_MASK (0x00800000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT24_MASK (0x01000000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT25_MASK (0x02000000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT26_MASK (0x04000000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT27_MASK (0x08000000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT28_MASK (0x10000000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT29_MASK (0x20000000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT2_MASK (0x00000004UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT30_MASK (0x40000000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT31_MASK (0x80000000UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT3_MASK (0x00000008UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT4_MASK (0x00000010UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT5_MASK (0x00000020UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT6_MASK (0x00000040UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT7_MASK (0x00000080UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT8_MASK (0x00000100UL) |
#include <drivers/inc/hpm_common.h>
| #define BIT9_MASK (0x00000200UL) |
#include <drivers/inc/hpm_common.h>
| #define HPM_2_PI (6.28318530717958647692) |
#include <drivers/inc/hpm_common.h>
| #define HPM_ALIGN_DOWN | ( | a, | |
| n | |||
| ) | ((uint32_t)(a) & ~(n-1U)) |
#include <drivers/inc/hpm_common.h>
| #define HPM_ALIGN_UP | ( | a, | |
| n | |||
| ) | (((uint32_t)(a) + (n-1U)) & ~(n-1U)) |
#include <drivers/inc/hpm_common.h>
| #define HPM_BITSMASK | ( | val, | |
| offset | |||
| ) | ((uint32_t)(val) << (offset)) |
#include <drivers/inc/hpm_common.h>
| #define HPM_BREAK_IF | ( | cond | ) | if (cond) { break; } |
#include <drivers/inc/hpm_common.h>
| #define HPM_CHECK_RET | ( | x | ) |
#include <drivers/inc/hpm_common.h>
| #define HPM_CONTINUE_IF | ( | cond | ) | if (cond) { continue; } |
#include <drivers/inc/hpm_common.h>
| #define HPM_DIV_ROUND_CLOSEST | ( | x, | |
| div | |||
| ) | (((x) + (div) / 2) / (div)) |
#include <drivers/inc/hpm_common.h>
| #define HPM_DIV_ROUND_UP | ( | x, | |
| div | |||
| ) | (((x) + (div) - 1) / (div)) |
#include <drivers/inc/hpm_common.h>
| #define HPM_HALF_PI (1.57079632679489661923) |
#include <drivers/inc/hpm_common.h>
| #define HPM_NUM_TO_EVEN_CEILING | ( | x | ) | ((x + 1) & 0xFFFFFFFEUL) |
#include <drivers/inc/hpm_common.h>
| #define HPM_NUM_TO_EVEN_FLOOR | ( | x | ) | ((x) & 0xFFFFFFFEUL) |
#include <drivers/inc/hpm_common.h>
| #define HPM_PI (3.14159265358979323846) |
#include <drivers/inc/hpm_common.h>
| #define HPM_STRINGIFY | ( | x | ) | _HPM_STRINGIFY(x) |
#include <drivers/inc/hpm_common.h>
| #define IS_HPM_BIT_CLR | ( | val, | |
| offset | |||
| ) | (((uint32_t)(val) & (1UL << (offset))) == 0U) |
#include <drivers/inc/hpm_common.h>
| #define IS_HPM_BIT_SET | ( | val, | |
| offset | |||
| ) | (((uint32_t)(val) & (1UL << (offset))) != 0U) |
#include <drivers/inc/hpm_common.h>
| #define IS_HPM_BITMASK_CLR | ( | val, | |
| mask | |||
| ) | (((uint32_t)(val) & (uint32_t)(mask)) == 0U) |
#include <drivers/inc/hpm_common.h>
| #define IS_HPM_BITMASK_SET | ( | val, | |
| mask | |||
| ) | (((uint32_t)(val) & (uint32_t)(mask)) != 0U) |
#include <drivers/inc/hpm_common.h>
| #define MAKE_STATUS | ( | group, | |
| code | |||
| ) | ((uint32_t)(group)*1000U + (uint32_t)(code)) |
#include <drivers/inc/hpm_common.h>
| #define MAX | ( | a, | |
| b | |||
| ) | ((a) > (b) ? (a) : (b)) |
#include <drivers/inc/hpm_common.h>
| #define MIN | ( | a, | |
| b | |||
| ) | ((a) < (b) ? (a) : (b)) |
#include <drivers/inc/hpm_common.h>
| #define SIZE_1KB (1024UL) |
#include <drivers/inc/hpm_common.h>
| #define SIZE_1MB (1048576UL) |
#include <drivers/inc/hpm_common.h>
| typedef uint32_t hpm_stat_t |
#include <drivers/inc/hpm_common.h>
| anonymous enum |
#include <drivers/inc/hpm_common.h>
| anonymous enum |
#include <drivers/inc/hpm_common.h>
| Enumerator | |
|---|---|
| status_success | |
| status_fail | |
| status_invalid_argument | |
| status_timeout | |
|
inlinestatic |
#include <drivers/inc/hpm_common.h>
Count bits set to 1.
| value | Data to be counted |
|
inlinestatic |
#include <drivers/inc/hpm_common.h>
Count bits set to 1 from least significant bit.
| value | Data to be counted |
|
inlinestatic |
#include <drivers/inc/hpm_common.h>
Count bits set to 1 from most significant bit.
| value | Data to be counted |
|
inlinestatic |
#include <drivers/inc/hpm_common.h>
Convert the elapsed ticks to milliseconds according to the source clock frequency.
| [in] | ticks | elapsed ticks |
| [in] | src_clk_freq | The Frequency of the source |
|
inlinestatic |
#include <drivers/inc/hpm_common.h>
Convert the elapsed ticks to microseconds according to the source clock frequency.
| [in] | ticks | elapsed ticks |
| [in] | src_clk_freq | The Frequency of the source |