Dynamic programming. STMicroelectronics SPC58xNx 32-bit Power Architecture microcontroller, SPC58NN84C3, SPC58NN84E7
تبلیغات
تبلیغات
RM0421
Note:
Enhanced Direct Memory Access (eDMA) except for the last. When the major loop is exhausted, only the major loop channel link fields are used to determine if a channel link should be made. For example, the initial fields of:
TCD n _CITER[E_LINK] = 1
TCD n _CITER[LINKCH] = 0xC
TCD n _CITER[CITER] value = 0x4
TCD n _CSR[MAJOR_E_LINK] = 1
TCD n _CSR[MAJOR_LINKCH] = 0x7 executes as:
1.
Minor loop done → set TCD12_CSR[START] bit
2. Minor loop done → set TCD12_CSR[START] bit
3. Minor loop done → set TCD12_CSR[START] bit
4. Minor loop done, major loop done → set TCD7_CSR[START] bit
When minor loop linking is enabled (TCD n _CITER[E_LINK] = 1), the TCD n _CITER[CITER] field uses a 9-bit vector to form the current iteration count. When minor loop linking is disabled (TCD n _CITER[E_LINK] = 0), the TCD n _CITER[CITER] field uses a 15-bit vector to form the current iteration count. The bits associated with the TCD n _CITER[LINKCH] field are concatenated onto the CITER value to increase the range of the CITER.
The TCD n_CITER[E_LINK] bit and the TCD n_BITER[E_LINK] bit must equal or a configuration error is reported. The CITER and BITER vector widths must be equal to calculate the major loop, half-way done interrupt point.
summarizes how a DMA channel can link to another DMA channel (that is, how it can use another channel’s TCD) at the end of a loop.
Table 320. Channel linking parameters
Desired link behavior
TCD control field name Description
CITER[E_LINK]
Link at end of minor loop
CITER[LINKCH]
Link channel number when linking at end of minor loop (current iteration)
Enable channel-to-channel linking on minor loop completion (current iteration)
CSR[MAJOR_E_LINK]
Link at end of major loop
CSR[MAJOR_LINKCH]
Link channel number when linking at end of major loop
Enable channel-to-channel linking on major loop completion
23.5.7 Dynamic programming
23.5.7.1 The following sections describe dynamic programming.
23.5.7.2 Dynamic priority changing
The following two options are recommended for dynamically changing channel priority levels:
RM0421 Rev 5
644
Enhanced Direct Memory Access (eDMA) RM0421
1.
Switch to Round-Robin Channel Arbitration mode, change the channel priorities, then switch back to Fixed Arbitration mode.
2. Disable all the channels within a group, then change the channel priorities within that group only, then enable the appropriate channels.
The following two options are available for dynamically changing group priority levels:
1.
Switch to Round-Robin Group Arbitration mode, change the group priorities, then switch back to Fixed Arbitration mode.
2. Disable all channels, change the group priorities, then enable the appropriate channels.
23.5.7.3 Dynamic channel linking
Dynamic channel linking is the process of setting the TCD.major.e_link bit during channel execution. This bit is read from the TCD local memory at the end of channel execution, thus allowing the user to enable the feature during channel execution.
Because the user is allowed to change the configuration during execution, a coherency model is needed. Consider the scenario where the user attempts to execute a dynamic channel link by enabling the TCD.major.e_link bit at the same time the eDMA engine is retiring the channel. The TCD.major.e_link would be set in the programmer’s model, but it would be unclear whether the actual link was made before the channel retired.
The coherency model in Table 321
is recommended when executing a dynamic channel link request.
Step
1
2
3
Table 321. Coherency model for a dynamic channel link request
Action
Write 1b to the TCD.major.e_link bit.
Read back the TCD.major.e_link bit.
Test the TCD.major.e_link request status:
– If TCD.major.e_link = 1b, the dynamic link attempt was successful.
– If TCD.major.e_link = 0b, the attempted dynamic link did not succeed (the channel was already retiring).
Note:
For this request, the TCD local memory controller forces the TCD.major.e_link bit to zero on any writes to a channel’s TCD.word7 after that channel’s TCD.done bit is set, indicating the major loop is complete.
The user must clear the TCD.done bit before writing the TCD.major.e_link bit. The
TCD.done bit is cleared automatically by the eDMA engine after a channel begins execution.
23.5.7.4 Dynamic scatter/gather
Dynamic scatter/gather is the process of setting the TCD.e_sg bit during channel execution.
This bit is read from the TCD local memory at the end of channel execution, thus allowing the user to enable the feature during channel execution.
Because the user is allowed to change the configuration during execution, a coherency model is needed. Consider the scenario where the user attempts to execute a dynamic scatter/gather operation by enabling the TCD.e_sg bit at the same time the eDMA engine is
RM0421 Rev 5
RM0421 Enhanced Direct Memory Access (eDMA)
Note: retiring the channel. The TCD.e_sg would be set in the programmer’s model, but it would be unclear whether the actual scatter/gather request was honored before the channel retired.
Two methods for this coherency model are shown in the following subsections. Method 1 has the advantage of reading the major.linkch field and the e_sg bit with a single read. For both dynamic channel linking and scatter/gather requests, the TCD local memory controller forces the TCD.major.e_link and TCD.e_sg bits to zero on any writes to a channel’s
TCD.word7 if that channel’s TCD.done bit is set indicating the major loop is complete.
The user must clear the TCD.done bit before writing the TCD.major.e_link or TCD.e_sg bits.
The TCD.done bit is cleared automatically by the eDMA engine after a channel begins execution.
23.5.7.4.1 Method 1 (channel not using major loop channel linking)
For a channel not using major loop channel linking, the coherency model in
be used for a dynamic scatter/gather request.
When the TCD.major.e_link bit is zero, the TCD.major.linkch field is not used by the eDMA.
In this case, the TCD.major.linkch bits may be used for other purposes. This method uses the TCD.major.linkch field as a TCD identification (ID).
3
4
5
Step
1
2
6
Table 322. Coherency model for method 1
Action
When the descriptors are built, write a unique TCD ID in the TCD.major.linkch field for each
TCD associated with a channel using dynamic scatter/gather.
Write 1b to theTCD.d_req bit.
Note: Should a dynamic scatter/gather attempt fail, setting the d_req bit will prevent a future hardware activation of this channel. This stops the channel from executing with a destination address (daddr) that was calculated using a scatter/gather address (written in the next step) instead of a dlast final offset value.
Write theTCD.dlast_sga field with the scatter/gather address.
Write 1b to the TCD.e_sg bit.
Read back the 16 bit TCD control/status field.
Test the TCD.e_sg request status and TCD.major.linkch value:
– If e_sg = 1b, the dynamic link attempt was successful.
– If e_sg = 0b and the major.linkch (ID) did not change, the attempted dynamic link did not succeed (the channel was already retiring).
– If e_sg = 0b and the major.linkch (ID) changed, the dynamic link attempt was successful
(the new TCD’s e_sg value cleared the e_sg bit).
23.5.7.4.2 Method 2 (channel using major loop linking)
For a channel using major loop channel linking, the coherency model in
used for a dynamic scatter/gather request. This method uses the TCD.dlast_sga field as a
TCD identification (ID).
RM0421 Rev 5
644
Enhanced Direct Memory Access (eDMA) RM0421
2
3
4
Step
1
5
Table 323. Coherency model for method 2
Action
Write 1b to theTCD.d_req bit.
Note: Should a dynamic scatter/gather attempt fail, setting the d_req bit will prevent a future hardware activation of this channel. This stops the channel from executing with a destination address (daddr) that was calculated using a scatter/gather address (written in the next step) instead of a dlast final offset value.
Write theTCD.dlast_sga field with the scatter/gather address.
Write 1b to the TCD.e_sg bit.
Read back the TCD.e_sg bit.
Test the TCD.e_sg request status:
– If e_sg = 1b, the dynamic link attempt was successful.
– If e_sg = 0b, read the 32 bit TCD dlast_sga field.
– If e_sg = 0b and the dlast_sga did not change, the attempted dynamic link did not succeed
(the channel was already retiring).
– If e_sg = 0b and the dlast_sga changed, the dynamic link attempt was successful (the new TCD’s e_sg value cleared the e_sg bit).
RM0421 Rev 5
دانلود
تبلیغات