void acoral_fs_init(void) { DiskInit(); FileInit(); fs_mutex=acoral_mutex_create(0,NULL); acoral_mount("disk","A:",NULL,0,NULL); }
void main(void) { Int16 temp_cnt; ICR = 0xff2e; /* IDLE Control Register */ /* mem port, io port and cpu idle active */ /* Peripheral_Reset */ CSL_SYSCTRL_REGS->PSRCR = 0x0020; CSL_SYSCTRL_REGS->PCGCR1 = 0x0000; CSL_SYSCTRL_REGS->PCGCR2 = 0x0000; CSL_SYSCTRL_REGS->PRCR = 0x00bf; /* VERY IMPORTANT !!! */ /* PPMODE1 (SPI, GPIO, UART, and I2S2): 7 signals of the SPI module, 6 GPIO signals(GP[17:12]), 4 signals of the UART module, 4 signals of the I2S2 module SP1MODE2 (GP[11:6]). 6 GPIO signals (GP[11:6]) SP0MODE0 (MMC/SD0). All 6 signals of the MMC/SD0 */ CSL_SYSCTRL_REGS->EBSR = (CSL_SYS_EBSR_PPMODE_MODE1 << 12) |(CSL_SYS_EBSR_SP1MODE_MODE2 << 10) |(CSL_SYS_EBSR_SP0MODE_MODE0 << 8); asm(" bit(ST1, #ST1_INTM) = #1"); INTR_init(); PLL_init(3658); // system clock set to 120MHz TIMER_init(); EZDSP5535_GPIO_init(); EZDSP5535_I2C_init(); /* Initialize I2C */ Audio_init(7); /* Initialise to bandwidth=7kHz */ EZDSP5535_LCD_init(); LCD_print("G722.1 Receiver ", 17, 0); LCD_print("16kbps ", 8, 1); EZDSP5535_SPI_init(); Si446x_Init(); EZDSP5535_SAR_init(); DiskInit(); FileInit(); AddFileDriver(SDCammand, NULL); asm(" bit(ST1, #ST1_INTM) = #0"); bApi_Set_Receive(); while(1) { if(gpioIsrStatus == 1) { temp_cnt = SPI_recvData(spibuffer); gpioIsrStatus = 0; CSL_GPIO_REGS->IOINTFLG1 = 0x0800; } if(spiIsrStatus == 1) { // SpiWriteByte(CMD_FIFO_INFO, 0); SpiWriteByte(CMD_GET_INT_STATUS, 0); bApi_Set_Receive(); if(audioProcessing()) continue; spiIsrStatus = 0; } fileProcessing(); asm(" idle"); } // RemoveFileDriver(SDCammand); }
bool InitAll(const char *vmdir) { // Check ROM version if (!CheckROM()) { ErrorAlert(STR_UNSUPPORTED_ROM_TYPE_ERR); return false; } #if EMULATED_68K // Set CPU and FPU type (UAE emulation) switch (ROMVersion) { case ROM_VERSION_64K: case ROM_VERSION_PLUS: case ROM_VERSION_CLASSIC: CPUType = 0; FPUType = 0; TwentyFourBitAddressing = true; break; case ROM_VERSION_II: CPUType = PrefsFindInt32("cpu"); if (CPUType < 2) CPUType = 2; if (CPUType > 4) CPUType = 4; FPUType = PrefsFindBool("fpu") ? 1 : 0; if (CPUType == 4) FPUType = 1; // 68040 always with FPU TwentyFourBitAddressing = true; break; case ROM_VERSION_32: CPUType = PrefsFindInt32("cpu"); if (CPUType < 2) CPUType = 2; if (CPUType > 4) CPUType = 4; FPUType = PrefsFindBool("fpu") ? 1 : 0; if (CPUType == 4) FPUType = 1; // 68040 always with FPU TwentyFourBitAddressing = false; break; } CPUIs68060 = false; #endif // Load XPRAM XPRAMInit(vmdir); // Load XPRAM default values if signature not found if (XPRAM[0x0c] != 0x4e || XPRAM[0x0d] != 0x75 || XPRAM[0x0e] != 0x4d || XPRAM[0x0f] != 0x63) { D(bug("Loading XPRAM default values\n")); memset(XPRAM, 0, 0x100); XPRAM[0x0c] = 0x4e; // "NuMc" signature XPRAM[0x0d] = 0x75; XPRAM[0x0e] = 0x4d; XPRAM[0x0f] = 0x63; XPRAM[0x01] = 0x80; // InternalWaitFlags = DynWait (don't wait for SCSI devices upon bootup) XPRAM[0x10] = 0xa8; // Standard PRAM values XPRAM[0x11] = 0x00; XPRAM[0x12] = 0x00; XPRAM[0x13] = 0x22; XPRAM[0x14] = 0xcc; XPRAM[0x15] = 0x0a; XPRAM[0x16] = 0xcc; XPRAM[0x17] = 0x0a; XPRAM[0x1c] = 0x00; XPRAM[0x1d] = 0x02; XPRAM[0x1e] = 0x63; XPRAM[0x1f] = 0x00; XPRAM[0x08] = 0x13; XPRAM[0x09] = 0x88; XPRAM[0x0a] = 0x00; XPRAM[0x0b] = 0xcc; XPRAM[0x76] = 0x00; // OSDefault = MacOS XPRAM[0x77] = 0x01; } // Set boot volume int16 i16 = PrefsFindInt32("bootdrive"); XPRAM[0x78] = i16 >> 8; XPRAM[0x79] = i16 & 0xff; i16 = PrefsFindInt32("bootdriver"); XPRAM[0x7a] = i16 >> 8; XPRAM[0x7b] = i16 & 0xff; // Init drivers SonyInit(); DiskInit(); CDROMInit(); SCSIInit(); #if SUPPORTS_EXTFS // Init external file system ExtFSInit(); #endif // Init serial ports SerialInit(); // Init network EtherInit(); // Init Time Manager TimerInit(); // Init clipboard ClipInit(); // Init ADB ADBInit(); // Init audio AudioInit(); // Init video if (!VideoInit(ROMVersion == ROM_VERSION_64K || ROMVersion == ROM_VERSION_PLUS || ROMVersion == ROM_VERSION_CLASSIC)) return false; // Set default video mode in XPRAM XPRAM[0x56] = 0x42; // 'B' XPRAM[0x57] = 0x32; // '2' const monitor_desc &main_monitor = *VideoMonitors[0]; XPRAM[0x58] = uint8(main_monitor.depth_to_apple_mode(main_monitor.get_current_mode().depth)); XPRAM[0x59] = 0; #if EMULATED_68K // Init 680x0 emulation (this also activates the memory system which is needed for PatchROM()) if (!Init680x0()) return false; #endif // Install ROM patches if (!PatchROM()) { ErrorAlert(STR_UNSUPPORTED_ROM_TYPE_ERR); return false; } #if ENABLE_MON // Initialize mon mon_init(); mon_read_byte = mon_read_byte_b2; mon_write_byte = mon_write_byte_b2; #endif return true; }
void main(void) { Int16 *samples; HANDLE FHandle = Not_Open_FILE; Int16 *out_words = &rawOutWords[1]; Uint8 *byte16 = &RfByte[2]; Int16 mlt_coefs[DCT_LENGTH]; Int16 mag_shift[2]; Int16 old_mag_shift[2]; Uint16 number_of_bits_per_frame; Uint16 number_of_bytes_per_frame; Uint16 number_of_16bit_words_per_frame; Int16 offset; Int16 key; Uint16 chn; // left and right channel, 0 or 1 Int16 sent_buffer_cnt = 0; Uint8 *sent_buffer; ICR = 0xff2e; /* IDLE Control Register */ /* mem port, io port and cpu idle active */ DSP_zero(xmt_l, DCT_LENGTH); DSP_zero(xmt_r, DCT_LENGTH); /* Peripheral_Reset */ CSL_SYSCTRL_REGS->PSRCR = 0x0020; CSL_SYSCTRL_REGS->PCGCR1 = 0x0000; CSL_SYSCTRL_REGS->PCGCR2 = 0x0000; CSL_SYSCTRL_REGS->PRCR = 0x00bf; CSL_SYSCTRL_REGS->EBSR = (CSL_SYS_EBSR_PPMODE_MODE1 << 12) | (0 << 8) | (2 << 10);//GPIO(11-6) asm(" bit(ST1, #ST1_INTM) = #1"); number_of_bits_per_frame = (Uint16)(BITRATE * 20); // BITRATE in kbps number_of_bytes_per_frame = (Uint16)(number_of_bits_per_frame>>3); number_of_16bit_words_per_frame = (Uint16)(number_of_bits_per_frame>>4); INTR_init(); PLL_init(); TIMER_init(); EZDSP5535_GPIO_init(); DMA_audio_init(DCT_LENGTH); EZDSP5535_I2C_init(); /* Initialize I2C */ aic3204_init(6); /* Initialize codec */ EZDSP5535_LCD_init(); EZDSP5535_I2S_init(); /* Initialize I2S */ LCD_print("G722.1 Send ", 17, 0); LCD_print("16kbps ", 8, 1); EZDSP5535_SPI_init(); Si446x_Init(); EZDSP5535_SAR_init(); DiskInit(); FileInit(); AddFileDriver(SDCammand, NULL); sam2coef_init(); coef2sam_init(); rawOutWords[0] = 0x6b21; RfByte[0] = 0x21; RfByte[1] = 0x6b; // little-endian old_mag_shift[0] = 0; old_mag_shift[1] = 0; asm(" bit(ST1, #ST1_INTM) = #0"); SpiWriteByte(CMD_GET_INT_STATUS, 0); // clear interrupt pending while(1) { if(pingpong >= 0) { offset = (pingpong>>1) * DCT_LENGTH; /******************************************************************* * LEFT LEFT LEFT LEFT LEFT LEFT LEFT LEFT LEFT LEFT LEFT LEFT *******************************************************************/ chn = LEFT; samples = &rcv_l[offset]; // Read frame of samples from mem. // Convert input samples to rmlt coefs mag_shift[chn] = samples_to_rmlt_coefs(samples, mlt_coefs, chn); // Encode the mlt coefs encoder(number_of_bits_per_frame, mlt_coefs, mag_shift[chn], out_words); byte16 = &RfByte[2]; byte16[-2] = 0x6b; byte16[-1] = 0x20; DSP_word2byte(byte16, out_words, number_of_16bit_words_per_frame); // process the out_words into decoder_mlt_coefs decoder(out_words, mlt_coefs, &mag_shift[chn], &old_mag_shift[chn]); samples = &xmt_l[offset]; // Write frame of output samples // convert the decoder_mlt_coefs to samples rmlt_coefs_to_samples(mlt_coefs, samples, mag_shift[chn], chn); /******************************************************************* * RIGHT RIGHT RIGHT RIGHT RIGHT RIGHT RIGHT RIGHT RIGHT RIGHT *******************************************************************/ chn = RIGHT; samples = &rcv_r[offset]; // Read frame of samples from mem. // Convert input samples to rmlt coefs mag_shift[chn] = samples_to_rmlt_coefs(samples, mlt_coefs, chn); // Encode the mlt coefs encoder(number_of_bits_per_frame, mlt_coefs, mag_shift[chn], out_words); byte16 = &RfByte[number_of_bytes_per_frame + 4]; byte16[-2] = 0x6b; byte16[-1] = 0x21; DSP_word2byte(byte16, out_words, number_of_16bit_words_per_frame); // process the out_words into decoder_mlt_coefs decoder(out_words, mlt_coefs, &mag_shift[chn], &old_mag_shift[chn]); samples = &xmt_r[offset]; // Write frame of output samples // convert the decoder_mlt_coefs to samples rmlt_coefs_to_samples(mlt_coefs, samples, mag_shift[chn], chn); if (FHandle != Not_Open_FILE) // Write output bitstream FileWrite(RfByte, 2*number_of_bytes_per_frame+4, FHandle); pingpong = -1; sent_buffer = RfByte; sent_buffer_cnt = 0; } if(spiIsrStatus == 1) { bApi_Set_Send(43); spiIsrStatus = 0; } if(sent_buffer_cnt < 2) { if(gpioIsrStatus == 1) { SPI_sendData(sent_buffer, number_of_bytes_per_frame+2); sent_buffer += number_of_bytes_per_frame+2; sent_buffer_cnt++; gpioIsrStatus = 0; CSL_GPIO_REGS->IOINTFLG1 = 0x0800; } } // key = EZDSP5535_SAR_getKey(); key = -1; if(key == SW1) if(FHandle == Not_Open_FILE) { LCD_print("RECORDING......", 15, 0); FHandle = FileOpen("A:\\VOICE000.TXT", FILE_FLAGS_WRITE); } if(key == SW2) if(FHandle != Not_Open_FILE) { LCD_print("SAVE VOICE000.DAT", 17, 0); FileClose(FHandle); AllCacheWriteBack(); FHandle = Not_Open_FILE; } asm(" idle"); }