Chapter 9 XGATE (S12XGATEV2)
MC9S12XDP512 Data Sheet, Rev. 2.11
394 Freescale Semiconductor
Figure 9-20. XGATE Vector Block
9.4.4 Semaphores
The XGATE module offers a set of eight hardware semaphores. These semaphores provide a mechanism
to protect system resources that are shared between two concurrent threads of program execution; one
thread running on the S12X_CPU and one running on the XGATE RISC core.
Each semaphore can only be in one of the three states: “Unlocked”, “Locked by S12X_CPU”, and “Locked
by XGATE”. The S12X_CPU can check and change a semaphore’s state through the XGATE semaphore
register (XGSEM, see Section 9.3.2.6, “XGATE Semaphore Register (XGSEM)”). The RISC core does
this through its SSEM and CSEM instructions.
If the S12X_CPU and the RISC core attempt to lock an unlocked semaphore at the same time, it will be
locked by the S12X_CPU.
Figure 9-21 illustrates the valid state transitions.
+$0000
unused
+$0024
+$0028
+$002C
+$0030
+$01E0
CodeVariablesCodeVariables
XGVBR
Channel $0A Initial Program Counter
Channel $0A Initial Variable Pointer
Channel $09 Initial Program Counter
Channel $09 Initial Variable Pointer
Channel $0B Initial Program Counter
Channel $0B Initial Variable Pointer
Channel $0C Initial Program Counter
Channel $0C Initial Variable Pointer
Channel $78 Initial Program Counter
Channel $78 Initial Variable Pointer