libsidplayfp
2.0.2
|
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | XS_VERSION "2.0pre" |
#define | exSID_write(addr, data) exSID_clkdwrite(0, addr, data) |
#define | exSID_read(addr) exSID_clkdread(0, addr) |
Enumerations | |
enum | { XS_CS_CHIP0, XS_CS_CHIP1, XS_CS_BOTH } |
enum | { XS_AU_6581_8580, XS_AU_8580_6581, XS_AU_8580_8580, XS_AU_6581_6581, XS_AU_MUTE, XS_AU_UNMUTE } |
enum | { XS_CL_PAL, XS_CL_NTSC, XS_CL_1MHZ } |
enum | { XS_MD_STD, XS_MD_PLUS } |
Functions | |
int | exSID_init (void) |
void | exSID_exit (void) |
void | exSID_reset (uint_least8_t volume) |
int | exSID_hwmodel (void) |
uint16_t | exSID_hwversion (void) |
int | exSID_clockselect (int clock) |
int | exSID_audio_op (int operation) |
void | exSID_chipselect (int chip) |
void | exSID_delay (uint_fast32_t cycles) |
void | exSID_clkdwrite (uint_fast32_t cycles, uint_least8_t addr, uint8_t data) |
uint8_t | exSID_clkdread (uint_fast32_t cycles, uint_least8_t addr) |
const char * | exSID_error_str (void) |
libexsid interface header file.
anonymous enum |
Chip selection values for exSID_chipselect()
Enumerator | |
---|---|
XS_CS_CHIP0 | 6581 |
XS_CS_CHIP1 | 8580 |
XS_CS_BOTH | Both chips.
|
anonymous enum |
Audio output operations for exSID_audio_op()
anonymous enum |
Clock selection values for exSID_clockselect()
Enumerator | |
---|---|
XS_CL_PAL | select PAL clock |
XS_CL_NTSC | select NTSC clock |
XS_CL_1MHZ | select 1MHz clock |
anonymous enum |
Hardware model return values for exSID_hwmodel()
Enumerator | |
---|---|
XS_MD_STD | exSID USB |
XS_MD_PLUS | exSID+ USB |
int exSID_audio_op | ( | int | operation | ) |
exSID+ audio operations routine. Selects the audio mixing / muting option. Only implemented in exSID+ devices.
operation | audio operation value, see exSID.h. |
void exSID_chipselect | ( | int | chip | ) |
SID chipselect routine. Selects which SID will play the tunes. If neither CHIP0 or CHIP1 is chosen, both SIDs will operate together. Accounts for elapsed cycles.
chip | SID selector value, see exSID.h. |
uint8_t exSID_clkdread | ( | uint_fast32_t | cycles, |
uint_least8_t | addr | ||
) |
BLOCKING Timed read routine, attempts cycle-accurate reads. The following description is based on exSID (standard). This function will be cycle-accurate provided that no two consecutive reads or writes are less than XS_CYCIO apart and leftover delay is <= max_adj SID clock cycles. Read result will only be available after a full XS_CYCIO, giving clkdread() the same run time as clkdwrite(). There's a 2-cycle negative adjustment in the code because that's the actual offset from the write calls ('/' denotes falling clock edge latch), which the following ASCII tries to illustrate:
Write looks like this in firmware:
...|_/_|...
...end of data byte read | cycle during which write is enacted / next cycle | etc...
Read looks like this in firmware:
...|_|_|_/_|_|...
...end of address byte read | 2 cycles for address processing | cycle during which SID is read / then half a cycle later the CYCCHR-long data TX starts, cycle completes | another cycle | etc...
This explains why reads happen a relative 2-cycle later than then should with respect to writes.
cycles | how many SID clocks to wait before the actual data read. |
addr | target address. |
void exSID_clkdwrite | ( | uint_fast32_t | cycles, |
uint_least8_t | addr, | ||
uint8_t | data | ||
) |
Timed write routine, attempts cycle-accurate writes. This function will be cycle-accurate provided that no two consecutive reads or writes are less than write_cycles apart and the leftover delay is <= max_adj SID clock cycles.
cycles | how many SID clocks to wait before the actual data write. |
addr | target address. |
data | data to write at that address. |
int exSID_clockselect | ( | int | clock | ) |
exSID+ clock selection routine. Selects between PAL, NTSC and 1MHz clocks.
clock | clock selector value, see exSID.h. |
void exSID_delay | ( | uint_fast32_t | cycles | ) |
Cycle accurate delay routine. Applies the most efficient strategy to delay for cycles SID clocks while leaving enough lead time for an I/O operation.
cycles | how many SID clocks to loop for. |
const char* exSID_error_str | ( | void | ) |
Returns a string describing the last recorded error.
void exSID_exit | ( | void | ) |
Device exit routine. Must be called to release the device. Resets the SIDs and clears RX/TX buffers, releases all resources allocated in exSID_init().
int exSID_hwmodel | ( | void | ) |
Device hardware model. Queries the driver for the hardware model currently identified.
uint16_t exSID_hwversion | ( | void | ) |
Hardware and firmware version of the device. Queries the device for the hardware revision and current firmware version and returns both in the form of a 16bit integer: MSB is an ASCII character representing the hardware revision (e.g. 0x42 = "B"), and LSB is a number representing the firmware version in decimal integer. Does NOT account for elapsed cycles.
int exSID_init | ( | void | ) |
Device init routine. Must be called once before any operation is attempted on the device. Opens first available device, and sets various parameters: baudrate, parity, flow control and USB latency, and finally clears the RX and TX buffers.
void exSID_reset | ( | uint_least8_t | volume | ) |
SID reset routine. Performs a hardware reset on the SIDs.
volume | volume to set the SIDs to after reset. |