librfn
An ad-hoc utility library
Data Structures | Macros | Typedefs | Functions
Register dump

Symbolic register dump routines. More...

Data Structures

struct  regdump_desc
 Register description structure. More...
 

Macros

#define PRIxreg   PRIx32
 
#define REGDUMP_STATE_VAR_INIT   0
 Static initializer for re-entrancy state variable. More...
 

Typedefs

typedef uint32_t uintreg_t
 
typedef struct regdump_desc regdump_desc_t
 Register description structure. More...
 

Functions

int fregdump_single (FILE *f, uintreg_t reg, const regdump_desc_t *desc, int *state)
 Dump single line of register output to file. More...
 
void fregdump (FILE *f, uintreg_t reg, const regdump_desc_t *desc)
 Dump the current register status to file. More...
 
int regdump_single (uintreg_t reg, const regdump_desc_t *desc, int *state)
 Dump single line of register output to stdout. More...
 
void regdump (uintreg_t reg, const regdump_desc_t *desc)
 Dump the current register status to stdout. More...
 

Detailed Description

Symbolic register dump routines.

Macro Definition Documentation

#define PRIxreg   PRIx32

Definition at line 34 of file regdump.h.

#define REGDUMP_STATE_VAR_INIT   0

Static initializer for re-entrancy state variable.

Definition at line 63 of file regdump.h.

Typedef Documentation

typedef struct regdump_desc regdump_desc_t

Register description structure.

The following example shows a simple UART RX register combining the received character with some flags:

1 static const regdump_desc_t uart_rx_desc = {
2  { "UART_RX" },
3  { "CH", 0x00ff },
4  { "FRM", 0x2000 },
5  { "OVF", 0x4000 },
6  { "BRK", 0x8000 }
7 };
8 
9 regdump(UART_RX(UART0), &uart_rx_desc);
typedef uint32_t uintreg_t

Definition at line 33 of file regdump.h.

Function Documentation

void fregdump ( FILE *  f,
uintreg_t  reg,
const regdump_desc_t desc 
)

Dump the current register status to file.

Definition at line 38 of file regdump.c.

int fregdump_single ( FILE *  f,
uintreg_t  reg,
const regdump_desc_t desc,
int *  state 
)

Dump single line of register output to file.

This function works a line at a time and returns to the caller between each line. It is only useful with run-to-completion schedulers as a means to boost responsiveness.

Returns
Zero if the register dump is complete, non-zero otherwise.

Definition at line 19 of file regdump.c.

void regdump ( uintreg_t  reg,
const regdump_desc_t desc 
)

Dump the current register status to stdout.

Definition at line 50 of file regdump.c.

int regdump_single ( uintreg_t  reg,
const regdump_desc_t desc,
int *  state 
)

Dump single line of register output to stdout.

See also
fregdump_single()
Returns
Zero if the register dump is complete, non-zero otherwise.

Definition at line 45 of file regdump.c.