ROCK L0 library - rockbits


This module implements the field operations; this is the only part of the library to know where are the fields in a register.

The routines present in this module do not access the ROCK!
Normaly they are used in conjunction with the routines present in rockhard.

Directly should only be used in test applications.


Index:


Get a field

This routines extract a single field from a register value.

The general form of a get routine is:
Syntax:
#define rockb_get_<field>(nr)
Parameters:
IN: nr
register value
Returns:
field value
Note:
Be carefull to pass the value of the right register!

The routines are implemented as macros.

Follows the list of the routines, sorted by register:

Set a field

This routines set a single field in a register value.

The general form of a set routine is:
Syntax:
#define rockb_set_<field>(nr,val)
Parameters:
IN: nr
register value
IN: val
field value
Returns:
register value with the field modified
Note:
Be carefull to pass the value of the right register!

If val is out of range, an and is applied.

The routines are implemented as macros.

Follows the list of the routines, sorted by register:

Decode/encode a register

Sometimes there is a need to get or set more than just a field in a register.

The general form of a

decode routine
Decode the register value into a record of fields.

Syntax:
#define rockb_nr2<register>(nr, /* ROCKB_<REGISTER>_bits */ fields)
Parameters:
IN: nr
register value
OUT: fields
record of fields
Returns:
not defined
Note:
Be carefull to pass the value of the right register!

The routines are implemented as macros.

encode routine
Encode the record of fields to a register value.

Syntax:
#define rockb_<register>2nr(/* ROCKB_<REGISTER>_bits */ fields)
Parameters:
IN: fields
record of fields
Returns:
register value
Note:
The routines are implemented as macros.
Follows the list of encode/decode specific types and the list of encode/decode routines:

Decode/encode a page

Sometimes even the decode/encode of a sigle bit is not enough.

This routines uses types defined in rockhard:

The general form of a
page decode routine
Decode the record of registers into a record of fields.

Syntax:
#define rockb_regs2bits_<page>(/* ROCKH_<PAGE>_regs */ regs, /* ROCKB_PAGE_<PAGE>_bits */ fields)
Parameters:
IN: regs
record of registers
OUT: fields
record of fields
Returns:
not defined
Note:
The routines are implemented as macros.
page encode routine
Encode the record of fields to a record of registers.

Syntax:
#define rockb_bits2regs_<page>(/* ROCKB_PAGE_<PAGE>_bits */ fields, /* ROCKH_<PAGE>_regs */ regs)
Parameters:
IN: fields
record of fields
OUT: regs
record of registers
Returns:
not defined
Note:
The routines are implemented as macros.
Follows the list of page encode/decode specific types and the list of page encode/decode routines:

Examples

Follows 4 simple examples:
If you want something more complex, see the L1 module rock source code:

List of types and routines

Types:
Routines:
Top of the page. Rock library.
Send comments to: Igor Sfiligoi

Created:10.2.1997
Last modified:12.3.1997