home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / std / c / 2363 < prev    next >
Encoding:
Text File  |  1992-07-25  |  1.0 KB  |  34 lines

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!haven.umd.edu!news.umbc.edu!gmuvax2!kbass
  3. From: kbass@gmuvax2.gmu.edu (Ken Bass)
  4. Subject: Help with bit and byte addressable bitfields
  5. Message-ID: <1992Jul26.043900.7020@gmuvax2.gmu.edu>
  6. Organization: George Mason University, Fairfax, Va.
  7. Distribution: na
  8. Date: Sun, 26 Jul 1992 04:39:00 GMT
  9. Lines: 23
  10.  
  11. I'd like to know your suggestions on how to define and access a bitfield
  12. that is both bit and byte addressable. The application is to maintain a
  13. ram image in a memory mapped i/o system.
  14.  
  15. Lets say we have WidgetRamImg of type WidgetRamImgDef where
  16.  
  17. typedef struct {
  18.    unsigned int bit0;
  19.          ...
  20.    unsigned int bit32;
  21. } WidgetRamImgDef;
  22.  
  23. WidgetRamImgDef WidgetRamImg;
  24.  
  25. I'd like to say WidgetRamImg=0x0; at init time, but the type is wrong.
  26. Casting to WidgetRamImgDef does not work either.
  27.  
  28. Any suggestions?
  29.  
  30. -- 
  31. Ken Bass (kbass@gmuvax2.gmu.edu)              |   Telecommunications  
  32. George Mason University                       |   Techniques Corp, 
  33. Student, Department of Electrical Engineering |   Software Engineer 
  34.