$DUAL - Declare reserved dual port RAM

Language reference ›› Directives ››
Parent Previous Next

dual-directive = $DUAL reserved-area { "," reserved-area } .
reserved-area = ( CTRL | DATA ) address-expression ( TO | ".." ) address-expression .


NEW! (V2.1): Defines a RAM area to use for dual RAM variables allocation of the specified type.


By default, PMP uses all available RAM for variables allocation.

When a processor has dual RAM functionality, like USB interfaces, some RAM areas are "dual port" and specialized for interfacing the special feature engine.

One area is generally for control (descriptors or data), others may be used as data only.

Unfortunately there is no available information in processor's definition file to qualify such areas so it is necessary to define them through directives.


Then when declaring dual RAM variables, the type of variables may be indicated with the $SPACE DUAL CTRL or $SPACE DUAL DATA directives.


When defined, dual RAM areas cannot be used for "normal" variables, so the effective areas must be chosen carefully.


This directive may be used several times to define more than one area, or different areas may be defined in one directive, separated by a comma.

If an address is already used by PMP or does not exist, an error occurs.




{$DUAL CTRL $400 TO $4FF} // reserved for USB control
{$DUAL DATA $500 TO $7FF} // reserved for USB buffers
...
VAR
 {$SPACE DUAL CTRL}
 USB_CTRL1:  WORD;
 {$SPACE DUAL DATA}
 USB_BUF1: ARRAY[64] OF BYTE;