User Tools

Site Tools


acsim_mios_c

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
acsim_mios_c [2006/08/07 00:07] – fixed bs error codes audiocommanderacsim_mios_c [2007/11/17 16:46] (current) – move acsim.zip to "acsim" namespace smashtv
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_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 29: Line 33:
  * YOU ARE ALLOWED TO COPY AND CHANGE   * YOU ARE ALLOWED TO COPY AND CHANGE 
  * BUT YOU MUST RELEASE THE SOURCE TOO (UNDER GNU GPL) IF YOU RELEASE YOUR PRODUCT   * BUT YOU MUST RELEASE THE SOURCE TOO (UNDER GNU GPL) IF YOU RELEASE YOUR PRODUCT 
- * YOU ARE NOT ALLOWED NOT USE IT WITHIN PROPRIETARY CLOSED-SOURCE PROJECTS+ * YOU ARE NOT ALLOWED TO USE IT WITHIN PROPRIETARY CLOSED-SOURCE PROJECTS
  */  */
  
Line 35: 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.c"+
  
  
Line 43: 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 48: Line 54:
 unsigned char debug_din_value[32]; unsigned char debug_din_value[32];
 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 char debug_bankstick_ctrl = 0x00; // 1st Bankstick preselected unsigned char debug_bankstick_ctrl = 0x00; // 1st Bankstick preselected
Line 55: 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 133: Line 143:
 extern void MIOS_LCD_PrintBCD2(unsigned char v) { printf("%2.2i",v); } extern void MIOS_LCD_PrintBCD2(unsigned char v) { printf("%2.2i",v); }
 extern void MIOS_LCD_PrintBCD3(unsigned char v) { printf("%3.3i",v); } extern void MIOS_LCD_PrintBCD3(unsigned char v) { printf("%3.3i",v); }
-extern void MIOS_LCD_PrintBCD4(unsigned int v) { printf("%i",v); } +extern void MIOS_LCD_PrintBCD4(unsigned int v) { printf("%4.4i",v); } 
-extern void MIOS_LCD_PrintBCD5(unsigned int v) { printf("%i",v); }+extern void MIOS_LCD_PrintBCD5(unsigned int v) { printf("%5.5i",v); }
 extern void MIOS_LCD_PrintChar(unsigned char c) {  extern void MIOS_LCD_PrintChar(unsigned char c) { 
  switch(c) {  switch(c) {
- case 0x00: c = '_'; break; + case 0x00: printf("_(0)"); break; 
- case 0x01: c = '_'; break; + case 0x01: printf("_(1)"); break; 
- case 0x02: c = '_'; break; + case 0x02: printf("-(2)"); break; 
- case 0x03: c = '-'; break; + case 0x03: printf("-(3)"); break; 
- case 0x04: c = '-'; break; + case 0x04: printf("-(4)"); break; 
- case 0x05: c = '-'; break; + case 0x05: printf("-(5)"); break; 
- case 0x06: '='; break; + case 0x06: printf("=(6)"); break; 
- case 0x07: '='; break;+ case 0x07: printf("=(7)"); break
 + default: 
 + printf("%c",c)
  }  }
- printf("%c",c);  
 } }
 extern void MIOS_LCD_PrintHex1(unsigned char h) { printf("%X",h); } extern void MIOS_LCD_PrintHex1(unsigned char h) { printf("%X",h); }
Line 199: Line 210:
  }  }
  // print buffer  // print buffer
 + printf("\n**MIOS_BANKSTICK_ReadPage at 0x%X \n", addr);
  //hexview(buffer, sizeof(buffer));  //hexview(buffer, sizeof(buffer));
  hexview(buffer, 64);  hexview(buffer, 64);
Line 222: Line 234:
  }  }
  // print buffer  // print buffer
 + printf("\n**MIOS_BANKSTICK_WritePage at 0x%X \n", addr);
  //hexview(buffer, sizeof(buffer));  //hexview(buffer, sizeof(buffer));
  hexview(buffer, 64);  hexview(buffer, 64);
