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

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

?? cdu31a.c

?? LINUX1.0源代碼,代碼條理清晰
?? C
?? 第 1 頁 / 共 4 頁
字號:
    * how many more status bytes are coming.
    *
    * The result register can be read 10 bytes at a time, a wait for
    * result ready to be asserted must be done between every 10 bytes.
    */
   if ((a & 0xf0) != 0x20)
   {
      if (b > 8)
      {
         for (i=0; i<8; i++)
         {
            *result_buffer = read_result_register();
            result_buffer++;
            (*result_size)++;
         }
         b = b - 8;

         while (b > 10)
         {
            retry_count = SONY_READY_RETRIES;
            while ((retry_count > 0) && (!is_result_ready()))
            {
               retry_count--;
            }
            if (!is_result_ready())
            {
               result_buffer[0] = 0x20;
               result_buffer[1] = SONY_TIMEOUT_OP_ERR;
               *result_size = 2;
               return;
            }

            clear_result_ready();
                                
            for (i=0; i<10; i++)
            {
               *result_buffer = read_result_register();
               result_buffer++;
               (*result_size)++;
            }
            b = b - 10;
         }

         if (b > 0)
         {
            retry_count = SONY_READY_RETRIES;
            while ((retry_count > 0) && (!is_result_ready()))
            {
               retry_count--;
            }
            if (!is_result_ready())
            {
               result_buffer[0] = 0x20;
               result_buffer[1] = SONY_TIMEOUT_OP_ERR;
               *result_size = 2;
               return;
            }
         }
      }

      while (b > 0)
      {
         *result_buffer = read_result_register();
         result_buffer++;
         (*result_size)++;
         b--;
      }
   }
}

/*
 * Read in a 2048 byte block of data.
 */
static void
read_data_block(unsigned char *data,
                unsigned char *result_buffer,
                unsigned int  *result_size)
{
   int i;
   unsigned int retry_count;

   for (i=0; i<2048; i++)
   {
      retry_count = jiffies + SONY_JIFFIES_TIMEOUT;
      while ((retry_count > jiffies) && (!is_data_requested()))
      {
         while (handle_sony_cd_attention())
            ;
         
         sony_sleep();
      }
      if (!is_data_requested())
      {
         result_buffer[0] = 0x20;
         result_buffer[1] = SONY_TIMEOUT_OP_ERR;
         *result_size = 2;
         return;
      }
      
      *data = read_data_register();
      data++;
   }
}

/*
 * This routine issues a read data command and gets the data.  I don't
 * really like the way this is done (I would prefer for do_sony_cmd() to
 * handle it automatically) but I found that the drive returns status
 * when it finishes reading (not when the host has read all the data)
 * or after it gets an error.  This means that the status can be
 * received at any time and should be handled immediately (at least
 * between every 2048 byte block) to check for errors, we can't wait
 * until all the data is read.
 *
 * This routine returns the total number of sectors read.  It will
 * not return an error if it reads at least one sector successfully.
 */
