The bit field and register-file structure approach is very efficient when accessing a single bit within a register or when polling a bit. As an example, consider code to initialize the PCLKCR0 register on a TMS320x280x device. PCLKCR0 is described in detail in the TMS320x280x, 2801x, 2804x System Control and Interrupts Reference Guide (SPRU712). The bit-field definition for this register is shown in Example 12.
Figure 5. Peripheral Clock Control 0 Register (PCLKCR0)
15
14
13
12
11
10
9
8
ECANBENCLK
ECANAENCLK
Reserved
SCIBENCLK
SCIAENCLK
SPIBENCLK
SPIAENCLK
R/W-0
R/W-0
R-0
R/W-0
R/W-0
R/W-0
R/W-0
7
6
5
4
3
2
1
0
SPIDENCLK
SPICENCLK
Reserved
I2CAENCLK
ADCENCLK
TBCLKSYNC
Reserved
R/W-0
R/W-0
R-0
R/W-0
R/W-0
R/W-0
R-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset