Main Page   Hardware Class Hierarchy   Hardware API     Mapping Class Hierarchy  Mapping API 

oVBR Class Reference

Class (hardware layer) that allows access to the VBR table. More...

#include <ovbr.h>


Static Public Member Functions

long * address (void)
 Return internal address where VBR is located.

int openvector (void)
 Return next free user vector location.

int vector (void)
 Return last vector used.


Detailed Description

Class (hardware layer) that allows access to the VBR table.

Operation
The VBR address is stored internally and currently cannot be changed. Any new object or process that needs to use the vector base register should access it through this object or it may impact objects which currently use the VBR. Be careful when calling openvector; it automatically increments to the next available free vector location. Thus if you call
  console.echo("freevector=",_vbr.openvector());        // increments to next free vector (wasted)--not what you wanted!
  *(long*)(_vbr.address()+_vbr.openvector()) = (long)event_int;
  // ...
Then notice the wasted vector, and the printed vector is not the one you're using!
/par Remarks This class should be used for all access. The constructor loads the VBR into default location and sets the first open (free) user vector to. Each call to openvector() will increment; so if you need to use same vector# use vector method
Note:
No error table for overflow to VBR but there are almost 60 user vectors--surely you don't need that many ;) Otherwise, could later implement tracking mechanism to which vectors are open/used. Wow, did I go around in circles on this one. Woulnd't link so changed--crashes, etc. "new" operator took 40K overhead, then so did something else, on and on... finnally, changed back to orignal linker script, and voila, it worked. Must have did something, eh?
Currently, the oConsole and oSchedule object use the VBR to coordinate interrupt vector offsets.
Using the Design Pattern terminology, the VBR is a singleton object. In short, that means you declare any number of VBR objects in different modules, but you will be accessing the same object (declared static). The impact of this ensures that even if another module declares another VBR and request another vector location (openvector), it will be ensure it is truly open between all modules that use the VBR.
Note:
Note that the usable vector numbers start at 68 because of the following statement in the DEBUG MONITOR USER's MANUAL. Of particular interest is the use of vector number 66. Note, this also implies the internal copy of the VBR table must copy vector 66.
2.4.2 332Bug Exception Vectors

The debugger exception vectors are listed below. Do not change these specified vector offsets in the target program vector
table or the associated debugger facilities (breakpoints, trace mode, etc) will not operate.


TABLE 2-2. 332Bug Exception Vectors

VECTOR NUMBER   OFFSET  EXCEPTION 332Bug FACILITY
4               $10     Illegal Instruction breakpoints (Used 
                        instruction by GO, GN, GT)
9               $24     Trace T, TC, TT
31              $7C     Level 7 interrupt ABORT pushbutton
47              $BC     TRAP #15 System calls (see Chapter 5)
66              $108    User Defined Timer Trap #15 Calls ($4X)

It is unclear whether the above is a seperate vector table maintained by CPU32BUG or the common vector table as initialized internally. But I am assuming the mentioned target program vector table is the vector table at address $0.
Also, For some reason, I could not get odd numbered vectors to work. Thus the vector numbers start at 68 and increment by 2--this is puzzling. Also, as of version 1.4, I Changed to internal VBR table rather than hardcoded 0x400. The orignal code base I used, had the vector table pointing at the CPU32BUG vector table. But the CPU32BUG manual says..."With the exception of the first 1024-uint8 vector table area, do not to use the above-mentioned reserved memory areas."
Sample Code
oSchedule()
{
// ...
  VBR _vbr;
  _Evector = _vbr.openvector();         // get next free vector for oSchedule address.
  // Inizialize periodic timer for Event_Int interrupt
  // NOTE: ver 1.4 address returns long* not int
  *(long*)(_vbr.address()+_Evector) = (long)event_int;
  // ...
}


The documentation for this class was generated from the following file:
Generated on Mon Oct 8 19:32:45 2007 for OOMRM Hardware API by doxygen1.3