regview32.c.html 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. regview32.c
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='ReadRules.c.html' title=' ReadRules.c '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='RemoteDeviceList1.c.html' title=' RemoteDeviceList1.c '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * void regview32 (void const * memory, size_t offset, size_t length, FILE *fp);
  24. *
  25. * memory.h
  26. *
  27. * print memory as a binary dump showing absolute memory offsets
  28. * and 32-bit binary register maps; sample output looks like:
  29. *
  30. * REGISTER CONTENTS 31----24 23----16 15----08 07----00
  31. *
  32. * 00183000 00000F7F 00000000-00000000-00001111-01111111
  33. * 00183004 00000A00 00000000-00000000-00001010-00000000
  34. * 00183008 00000FF8 00000000-00000000-00001111-11111000
  35. * 0018300C 00000000 00000000-00000000-00000000-00000000
  36. * 00183010 00000075 00000000-00000000-00000000-01110101
  37. *
  38. * the header line shown above is not part of the output;
  39. *
  40. * Motley Tools by Charles Maier &lt;cmaier@cmassoc.net&gt;;
  41. * Copyright (c) 2001-2006 by Charles Maier Associates;
  42. * Licensed under the Internet Software Consortium License;
  43. *
  44. *--------------------------------------------------------------------*/
  45. #ifndef REGVIEW_SOURCE
  46. #define REGVIEW_SOURCE
  47. #include &lt;stdio.h&gt;
  48. #include &quot;../tools/memory.h&quot;
  49. #include &quot;../tools/endian.h&quot;
  50. void regview32 (void const * memory, size_t offset, size_t extent, FILE *fp)
  51. {
  52. uint32_t * origin = (uint32_t *)(memory);
  53. while (extent &gt;= sizeof (* origin))
  54. {
  55. signed bit = sizeof (* origin) &lt;&lt; 3;
  56. printf (&quot;%08X &quot;, (uint32_t)(offset));
  57. printf (&quot;%08X &quot;, LE32TOH (* origin));
  58. while (bit--)
  59. {
  60. putc (((LE32TOH (* origin) &gt;&gt; bit) &amp; 1)? '1': '0', fp);
  61. if ((bit) &amp;&amp; !(bit%8))
  62. {
  63. putc ('-', fp);
  64. }
  65. }
  66. putc ('\n', fp);
  67. offset += sizeof (* origin);
  68. extent -= sizeof (* origin);
  69. origin++;
  70. }
  71. return;
  72. }
  73. #endif
  74. </pre>
  75. <div class='footerlink'>
  76. [<a href='ReadRules.c.html' title=' ReadRules.c '>PREV</a>]
  77. [<a href='toolkit.html' title=' Index '>HOME</a>]
  78. [<a href='RemoteDeviceList1.c.html' title=' RemoteDeviceList1.c '>NEXT</a>]
  79. </div>
  80. </body>
  81. </html>