PRELIMINARY
Using the Algorithms With C Code to Erase and Reprogram the 'F240
OR | #06fh | ; | set WDDIS | bit | and WDCHK2:0 bits, WDCLK to max. |
SACL | WDCR | ; | write ACC | out | to WDTCR |
*****************************************************************************
* Step 9. Deallocate the local frame*
*****************************************************************************
SBRK 1+1 | ; deallocate frame, point to saved FP |
|
*************************************************************************** |
| |
* Step 10. restore the frame pointer | * |
*****************************************************************************
LAR AR0,*± ; pop FP
***************************************************************************
* Step 11. copy the return address from the s/w stack and push onto h/w *
* stack*
***************************************************************************
PSHD * | ; push return address on h/w stack |
RET | ; return |
.en |
|
A.6.4 C Functions for Initializing the TMS320F240
*********************************************************************** |
| |||||
* | TMS320x240 Initialization Function | * |
| |||
* Arguments passed from Caller: None | * |
| ||||
* | Local Variables: | None | * |
| ||
*********************************************************************** |
| |||||
SYSSR | .set | 0701Ah |
|
|
| |
SYSCR | .set | 07018h |
|
|
| |
WDTCR | .set | 07029h | ;WD Control reg |
|
| |
CKCR0 | .set | 0702ah | ;PLL Clock Control Register 0 |
|
| |
CKCR1 | .set | 0702ch | ;PLL Clock Control Register 1 |
|
| |
DP_PF1 | .set | 224 |
|
|
| |
|
| .globl _c240init |
|
|
| |
|
| .text |
|
|
|
|
|
| .def | _c240init |
|
|
|
_c240init: |
| ; presume ARP = AR1 (SP)** |
|
| ||
*************************************************************************** |
| |||||
* On entry, presume ARP = AR1 (SP) |
| * | ||||
* |
|
|
|
|
| * |
* Step 1. pop the return address off the h/w stack and push to s/w stack | * |
*****************************************************************************
POPD *+ | ; pop return address, push on software stack |
;ARP=AR1, SP=SP+1
*****************************************************************************
* Step 2. push the frame pointer onto s/w stack*
*****************************************************************************
SAR AR0,*+ | ; push AR0 (FP) onto SP |
;ARP=AR1, SP=SP+2
*****************************************************************************
* Step 3. Allocate the local frame*
*****************************************************************************
SAR | AR1,* | ; *SP = FP |
LAR | AR0,#1 | ; FP = size of local frame, 1 |
LAR | AR0,*0+ | ; FP = SP, SP += size ==> allocate frame |
*****************************************************************************
PRELIMINARY | Assembly Source Listings and Program Examples |