亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? floppy.c

?? minix3的源碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
 * opcode.  This routine sets up the DMA chip.  Note that the chip is not * capable of doing a DMA across a 64K boundary (e.g., you can't read a * 512-byte block starting at physical address 65520). * * Warning! Also note that it's not possible to do DMA above 16 MB because  * the ISA bus uses 24-bit addresses. Addresses above 16 MB therefore will  * be interpreted modulo 16 MB, dangerously overwriting arbitrary memory.  * A check here denies the I/O if the address is out of range.  */  pvb_pair_t byte_out[9];  int s;  /* First check the DMA memory address not to exceed maximum. */  if (tmp_phys != (tmp_phys & DMA_ADDR_MASK)) {	report("FLOPPY", "DMA denied because address out of range", NO_NUM);	return(EIO);  }  /* Set up the DMA registers.  (The comment on the reset is a bit strong,   * it probably only resets the floppy channel.)   */  pv_set(byte_out[0], DMA_INIT, DMA_RESET_VAL);	/* reset the dma controller */  pv_set(byte_out[1], DMA_FLIPFLOP, 0);		/* write anything to reset it */  pv_set(byte_out[2], DMA_MODE, opcode == DEV_SCATTER ? DMA_WRITE : DMA_READ);  pv_set(byte_out[3], DMA_ADDR, (unsigned) tmp_phys >>  0);  pv_set(byte_out[4], DMA_ADDR, (unsigned) tmp_phys >>  8);  pv_set(byte_out[5], DMA_TOP, (unsigned) (tmp_phys >> 16));  pv_set(byte_out[6], DMA_COUNT, (((SECTOR_SIZE - 1) >> 0) & 0xff));  pv_set(byte_out[7], DMA_COUNT, (SECTOR_SIZE - 1) >> 8);  pv_set(byte_out[8], DMA_INIT, 2);		/* some sort of enable */  if ((s=sys_voutb(byte_out, 9)) != OK)  	panic("FLOPPY","Sys_voutb in dma_setup() failed", s);  return(OK);}/*===========================================================================* *				start_motor				     * *===========================================================================*/PRIVATE void start_motor(){/* Control of the floppy disk motors is a big pain.  If a motor is off, you * have to turn it on first, which takes 1/2 second.  You can't leave it on * all the time, since that would wear out the diskette.  However, if you turn * the motor off after each operation, the system performance will be awful. * The compromise used here is to leave it on for a few seconds after each * operation.  If a new operation is started in that interval, it need not be * turned on again.  If no new operation is started, a timer goes off and the * motor is turned off.  I/O port DOR has bits to control each of 4 drives. */  int s, motor_bit, running;  message mess;  motor_bit = 1 << f_drive;		/* bit mask for this drive */  running = motor_status & motor_bit;	/* nonzero if this motor is running */  motor_status |= motor_bit;		/* want this drive running too */  if ((s=sys_outb(DOR,  		(motor_status << MOTOR_SHIFT) | ENABLE_INT | f_drive)) != OK)	panic("FLOPPY","Sys_outb in start_motor() failed", s);  /* If the motor was already running, we don't have to wait for it. */  if (running) return;			/* motor was already running */  /* Set an alarm timer to force a timeout if the hardware does not interrupt   * in time. Expect HARD_INT message, but check for SYN_ALARM timeout.   */   f_set_timer(&f_tmr_timeout, f_dp->start, f_timeout);  f_busy = BSY_IO;  do {  	receive(ANY, &mess);   	if (mess.m_type == SYN_ALARM) {   		f_expire_tmrs(NULL, NULL);	} else if(mess.m_type == DEV_PING) {		notify(mess.m_source);  	} else {  		f_busy = BSY_IDLE;  	}  } while (f_busy == BSY_IO);  f_fp->fl_sector = NO_SECTOR;}/*===========================================================================* *				stop_motor				     * *===========================================================================*/PRIVATE void stop_motor(tp)timer_t *tp;{/* This routine is called from an alarm timer after several seconds have * elapsed with no floppy disk activity.  It turns the drive motor off. */  int s;  motor_status &= ~(1 << tmr_arg(tp)->ta_int);  if ((s=sys_outb(DOR, (motor_status << MOTOR_SHIFT) | ENABLE_INT)) != OK)	panic("FLOPPY","Sys_outb in stop_motor() failed", s);}/*===========================================================================* *				floppy_stop				     * *===========================================================================*/PRIVATE void floppy_stop(struct driver *dp, message *m_ptr){/* Stop all activity and cleanly exit with the system. */  int s;  sigset_t sigset = m_ptr->NOTIFY_ARG;  if (sigismember(&sigset, SIGTERM) || sigismember(&sigset, SIGKSTOP)) {      if ((s=sys_outb(DOR, ENABLE_INT)) != OK)		panic("FLOPPY","Sys_outb in floppy_stop() failed", s);      exit(0);	  }}/*===========================================================================* *				seek					     * *===========================================================================*/PRIVATE int seek(){/* Issue a SEEK command on the indicated drive unless the arm is already * positioned on the correct cylinder. */  struct floppy *fp = f_fp;  int r;  message mess;  u8_t cmd[3];  /* Are we already on the correct cylinder? */  if (fp->fl_calibration == UNCALIBRATED)	if (recalibrate() != OK) return(ERR_SEEK);  if (fp->fl_curcyl == fp->fl_hardcyl) return(OK);  /* No.  Wrong cylinder.  Issue a SEEK and wait for interrupt. */  cmd[0] = FDC_SEEK;  cmd[1] = (fp->fl_head << 2) | f_drive;  cmd[2] = fp->fl_hardcyl;  if (fdc_command(cmd, 3) != OK) return(ERR_SEEK);  if (f_intr_wait() != OK) return(ERR_TIMEOUT);  /* Interrupt has been received.  Check drive status. */  fdc_out(FDC_SENSE);		/* probe FDC to make it return status */  r = fdc_results();		/* get controller status bytes */  if (r != OK || (f_results[ST0] & ST0_BITS_SEEK) != SEEK_ST0				|| f_results[ST1] != fp->fl_hardcyl) {	/* seek failed, may need a recalibrate */	return(ERR_SEEK);  }  /* Give head time to settle on a format, no retrying here! */  if (f_device & FORMAT_DEV_BIT) {	/* Set a synchronous alarm to force a timeout if the hardware does	 * not interrupt. Expect HARD_INT, but check for SYN_ALARM timeout. 	 */  	f_set_timer(&f_tmr_timeout, HZ/30, f_timeout);	f_busy = BSY_IO;  	do {  		receive(ANY, &mess);   		if (mess.m_type == SYN_ALARM) {   			f_expire_tmrs(NULL, NULL);		} else if(mess.m_type == DEV_PING) {			notify(mess.m_source);  		} else {  			f_busy = BSY_IDLE;  		}  	} while (f_busy == BSY_IO);  }  fp->fl_curcyl = fp->fl_hardcyl;  fp->fl_sector = NO_SECTOR;  return(OK);}/*===========================================================================* *				fdc_transfer				     * *===========================================================================*/PRIVATE int fdc_transfer(opcode)int opcode;			/* DEV_GATHER or DEV_SCATTER */{/* The drive is now on the proper cylinder.  Read, write or format 1 block. */  struct floppy *fp = f_fp;  int r, s;  u8_t cmd[9];  /* Never attempt a transfer if the drive is uncalibrated or motor is off. */  if (fp->fl_calibration == UNCALIBRATED) return(ERR_TRANSFER);  if ((motor_status & (1 << f_drive)) == 0) return(ERR_TRANSFER);  /* The command is issued by outputting several bytes to the controller chip.   */  if (f_device & FORMAT_DEV_BIT) {	cmd[0] = FDC_FORMAT;	cmd[1] = (fp->fl_head << 2) | f_drive;	cmd[2] = fmt_param.sector_size_code;	cmd[3] = fmt_param.sectors_per_cylinder;	cmd[4] = fmt_param.gap_length_for_format;	cmd[5] = fmt_param.fill_byte_for_format;	if (fdc_command(cmd, 6) != OK) return(ERR_TRANSFER);  } else {	cmd[0] = opcode == DEV_SCATTER ? FDC_WRITE : FDC_READ;	cmd[1] = (fp->fl_head << 2) | f_drive;	cmd[2] = fp->fl_cylinder;	cmd[3] = fp->fl_head;	cmd[4] = BASE_SECTOR + fp->fl_sector;	cmd[5] = SECTOR_SIZE_CODE;	cmd[6] = f_sectors;	cmd[7] = f_dp->gap;	/* sector gap */	cmd[8] = DTL;		/* data length */	if (fdc_command(cmd, 9) != OK) return(ERR_TRANSFER);  }  /* Block, waiting for disk interrupt. */  if (f_intr_wait() != OK) {	printf("%s: disk interrupt timed out.\n", f_name());  	return(ERR_TIMEOUT);  }  /* Get controller status and check for errors. */  r = fdc_results();  if (r != OK) return(r);  if (f_results[ST1] & WRITE_PROTECT) {	printf("%s: diskette is write protected.\n", f_name());	return(ERR_WR_PROTECT);  }  if ((f_results[ST0] & ST0_BITS_TRANS) != TRANS_ST0) return(ERR_TRANSFER);  if (f_results[ST1] | f_results[ST2]) return(ERR_TRANSFER);  if (f_device & FORMAT_DEV_BIT) return(OK);  /* Compare actual numbers of sectors transferred with expected number. */  s =  (f_results[ST_CYL] - fp->fl_cylinder) * NR_HEADS * f_sectors;  s += (f_results[ST_HEAD] - fp->fl_head) * f_sectors;  s += (f_results[ST_SEC] - BASE_SECTOR - fp->fl_sector);  if (s != 1) return(ERR_TRANSFER);  /* This sector is next for I/O: */  fp->fl_sector = f_results[ST_SEC] - BASE_SECTOR;#if 0  if (processor < 386) fp->fl_sector++;		/* Old CPU can't keep up. */#endif  return(OK);}/*===========================================================================* *				fdc_results				     * *===========================================================================*/PRIVATE int fdc_results(){/* Extract results from the controller after an operation, then allow floppy * interrupts again. */  int s, result_nr, status;  clock_t t0,t1;  /* Extract bytes from FDC until it says it has no more.  The loop is   * really an outer loop on result_nr and an inner loop on status.    * A timeout flag alarm is set.   */  result_nr = 0;  getuptime(&t0);  do {	/* Reading one byte is almost a mirror of fdc_out() - the DIRECTION	 * bit must be set instead of clear, but the CTL_BUSY bit destroys	 * the perfection of the mirror.	 */	if ((s=sys_inb(FDC_STATUS, &status)) != OK)		panic("FLOPPY","Sys_inb in fdc_results() failed", s);	status &= (MASTER | DIRECTION | CTL_BUSY);	if (status == (MASTER | DIRECTION | CTL_BUSY)) {		if (result_nr >= MAX_RESULTS) break;	/* too many results */		if ((s=sys_inb(FDC_DATA, &f_results[result_nr])) != OK)		   panic("FLOPPY","Sys_inb in fdc_results() failed", s);		result_nr ++;		continue;	}	if (status == MASTER) {			/* all read */		if ((s=sys_irqenable(&irq_hook_id)) != OK)			panic("FLOPPY", "Couldn't enable IRQs", s);		return(OK);			/* only good exit */	}  } while ( (s=getuptime(&t1))==OK && (t1-t0) < TIMEOUT_TICKS );  if (OK!=s) printf("FLOPPY: warning, getuptime failed: %d\n", s);   need_reset = TRUE;		/* controller chip must be reset */  if ((s=sys_irqenable(&irq_hook_id)) != OK)	panic("FLOPPY", "Couldn't enable IRQs", s);  return(ERR_STATUS);}/*===========================================================================* *				fdc_command				     * *===========================================================================*/PRIVATE int fdc_command(cmd, len)u8_t *cmd;		/* command bytes */int len;		/* command length */{/* Output a command to the controller. */  /* Set a synchronous alarm to force a timeout if the hardware does   * not interrupt. Expect HARD_INT, but check for SYN_ALARM timeout.   * Note that the actual check is done by the code that issued the   * fdc_command() call.   */   f_set_timer(&f_tmr_timeout, WAKEUP, f_timeout);  f_busy = BSY_IO;  while (len > 0) {	fdc_out(*cmd++);	len--;  }  return(need_reset ? ERR_DRIVE : OK);}/*===========================================================================* *				fdc_out					     * *===========================================================================*/PRIVATE void fdc_out(val)int val;		/* write this byte to floppy disk controller */{/* Output a byte to the controller.  This is not entirely trivial, since you * can only write to it when it is listening, and it decides when to listen.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级日韩一级| 中文字幕在线一区| 国产午夜精品理论片a级大结局| 国产精品私人自拍| 日韩精品91亚洲二区在线观看| 成人视屏免费看| 日韩欧美卡一卡二| 亚洲午夜激情av| 从欧美一区二区三区| 欧美日韩精品一区二区三区| 国产精品美女久久福利网站| 久久国产生活片100| 欧美日韩在线播放一区| 1000部国产精品成人观看| 国产乱对白刺激视频不卡| 欧美日韩亚洲国产综合| 国产精品青草综合久久久久99| 日本美女一区二区| 91成人网在线| 日韩一区在线免费观看| 国产成人精品综合在线观看| 精品久久久久久久久久久久久久久| 亚洲一区二区三区美女| 色哟哟在线观看一区二区三区| 国产日韩成人精品| 国产在线视频不卡二| 日韩欧美电影一区| 免费观看一级欧美片| 欧美浪妇xxxx高跟鞋交| 亚洲午夜电影在线观看| 欧美日韩中文字幕一区| 一区二区成人在线视频| 欧美性猛片aaaaaaa做受| 亚洲精品高清在线| 欧美亚日韩国产aⅴ精品中极品| 亚洲人午夜精品天堂一二香蕉| 成人av免费在线观看| 中文字幕亚洲视频| 色综合久久天天| 一区二区不卡在线播放 | 日韩一区精品视频| 欧美日韩国产另类不卡| 亚洲国产成人91porn| 欧美另类videos死尸| 奇米精品一区二区三区在线观看 | 六月婷婷色综合| 日韩一区二区三区免费看| 秋霞午夜鲁丝一区二区老狼| 日韩一区二区三区四区| 国产乱码精品一区二区三区av| 久久精子c满五个校花| 国产a区久久久| 亚洲欧洲中文日韩久久av乱码| 一本色道a无线码一区v| 日韩有码一区二区三区| 久久这里只有精品首页| 成人免费av网站| 亚洲国产一二三| 精品欧美乱码久久久久久1区2区| 国产精品一品二品| 一区二区三区四区精品在线视频| 欧美日韩一区视频| 国产高清不卡一区| 一区二区三国产精华液| 日韩欧美中文字幕制服| 菠萝蜜视频在线观看一区| 夜夜操天天操亚洲| 日韩视频在线你懂得| av在线不卡电影| 肉色丝袜一区二区| 中文字幕高清一区| 欧美一级高清片| 成人avav影音| 久久精品国产精品亚洲精品| 亚洲视频图片小说| 日韩欧美一二区| 91老师国产黑色丝袜在线| 理论片日本一区| 亚洲综合视频在线| 中文字幕免费不卡| 欧美日韩国产综合视频在线观看| 国产精品一区2区| 日韩国产一二三区| 亚洲免费观看高清| 久久久久久97三级| 3751色影院一区二区三区| 成人黄色av电影| 久国产精品韩国三级视频| 亚洲国产成人av网| 《视频一区视频二区| 2023国产精品视频| 欧美一区二区视频在线观看 | 免费看精品久久片| 亚洲一区日韩精品中文字幕| 国产人成一区二区三区影院| 欧美一级日韩不卡播放免费| 欧美又粗又大又爽| www.欧美精品一二区| 国产一区二区三区四区五区入口 | 久久不见久久见免费视频7| 亚洲黄色av一区| 国产精品嫩草影院av蜜臀| 精品sm捆绑视频| 日韩一区国产二区欧美三区| 91国产丝袜在线播放| 99久久精品国产网站| 大陆成人av片| 成人激情小说乱人伦| 国产伦精品一区二区三区在线观看 | 欧美精品丝袜中出| 欧美视频在线一区| 欧美日韩国产高清一区| 91官网在线免费观看| 欧美怡红院视频| 欧美亚男人的天堂| 欧美日韩另类国产亚洲欧美一级| 91麻豆swag| 欧美无砖砖区免费| 欧美午夜电影一区| 911国产精品| 日韩一级在线观看| 久久美女高清视频| 欧美激情艳妇裸体舞| 国产精品情趣视频| 又紧又大又爽精品一区二区| 亚洲在线成人精品| 日韩精品午夜视频| 久久电影网站中文字幕| 国产福利一区二区| 成人18精品视频| 色噜噜狠狠成人中文综合| 欧美日韩在线免费视频| 欧美一区二区观看视频| 久久精品网站免费观看| 国产精品久久久久影视| 一区二区三区色| 美女在线视频一区| 国产激情视频一区二区三区欧美| 成人理论电影网| 欧美亚男人的天堂| 精品奇米国产一区二区三区| 国产精品妹子av| 亚洲国产视频直播| 精品一二线国产| 91视频精品在这里| 欧美电影免费观看高清完整版在线 | 亚洲一区二区三区三| 蜜桃久久久久久| 不卡av电影在线播放| 欧美老年两性高潮| 亚洲国产精品国自产拍av| 亚洲成人你懂的| 国产精品自拍av| 欧美视频一区二区三区在线观看 | 另类成人小视频在线| 国产精品一区久久久久| 色一情一乱一乱一91av| 欧美一个色资源| 亚洲欧美成aⅴ人在线观看| 久久激情综合网| 99国产一区二区三精品乱码| 欧美精选一区二区| 国产精品久久久久一区二区三区| 亚洲成人7777| 成人av在线播放网站| 日韩精品一区二区三区视频播放| 亚洲丝袜另类动漫二区| 黄色精品一二区| 欧美乱妇一区二区三区不卡视频 | 51精品久久久久久久蜜臀| 中文字幕一区免费在线观看| 美女视频黄免费的久久| 一本色道久久综合亚洲91| 国产亚洲成av人在线观看导航| 婷婷开心激情综合| 在线观看日韩高清av| 国产精品乱子久久久久| 国产精品亚洲一区二区三区妖精| 欧美美女喷水视频| 亚洲人成伊人成综合网小说| 国产成人免费视| 欧美videossexotv100| 亚洲一二三区在线观看| 91香蕉国产在线观看软件| 久久精品夜色噜噜亚洲aⅴ| 美国毛片一区二区三区| 欧美日韩国产免费一区二区| 一区二区三区在线影院| 9人人澡人人爽人人精品| 亚洲国产精品av| 丰满少妇久久久久久久 | 欧美丰满美乳xxx高潮www| 日韩美女视频一区二区| 99re66热这里只有精品3直播| 欧美国产日韩一二三区| 国产成人免费网站| 国产性天天综合网| 国产suv一区二区三区88区| 久久精品欧美一区二区三区不卡| 久久成人18免费观看|