Japanese
HARDWARE ManualSMPC User's Manual
BackForward
SMPC User's Manual/Chapter 2 SMPC Commands

■2.2 Command issue

Commands to SMPC can be issued by setting the SMPC status flag (SF) to "1", setting command parameters if necessary, and writing the command code to the SH-2 interface register.
When issuing SMPC commands, be careful not to issue commands twice. Preventing double issuance of commands to SMPC can be managed with SMPC status flags. When this flag is "1", SMPC is busy. When issuing a command, check that the status flag is "0" and set it to "1" before issuing the command. The status flag is reset to "0" by SMPC at the end of the command.

◆How to issue commands

SMPC commands can be categorized in terms of issuing procedures and result parameter acquisition methods, depending on the command execution content, command parameters, and result parameter types. The classifications and corresponding commands are shown in Table 2.4 below, and examples of issuing methods according to each classification are shown in Figures 2.1 to 2.5.

(1) Classification A:
A command that causes the master SH-2 to reset or transition to exception processing such as NMI after issuing the command.

(2) Category B:
Commands that do not require command parameter settings and do not return result parameters (excluding OREG31)

(3) Classification C:
Commands that require command parameter settings and do not return result parameters (excluding OREG31)

(4) Classification D:
A command that requires setting command parameters, also returns result parameters, and requests an SMPC interrupt when the result parameters are complete.

Table 2.4 Command issue classification
 classification
 command
 A
 MSHON , SYSRES , NMIREQ, CKCHG352 , CKCHG320
 B
 SSHON,SSHOFF,SNDON,SNDOFF, CDON , CDOFF ,RESENAB,RESDISA
 C
 SETTIME,SETSMEM
 D
 INTBACK
Commands in bold are prohibited for users.

Figure 2.1 Class A command flow

Figure 2.2 Classification B command flow

Figure 2.3 Classification C command flow

Figure 2.4 Class D command flow

Note) Mask SMPC interrupts (do not use SMPC interrupts) and set the SMPC interrupt flag and SF
Polling after issuing a clear command can also be done in the same way as the SMPC interrupt routine.
processing can be performed.

◆Command issue timing

SMPC uses V-BLANK-IN interrupts to execute internal tasks. Therefore, issuing commands from V-BLANK-IN within a 300μS period is prohibited. Additionally, the timing of issuing the INTBACK command, which is used to obtain various SMPC statuses and peripheral data, is more strictly specified than other commands. For details on the INTBACK command, refer to ■2.4 Non-reset System Management Commands and Chapter 3 Peripheral Control .

●Common matters regarding command issue timing
As mentioned above, issuing all commands is prohibited for a period of 300μS from V-BLANK-IN.

●INTBACK command
The INTBACK command initiates peripheral data collection with V-BLANK-OUT. To start peripheral data collection, issue V-BLANK-OUT after 300μs after V-BLANK-IN and before V-BLANK-OUT. Figure 2.5 shows the timing of issuing the INTBACK command.

There are three ways to use the INTBACK command:

(1) Obtain only SMPC status
(2) Obtain peripheral data after obtaining SMPC status
(3) Obtain only peripheral data

(2) When acquiring peripheral data after acquiring SMPC status, an SMPC interrupt is generated when the SMPC status reaches OREG, and a request is made to SH2 to acquire the result parameters. After SH2 requests continue, SMPC starts collecting peripheral data. Therefore, when requesting to continue after acquiring the SMPC status, it is necessary to issue the INTBACK command and request continue so that peripheral data collection can be started with V-BLANK-OUT. The acquisition of SMPC status will be completed in approximately 300μs after issuing the INTBACK command, and an SMPC interrupt will be requested from SMPC.

Figure 2.5 INTBACK command issuance timing

●INTBACK command issuance timing after executing SYSRES, CCKHG320, CCKHG352 commands
The above commands take more than 100msec to execute. When issuing the INTBACK command after executing these commands, wait until the next V-BLANK-IN before issuing it. Figure 2.6 shows the timing of issuing the INTBACK command after executing the SYSRES, CCKHG320, and CCKHG352 commands. Please note that the SYSRES, CCKHG320, and CCKHG352 commands should be issued after 300μs after V-BLANK-IN and before the next V-BLANK-IN.

When using clock change commands, be sure to use the system library.

Figure 2.6 INTBACK command issuance timing after executing SYSRES, CCKHG320, CCKHG352 commands

●Issuance timing of other commands
If you do not issue the INTBACK command in the same frame after issuing other commands, please issue it after 300μs after V-BLANK-IN and before the next V-BLANK-IN. If you issue other commands after 300μS after V-BLANK-IN and then issue the INTBACK command in the same frame, please issue the INTBACK command before V-BLANK-OUT. Figure 2.7 shows the timing of issuing other commands.

Figure 2.7 Issuing other commands

◆Command issue restrictions

The following are restrictions on issuing commands.

● Try to issue commands to SMPC in a single task as much as possible. If the issuing process is divided into multiple parts, problems such as double issuing of commands may occur, which may cause SMPC malfunction or deadlock. If it is unavoidable for multiple tasks to issue commands to SMPC, be sure to implement exclusive control to prevent duplicate commands from being issued between tasks in addition to the command issuing method described above. .

● Even when issuing commands consecutively, be sure to check the status flag to avoid issuing commands twice, and wait until the previous command has finished executing before issuing the next command.

● The real-time clock counts up once every second. Also, immediately after V-BLANK-IN, the reset button is detected inside the SMPC. Please note that if you issue a command while these processes are in progress, these processing times will be added to the command processing time, so the command processing time will fluctuate.

● SMPC commands can be issued from either the master or slave SH-2, but there are some commands that have restrictions on issuance, such as causing the system to stop operating.

Table 2.5 shows the restrictions for issuing each SH-2 command.

Table 2.5 SH-2 command issuance restrictions
No. Command name Command abbreviation from master SH-2
Issue command
from slave SH-2
Issue command
1 × Master SH-2 ON MSHON
2 Slave SH-2 ON SSHON ×
3 Slave SH-2 OFF SSHOFF ×
4 sound on SNDON
5 Sound OFF SNDOFF
6 × CD ON CDON
7 × CD OFF CDOFF
8 × Whole system reset SYSRES
9 × clock change 352 CKCHG352 ×
10 × clock change 320 CKCHG320 ×
11 NMI request NMIREQ
12 reset enable RESENAB
13 reset disable RESDISA
14 interrupt back INTBACK ×
15 SMPC memory settings SETSMEM
16 Time setting SETTIME
Users are prohibited from using the × mark.

BackForward
HARDWARE ManualSMPC User's Manual
Copyright SEGA ENTERPRISES, LTD., 1997