/****************************************************************************** Description: DragonMP3 standard routines. These routines are used to perform the basic instructions of the MAS3587F made by: Koen Kumps Date:22/10/2001 revision:1.5 ******************************************************************************/ #include #include "dragon.h" #include "io.h" #include "MAS3587F.h" #include "fpga.h" #include "i2c.h" #define FPGADDRA FPGAREG00 #define FPGAODRA FPGAREG01 #define FPGAIDRA FPGAREG01 #define FPGADDRB FPGAREG02 #define FPGAODRB FPGAREG03 #define FPGAIDRB FPGAREG03 #define FPGADDRC FPGAREG04 #define FPGAODRC FPGAREG05 #define FPGAIDRC FPGAREG05 #define FPGAPWM1A FPGAREG06 #define FPGAPWM1B FPGAREG07 #define FPGAPWM2A FPGAREG08 #define FPGAPWM2B FPGAREG09 /* change this value for Muting Attenuation*/ /* Do this inh MAIN.C also */ #define ATT 64 /* SDA 0x0400 in DRC */ /* SCL 0x0200 in DRC */ /* input state = tri-state */ /* ODR = Output data register */ /* IDR = Input data register */ /* DDR = Direction data register */ /* Initialise global Variables */ unsigned char volume = 0x73; /*Volume control*/ unsigned char mute = 0x00; /*Mute value*/ unsigned char bass = 0x00; /*Bass value*/ unsigned char treble = 0x00; /*Treble value*/ unsigned char loudness = 0x00; /*Loudness value*/ unsigned char lmode = 0x00; /*Loudness mode (superbasstoggle)*/ unsigned char MDBStrength = 0x49;/*MDB Effect Strength*/ unsigned char MDBHarm = 0x29; /*MDB Harmonics*/ unsigned char MDBCentFreq = 0x05;/*MDB Center Frequency*/ unsigned int Songadress; int Songsize; /* Initialisation of MAS3587F */ /* Load Default or Last settings from FLASH */ void InitMAS3587F(void) { ResetMAS3587F(); WriteConfReg(); CheckPUP(); } /* RESETTING THE MAS3587F */ void ResetMAS3587F() { clrbw(0x0080,FPGAODRC); /*set FPGA-output pin RES MAS3587F to "0"*/ clrbw(0x0080,FPGADDRC); /*set FPGA-output pin RES MAS3587F as output*/ delay(100000); /*wait a while*/ setbw(0x0080,FPGADDRC); /*set FPGA-output pin RES MAS3587F as input*/ setbw(0x0080,FPGAODRC); /*set FPGA-output pin RES MAS3587F to "1"*/ } /* If key is hit on keyboard we jump to this routine */ void Commands(void) { switch(toupper(dfgetc(ser1))) { case 'H' : PrintManual(); break; case 'R' : ReadICinfo(); break; case '+' : Volume('+'); break; case '-' : Volume('-'); break; case 'M' : Mute(); break; case 'B' : Bass_Settings(); break; case 'T' : Treble_Settings(); break; case 'L' : Loudness_Settings(); break; case 'X' : Superbass_toggle(); break; case 'D' : Songadress = 0x200000; Songsize = 1791164; Decode_I2S(); break; case 'A' : Micronas_Dynamic_Bass(); break; case 'P' : Play(); break; case 'S' : Stop(); break; case 'J' : REW(); break; case 'K' : FFWD(); break; case 'I' : WriteConfReg(); dprintf("Initialisation succesfull\n"); break; case 'C' : ReadConfReg(); break; default : dprintf("Invalid Input, try again\n"); break; } } void REW(void) { dprintf("rew "); Songadress -= 1000; } void FFWD(void) { Songadress += 1000; } /* Print Help and some more info */ void PrintManual(void) { dprintf("******************************************************************************\n"); dprintf("This program is an application for the DragonEngineII\n"); dprintf("in combination with the MP3 demo-board.\n"); dprintf("******************************************************************************\n"); dprintf("while running the program:\n"); dprintf("[H] for printing out this message and some more info\n"); dprintf("[+] for volume up\n"); dprintf("[-] for volume down\n"); dprintf("[B] is for BASS settings (after [B] pres [+]/[-] for adjustment or [Q]uit)\n"); dprintf("[T] is for TREBLE settings (after [N] pres [+]/[-] for adjustment or [Q]uit)\n"); dprintf("[L] is for LOUDNESS settings (after [L] pres [+]/[-] for adjustment or [Q]uit)\n"); dprintf("[X] is for toggling SuperBass\n"); dprintf("[M] for ATTENUATION (or mute), hit [P] or [+]/[-] to unmute.\n"); dprintf("[R] is for reading IC information of the MAS3587F\n"); dprintf("[I] is for Initialisation of the MAS3587F (write to DIRECT CONFIG registers)\n"); dprintf("[C] is for checking the content of the DIRECT CONFIG registers\n"); dprintf("[P] is \"PLAY\", for now Analog-in to Analog-out\n"); dprintf("[S] is \"STOP\" & shutdown\n"); dprintf("[J] is REWIND\n"); dprintf("[K] is FAST FORWARD\n"); dprintf("[A] is for MICRONAS DYNAMIC BASS settings. Hit [E]ffect,[H]armonics, [C]enter\n"); dprintf("frequency adjust, [O]ff or [Q]uit settings afterwards\n"); dprintf("----------- STIL UNDER TEST-------------\n"); dprintf("[D] decode MP3 trough I²S\n"); dprintf("----------------------------------------\n\n"); dprintf("This software is updated regularly. Check out the version number and compare to\n"); dprintf("the software on the site.\n\n"); dprintf("Have fun!!\n\n"); dprintf("made by: Koen Kumps & Jan Vanvaerenbergh\n"); dprintf("programming started: 19th. october 2001\n"); dprintf("version: 3.6\n"); dprintf("******************************************************************************\n"); dprintf("MICRONAS CHIP INFO:\n"); WriteConfReg(); ReadICinfo(); dprintf("\n\nPress a key to command MAS3587F\n"); } /* --- UNDER TEST --- */ /* Edit DSP volume matrix */ void DSPVolume(void) { WriteMem(Write_D0,0x0001,out_LL,0x07,0xFF,0xFF); WriteMem(Write_D0,0x0001,out_LR,0x00,0x00,0x00); WriteMem(Write_D0,0x0001,out_RL,0x00,0x00,0x00); WriteMem(Write_D0,0x0001,out_RR,0x07,0xFF,0xFF); /* give echo of values that are set */ dprintf("DSP volume Matrix\nLL: "); ReadMem(Read_D0,0x0001,out_LL); dprintf("LR: "); ReadMem(Read_D0,0x0001,out_LR); dprintf("RL: "); ReadMem(Read_D0,0x0001,out_RL); dprintf("RR: "); ReadMem(Read_D0,0x0001,out_RR); } /* --- ********** --- */ /* Volume Adjustment */ void Volume(unsigned char input) { if(input == '+') /*see if user wants louder music*/ { if(volume == 0x7F) dprintf("\nMaximum volume reached...\n"); /*watch your ears*/ else WriteCODEC(VOLUME,volume++,0x00); /*write Volume value*/ } if(input == '-') /*see if user wants less music*/ { if(volume == 0x00) dprintf("\nMinimum volume reached...\n"); /*Still too loud ?!?!*/ else WriteCODEC(VOLUME,volume--,0x00); /*write Volume value*/ } } /* Equaliser Adjustment */ unsigned char Equaliser(unsigned char subad,unsigned char input,unsigned char equ) { if(input == '+') /*see if user wants more bass/treble*/ { if(equ == 0x60) dprintf("\nMaximum level reached...\n"); /*watch your ears*/ else { WriteCODEC(subad,equ++,0x00); /*write new value*/ dprintf("\nLevel +1/8dB\n"); /*give echo*/ } } if(input == '-') /*see if user wants less bass/treble*/ { if((equ-0xA0) == 0) dprintf("\nMinimum level reached...\n"); else { WriteCODEC(subad,equ--,0x00); /*write new value*/ dprintf("\nLevel -1/8dB\n"); /*give echo*/ } } return equ; } /* Loudness Adjustment */ unsigned char Loudness(unsigned char input,unsigned char gain,unsigned char mode) { if(input == '+') /*see if user wants more "loudness"*/ { if(gain == 0x44) dprintf("\nMaximum level reached...\n"); /*watch your ears*/ else { WriteCODEC(LOUDNESS,gain++,mode); /*write new value*/ dprintf("\nLevel +1/4dB\n"); /*give echo*/ } } if(input == '-') /*see if user wants less bass/treble*/ { if(gain == 0x00) dprintf("\nMinimum level reached...\n"); else { WriteCODEC(LOUDNESS,gain--,mode); /*write new value*/ dprintf("\nLevel -1/4dB\n"); /*give echo*/ } } return gain; } /* Mute function -ATTdB */ void Mute(void) { if(mute != 0) { volume = (mute - 1); WriteCODEC(VOLUME,volume,0x00); mute = 0; dprintf("Playing..."); } else { mute = volume; if(volume > ATT) volume -= ATT; /*-ATTdB mute*/ else volume = 1; /*sssssssttttttt*/ WriteCODEC(VOLUME,volume,0x00); /*write Volume value*/ dprintf("Muting...\n"); /*give echo*/ } } /* Write to CODEC register */ void WriteCODEC(unsigned char subad,unsigned char byte1,unsigned char byte2) { short errorI2C; startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return; sendbyte(codec_write); /*send Codec's address*/ sendbyte(0x00); /*Codec register subaddress*/ sendbyte(subad); sendbyte(byte1); /*send first 8bit (15 - 8)*/ sendbyte(byte2); /*send next 8bit (7 - 0)*/ stopI2C(); /*stop condition*/ } /* Reading CODEC register */ short ReadCODEC(unsigned char subad) { unsigned char data1; unsigned char data2; unsigned short data; short errorI2C; startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return 0; sendbyte(codec_write); /*send Codec's address*/ sendbyte(0x00); /*Codec register subaddress*/ sendbyte(subad); /*send subadress register*/ stopI2C(); /*stop condition*/ startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return 0; sendbyte(codec_read); /*send Codec's address*/ startI2C(); /*Repeated start condition*/ errorI2C = sendbyte(DR); /*send Device Read*/ if(errorI2C != 0) return 0; data1 = readbyte(); /*put first byte (15 - 8) in data1*/ send_ACK(); /*send Acknowledge*/ data2 = readbyte(); /*put second byte (7 - 0) in data2*/ send_NACK(); /*send Not Acknowledge*/ stopI2C(); /*stop condition*/ data = data1; /*copying received bytes in one 16-bit value*/ data <<= 8; data += data2; return data; /*return 16-bit value*/ } /* Write to DIRECT CONFIGURATION register */ void WriteCONF(unsigned char subad,unsigned char byte1,unsigned char byte2) { short errorI2C; startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return; sendbyte(subad); /*send subadress register*/ sendbyte(byte1); /*send first 8bit (15 - 8)*/ sendbyte(byte2); /*send next 8bit (7 - 0)*/ stopI2C(); /*stop condition*/ } /* Reading DIRECT CONFIGURATION register */ short ReadCONF(unsigned char subad) { unsigned char data1; unsigned char data2; unsigned short data; short errorI2C; startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return 0; sendbyte(subad); /*send subadress register*/ startI2C(); /*Repeated start condition*/ errorI2C = sendbyte(DR); /*send Device Read*/ if(errorI2C != 0) return 0; data1 = readbyte(); /*put first byte (15 - 8) in data1*/ send_ACK(); /*send Acknowledge*/ data2 = readbyte(); /*put second byte (7 - 0) in data2*/ send_NACK(); /*send Not Acknowledge*/ stopI2C(); /*stop condition*/ data = data1; /*copying received bytes in one 16-bit value*/ data <<= 8; data += data2; return data; /*return 16-bit value*/ } /* Write to DSP register */ void WriteDSP(unsigned char subad,unsigned char byte1,unsigned char byte2,unsigned char byte3) { short errorI2C; short RR = 0; RR += WriteReg; /*|WriteReg+Subad(MSN)|,|Subad(LSN)+d4|*/ RR += (subad >> 4); RR <<= 8; subad = (subad << 4) + byte1; startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return; sendbyte(data_write); /*send subcommando DSP*/ sendbyte(RR); /*send DSP subadress + command*/ sendbyte(subad); sendbyte(byte2); sendbyte(byte3); stopI2C(); /*stop condition*/ } /* Reading DSP register */ int ReadDSP(unsigned char subad) { unsigned char data1; unsigned char data2; unsigned char data3; int data = 0; short errorI2C; short RR = 0; RR += ReadReg; RR += (subad >> 4); RR <<= 8; subad = (subad << 4); startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return 0; sendbyte(data_write); /*send subcommando DSP*/ sendbyte(RR); /*send DSP subadress + command*/ sendbyte(subad); stopI2C(); /*stop condition*/ startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return 0; sendbyte(data_read); /*send subcommando DSP*/ startI2C(); /*Repeated start condition*/ errorI2C = sendbyte(DR); /*send Device Read*/ if(errorI2C != 0) return 0; data1 = readbyte(); /*get first byte*/ send_ACK(); /*send Acknowledge*/ data1 = readbyte(); /*get second byte, yes I use data1 again, the first 8-bit are of no use*/ wait(); send_ACK(); /*send Acknowledge*/ data2 = readbyte(); /*get third byte*/ send_ACK(); /*send Acknowledge*/ data3 = readbyte(); /*get fourth byte*/ wait(); /*wait a while*/ send_NACK(); /*send Not Acknowledge*/ stopI2C(); /*stop condition*/ data1 &= 0x0F; /*first nibble of no use so clearing it*/ data += data1; /*put the 4 bytes in 1 integer value*/ data <<= 8; data += data2; data <<= 8; data += data3; return data; /*return the received data*/ } /* Write to memory adress DSP */ void WriteMem(short subad, short number, short admem, unsigned char byte1, unsigned char byte2, unsigned char byte3) { short errorI2C; unsigned char number1; unsigned char number2; unsigned char adress1; unsigned char adress2; /* split number up in to two bytes */ number1 = (number >> 8) & 0xFF; number2 = number & 0xFF; adress1 = (admem >> 8) & 0xFF; adress2 = admem & 0xFF; /* start sending date as an I2C sequence */ startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if (errorI2C != 0) return; sendbyte(data_write); /*send subcommando DSP*/ sendbyte(subad); /*send Memorycell adress*/ sendbyte(0x00); sendbyte(number1); /*send number of bytes to send*/ sendbyte(number2); sendbyte(adress1); /*send subadress memorycell*/ sendbyte(adress2); sendbyte(0x00); /*send actual data*/ sendbyte(byte1); sendbyte(byte2); sendbyte(byte3); stopI2C(); /*stop condition*/ } /* Reading memory adress DSP */ void ReadMem(short subad,short number,short admem) { short errorI2C; unsigned char number1; unsigned char number2; unsigned char adress1; unsigned char adress2; unsigned char byte1; unsigned char byte2; unsigned char byte3; number1 = (number >> 8); number2 = number; adress1 = (admem >> 8); adress2 = admem; startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return; sendbyte(data_write); /*send subcommando DSP*/ sendbyte(subad); /*send Memorycell adress*/ sendbyte(0x00); sendbyte(number1); /*send number of words to read*/ sendbyte(number2); sendbyte(adress1); /*send subadress memorycell*/ sendbyte(adress2); stopI2C(); startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return; sendbyte(data_read); /*send subcommando DSP*/ startI2C(); /*start condition*/ errorI2C = sendbyte(DR); /*send Device Read*/ if(errorI2C != 0) return; byte1 = readbyte(); send_ACK(); byte1 = readbyte(); wait(); send_ACK(); byte2 = readbyte(); send_ACK(); byte3 = readbyte(); wait(); /*wait a while*/ send_NACK(); stopI2C(); /*stop condition*/ dprintf("%01X %02X %02X\n",byte1, byte2, byte3); } /* Check PUP flags */ void CheckPUP(void) { ReadCONF(DCCF); } /* Read IC version */ void ReadICinfo(void) { unsigned char data1; unsigned char data2; unsigned char data3; unsigned char data4; short number; unsigned char derivate; char version; short errorI2C; startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return; sendbyte(data_write); /*send subcommando DSP*/ sendbyte(Read_IC); /*SEND IC-info READ COMMAND*/ sendbyte(0x00); stopI2C(); /*stop condition*/ startI2C(); /*start condition*/ errorI2C = sendbyte(DW); /*send Device Write*/ if(errorI2C != 0) return; sendbyte(data_read); /*send subcommando DSP*/ startI2C(); /*Repeated start condition*/ errorI2C = sendbyte(DR); /*send Device Read*/ if(errorI2C != 0) return; data1 = readbyte(); /*get first byte*/ send_ACK(); /*send Acknowledge*/ data2 = readbyte(); /*get second byte*/ wait(); send_ACK(); /*send Acknowledge*/ data3 = readbyte(); /*get third byte*/ send_ACK(); /*send Acknowledge*/ data4 = readbyte(); /*get fourth byte*/ wait(); /*wait a while*/ send_NACK(); /*send Not Acknowledge*/ stopI2C(); /*stop condition*/ number = (data1 << 8) + data2; derivate = ((data3 >> 4) & 0xF0); version = (data3 & 0x0F) + 0x041; dprintf("\nIC version: MAS%04XF\nDerivate: %01X\nVersion: %c%02X\n",number,derivate,version,data4);/*give echo of value*/ } /* MICRONAS DYNAMIC BASS functions */ /* When editing a setting MDB is automaticly switched ON, press O in this menu to switch MDB off */ void Micronas_Dynamic_Bass(void) { dprintf("MDB Settings\n[E]ffect,[H]armonics,[C]enter frequency,Load [D]efault,[O]ff or [Q]uit settings\n"); opnieuw3: switch(toupper(dfgetc(ser1))) { case 'O' : dprintf("MDB Off\n"); WriteCODEC(MDB_SHAPE,0x09,0x00); break; case 'D' : dprintf("Loading default settings\nIdeal for Low end headphones and medium effect\n"); MDBStrength = MDB1(MDB_STR,'+',0x49); MDBHarm = MDB1(MDB_HAR,'+',0x29); MDBCentFreq = MDB2('+',0x05); MDB3(MDBCentFreq); dprintf("\nLoaded.\n"); break; case 'E' : dprintf("Effect Strength\nPress [+]/[-] to adjust\n"); opnieuw4: switch(toupper(dfgetc(ser1))) { case '+' : MDBStrength = MDB1(MDB_STR,'+',MDBStrength); goto opnieuw4; case '-' : MDBStrength = MDB1(MDB_STR,'-',MDBStrength); goto opnieuw4; case 'Q' : dprintf("Adjusted\n"); break; } MDB3(MDBCentFreq); break; case 'H' : dprintf("Harmonics\nPress [+]/[-] to adjust\nPress [+]/[-] to adjust\n"); opnieuw5: switch(toupper(dfgetc(ser1))) { case '+' : MDBHarm = MDB1(MDB_HAR,'+',MDBHarm); goto opnieuw5; case '-' : MDBHarm = MDB1(MDB_HAR,'-',MDBHarm); goto opnieuw5; case 'Q' : dprintf("Adjusted\n"); break; } MDB3(MDBCentFreq); break; case 'C' : dprintf("Center Frequency\nPress [+]/[-] to adjust\n"); opnieuw6: switch(toupper(dfgetc(ser1))) { case '+' : MDBCentFreq = MDB2('+',MDBCentFreq); goto opnieuw6; case '-' : MDBCentFreq = MDB2('-',MDBCentFreq); goto opnieuw6; case 'Q' : dprintf("Adjusted\n"); break; } MDB3(MDBCentFreq); break; case 'Q' : break; default : dprintf("Invalid Input, try again\n"); goto opnieuw3; } dprintf("MDB Settings saved...\n"); } /* MDB Shape Calculate and MDB "On" switch */ void MDB3(unsigned char shape) { shape *= 3; shape /= 2; WriteCODEC(MDB_SHAPE,shape,0x02); } /* used for effect strength and harmonics settings */ unsigned char MDB1(unsigned char subad,unsigned char input,unsigned char val) { if(input == '+') /*see if user wants more MDB effect*/ { if(val == 0x7F) dprintf("\nMaximum level reached...\n"); /*watch your ears*/ else { WriteCODEC(subad,val++,0x00); /*write effect value*/ dprintf("\nLevel +1dB\n"); /*give echo*/ } } if(input == '-') /*see if user wants less MDB effect*/ { if(val == 0x00) dprintf("\nMinimum level reached...\n"); /*Still too much ?!?!*/ else { WriteCODEC(subad,val--,0x00); /*write effect value*/ dprintf("\nLevel -1dB\n"); /*give echo*/ } } return val; } /* used for Center Frequency settings */ unsigned char MDB2(unsigned char input,unsigned char centfreq) { if(input == '+') /*see if user wants to increase center frequency*/ { if(centfreq == 0x30) dprintf("\nMaximum frequency reached (300Hz)\n"); /*get some better speakers*/ else { WriteCODEC(MDB_FC,centfreq++,0x00); /*write frequency value*/ dprintf("\nCenter Frequency +10Hz\n"); /*give echo*/ } } if(input == '-') /*see if user wants to decrease center frequency*/ { if(centfreq == 0x02) dprintf("\nMinimum frequency reached (20Hz)\n"); /*wow,super high-end speakers you've got*/ else { WriteCODEC(MDB_FC,centfreq--,0x00); /*write frequency value*/ dprintf("\nCenter Frequency -10Hz\n"); /*give echo*/ } } return centfreq; } /* Function that reads the Control Registers and puts them on screen one by one */ void ReadConfReg(void) { dprintf("CONTROL register value: %04X\nDCCF register value: %04X\nDCFR register value: %04X\n",ReadCONF(CONTROL), ReadCONF(DCCF), ReadCONF(DCFR)); } /* Function that writes to the Control Registers one by one */ void WriteConfReg(void) { WriteCONF(CONTROL,0x8C,0x00); delay(20000); /*Issueing INIT phase approx. 5ms*/ WriteCONF(DCCF,0x50,0x50); delay(20000); /*Issueing INIT phase approx. 5ms*/ WriteCONF(DCFR,0x00,0x00); delay(20000); /*Issueing INIT phase approx. 5ms*/ } /* Function that connects the Analog-in to Analog-out, also used to undo a mute */ void Play(void) { WriteCONF(CONTROL,0x8C,0x00); WriteCODEC(CONV_CONF,0x22,0x07); /*set CONVERTER CONFIGURATION*/ WriteCODEC(ADC_IN_MODE,0x00,0x00); /*set INPUT MODE of ADC*/ WriteCODEC(DAC_IN_ADC,0x40,0x00); /*set D/A Convertor source mixer*/ Volume('+'); dprintf("Playing...\n"); /*give echo*/ } /* Function that shuts the MAS3587F down */ void Stop(void) { unsigned char buf; buf = volume; volume = 0x01; Volume('-'); /*mute analog outputs*/ WriteCONF(CONTROL,0x80,0x00); /*disable DSP en CODEC, and clear DC1 and DC2 enable too*/ dprintf("Stopped...\n"); /*give echo*/ volume = buf; } /* Function to configure Bass-Settings */ void Bass_Settings(void) { dprintf("Bass Settings\nPress [+]/[-] to adjust\n"); opnieuw: switch(toupper(dfgetc(ser1))) { case '+' : bass = Equaliser(BASS,'+',bass); goto opnieuw; case '-' : bass = Equaliser(BASS,'-',bass); goto opnieuw; case 'Q' : dprintf("Adjusted\n"); break; default : dprintf("Invalid Input, try again\n"); goto opnieuw; } } /* Function to configure Treble-Settings */ void Treble_Settings(void) { dprintf("Treble Settings\nPress [+]/[-] to adjust\n"); opnieuw1: switch(toupper(dfgetc(ser1))) { case '+' : treble = Equaliser(TREBLE,'+',treble); goto opnieuw1; case '-' : treble = Equaliser(TREBLE,'-',treble); goto opnieuw1; case 'Q' : dprintf("Adjusted\n"); break; default : dprintf("Invalid Input, try again\n"); goto opnieuw1; } } /* Function to configure Loudness-Settings */ void Loudness_Settings(void) { dprintf("Loudness Settings\nPress [+]/[-] to adjust\n"); opnieuw2: switch(toupper(dfgetc(ser1))) { case '+' : loudness = Loudness('+',loudness,lmode); goto opnieuw2; case '-' : loudness = Loudness('-',loudness,lmode); goto opnieuw2; case 'Q' : dprintf("Adjusted\n"); break; default : dprintf("Invalid Input, try again\n"); goto opnieuw2; } } /* Function to Toggle Superbass on/off */ void Superbass_toggle(void) { if(lmode == 0x04) /*Turn of SuperBass*/ { lmode = 0x00; loudness = Loudness('+',loudness--,lmode); dprintf("\nSuper Bass off\n"); } else /*Turn on SuperBass*/ { lmode = 0x04; loudness = Loudness('+',loudness--,lmode); dprintf("\nSuper Bass on (throttle up Loudness to hear effect)\n"); } }