next up previous
Next: HDMC Bitfield Access (3) Up: l1joint_0330_hdmc Previous: HDMC Bitfield Access (1)

HDMC Bitfield Access (2)



Likely Implementation

class MyReg : public Register {
public:
  static const int ItemOne = 0x0;
  static const int ItemTwo = 0x1;
  static const int ItemThree = 0x3;

  int FourBitField (int value) {
    int regval = Register::read();    // Or use cached value?
    int oldval = (regval >> 1) & 0xF;
    regval &= (~0xF) >> 1;
    regval |= (value & 0xF) >> 1;
    Register::write (regval);         // Or caller does this?
    return oldval;
  }
}



Murrough Landon (m.p.j.landon@qmw.ac.uk)