#include <types.h>


Go to the source code of this file.
Defines | |
| #define | xstr(s) str(s) |
| Stringify the result after expansion of a macro argument. | |
| #define | str(s) #s |
| Stringify a macro argument without expansion. | |
| #define | ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0])) |
| Get the number of elements in array a. | |
| #define | container_of(ptr, type, member) ((type *)((unsigned long)(ptr) - offsetof(type, member))) |
| Get the containing object. | |
| #define | div_ceil(a, b) (((a) + (b) - 1) / (b)) |
Calculate using integer arithmetic. | |
Functions | |
| static int | isdigit (int c) |
| Determine whether or not the character c is a digit. | |
| static int | iscntrl (int c) |
| Determine whether or not the character c is a control character. | |
| static int | isspace (int c) |
| Determine whether or not the character c is a space. | |
| int | ilog2_undefined (void) |
| static int | ilog2 (unsigned int x) |
| Calculate the base-2 logarithm of a number rounded down to the nearest integer. | |
| static bool | is_power_of_two (unsigned long x) |
| Test if a given value is a power of two. | |
| static unsigned long | round_down (unsigned long x, unsigned int order) |
| Round down to the nearest power of two boundary. | |
| static unsigned long | round_up (unsigned long x, unsigned int order) |
| Round up to the nearest power of two boundary. | |
| static unsigned long | word_align (unsigned long x) |
| Round up to the nearest word-aligned boundary. | |
Definition in file util.h.
| #define ARRAY_LEN | ( | a | ) | (sizeof(a) / sizeof((a)[0])) |
Get the number of elements in array a.
Definition at line 59 of file util.h.
Referenced by softirq_priv_do_pending(), and softirq_set_handler().
| #define container_of | ( | ptr, | |||
| type, | |||||
| member | ) | ((type *)((unsigned long)(ptr) - offsetof(type, member))) |
Get the containing object.
| ptr | Pointer to the contained object. | |
| type | Type of the containing object. | |
| member | Member name of the contained object inside the containing object. |
Definition at line 111 of file util.h.
Referenced by pdca_channel_of(), and sdmmc_card_get_slot().
| #define div_ceil | ( | a, | |||
| b | ) | (((a) + (b) - 1) / (b)) |
| #define str | ( | s | ) | #s |
| #define xstr | ( | s | ) | str(s) |
| static int ilog2 | ( | unsigned int | x | ) | [inline, static] |
Calculate the base-2 logarithm of a number rounded down to the nearest integer.
| x | A 32-bit value |
Definition at line 128 of file util.h.
References count_leading_zeroes, ilog2_undefined(), and is_constant.
Referenced by usbb_udc_configure_ep(), and watchdog_set_timeout().

| int ilog2_undefined | ( | void | ) |
| static bool is_power_of_two | ( | unsigned long | x | ) | [inline, static] |
| static int iscntrl | ( | int | c | ) | [inline, static] |
| static int isdigit | ( | int | c | ) | [inline, static] |
Determine whether or not the character c is a digit.
| c | The character to consider. |
| 0 | The character c is not a digit. | |
| 1 | The character c is a digit. |
Definition at line 68 of file util.h.
Referenced by console_vprintf().
| static int isspace | ( | int | c | ) | [inline, static] |
Determine whether or not the character c is a space.
| c | The character to consider. |
| 0 | The character c is not a space. | |
| 1 | The character c is a space. |
| static unsigned long round_down | ( | unsigned long | x, | |
| unsigned int | order | |||
| ) | [inline, static] |
Round down to the nearest power of two boundary.
| x | A positive integer | |
| order | log2 of the required boundary. |
Definition at line 186 of file util.h.
Referenced by physmem_alloc(), and round_up().
| static unsigned long round_up | ( | unsigned long | x, | |
| unsigned int | order | |||
| ) | [inline, static] |
Round up to the nearest power of two boundary.
| x | A positive integer | |
| order | log2 of the required boundary. |
Definition at line 198 of file util.h.
References round_down().
Referenced by dma_pool_init_coherent_physmem(), mem_pool_init(), mem_pool_init_physmem(), physmem_alloc_low(), and word_align().

| static unsigned long word_align | ( | unsigned long | x | ) | [inline, static] |
Round up to the nearest word-aligned boundary.
| x | Address or offset to be word-aligned |
Definition at line 209 of file util.h.
References round_up().

1.5.8