Implementation - Texas Instruments UCD3138 Technical Reference Manual

Digital power supply controller
Hide thumbs Also See for UCD3138:
Table of Contents

Advertisement

www.ti.com

14.5.2 Implementation

Dual-state support is implemented by providing an alternate entry point for a function. This alternate entry
point is used by functions requiring a state change. Dual-state support handles the change to the correct
state and, if needed, changes the function back to the state of the caller when it returns. Also, indirect
calls set up the return address so that once the called function returns, the state can be reliably changed
back to that of the caller.
14.5.3 Naming Conventions for Entry Points (CCS 3.x)
Most of the CCS 3.x compilers reserves the name space of all identifiers beginning with an underscore (_)
or a dollar sign ($). In this dual-state support scheme, all 32-BIS state entry points begin with an
underscore, and all 16-BIS state entry points begin with a dollar sign. All other compiler-generated
identifiers, which are independent of the state of the processor, begin with an underscore. By this
convention, all direct calls within a 16-bit function refer to the entry point beginning with a dollar sign and
all direct calls within a 32-bit function refer to the entry point beginning with an underscore.
The compiler/linkers used in CCS6 use an underscore for all entry points. CCS6 uses the state of the
assembler at the function call (ARM or Thumb mode) to determine how to call the function.
14.5.4 Indirect Calls
Addresses of functions taken in 16-BIS state use the address of the 16-BIS state entry point to the
function (with bit 0 of the address set). Likewise, addresses of functions taken in 32-BIS state use the
address of the 32-BIS state entry point (with bit 0 of the address cleared).
Then all indirect calls are performed by loading the address of the called function into a register and
executing the branch and exchange (BX) instruction. This automatically changes the state and ensures
that the code works correctly, regardless of what state the address was in when it was taken.
The return address must also be set up so that the state of the processor is consistent and known upon
return. Bit 0 of the address is tested to determine if the BX instruction invokes a state change. If it does
not invoke a state change, the return address is set up for the state of the function. If it does invoke a
change, the return address is set up for the alternate state and code is executed to return to the function's
state. Because the entry point into a function depends upon the state of the function that takes the
address, it is more efficient to take the address of a function when in the same state as that function.
This ensures that the address of the actual function is used, not its alternate entry point. Because the
indirect call can invoke a state change itself, entering a function through its alternate entry point, even if
calling it from a different state, is unnecessary.
Example-1 shows sum( ) calling max( ) with code that is compiled for the 16-BIS state and supports dual-
state interworking.
The sum( ) function is compiled with the −mt option, which creates 16-bit instructions. Example-2 shows
the same function call with code that is compiled for the 32-BIS state and supports dual-state interworking.
Function max( ) is compiled without the −mt option, creating 32-bit instructions.
SNIU028A – February 2016 – Revised April 2016
Submit Documentation Feedback
Copyright © 2016, Texas Instruments Incorporated
Dual-State Interworking
459
ARM7TDMI-S MPUSS

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents