Example #1
0
void
ata_start(struct ata_channel *ch)
{
#ifdef NATADISK
    struct ad_request *ad_request; 
#endif
#if DEV_ATAPIALL
    struct atapi_request *atapi_request;
#endif
    int s;

    if (!ATA_LOCK_CH(ch, ATA_ACTIVE))
	return;

    s = splbio();
#if NATADISK > 0
    /* find & call the responsible driver if anything on the ATA queue */
    if (TAILQ_EMPTY(&ch->ata_queue)) {
	if (ch->devices & (ATA_ATA_MASTER) && ch->device[MASTER].driver)
	    ad_start(&ch->device[MASTER]);
	if (ch->devices & (ATA_ATA_SLAVE) && ch->device[SLAVE].driver)
	    ad_start(&ch->device[SLAVE]);
    }
    if ((ad_request = TAILQ_FIRST(&ch->ata_queue))) {
	TAILQ_REMOVE(&ch->ata_queue, ad_request, chain);
	ch->active = ATA_ACTIVE_ATA;
	ch->running = ad_request;
	if (ad_transfer(ad_request) == ATA_OP_CONTINUES) {
	    splx(s);
	    return;
	}
    }

#endif
#if DEV_ATAPIALL
    /* find & call the responsible driver if anything on the ATAPI queue */
    if (TAILQ_EMPTY(&ch->atapi_queue)) {
	if (ch->devices & (ATA_ATAPI_MASTER) && ch->device[MASTER].driver)
	    atapi_start(&ch->device[MASTER]);
	if (ch->devices & (ATA_ATAPI_SLAVE) && ch->device[SLAVE].driver)
	    atapi_start(&ch->device[SLAVE]);
    }
    if ((atapi_request = TAILQ_FIRST(&ch->atapi_queue))) {
	TAILQ_REMOVE(&ch->atapi_queue, atapi_request, chain);
	ch->active = ATA_ACTIVE_ATAPI;
	ch->running = atapi_request;
	if (atapi_transfer(atapi_request) == ATA_OP_CONTINUES) {
	    splx(s);
	    return;
	}
    }
#endif
    ATA_UNLOCK_CH(ch);
    splx(s);
}
Example #2
0
void sample_replay(int mode)
     /* 録音または再生を行う関数 */
     /*   mode: PLAY, SAMPLE     */
{
   bufptr = 0;                             /* バッファポインタを初期化  */
	 if (mode == PLAY){                      /* 再生モードの処理 */
    /* ここにスピーカをスピーカとして使用する命令 */
    speaker_switch(SPEAKER);
    lcd_init();
		lcd_cursor(0,0);
		lcd_printstr(" Push * or # key");
		lcd_cursor(0,1);
		lcd_printstr(" Now Playing... ");
		
    /* 音声出力処理内容を記述する */
    while(bufptr <= TIME){            /*   データ出力を繰り返す    */
			da_out( 0, databuf[bufptr]);    /* ◎D/Aにデータを出力    */
			bufptr++;                       /* ◎バッファポインタを +1   */
    }   
  }
  if (mode == INVERSE){                    /* 再生モードの処理 */
    /* ここにスピーカをスピーカとして使用する命令 */
    speaker_switch(SPEAKER);
    lcd_init();
		lcd_cursor(0,0);
		lcd_printstr(" Push * or 5 key");
		lcd_cursor(0,1);
		lcd_printstr(" Now Inverse... ");
		
    /* 音声出力処理内容を記述する */
    while(bufptr <= TIME){             /*   データ出力を繰り返す    */
			da_out( 0, databuf[TIME-bufptr]);/* ◎D/Aにデータを出力    */
			bufptr++;                        /* ◎バッファポインタを +1   */
    }   
  }
  if (mode == SAMPLE){                              /* 録音モードの処理 */
    /* ここにスピーカをマイクとして使用する命令 */
    speaker_switch(MIC);
		lcd_init();
		lcd_cursor(0,0);
		lcd_printstr(" Push * or 5 key");
		lcd_cursor(0,1);
		lcd_printstr(" Now Sampling...");
		
    /* 音声取込処理内容を記述する */
    while(bufptr <= TIME){          /*   データ読込を繰り返す     */
			ad_start( 0, 0);              /* ◎A/D変換スタート       */
			while(ADSTATUS() == 0);			  /* ◎A/D変換終了待ち 約5us */
			databuf[bufptr] = ADREAD();	  /* ◎変換データを格納     */
			bufptr++;										  /* ◎バッファポインタを +1    */
    }
  }
  speaker_switch(MIC);      /* スピーカーオフ   */
}
Example #3
0
unsigned char key_scan(void){

	key_value = ad_start();	//read ad value

	if(key_value > 220) return KEY_NONE;
	
	else if((key_value > 190)&&(key_value <210)) return KEY_OUT_EN;

	else if((key_value > 150)&&(key_value <170)) return KEY_OUT_48V;

	else if((key_value > 110)&&(key_value <130)) return KEY_OUT_96V;

	else if((key_value > 40)&&(key_value  <60)) return KEY_OUT_144V;

	else if( key_value < 20) return KEY_OUT_192V;

}
Example #4
0
File: i8x9x.c Project: opicron/mame
void i8x9x_device::io_w8(UINT8 adr, UINT8 data)
{
	switch(adr) {
	case 0x02:
		ad_command = data;
		if(ad_command & 8)
			ad_start(get_cycle());
		break;
	case 0x03:
		logerror("%s: hsi_mode %02x (%04x)\n", tag(), data, PPC);
		break;
	case 0x04:
		hso_time = (hso_time & 0xff00) | data;
		break;
	case 0x05:
		hso_time = (hso_time & 0x00ff) | (data << 8);
		commit_hso_cam();
		break;
	case 0x06:
		hso_command = data;
		break;
	case 0x07:
		logerror("%s: sbuf %02x (%04x)\n", tag(), data, PPC);
		serial_send(data);
		break;
	case 0x08:
		PSW = (PSW & 0xff00) | data;
		check_irq();
		break;
	case 0x09:
		pending_irq = data;
		logerror("%s: int_pending %02x (%04x)\n", tag(), data, PPC);
		break;
	case 0x0a:
		logerror("%s: watchdog %02x (%04x)\n", tag(), data, PPC);
		break;
	case 0x0e:
		logerror("%s: baud rate %02x (%04x)\n", tag(), data, PPC);
		break;
	case 0x0f:
		logerror("%s: io port 1 %02x (%04x)\n", tag(), data, PPC);
		io->write_word(P1*2, data);
		break;
	case 0x10:
		logerror("%s: io port 2 %02x (%04x)\n", tag(), data, PPC);
		io->write_word(P2*2, data);
		break;
	case 0x11:
		logerror("%s: sp con %02x (%04x)\n", tag(), data, PPC);
		break;
	case 0x15:
		logerror("%s: ioc0 %02x (%04x)\n", tag(), data, PPC);
		ioc0 = data;
		break;
	case 0x16:
		logerror("%s: ioc1 %02x (%04x)\n", tag(), data, PPC);
		ioc1 = data;
		break;
	case 0x17:
		logerror("%s: pwm control %02x (%04x)\n", tag(), data, PPC);
		break;
	}
	return;
}