47static const unsigned pitch2freq[]={
48 0x8d03, 0x8603, 0x7d03, 0x7703, 0x7003, 0x6a03, 0x6303, 0x5e03,
49 0x5903, 0x5403, 0x4f03, 0x4a03, 0x4603, 0x4203, 0xfd83, 0xee83,
50 0xe083, 0xd483, 0xc783, 0xbc83, 0xb283, 0xa883, 0x9e83, 0x9583,
51 0x8d83, 0x8583, 0x7e83, 0x7683, 0x7083, 0x6983, 0x6383, 0x5e83,
52 0x5983, 0x5383, 0x4f83, 0x4a83, 0x4683, 0x4283, 0xfc02, 0xee02,
53 0xe102, 0xd402, 0xc802, 0xbd02, 0xb202, 0xa802, 0x9e02, 0x9502,
54 0x8d02, 0x8502, 0xfc82, 0xee82, 0xe082, 0xd482, 0xc882, 0xbd82,
55 0xb282, 0xa882, 0x9e82, 0x9682, 0x8d82, 0x8582, 0x7e82, 0x7682,
56 0x7082, 0x6982, 0x6382, 0x5e82, 0x5882, 0x5382, 0x4f82, 0x4a82,
57 0x4682, 0x4282, 0xfc01, 0xee01, 0xe001, 0xd401, 0xc801, 0xbd01,
58 0xb201, 0xa801, 0x9e01, 0x9501, 0x8d01, 0x8501, 0x7e01, 0x7601,
59 0x7001, 0x6901, 0x6301, 0x5e01, 0x5801, 0x5301, 0x4f01, 0x4a01,
64static const note_t sys_beep[]={
78static volatile int internote;
88static inline void play_freq(
unsigned freq) {
89 unsigned char CKSmask = freq & 0xff;
90 unsigned char match = freq >> 8;
110static inline void play_pause() {
122#ifdef CONF_RCX_COMPILER
127void dsound_core(
void) {
144 play_freq(pitch2freq[pitch]);
Internal Interface: H8/300 bit operations.
#define bit_load(mask, bit)
load a single bit from a mask to the carry flag
#define bit_store(byte, bit)
store the carry flag to a single single bit in memory
Interface: console input / output.
unsigned dsound_internote_ms
length of internote spacing in ms
const note_t * dsound_system_sounds[]
system sound data
volatile time_t dsound_next_time
when to play next note
#define DSOUND_DEFAULT_16th_ms
default duration of 1/16th note in ms
#define PITCH_MAX
maximum pitch value
#define DSOUND_DEFAULT_internote_ms
default duration internote spacing in ms
static int dsound_playing(void)
returns nonzero value if a sound is playing
#define PITCH_END
mark the end of a list of note_t entries
#define PITCH_PAUSE
specify a pause (rest)
wakeup_t dsound_finished(wakeup_t data)
sound finished event wakeup function
volatile note_t * dsound_next_note
pointer to current note
unsigned dsound_16th_ms
length of 1/16 note in ms
void dsound_stop(void)
stop playing sound
Internal Interface: H8/3297 processor registers.
volatile unsigned char T0_CNT
timer 0 counter register
unsigned char STCR
serial / timer control register
volatile unsigned char T0_CSR
timer 0 control / status register
unsigned char T0_CORA
timer 0 constant A register
unsigned char T0_CR
timer 0 control register
Internal LNP Interface: RCX redirected IRQ vectors.
#define HANDLER_WRAPPER(wrapstring, handstring)
the note structure describing a single note.
unsigned char pitch
note pitch, 0 ^= A_0 (~55 Hz)
unsigned char length
note length in 1/16ths
Internal Interface: direct sound control.
void dsound_handler()
sound handler, called from system timer interrupt
void dsound_init()
initialize sound driver
void dsound_shutdown()
shutdown sound driver
Internal Interface: task management.
time_t get_system_up_time(void)
retrieve the current system time
unsigned long time_t
time type
unsigned long wakeup_t
wakeup data area type