0.3.1

Data Structures

struct  scu_dsp_status
 SCU-DSP status. More...
 

Macros

#define DSP_PROGRAM_SIZE   0x0400
 SCU-DSP program size in bytes.
 
#define DSP_PROGRAM_WORD_COUNT   (DSP_PROGRAM_SIZE / 4)
 SCU-DSP program word count.
 
#define DSP_RAM_PAGE_SIZE   0x0100
 SCU-DSP RAM page size in bytes.
 
#define DSP_RAM_PAGE_WORD_COUNT   (DSP_RAM_PAGE_SIZE / 4)
 SCU-DSP RAM page word count.
 

Typedefs

typedef enum scu_dsp_ram scu_dsp_ram_t
 SCU-DSP RAM pages.
 
typedef void(* scu_dsp_ihr_t) (void)
 Callback type.
 
typedef uint8_t scu_dsp_pc_t
 Program counter to reference 256 instructions.
 
typedef struct scu_dsp_status scu_dsp_status_t
 SCU-DSP status.
 

Enumerations

enum  scu_dsp_ram
 SCU-DSP RAM pages. More...
 

Functions

static void scu_dsp_program_pause (bool pause)
 Pause SCU-DSP execution.
 
void scu_dsp_program_load (const void *program, uint32_t count)
 Load program onto SCU-DSP.
 
void scu_dsp_program_clear (void)
 Completely clear program memory.
 
void scu_dsp_program_pc_set (scu_dsp_pc_t pc)
 Set the SCU-DSP program counter.
 
void scu_dsp_program_start (void)
 Start SCU-DSP execution.
 
void scu_dsp_program_stop (void)
 Stop SCU-DSP execution.
 
scu_dsp_pc_t scu_dsp_program_step (void)
 Step one instruction excecution.
 
bool scu_dsp_dma_busy (void)
 Determine if the SCU-DSP DMA transfer is occurring.
 
void scu_dsp_dma_wait (void)
 Wait until a SCU-DSP DMA transfer is complet.
 
bool scu_dsp_program_end (void)
 Determine if SCU-DSP program has ended.
 
void scu_dsp_program_end_wait (void)
 Wait until the SCU-DSP program has ended.
 
void scu_dsp_data_read (scu_dsp_ram_t ram_page, uint8_t offset, void *data, uint32_t count)
 Read from one of the SCU-DSP RAM page.
 
void scu_dsp_data_write (scu_dsp_ram_t ram_page, uint8_t offset, void *data, uint32_t count)
 Write to one of the SCU-DSP RAM page.
 
void scu_dsp_status_get (scu_dsp_status_t *status)
 Obtain SCU-DSP operation status.
 

Detailed Description

Description goes here.


Data Structure Documentation

◆ scu_dsp_status

struct scu_dsp_status

SCU-DSP status.

Data Fields
bool t0:1 D0-Bus DMA execution flag.
bool s:1 SCU-DSP S (sine) flag.
bool z:1 SCU-DSP Z (zero) flag.
bool c:1 SCU-DSP C (carry) flag.
bool v:1 SCU-DSP V (overflow) flag.
bool e:1 SCU-DSP E (program end interrupt) flag.
bool ex:1 Flag to indicate whether execution is in progress or stopped.
scu_dsp_pc_t pc:8 Not yet documented.

Enumeration Type Documentation

◆ scu_dsp_ram

SCU-DSP RAM pages.

Enumerator
DSP_RAM_PAGE_0 

SCU-DSP RAM page #0.

DSP_RAM_PAGE_1 

SCU-DSP RAM page #1.

DSP_RAM_PAGE_2 

SCU-DSP RAM page #2.

DSP_RAM_PAGE_3 

SCU-DSP RAM page #3.

Function Documentation

◆ scu_dsp_program_pause()

static void scu_dsp_program_pause ( bool  pause)
inlinestatic

Pause SCU-DSP execution.

Parameters
pausePause or unpause.

◆ scu_dsp_program_load()

void scu_dsp_program_load ( const void *  program,
uint32_t  count 
)

Load program onto SCU-DSP.

The PC is reset back to zero after loading the program. Should the count be zero, nothing is copied. If the count exceeds DSP_PROGRAM_WORD_COUNT, the count is clamped.

Does not start SCU-DSP execution. For that, use scu_dsp_program_start.

Parameters
programPointer to buffer containing the SCU-DSP program.
countNumber of instructions.

◆ scu_dsp_program_clear()

void scu_dsp_program_clear ( void  )

Completely clear program memory.

This function is heavy handed. The following is performed: Program memory is cleared, the Z, S, and C flags are cleared, and the PC is reset.

◆ scu_dsp_program_pc_set()

void scu_dsp_program_pc_set ( scu_dsp_pc_t  pc)

Set the SCU-DSP program counter.

Parameters
pcThe program counter.

◆ scu_dsp_program_step()

scu_dsp_pc_t scu_dsp_program_step ( void  )

Step one instruction excecution.

The function blocks until that execution of one instruction is complete.

Warning
There is a possibility that this function never returns should the SCU-DSP crash for any reason, or there is an instruction that causes the state on the SCU to never update.

This function should be used to debug on real hardware.

Returns
Not yet documented.

◆ scu_dsp_dma_busy()

bool scu_dsp_dma_busy ( void  )

Determine if the SCU-DSP DMA transfer is occurring.

Returns
true if SCU-DSP DMA transfer is occurring. Otherwise, false.

◆ scu_dsp_program_end()

bool scu_dsp_program_end ( void  )

Determine if SCU-DSP program has ended.

Returns
true if the SCU-DSP has ended. Otherwise, false.

◆ scu_dsp_data_read()

void scu_dsp_data_read ( scu_dsp_ram_t  ram_page,
uint8_t  offset,
void *  data,
uint32_t  count 
)

Read from one of the SCU-DSP RAM page.

If offset + count exceeds DSP_RAM_PAGE_WORD_COUNT, the function returns without copying.

Parameters
ram_pageThe RAM page.
offsetThe offset in the RAM page.
[out]dataThe pointer to the buffer to write to.
countThe number of words.

◆ scu_dsp_data_write()

void scu_dsp_data_write ( scu_dsp_ram_t  ram_page,
uint8_t  offset,
void *  data,
uint32_t  count 
)

Write to one of the SCU-DSP RAM page.

If offset + count exceeds DSP_RAM_PAGE_WORD_COUNT, the function returns without copying.

Parameters
ram_pageThe RAM page.
offsetThe offset in the RAM page.
[in]dataThe pointer to the buffer to write to.
countThe number of words.

◆ scu_dsp_status_get()

void scu_dsp_status_get ( scu_dsp_status_t status)

Obtain SCU-DSP operation status.

If status is NULL, the status will not be updated.

Parameters
[out]statusThe pointer to scu_dsp_status.