static unsigned int
get_data(unsigned char *orig_data,
         unsigned char *params,         /* 6 bytes with the MSF start address
                                           and number of sectors to read. */
         unsigned int orig_data_size,
         unsigned char *result_buffer,
         unsigned int *result_size)
{
   unsigned int cur_offset;
   unsigned int retry_count;
   int result_read;
   int num_retries;
   unsigned int num_sectors_read = 0;
   unsigned char *data = orig_data;
   unsigned int data_size = orig_data_size;


   cli();
   while (sony_inuse)
   {
      interruptible_sleep_on(&sony_wait);
      if (current->signal & ~current->blocked)
      {
         result_buffer[0] = 0x20;
         result_buffer[1] = SONY_SIGNAL_OP_ERR;
         *result_size = 2;
         return 0;
      }
   }
   sony_inuse = 1;
   has_cd_task = current;
   sti();

   num_retries = 0;
retry_data_operation:
   result_buffer[0] = 0;
   result_buffer[1] = 0;

   /*
    * Clear any outstanding attentions and wait for the drive to
    * complete any pending operations.
    */
   while (handle_sony_cd_attention())
      ;

   retry_count = jiffies + SONY_JIFFIES_TIMEOUT;
   while ((retry_count > jiffies) && (is_busy()))
   {
      sony_sleep();
      
      while (handle_sony_cd_attention())
         ;
   }

   if (is_busy())
   {
      result_buffer[0] = 0x20;
      result_buffer[1] = SONY_TIMEOUT_OP_ERR;
      *result_size = 2;
   }
   else
   {
      /* Issue the command */
      clear_result_ready();
      clear_param_reg();

      write_params(params, 6);
      write_cmd(SONY_READ_CMD);

      /*
       * Read the data from the drive one 2048 byte sector at a time.  Handle
       * any results received between sectors, if an error result is returned
       * terminate the operation immediately.
       */
      cur_offset = 0;
      result_read = 0;
      while ((data_size > 0) && (result_buffer[0] == 0))
      {
         /* Wait for the drive to tell us we have something */
         retry_count = jiffies + SONY_JIFFIES_TIMEOUT;
         while ((retry_count > jiffies) && (!(is_result_ready() || is_data_ready())))
         {
            while (handle_sony_cd_attention())
               ;

            sony_sleep();
         }
         if (!(is_result_ready() || is_data_ready()))
         {
            result_buffer[0] = 0x20;
            result_buffer[1] = SONY_TIMEOUT_OP_ERR;
            *result_size = 2;
         }
      
         /* Handle results first */
         else if (is_result_ready())
         {
            result_read = 1;
            get_result(result_buffer, result_size);
         }
         else /* Handle data next */
         {
            /*
             * The drive has to be polled for status on a byte-by-byte basis
             * to know if the data is ready.  Yuck.  I really wish I could use DMA.
             */
            clear_data_ready();
            read_data_block(data, result_buffer, result_size);
            data += 2048;
            data_size -= 2048;
            cur_offset = cur_offset + 2048;
            num_sectors_read++;
         }
      }

      /* Make sure the result has been read */
      if (!result_read)
      {
         get_result(result_buffer, result_size);
      }
   }

   if (   ((result_buffer[0] & 0x20) == 0x20)
       && (result_buffer[1] != SONY_NOT_SPIN_ERR) /* No retry when not spin */
       && (num_retries < MAX_CDU31A_RETRIES))
   {
      /*
       * If an error occurs, go back and only read one sector at the
       * given location.  Hopefully the error occurred on an unused
       * sector after the first one.  It is hard to say which sector
       * the error occurred on because the drive returns status before
       * the data transfer is finished and doesn't say which sector.
       */
      data_size = 2048;
      data = orig_data;
      num_sectors_read = 0;
      size_to_buf(1, &params[3]);

      num_retries++;
      /* Issue a reset on an error (the second time), othersize just delay */
      if (num_retries == 2)
      {
         restart_on_error();
      }
      else
      {
         current->state = TASK_INTERRUPTIBLE;
         current->timeout = jiffies + 10;
         schedule();
      }

      /* Restart the operation. */
      goto retry_data_operation;
   }

   has_cd_task = NULL;
   sony_inuse = 0;
   wake_up_interruptible(&sony_wait);

   return(num_sectors_read);
}


/*
 * Do a command that does not involve data transfer.  This routine must
 * be re-entrant from the same task to support being called from the
 * data operation code when an error occurs.
 */
static void
do_sony_cd_cmd(unsigned char cmd,
               unsigned char *params,
               unsigned int num_params,
               unsigned char *result_buffer,
               unsigned int *result_size)
{
   unsigned int retry_count;
   int num_retries;
   int recursive_call;


   cli();
   if (current != has_cd_task) /* Allow recursive calls to this routine */
   {
      while (sony_inuse)
      {
         interruptible_sleep_on(&sony_wait);
         if (current->signal & ~current->blocked)
         {
            result_buffer[0] = 0x20;
            result_buffer[1] = SONY_SIGNAL_OP_ERR;
            *result_size = 2;
            return;
         }
      }
      sony_inuse = 1;
      has_cd_task = current;
      recursive_call = 0;
   }
   else
   {
      recursive_call = 1;
   }
   sti();

   num_retries = 0;
retry_cd_operation:

   while (handle_sony_cd_attention())
      ;
   
   retry_count = jiffies + SONY_JIFFIES_TIMEOUT;
   while ((retry_count > jiffies) && (is_busy()))
   {
      sony_sleep();
      
      while (handle_sony_cd_attention())
         ;
   }
   if (is_busy())
   {
      result_buffer[0] = 0x20;
      result_buffer[1] = SONY_TIMEOUT_OP_ERR;
      *result_size = 2;
   }
   else
   {
      clear_result_ready();
      clear_param_reg();

      write_params(params, num_params);
      write_cmd(cmd);

      get_result(result_buffer, result_size);
   }

   if (   ((result_buffer[0] & 0x20) == 0x20)
       && (num_retries < MAX_CDU31A_RETRIES))
   {
      num_retries++;
      current->state = TASK_INTERRUPTIBLE;
      current->timeout = jiffies + 10; /* Wait .1 seconds on retries */
      schedule();
      goto retry_cd_operation;
   }

   if (!recursive_call)
   {
      has_cd_task = NULL;
      sony_inuse = 0;
      wake_up_interruptible(&sony_wait);
   }
}