Line 235: 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;  
 +}
  
  
 #pragma mark MIOS_IIC #pragma mark MIOS_IIC
 // MIOS_IIC // MIOS_IIC
-extern void MIOS_IIC_Start(void) { printf("\n**MIOS_IIC_Start**");+extern void MIOS_IIC_Start(void) { 
-extern void MIOS_IIC_Stop(void) { printf("\n**MIOS_IIC_Stop**"); }+ debug_IIC_byteNum = 0; 
 + printf("\n**MIOS_IIC_Start**");  
 +
 +extern void MIOS_IIC_Stop(void) { 
 + printf("\n**MIOS_IIC_Stop**"); 
 +}
 extern unsigned char MIOS_IIC_ByteSend(unsigned char b) {  extern unsigned char MIOS_IIC_ByteSend(unsigned char b) { 
- printf("\n**MIOS_IIC_ByteSend: %x  \t %i  \t %c", b, b, b); + printf("\n**MIOS_IIC_ByteSend: 0x%x  \t %i  \t %c", b, b, b);  
 +#if DEBUG_SPEAKJET_VERBOSE 
 + if(debug_IIC_byteNum == 1) { 
 + // MSA controls 
 + switch(b) { 
 + case 0: case 1: case 2: case 3: case 4: case 5: case 6: printf(" \t MSA_PAUSE"); break; 
 + case 7: printf(" \t MSA_NEXTFAST"); break; 
 + case 8: printf(" \t MSA_NEXTSLOW"); break; 
 + case 14: printf(" \t MSA_NEXTHIGH"); break; 
 + case 15: printf(" \t MSA_NEXTLOW"); break; 
 + case 16: printf(" \t MSA_WAIT"); break; 
 + case 20: printf(" \t MSA_VOLUME"); break; 
 +  
 + case 21: printf(" \t MSA_SPEED"); break; 
 + case 22: printf(" \t MSA_PITCH"); break; 
 + case 23: printf(" \t MSA_BEND"); break; 
 + case 24: printf(" \t MSA_PORTCTR"); break; 
 + case 25: printf(" \t MSA_PORT"); break; 
 + case 26: printf(" \t MSA_REPEAT"); break; 
 +  
 + case 28: printf(" \t MSA_CALLPHRASE"); break; 
 + case 29: printf(" \t MSA_GOTOPHRASE"); break; 
 + case 30: printf(" \t MSA_DELAY"); break; 
 + case 31: printf(" \t MSA_RESET"); break; 
 +  
 + default: 
 + if(b > 127) { 
 + if(b < 200) { 
 + printf(" \t MSA_SOUNDCODE_PHONEME"); 
 + } else if(b < 255) { 
 + printf(" \t MSA_SOUNDCODE_FX"); 
 + } else { 
 + printf(" \t MSA unknown: %i", b); 
 +
 +
 + break; 
 +
 +
 + // SCP controls 
 + switch(b) { 
 + case SCP_ESCAPE: printf(" \t --- ENTER SCP MODE ---"); break; 
 + case SCP_EXIT: printf(" \t --- LEAVE SCP MODE ___"); break; 
 + case SCP_READY: printf(" \t READY"); break; 
 + case SCP_CLEAR_BUFFER: printf(" \t CLEAR BUFFER"); break; 
 + case SCP_START: printf(" \t START"); break; 
 + case SCP_STOP: printf(" \t STOP"); break; 
 + case SCP_MEMTYPE: printf(" \t  ^  MEMTYPE (REG:0 EEPROM_L:2 EEPROM_H:3)"); break; 
 + case SCP_MEMADDR: printf(" \t  ^  MEMADDR (freq:1-5 lvl:11-15 dist:6, vol:7)"); break; 
 + case SCP_MEMWRT: printf(" \t  ^  STORED"); break; 
 + case SCP_RESET: printf(" \t RESET"); break; 
 +
 +#endif 
 + debug_IIC_byteNum++;
  return 1;  return 1;
 } }
acsim_mios_c.1154909275.txt.gz · Last modified: 2006/10/15 09:35 (external edit)