void loadkernel(){ Init8259(); Setinterrupt(0x26,FloppyIntHandler); Setinterrupt(0x2e,HdIntHandler); outp(0x21,inp(0x21)&0xfb); //允许从片中断 outp(0xa1,inp(0xa1)&0xbf); //开启硬盘中断 sti(); initfs(); filedes file; if(file_open(&file,"chouryos",O_RDWR)<0){ putstring("Can't find kernel!\n"); }else{ file_read(&file,(void *)KernelLocation,0xffffffff); file_close(&file); kernel(); } }
static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec) { void *oldpile; unsigned long buffer; unsigned char mode; /* Set replay tracks */ if (cookie_snd & SND_16BIT) { Settracks(0,0); Setmontracks(0); } oldpile=(void *)Super(0); /* Stop currently playing sound */ DMAAUDIO_IO.control=0; /* Set buffer */ buffer = (unsigned long) SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; DMAAUDIO_IO.start_high = (buffer>>16) & 255; DMAAUDIO_IO.start_mid = (buffer>>8) & 255; DMAAUDIO_IO.start_low = buffer & 255; buffer += SDL_MintAudio_audiosize; DMAAUDIO_IO.end_high = (buffer>>16) & 255; DMAAUDIO_IO.end_mid = (buffer>>8) & 255; DMAAUDIO_IO.end_low = buffer & 255; mode = 3-MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor; if (spec->channels==1) { mode |= 1<<7; } DMAAUDIO_IO.sound_ctrl = mode; /* Set interrupt */ Jdisint(MFP_DMASOUND); Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt); Jenabint(MFP_DMASOUND); if (cookie_snd & SND_16BIT) { if (Setinterrupt(SI_TIMERA, SI_PLAY)<0) { DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n")); } } /* Go */ DMAAUDIO_IO.control = 3; /* playback + repeat */ Super(oldpile); }
static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec) { int channels_mode, prediv; void *buffer; SDL_MintAudio_quit_thread = SDL_FALSE; SDL_MintAudio_thread_finished = SDL_TRUE; SDL_MintAudio_WaitThread(); Buffoper(0); Settracks(0,0); Setmontracks(0); channels_mode=STEREO16; switch (spec->format & 0xff) { case 8: if (spec->channels==2) { channels_mode=STEREO8; } else { channels_mode=MONO8; } break; } if (Setmode(channels_mode)<0) { DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n")); } prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor; if (MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits != -1) { Gpio(GPIO_SET,7); Gpio(GPIO_WRITE, MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits); Devconnect2(DMAPLAY, DAC|EXTOUT, CLKEXT, prediv); } else { Devconnect2(DMAPLAY, DAC, CLK25M, prediv); } buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; if (Setbuffer(0, buffer, buffer + spec->size)<0) { DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n")); } if (SDL_MintAudio_mint_present) { SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0); } else { Jdisint(MFP_DMASOUND); Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt); Jenabint(MFP_DMASOUND); if (Setinterrupt(SI_TIMERA, SI_PLAY)<0) { DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n")); } } Buffoper(SB_PLA_ENA|SB_PLA_RPT); DEBUG_PRINT((DEBUG_NAME "hardware initialized\n")); }
static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec) { int channels_mode, dmaclock, prediv; void *buffer; /* Stop currently playing sound */ SDL_MintAudio_quit_thread = SDL_FALSE; SDL_MintAudio_thread_finished = SDL_TRUE; SDL_MintAudio_WaitThread(); Buffoper(0); /* Set replay tracks */ Settracks(0,0); Setmontracks(0); /* Select replay format */ channels_mode=STEREO16; switch (spec->format & 0xff) { case 8: if (spec->channels==2) { channels_mode=STEREO8; } else { channels_mode=MONO8; } break; } if (Setmode(channels_mode)<0) { DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n")); } dmaclock = MINTAUDIO_frequencies[MINTAUDIO_numfreq].masterclock; prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor; if (MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits != -1) { Gpio(GPIO_SET,7); /* DSP port gpio outputs */ Gpio(GPIO_WRITE, MINTAUDIO_frequencies[MINTAUDIO_numfreq].gpio_bits); Devconnect2(DMAPLAY, DAC|EXTOUT, CLKEXT, prediv); } else { Devconnect2(DMAPLAY, DAC, CLK25M, prediv); } /* Set buffer */ buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; if (Setbuffer(0, buffer, buffer + spec->size)<0) { DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n")); } if (SDL_MintAudio_mint_present) { SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0); } else { /* Install interrupt */ Jdisint(MFP_DMASOUND); /*Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt);*/ Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt); Jenabint(MFP_DMASOUND); if (Setinterrupt(SI_TIMERA, SI_PLAY)<0) { DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n")); } } /* Go */ Buffoper(SB_PLA_ENA|SB_PLA_RPT); DEBUG_PRINT((DEBUG_NAME "hardware initialized\n")); }