<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Your C code seems to a bit convoluted
      if just want to access a register.  <br>
      This is quite often done by defining the registers as volatile
      pointers like this:<br>
      <br>
      Register address definitions (in this case for a UART):<br>
      <font face="Courier New, Courier, monospace">#define
        UART0_UDR      (*(volatile  uint8_t *)(0x44000000))<br>
        #define UART0_UCR      (*(volatile uint16_t *)(0x44000004))<br>
        #define UART0_UBRR     (*(volatile uint16_t *)(0x44000008))<br>
        <br>
      </font>You can then access registers like this (read UART data
      register):<br>
      <font face="Courier New, Courier, monospace">uint8_t c =
        UART0_UDR;<br>
      </font><br>
      Magnus<br>
      <br>
      On 7/29/2016 11:06 PM, Skulski, Wojciech wrote:<br>
    </div>
    <blockquote
cite="mid:CY1PR07MB22133DC439B74A075A3D631FFF020@CY1PR07MB2213.namprd07.prod.outlook.com"
      type="cite">
      <pre wrap="">Chris:

</pre>
      <blockquote type="cite">
        <pre wrap="">But Oberon variables are not mapped to registers that can be changed "from
the other end". The explicit operations SYSTEM.GET and SYSTEM.PUT are used
when you want to transfer data between a peripheral register (mapped to an
absolute memory location) and Oberon variables.
</pre>
      </blockquote>
      <pre wrap="">
 Pardon my C on this mailing list. The point I want to make is that it is ugly. 

Here is a sample of my C program where I am reading from an absolute memory location mapped to an FPGA register. The "target" is an integer, which is then used to retrieve a value from the FPGA. The address is not constant, but I can make it constant using a #define.

 long target; /* long int holds addr, needs a typecast */
 short value;
 short *virt_saddr;     /* typed pointer to 16-bit short */

 virt_saddr = (short *) target; /* convert target to pointer */
 value = * virt_saddr;            /* read value from address   */

I would prefer to write in C something like the following:
 
 short value at address; /* address is constant, which is most often the case*/

In Oberon it would be something like this:

 CONST address = ....; 
  VAR value: INTEGER AT address; (* address must be constant*)

Now the question, is this unreasonable? 

Wojtek
--
<a class="moz-txt-link-abbreviated" href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems
<a class="moz-txt-link-freetext" href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a>

</pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>