The compiler extends the C/C++ language by adding the __cregister keyword to allow high level language access to control registers.
When you use the __cregister keyword on an object, the compiler compares the name of the object to a list of standard control registers (see Table 5-5). If the name matches, the compiler generates the code to reference the control register. If the name does not match, the compiler issues an error.
The following control registers are declared in the c7x.h header file. In addition, a large number of Extended Control Registers (ECRs) are declared in c7x_ecr.h.
Category | Register | Description |
---|---|---|
General Control Registers | CPUID | CPU ID register |
PMR | Power management register | |
DNUM | DSP core number register | |
TSC | Time-stamp counter register | |
TSR | Task state register | |
RP | Return pointer register | |
BPCR | Branch predictor control register | |
STSC | Shadow time stamp counter register | |
Computation Control Registers | FPCR | Floating-point control register |
FSR | Flag status register | |
GPLY | Galois polynomial register | |
GFPGFR | Galois field polynomial generator function register | |
Event Control Registers | DEPR | Debug event priority register |
IESET | Internal exception event set register | |
ESTP_SS | Event service table pointer register, secure supervisor | |
ESTP_S | Event service table pointer register, supervisor | |
ESTP_GS | Event service table pointer register, guest supervisor | |
ECSP_SS | Event context save pointer register, secure supervisor | |
ECSP_S | Event context save pointer register, supervisor | |
ECSP_GS | Event context save pointer register, guest supervisor | |
TCSP | Task context save pointer | |
RXMR_SS | Returning execution mode register, secure supervisor | |
RXMR_S | Returning execution mode register, supervisor | |
AHPEE | Highest priority enabled event register, currently in service | |
PHPEE | Highest priority enabled event register, pending | |
IEBER | Internal event broadcast enable register | |
IERR | Internal exception report register | |
IEAR | Internal exception address register | |
IESR | Internal exception status register | |
IEDR | Internal exception data register | |
TCR | Test count register | |
TCCR | Test count config register | |
GMER | Guest mode enable register | |
UMER | User mask enable register | |
SPBR | Stack pointer boundary register | |
UFCMR | User flag clear mask register | |
IPE | Inter-processor event register | |
Lookup Table and Histogram Control Registers | LTBR0 to LTBR3 | Lookup table base address registers |
LTCR0 to LTCR3 | Lookup table configuration registers | |
LTER | Lookup table enable register | |
Debug Control Registers | DBGCTXT | Debug context (overlay) register |
ILCNT | Inner loop counter register | |
OLCNT | Outer loop counter initial value register | |
LCNTFLG | 16-bit predicate flags register | |
SCRB | Scoreboard bits register |
The __cregister keyword can be used only in file scope. The __cregister keyword is not allowed on any declaration within the boundaries of a function. It can only be used on objects of type integer or pointer. The __cregister keyword is not allowed on objects of any floating-point type or on any structure or union objects.
The __cregister keyword does not imply that the object is volatile. If the control register being referenced is volatile (that is, can be modified by some external control), then the object must be declared with the volatile keyword also.
To use the control registers in Table 5-5, you must declare each register as follows. The c7x.h include file defines all the control registers through this syntax:
extern __cregister volatile unsigned intregister; |
Once you have declared the register, you can use the register name directly.