rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
|
Useful macro to use for debuggin purpose. More...
Macros | |
#define | RFLPC_DELAY(c) |
wait until a counter reaches c. More... | |
#define | RFLPC_DELAY_MICROSECS(c) RFLPC_DELAY(32*(c)) |
Wait c micro seconds. More... | |
#define | RFLPC_STOP(l, c) |
Stops execution by an infinite loop, switching between led pattern l and its opposite. More... | |
#define | RFLPC_ARM_GET_REGISTER(reg, var) |
Stores the content of a register in var. More... | |
#define | RFLPC_DUMP_STACK() |
Dumps 64 bytes from the current value of the stack pointer. More... | |
#define | RFLPC_ASSERT(cond) do { if (!(cond)) { RFLPC_STOP(0, 50000); } } while (0) |
Asserts a condition. More... | |
#define | RFLPC_ADDR_IN(addr, inf, sup) ( ((void*)(addr)) >= ((void*)(inf)) ? (((void*)(addr)) < ((void*)(sup))) : 0) |
True if addr in [inf..sup[. | |
#define | RFLPC_PROFILE_PRESCALE (rflpc_clock_get_system_clock() / 1000000) |
This holds the value of the prescale counter that will be used for time measurement. More... | |
#define | RFLPC_PROFILE_INIT(timer) do {rflpc_timer_enable(timer); rflpc_timer_set_clock(timer, RFLPC_CCLK); rflpc_timer_set_pre_scale_register(timer,RFLPC_PROFILE_PRESCALE); rflpc_timer_start(timer); } while(0) |
Inits a given timer so that it can be used for profiling. More... | |
#define | RFLPC_PROFILE_DECLARE_COUNTER(counter) volatile uint32_t rflpc_profile_total_##counter; volatile uint32_t rflpc_profile_start_##counter; |
Declares the needed global variables for profiling. More... | |
#define | RFLPC_PROFILE_DECLARE_EXTERN_COUNTER(counter) extern volatile uint32_t rflpc_profile_total_##counter;extern volatile uint32_t rflpc_profile_start_##counter; |
Declare the needed global variables for profiling as externs. More... | |
#define | RFLPC_PROFILE_START_COUNTER(counter, timer) do { rflpc_profile_start_##counter = rflpc_timer_get_counter(timer);} while(0) |
Starts a given counter, storing the current time of the given timer. | |
#define | RFLPC_PROFILE_STOP_COUNTER(counter, timer) do { rflpc_profile_total_##counter += rflpc_timer_get_counter(timer) - rflpc_profile_start_##counter;} while(0) |
Stops a given counter, adding the elapsed time since its start to the global counter. | |
#define | RFLPC_PROFILE_GET_TOTAL(counter) rflpc_profile_total_##counter |
Gets the global counter value. More... | |
Useful macro to use for debuggin purpose.
#define RFLPC_ARM_GET_REGISTER | ( | reg, | |
var | |||
) |
#define RFLPC_ASSERT | ( | cond | ) | do { if (!(cond)) { RFLPC_STOP(0, 50000); } } while (0) |
#define RFLPC_DELAY | ( | c | ) |
wait until a counter reaches c.
Used to wait some time. Each loop step needs 3 clock cycle to execute. At 96Mhz, a delay of 32 loops is 1 microseconds.
#define RFLPC_DELAY_MICROSECS | ( | c | ) | RFLPC_DELAY(32*(c)) |
#define RFLPC_DUMP_STACK | ( | ) |
Dumps 64 bytes from the current value of the stack pointer.
#define RFLPC_PROFILE_DECLARE_COUNTER | ( | counter | ) | volatile uint32_t rflpc_profile_total_##counter; volatile uint32_t rflpc_profile_start_##counter; |
Declares the needed global variables for profiling.
This has to be used only once for each counter in your program and will define global variable to handle the counter
Definition at line 53 of file profiling.h.
#define RFLPC_PROFILE_DECLARE_EXTERN_COUNTER | ( | counter | ) | extern volatile uint32_t rflpc_profile_total_##counter;extern volatile uint32_t rflpc_profile_start_##counter; |
Declare the needed global variables for profiling as externs.
This can be used when using a counter in more than one C file.
Definition at line 58 of file profiling.h.
#define RFLPC_PROFILE_GET_TOTAL | ( | counter | ) | rflpc_profile_total_##counter |
Gets the global counter value.
It counts how much time have been spent between START and STOP calls
Definition at line 67 of file profiling.h.
#define RFLPC_PROFILE_INIT | ( | timer | ) | do {rflpc_timer_enable(timer); rflpc_timer_set_clock(timer, RFLPC_CCLK); rflpc_timer_set_pre_scale_register(timer,RFLPC_PROFILE_PRESCALE); rflpc_timer_start(timer); } while(0) |
Inits a given timer so that it can be used for profiling.
It will:
Definition at line 48 of file profiling.h.
#define RFLPC_PROFILE_PRESCALE (rflpc_clock_get_system_clock() / 1000000) |
This holds the value of the prescale counter that will be used for time measurement.
Define it if you wan't to use another value. By default, it is set so that a counter holds microseconds
Definition at line 38 of file profiling.h.
#define RFLPC_STOP | ( | l, | |
c | |||
) |
Stops execution by an infinite loop, switching between led pattern l and its opposite.