/*
 * Handle an attention from the drive.  This will return 1 if it found one
 * or 0 if not (if one is found, the caller might want to call again).
 *
 * This routine counts the number of consecutive times it is called
 * (since this is always called from a while loop until it returns
 * a 0), and returns a 0 if it happens too many times.  This will help
 * prevent a lockup.
 */
static int
handle_sony_cd_attention(void)
{
   unsigned char atten_code;
   static int num_consecutive_attentions = 0;


   if (is_attention())
   {
      if (num_consecutive_attentions > CDU31A_MAX_CONSECUTIVE_ATTENTIONS)
      {
         printk("cdu31a: Too many consecutive attentions: %d\n",
                num_consecutive_attentions);
         num_consecutive_attentions = 0;
         return(0);
      }

      clear_attention();
      atten_code = read_result_register();

      switch (atten_code)
      {
       /* Someone changed the CD.  Mark it as changed */
      case SONY_MECH_LOADED_ATTN:
         sony_disc_changed = 1;
         sony_toc_read = 0;
         sony_audio_status = CDROM_AUDIO_NO_STATUS;
         sony_first_block = -1;
         sony_last_block = -1;
         break;

      case SONY_AUDIO_PLAY_DONE_ATTN:
         sony_audio_status = CDROM_AUDIO_COMPLETED;
         read_subcode();
         break;

      case SONY_EJECT_PUSHED_ATTN:
         sony_audio_status = CDROM_AUDIO_INVALID;
         break;

      case SONY_LEAD_IN_ERR_ATTN:
      case SONY_LEAD_OUT_ERR_ATTN:
      case SONY_DATA_TRACK_ERR_ATTN:
      case SONY_AUDIO_PLAYBACK_ERR_ATTN:
         sony_audio_status = CDROM_AUDIO_ERROR;
         break;
      }

      num_consecutive_attentions++;
      return(1);
   }

   num_consecutive_attentions = 0;
   return(0);
}


/* Convert from an integer 0-99 to BCD */
static inline unsigned int
int_to_bcd(unsigned int val)
{
   int retval;


   retval = (val / 10) << 4;
   retval = retval | val % 10;
   return(retval);
}


/* Convert from BCD to an integer from 0-99 */
static unsigned int
bcd_to_int(unsigned int bcd)
{
   return((((bcd >> 4) & 0x0f) * 10) + (bcd & 0x0f));
}


/*
 * Convert a logical sector value (like the OS would want to use for
 * a block device) to an MSF format.
 */
