Jo Engine
2026.11.1
Jo Sega Saturn Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
jo_engine
jo
dsp.h
Go to the documentation of this file.
1
/*
2
** Jo Sega Saturn Engine
3
** Copyright (c) 2012-2026, Johannes Fetz (johannesfetz@gmail.com)
4
** All rights reserved.
5
**
6
** Redistribution and use in source and binary forms, with or without
7
** modification, are permitted provided that the following conditions are met:
8
** * Redistributions of source code must retain the above copyright
9
** notice, this list of conditions and the following disclaimer.
10
** * Redistributions in binary form must reproduce the above copyright
11
** notice, this list of conditions and the following disclaimer in the
12
** documentation and/or other materials provided with the distribution.
13
** * Neither the name of the Johannes Fetz nor the
14
** names of its contributors may be used to endorse or promote products
15
** derived from this software without specific prior written permission.
16
**
17
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
38
39
#ifndef __JO_DSP_H__
40
# define __JO_DSP_H__
41
43
# define JO_DSP_BANK_SIZE (64)
45
# define JO_DSP_PROGRAM_SIZE (256)
46
48
# define JO_DSP_PPAF (*(volatile unsigned int *)0x25FE0080)
50
# define JO_DSP_PPD (*(volatile unsigned int *)0x25FE0084)
52
# define JO_DSP_PDA (*(volatile unsigned int *)0x25FE0088)
54
# define JO_DSP_PDD (*(volatile unsigned int *)0x25FE008C)
56
# define JO_DSP_PPAF_EXECUTE (1 << 16)
58
# define JO_DSP_PPAF_LOAD (1 << 15)
60
# define JO_DSP_PPAF_DMA (1 << 23)
61
66
void
jo_dsp_load_program
(
const
unsigned
int
*
const
program,
const
unsigned
int
count);
67
74
void
jo_dsp_write_data
(
const
unsigned
int
bank,
const
unsigned
int
address,
const
unsigned
int
*
const
data,
const
unsigned
int
count);
75
82
void
jo_dsp_read_data
(
const
unsigned
int
bank,
const
unsigned
int
address,
unsigned
int
*
const
data,
const
unsigned
int
count);
83
88
static
__jo_force_inline
void
jo_dsp_start
(
const
unsigned
int
pc)
89
{
90
JO_DSP_PPAF
=
JO_DSP_PPAF_EXECUTE
|
JO_DSP_PPAF_LOAD
| (pc & 0xFF);
91
}
92
96
static
__jo_force_inline
bool
jo_dsp_is_running
(
void
)
97
{
98
return
((
JO_DSP_PPAF
& (
JO_DSP_PPAF_EXECUTE
|
JO_DSP_PPAF_DMA
)) != 0);
99
}
100
102
static
__jo_force_inline
void
jo_dsp_wait
(
void
)
103
{
104
while
(
jo_dsp_is_running
())
105
;
106
}
107
108
#endif
/* !__JO_DSP_H__ */
109
110
/*
111
** END OF FILE
112
*/
JO_DSP_PPAF
#define JO_DSP_PPAF
Program control port (PPAF).
Definition
dsp.h:48
jo_dsp_start
static __jo_force_inline void jo_dsp_start(const unsigned int pc)
Start the program loaded by jo_dsp_load_program().
Definition
dsp.h:88
jo_dsp_is_running
static __jo_force_inline bool jo_dsp_is_running(void)
Check if the DSP is running.
Definition
dsp.h:96
jo_dsp_read_data
void jo_dsp_read_data(const unsigned int bank, const unsigned int address, unsigned int *const data, const unsigned int count)
Read the data RAM (the DSP must be stopped).
jo_dsp_wait
static __jo_force_inline void jo_dsp_wait(void)
Wait for the end of the program started by jo_dsp_start().
Definition
dsp.h:102
JO_DSP_PPAF_EXECUTE
#define JO_DSP_PPAF_EXECUTE
PPAF: execute (write: start, read: running).
Definition
dsp.h:56
jo_dsp_write_data
void jo_dsp_write_data(const unsigned int bank, const unsigned int address, const unsigned int *const data, const unsigned int count)
Write the data RAM (the DSP must be stopped).
JO_DSP_PPAF_DMA
#define JO_DSP_PPAF_DMA
PPAF: a DMA of the DSP is in progress.
Definition
dsp.h:60
JO_DSP_PPAF_LOAD
#define JO_DSP_PPAF_LOAD
PPAF: program counter load (the low 8 bits).
Definition
dsp.h:58
jo_dsp_load_program
void jo_dsp_load_program(const unsigned int *const program, const unsigned int count)
Stop the DSP and load a program.
__jo_force_inline
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition
types.h:39
Generated by
1.18.0