cancel
Showing results for 
Search instead for 
Did you mean: 

SRAM Bit banding

greg_t
Associate II
Posted on April 25, 2011 at 11:07

SRAM Bit banding

1 REPLY 1
Posted on May 17, 2011 at 14:32

The bits are lined up a word at a time at 0x22000000

0x22000000 byte 0, bit 0

0x22000004 byte 0, bit 1

..

0x22000020 byte 1, bit 0

0x22000024 byte 1, bit 1

#define RAM_BASE       0x20000000

#define RAM_BB_BASE    0x22000000

/* Private macro -------------------------------------------------------------*/

#define  Var_ResetBit_BB(VarAddr, BitNumber)    \

          (*(vu32 *) (RAM_BB_BASE | ((VarAddr - RAM_BASE) << 5) | ((BitNumber) << 2)) = 0)

#define Var_SetBit_BB(VarAddr, BitNumber)       \

          (*(vu32 *) (RAM_BB_BASE | ((VarAddr - RAM_BASE) << 5) | ((BitNumber) << 2)) = 1)

#define Var_GetBit_BB(VarAddr, BitNumber)       \

          (*(vu32 *) (RAM_BB_BASE | ((VarAddr - RAM_BASE) << 5) | ((BitNumber) << 2)))

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..