Japanese
PROGRAMMER'S GUIDEInterrupt management library
■ | Go forward
interrupt management library

1. guide


1.1 Purpose

It's about managing interrupts.

1.2 Overview

Manage interrupt register access, register and reference interrupt processing routines.

1.3 Functional overview

[Interrupt register access management]
The interrupt mask register is write-only, so its value cannot be read. Therefore, the value written to the interrupt mask register is held in the library. Specifically, the method is as follows.

  1. Prepare a memory (hereinafter referred to as mask storage memory) that always has the same contents as the interrupt mask register.

  2. When writing to the interrupt mask register, be sure to write the same contents to the mask storage memory.

  3. When reading the interrupt mask register, read the contents of the mask storage memory.

[Register and reference interrupt handling routine]
You can register interrupt functions and SCU functions in the interrupt vector table, and view the current interrupt vector registration contents.
SCU interrupt functions are registered as initial values in the SCU interrupt vector table. The SCU interrupt function has the ability to call a registered SCU function as a subroutine. Registered SCU functions are executed every time the SCU interrupt function is executed.
As an initial value, a dummy function (executes only return processing) is registered for the interrupt function, and an SCU dummy function (executes only return processing) is registered for the SCU interrupt function.

1.4 Terms of Use

[Interrupt register access management]
Since the library holds the value of the interrupt mask register, use the function provided by the library to write to the interrupt mask register. If a direct write is performed, the mask storage memory and interrupt mask register will not match, and correct processing will not be possible.

1.5 Calling Sequence

[Interrupt register access management]
void sysInit()
{
     INT_SetMsk((INT_MSK_HBLK_IN | INT_MSK_VBLK_OUT),
                                         (INT_MSK_SPR | INT_MSK_DMA1));
               /* Enable "H-Blank-IN" and "V-Blank-OUT" */
               /* Disable "End sprite drawing" and "Level 0-DMA" */
     ...
}
void anyPrg()
{
     Uint32 status_bit;
     status_bit = INT_GET_STAT(); /* Get status */
     if(INT_JudgeStat(status_bit,INT_ST_VBLK_OUT,INT_ST_VBLK_IN) == TRUE){
                                   /* V-blank-OUT interrupt occurs, */
                                   /* When V-Blank-IN interrupt has not occurred */
     ...
     }
}

[Register and reference interrupt handling routine]
File A
#pragma interrupt (vblkIn) /* Make the vblkIn function the interrupt function */

void vblkIn(void)
{
     ...
}

File B
void systemInit(void)
{
     INT_SetFunc(INT_SCU_VBLK_IN, vblkIn);
                              /* vblkIn interrupt function V-blank-IN interrupt vector */
                              /* Register in the table. */
     INT_SetScuFunc(INT_SCU_VBLK_OUT, vblkOut);
                              /* vblkOut function of V-blank-OUT interrupt vector */
                              /* Register to SCU interrupt function. */
     ...
}

void vblkOut(void)
{
     ...
}


■ | Go forward
PROGRAMMER'S GUIDEInterrupt management library
Copyright SEGA ENTERPRISES, LTD., 1997