Visual tool for encoding/decoding registers

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi,

I'm really going insane using calc as my hex to binary tool, counting
bits with my cursor and cross-referencing that with the datasheet.
There must be some tool out there that displays this more elegantly.

For example, i define a simply set of bit fields:

status[0-3], reset[4], port[5-10], and so forth

and then i enter the register value and automatically get the decoded
bit field results. It could even go further and tell me what the
specific value means (status = 2, device failure, status = 3, device
ok, etc. from rules i predefine). I know automatic driver generators
(like Jungo's) probably has this but i'm looking for a free tool.

If that doesn't exist, what do you use to decode/encode your registers
?

TIA


Re: Visual tool for encoding/decoding registers
Quoted text here. Click to load it
Hello!

Quoted text here. Click to load it
For Power PC where MSB is called "bit 0" (in AMCC documentation) I use
  following macro (for 32-bit registers):
#define PPC_BIT_32(first, last, value) \
    ((last)<<(31-value))
so when I need to set value 0100b in bits 12-14 I write:
    out32(reg_addr, PPC_BIT_32(12, 14, 4);
Of course you have to remeber that this operation will set all
others bits to "0", and it isn't protected agains value overflow.

In your case you need macro which works in different direction, but
  it is easy to write.

--
Pawel Sklarow


Site Timeline