This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
acsim_mios_c [2007/01/17 00:23] audiocommander improved MIOS_IIC for SpeakJet debugging |
acsim_mios_c [2007/11/17 16:46] (current) smashtv move acsim.zip to "acsim" namespace |
||
---|---|---|---|
Line 3: | Line 3: | ||
[[acsim_console_h|ACSim_console.h]]\\ | [[acsim_console_h|ACSim_console.h]]\\ | ||
[[acsim_console_c|ACSim_console.c]]\\ | [[acsim_console_c|ACSim_console.c]]\\ | ||
- | |||
- | [[acsim_toolbox_h|ACSim_toolbox.h]]\\ | ||
- | [[acsim_toolbox_c|ACSim_toolbox.c]]\\ | ||
[[acsim_mios_h|ACSim_mios.h]]\\ | [[acsim_mios_h|ACSim_mios.h]]\\ | ||
**[[acsim_mios_c|ACSim_mios.c]]**\\ | **[[acsim_mios_c|ACSim_mios.c]]**\\ | ||
+ | [[acsim_toolbox_h|ACSim_toolbox.h]]\\ | ||
+ | [[acsim_toolbox_c|ACSim_toolbox.c]]\\ | ||
+ | [[acmididefines|ACMidiDefines.h]]\\ | ||
+ | \\ | ||
+ | This code is for viewing only and may not be up to date. You can download the files in a zip file {{acsim:acsim.zip}}. If you make any updates, please send them to stryd_one and he will update the zip for you. | ||
+ | \\ | ||
\\ | \\ | ||
<code c> | <code c> | ||
/* | /* | ||
* ACSim_mios.c | * ACSim_mios.c | ||
- | * v 0.0.5 | + | * v 0.0.7 |
* | * | ||
* 2006 April 06 Created by Michael Markert, http://www.audiocommander.de | * 2006 April 06 Created by Michael Markert, http://www.audiocommander.de | ||
Line 36: | Line 39: | ||
#import <Stdio.h> | #import <Stdio.h> | ||
+ | #import "ACMidiDefines.h" | ||
#import "ACSim_mios.h" | #import "ACSim_mios.h" | ||
- | |||
#import "ACSim_toolbox.h" | #import "ACSim_toolbox.h" | ||
Line 44: | Line 47: | ||
#pragma mark Globals | #pragma mark Globals | ||
// globals | // globals | ||
+ | debug_user_timer_t debug_user_timer; | ||
+ | |||
unsigned char debug_ain_lastPin; | unsigned char debug_ain_lastPin; | ||
unsigned int debug_ain_value[32]; | unsigned int debug_ain_value[32]; | ||
Line 50: | Line 55: | ||
unsigned int debug_enc_value[32]; | unsigned int debug_enc_value[32]; | ||
+ | unsigned int debug_MIDI_byteNum = 0; | ||
unsigned int debug_IIC_byteNum = 0; | unsigned int debug_IIC_byteNum = 0; | ||
Line 58: | Line 64: | ||
__PORTCbits_t PORTCbits; | __PORTCbits_t PORTCbits; | ||
__PORTDbits_t PORTDbits; | __PORTDbits_t PORTDbits; | ||
+ | __INTCONbits_t INTCONbits; | ||
mios_box_stat_t MIOS_BOX_STAT; | mios_box_stat_t MIOS_BOX_STAT; | ||
// HLP | // HLP | ||
Line 241: | Line 248: | ||
#pragma mark MIOS_MIDI | #pragma mark MIOS_MIDI | ||
// MIOS_MIDI | // MIOS_MIDI | ||
- | extern void MIOS_MIDI_BeginStream(void) { printf("\n**MIOS_MIDI_BeginStream**"); } | + | extern void MIOS_MIDI_BeginStream(void) { |
- | extern void MIOS_MIDI_TxBufferPut(unsigned char b) { printf("\n**MIOS_MIDI_TxBufferPut, %i", b); } | + | printf("\n**MIOS_MIDI_BeginStream**"); |
+ | debug_MIDI_byteNum = 0; | ||
+ | } | ||
+ | extern void MIOS_MIDI_TxBufferPut(unsigned char b) { | ||
+ | unsigned char ch; | ||
+ | printf("\n**MIOS_MIDI_TxBufferPut, %i", b); | ||
+ | debug_MIDI_byteNum++; | ||
+ | #if DEBUG_MIDI_VERBOSE | ||
+ | switch(debug_MIDI_byteNum) { | ||
+ | case 1: | ||
+ | // Channel Voice | ||
+ | ch = (b & 0x0f) + 1; | ||
+ | if( (b>=MIDI_NOTE_OFF) && (b<MIDI_NOTE_ON) ) { printf("\t\t\tMIDI_NOTE_OFF, CH %i",ch); } | ||
+ | if( (b>=MIDI_NOTE_ON) && (b<MIDI_POLY_AFTER) ) { printf("\t\t\tMIDI_NOTE_ON, CH %i",ch); } | ||
+ | if( (b>=MIDI_POLY_AFTER) && (b<MIDI_CC) ) { printf("\t\t\tMIDI_POLY_AFTER, CH %i",ch); } | ||
+ | if( (b>=MIDI_CC) && (b<MIDI_PRG) ) { printf("\t\t\tMIDI_CC, CH %i",ch); } | ||
+ | if( (b>=MIDI_PRG) && (b<MIDI_CH_AFTER) ) { printf("\t\t\tMIDI_PRG, CH %i",ch); } | ||
+ | if( (b>=MIDI_CH_AFTER) && (b<MIDI_PITCH) ) { printf("\t\t\tMIDI_CH_AFTER, CH %i",ch); } | ||
+ | if( (b>=MIDI_PITCH) && (b<MIDI_SYSEX) ) { printf("\t\t\tMIDI_NOTE_OFF, CH %i",ch); } | ||
+ | // System Common | ||
+ | if( (b==MIDI_SYSEX) ) { printf("\t\t\tMIDI_SYSEX"); } | ||
+ | if( (b==MIDI_TIMECODE) ) { printf("\t\t\tMIDI_TIMECODE"); } | ||
+ | if( (b==MIDI_SONG_POSITION_POINTER) ) { printf("\t\t\tMIDI_SONG_POSITION_POINTER"); } | ||
+ | if( (b==MIDI_SONG_SELECT) ) { printf("\t\t\tMIDI_SONG_SELECT"); } | ||
+ | if( (b==MIDI_TUNE_REQUEST) ) { printf("\t\t\tMIDI_TUNE_REQUEST"); } | ||
+ | if( (b==MIDI_EOX) ) { printf("\t\t\tMIDI_END_OF_SYSEX"); } | ||
+ | // System Realtime | ||
+ | if( (b==MIDI_CLOCK) ) { printf("\t\t\tMIDI_CLOCK"); } | ||
+ | if( (b==MIDI_START) ) { printf("\t\t\tMIDI_START"); } | ||
+ | if( (b==MIDI_CONTINUE) ) { printf("\t\t\tMIDI_CONTINUE"); } | ||
+ | if( (b==MIDI_STOP) ) { printf("\t\t\tMIDI_STOP"); } | ||
+ | if( (b==MIDI_ACTIVE_SENSING) ) { printf("\t\t\tMIDI_ACTIVE_SENSING"); } | ||
+ | if( (b==MIDI_RESET) ) { printf("\t\t\tMIDI_RESET"); } | ||
+ | break; | ||
+ | case 2: | ||
+ | case 3: | ||
+ | printf("\t\t\tMIDI_PARAM (BYTE #%i)", b); | ||
+ | break; | ||
+ | } | ||
+ | // reset counter for System Realtime Bytes | ||
+ | if(b >= MIDI_CLOCK) { debug_MIDI_byteNum = 0; } | ||
+ | #endif | ||
+ | } | ||
extern void MIOS_MIDI_EndStream(void) { | extern void MIOS_MIDI_EndStream(void) { | ||
+ | debug_MIDI_byteNum = 0; | ||
printf("\n**MIOS_MIDI_EndStream**"); | printf("\n**MIOS_MIDI_EndStream**"); | ||
- | DISPLAY_Init(); | ||
} | } | ||
+ | extern unsigned char MIOS_MIDI_MergerGet(void) { return 0; } // not yet supported! | ||
+ | extern void MIOS_MIDI_MergerSet(unsigned char mode) { return; } // not yet supported! | ||
+ | |||
+ | /* | ||
+ | extern void MIOS_MIDI_DeviceIDAutoSet(void) __wparam; | ||
+ | extern unsigned char MIOS_MIDI_DeviceIDGet(void) __wparam; | ||
+ | extern void MIOS_MIDI_DeviceIDSet(unsigned char device_id) __wparam; | ||
+ | extern void MIOS_MIDI_Init(void) __wparam; | ||
+ | extern unsigned char MIOS_MIDI_InterfaceGet(void) __wparam; | ||
+ | extern void MIOS_MIDI_InterfaceSet(unsigned char interface) __wparam; | ||
+ | extern void MIOS_MIDI_InterfaceAutoSet(void) __wparam; | ||
+ | extern unsigned char MIOS_MIDI_RxBufferFree(void) __wparam; | ||
+ | extern unsigned char MIOS_MIDI_RxBufferGet(void) __wparam; | ||
+ | extern void MIOS_MIDI_RxBufferPut(unsigned char b) __wparam; | ||
+ | extern unsigned char MIOS_MIDI_RxBufferUsed(void) __wparam; | ||
+ | extern void MIOS_MIDI_TxBufferFlush(void) __wparam; | ||
+ | extern unsigned char MIOS_MIDI_TxBufferFree(void) __wparam; | ||
+ | extern unsigned char MIOS_MIDI_TxBufferGet(void) __wparam; | ||
+ | extern void MIOS_MIDI_TxBufferPut(unsigned char b) __wparam; | ||
+ | extern unsigned char MIOS_MIDI_TxBufferUsed(void) __wparam; | ||
+ | */ | ||
#pragma mark MIOS_TIMER | #pragma mark MIOS_TIMER | ||
// MIOS_TIMER | // MIOS_TIMER | ||
- | extern void MIOS_TIMER_Init(unsigned char mode, unsigned int period) { return; } | + | extern void MIOS_TIMER_Init(unsigned char mode, unsigned int period) { |
+ | debug_user_timer.TIMER_ENABLED = TRUE; | ||
+ | return; | ||
+ | } | ||
extern void MIOS_TIMER_Start(void) { return; } | extern void MIOS_TIMER_Start(void) { return; } | ||
- | extern void MIOS_TIMER_Stop(void) { return; } | + | extern void MIOS_TIMER_Stop(void) { |
- | extern void MIOS_TIMER_ReInit(unsigned char mode, unsigned int period) { return; } | + | debug_user_timer.TIMER_ENABLED = FALSE; |
+ | return; | ||
+ | } | ||
+ | extern void MIOS_TIMER_ReInit(unsigned char mode, unsigned int period) { | ||
+ | MIOS_TIMER_Init(mode, period); | ||
+ | return; | ||
+ | } | ||