static void
log_to_msf(unsigned int log, unsigned char *msf)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品免费久久久久| 经典三级视频一区| 久久 天天综合| 97久久超碰国产精品电影| 777久久久精品| 日本一区二区三区四区| 天堂影院一区二区| aaa欧美大片| 久久久噜噜噜久噜久久综合| 亚洲国产婷婷综合在线精品| 成人av资源站| 久久综合九色综合欧美就去吻| 亚洲黄色小视频| 丁香天五香天堂综合| 日韩欧美国产精品| 日本在线不卡视频一二三区| 91免费版在线看| 中文在线资源观看网站视频免费不卡| 免费在线观看视频一区| 91福利国产成人精品照片| 国产精品私房写真福利视频| 麻豆成人综合网| 欧美高清激情brazzers| 亚洲自拍偷拍麻豆| 日本精品一区二区三区高清| 中文字幕亚洲一区二区va在线| 国产精品66部| 久久精品欧美日韩| 国产一区视频网站| 精品美女一区二区| 精品在线播放午夜| 精品免费国产二区三区| 老汉av免费一区二区三区| 欧美精品aⅴ在线视频| 亚洲成人精品一区二区| 欧美日韩成人一区二区| 亚洲成年人网站在线观看| 欧美午夜不卡在线观看免费| 亚洲国产精品一区二区www在线| 91麻豆精品一区二区三区| 亚洲精品美国一| 欧美网站一区二区| 午夜精彩视频在线观看不卡| 91精品国产综合久久蜜臀| 秋霞电影网一区二区| 日韩欧美一级在线播放| 韩国理伦片一区二区三区在线播放| 精品久久五月天| 成人综合在线观看| 中文字幕一区在线观看| 在线亚洲精品福利网址导航| 亚洲国产美女搞黄色| 欧美高清你懂得| 国产一区二区三区精品视频| 亚洲国产精品av| 色综合久久久久综合体| 亚洲成人免费av| 欧美成人一区二区三区在线观看| 国产精品一区二区三区99| 亚洲色图视频网| 在线不卡免费欧美| 国产成人av电影在线播放| 樱花影视一区二区| 制服丝袜日韩国产| 国产成人av一区二区| 亚洲美女视频在线观看| 91麻豆精品国产| 国产宾馆实践打屁股91| 亚洲一区二区三区四区在线| 欧美电视剧免费观看| 99精品欧美一区| 秋霞影院一区二区| 亚洲欧洲美洲综合色网| 日韩一级高清毛片| 99re66热这里只有精品3直播| 日韩精品一二三四| 国产精品乱人伦| 欧美一卡二卡三卡四卡| 成人免费高清视频在线观看| 日韩精品电影在线| 最新国产精品久久精品| 日韩欧美在线观看一区二区三区| 不卡欧美aaaaa| 日本欧美肥老太交大片| 亚洲人亚洲人成电影网站色| 欧美变态凌虐bdsm| 欧美网站大全在线观看| 国产成人av电影| 美女免费视频一区| 亚洲国产另类精品专区| 国产精品伦理一区二区| 精品粉嫩超白一线天av| 欧美日韩精品一区视频| 91免费视频大全| 成人白浆超碰人人人人| 久久www免费人成看片高清| 亚洲影视资源网| 国产精品伦理一区二区| 久久亚洲影视婷婷| 日韩欧美综合一区| 欧美日韩在线精品一区二区三区激情| bt欧美亚洲午夜电影天堂| 精品一二线国产| 麻豆一区二区在线| 日韩精品亚洲一区二区三区免费| 一区二区三区中文字幕| 亚洲人成影院在线观看| 国产精品的网站| 亚洲国产成人在线| 久久精品人人爽人人爽| 久久久久一区二区三区四区| 日韩欧美视频一区| 日韩一区二区三区电影在线观看| 欧美色综合网站| 欧美日韩高清一区二区不卡| 99re热这里只有精品免费视频| 国产.精品.日韩.另类.中文.在线.播放| 六月婷婷色综合| 麻豆国产欧美一区二区三区| 奇米综合一区二区三区精品视频| 视频一区二区不卡| 七七婷婷婷婷精品国产| 日韩电影一区二区三区四区| 日韩中文字幕亚洲一区二区va在线| 日日夜夜免费精品| 免费xxxx性欧美18vr| 久久97超碰色| 国产精选一区二区三区| 夫妻av一区二区| 成人av电影在线观看| 色呦呦一区二区三区| 色美美综合视频| 欧美日韩国产经典色站一区二区三区 | 成人毛片视频在线观看| 成人av小说网| 在线免费av一区| 欧美精品一二三| 日韩精品一区二| 国产欧美日韩三区| 亚洲影视在线观看| 久草这里只有精品视频| 豆国产96在线|亚洲| 色久优优欧美色久优优| 欧美久久久一区| 国产日韩欧美制服另类| 一区二区三区欧美激情| 日韩成人午夜精品| 国产乱人伦偷精品视频免下载| 成人av免费在线播放| 欧美三级韩国三级日本三斤| 日韩一区二区三区电影| 国产精品国产a| 日韩专区中文字幕一区二区| 国产精品一区二区你懂的| 91啪在线观看| 精品成a人在线观看| 亚洲日本va在线观看| 美女视频免费一区| 91蝌蚪porny| 日韩欧美国产精品一区| 亚洲三级在线观看| 蜜臀久久久久久久| 日韩欧美三级在线| 亚洲精品成人天堂一二三| 久久69国产一区二区蜜臀| 色欧美乱欧美15图片| 久久―日本道色综合久久| 一区二区在线免费观看| 国产精品综合一区二区三区| 欧美日韩高清一区二区不卡| 国产精品狼人久久影院观看方式| 日韩在线a电影| 91国产丝袜在线播放| 中文天堂在线一区| 久久成人久久鬼色| 欧美色综合网站| 亚洲男人天堂一区| 国产成人亚洲精品狼色在线| 日韩一区二区免费视频| 一区二区三区电影在线播| 成人av小说网| 欧美国产日本韩| 激情另类小说区图片区视频区| 欧美性生活影院| 中文字幕在线不卡| 成人自拍视频在线观看| 精品久久国产字幕高潮| 日韩精品高清不卡| 91超碰这里只有精品国产| 亚洲综合成人在线视频| 91在线精品一区二区| 国产日产精品一区| 国产一区二区视频在线播放| 日韩一级黄色大片| 丝袜美腿亚洲综合| 欧美精品日韩精品| 婷婷综合五月天| 69堂精品视频| 日韩精品久久久久久| 欧美一级理论性理论a|