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

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

?? lb_misc.c

?? uCOS+uCFS在Armulator上的移植
?? C
字號:
/*
**********************************************************************
*                          Micrium, Inc.
*                      949 Crestview Circle
*                     Weston,  FL 33327-1848
*
*                            uC/FS
*
*             (c) Copyright 2001 - 2003, Micrium, Inc.
*                      All rights reserved.
*
***********************************************************************

----------------------------------------------------------------------
File        : lb_misc.c
Purpose     : Logical Block Layer
----------------------------------------------------------------------
Known problems or limitations with current version
----------------------------------------------------------------------
None.
---------------------------END-OF-HEADER------------------------------
*/

/*********************************************************************
*
*             #include Section
*
**********************************************************************
*/

#include "fs_port.h"
#include "fs_conf.h"
#include "fs_dev.h"
#include "fs_api.h"
#include "fs_lbl.h"
#include "fs_os.h"
#include "fs_fsl.h"
#include "fs_int.h"
#include "fs_clib.h"


/*********************************************************************
*
*             Local functions
*
**********************************************************************
*/

#if FS_USE_LB_READCACHE

/*********************************************************************
*
*             _FS_LB_GetDriverIndex
*
  Description:
  FS internal function. Get index of a driver in the device information
  table referred by FS__pDevInfo.

  Parameters:
  pDriver     - Pointer to a device driver structure
 
  Return value:
  =>0         - Index of pDriver in the device information table.
  <0          - An error has occured.
*/

static int _FS_LB_GetDriverIndex(const FS__device_type *pDriver) {
  unsigned int i;

  i = 0;
  while (1) {
    if (i >= FS__maxdev) {
      break;  /* Driver not found */
    }
    if (FS__pDevInfo[i].devdriver == pDriver) {
      break;  /* Driver found */
    }
    i++;
  }
  if (i >= FS__maxdev) {
    return -1;
  }
  return i;
}


/*********************************************************************
*
*             _FS_LB_GetFromCache
*
  Description:
  FS internal function. Copy sector from cache, if available.

  Parameters:
  pDriver     - Pointer to a device driver structure.
  Unit        - Unit number.
  Sector      - Sector to be read from the device's cache.
  pBuffer     - Pointer to a data buffer for storing data of the cache. 
 
  Return value:
  ==0         - Sector is in cache and has been copied to pBuffer.
  <0          - An error has occured.
*/

static int _FS_LB_GetFromCache(const FS__device_type *pDriver, FS_u32 Unit, FS_u32 Sector, void *pBuffer) {
  int i;
  int idx;

  idx = _FS_LB_GetDriverIndex(pDriver);
  if (idx < 0) {
    return -1;
  }
  if (FS__pDevInfo[idx].pDevCacheInfo) {
    i = 0;
    while (1) {
      if (i >= FS__pDevInfo[idx].pDevCacheInfo[Unit].MaxCacheNum) {
        break;  /* Sector not in cache */
      }
      if (Sector == FS__pDevInfo[idx].pDevCacheInfo[Unit].pCache[i].BlockId) {
        break;  /* Sector found */
      }
      i++;
    }
    if (i < FS__pDevInfo[idx].pDevCacheInfo[Unit].MaxCacheNum) {
      FS__CLIB_memcpy(pBuffer, FS__pDevInfo[idx].pDevCacheInfo[Unit].pCache[i].aBlockData, FS_LB_BLOCKSIZE);
      return 0;
    }
  }
  return -1;  
}


/*********************************************************************
*
*             _FS_LB_CopyToCache
*
  Description:
  FS internal function. Copy a sector to the cache of the device.

  Parameters:
  pDriver     - Pointer to a device driver structure.
  Unit        - Unit number.
  Sector      - Sector to be copied to the device's cache.
  pBuffer     - Pointer to a data buffer to be stored in the cache. 
 
  Return value:
  None.
*/

static void _FS_LB_CopyToCache(const FS__device_type *pDriver, FS_u32 Unit, FS_u32 Sector, void *pBuffer) {
  int idx;

  idx = _FS_LB_GetDriverIndex(pDriver);
  if (idx < 0) {
    return;
  }
  if (FS__pDevInfo[idx].pDevCacheInfo) {
    FS__CLIB_memcpy(FS__pDevInfo[idx].pDevCacheInfo[Unit].pCache[FS__pDevInfo[idx].pDevCacheInfo[Unit].CacheIndex].aBlockData,
            pBuffer, FS_LB_BLOCKSIZE);
    FS__pDevInfo[idx].pDevCacheInfo[Unit].pCache[FS__pDevInfo[idx].pDevCacheInfo[Unit].CacheIndex].BlockId = Sector;
    FS__pDevInfo[idx].pDevCacheInfo[Unit].CacheIndex++;
    if (FS__pDevInfo[idx].pDevCacheInfo[Unit].CacheIndex >= FS__pDevInfo[idx].pDevCacheInfo[Unit].MaxCacheNum) {
      FS__pDevInfo[idx].pDevCacheInfo[Unit].CacheIndex = 0;
    }
  }
}


/*********************************************************************
*
*             _FS_LB_UpdateInCache
*
  Description:
  FS internal function. Update sector in cache, if it is there.

  Parameters:
  pDriver     - Pointer to a device driver structure.
  Unit        - Unit number.
  Sector      - Sector to be updated in the device's cache.
  pBuffer     - Pointer to a data buffer to be stored in the cache. 
 
  Return value:
  None.
*/

static void _FS_LB_UpdateInCache(const FS__device_type *pDriver, FS_u32 Unit, FS_u32 Sector, void *pBuffer) {
  int i;
  int idx;

  idx = _FS_LB_GetDriverIndex(pDriver);
  if (idx < 0) {
    return;
  }
  if (FS__pDevInfo[idx].pDevCacheInfo) {
    i = 0;
    while (1) {
      if (i >= FS__pDevInfo[idx].pDevCacheInfo[Unit].MaxCacheNum) {
        break; /* Sector not in cache */
      }
      if (Sector == FS__pDevInfo[idx].pDevCacheInfo[Unit].pCache[i].BlockId) {
        break; /* Sector found */
      }
      i++;
    }
    if (i < FS__pDevInfo[idx].pDevCacheInfo[Unit].MaxCacheNum) {
      FS__CLIB_memcpy(FS__pDevInfo[idx].pDevCacheInfo[Unit].pCache[i].aBlockData, pBuffer, FS_LB_BLOCKSIZE);
    }
  }
}


/*********************************************************************
*
*             _FS_LB_ClearCache
*
  Description:
  FS internal function. Clear cache of a device.

  Parameters:
  pDriver     - Pointer to a device driver structure.
  Unit        - Unit number.
 
  Return value:
  None.
*/

static void _FS_LB_ClearCache(const FS__device_type *pDriver, FS_u32 Unit) {
  int i;
  int idx;

  idx = _FS_LB_GetDriverIndex(pDriver);
  if (idx<0) {
    return;
  }
  if (FS__pDevInfo[idx].pDevCacheInfo) {
    FS__pDevInfo[idx].pDevCacheInfo[Unit].CacheIndex = 0;
    for (i = 0; i < FS__pDevInfo[idx].pDevCacheInfo[Unit].MaxCacheNum; i++) {
      FS__pDevInfo[idx].pDevCacheInfo[Unit].pCache[i].BlockId = 0xffffffffUL;
    }
  }
}

#endif  /* FS_USE_LB_READCACHE */


/*********************************************************************
*
*             Global functions
*
**********************************************************************

  Functions here are global, although their names indicate a local
  scope. They should not be called by user application.
*/

/*********************************************************************
*
*             FS__lb_status
*
  Description:
  FS internal function. Get status of a device.

  Parameters:
  pDriver     - Pointer to a device driver structure.
  Unit        - Unit number.
 
  Return value:
  ==1 (FS_LBL_MEDIACHANGED) - The media of the device has changed.
  ==0                       - Device okay and ready for operation.
  <0                        - An error has occured.
*/

int FS__lb_status(const FS__device_type *pDriver, FS_u32 Unit) {
  int x;

  if (pDriver->dev_status) {
    FS_X_OS_LockDeviceOp(pDriver, Unit);
    x = (pDriver->dev_status)(Unit);
#if FS_USE_LB_READCACHE
    if (x != 0) {
      _FS_LB_ClearCache(pDriver, Unit);
    }
#endif  /* FS_USE_LB_READCACHE */
    FS_X_OS_UnlockDeviceOp(pDriver, Unit);
    return x;
  }
  return -1;
}


/*********************************************************************
*
*             FS__lb_read
*
  Description:
  FS internal function. Read sector from device.

  Parameters:
  pDriver     - Pointer to a device driver structure.
  Unit        - Unit number.
  Sector      - Sector to be read from the device.
  pBuffer     - Pointer to buffer for storing the data.
 
  Return value:
  ==0         - Sector has been read and copied to pBuffer.
  <0          - An error has occured.
*/

int FS__lb_read(const FS__device_type *pDriver, FS_u32 Unit, FS_u32 Sector, void *pBuffer) {
  int x;

  if (pDriver->dev_read) {
    FS_X_OS_LockDeviceOp(pDriver, Unit);
#if FS_USE_LB_READCACHE
    x = _FS_LB_GetFromCache(pDriver, Unit, Sector, pBuffer);
    if (x != 0) {
      x = (pDriver->dev_read)(Unit, Sector, pBuffer);
      if (x == 0) {
        _FS_LB_CopyToCache(pDriver, Unit, Sector, pBuffer);
      }
    }
#else
    x = (pDriver->dev_read)(Unit, Sector, pBuffer);
#endif  /* FS_USE_LB_READCACHE */
    FS_X_OS_UnlockDeviceOp(pDriver, Unit);
    return  x;
  }
  return -1;
}


/*********************************************************************
*
*             FS__lb_write
*
  Description:
  FS internal function. Write sector to device.

  Parameters:
  pDriver     - Pointer to a device driver structure.
  Unit        - Unit number.
  Sector      - Sector to be written to the device.
  pBuffer     - Pointer to data to be stored.
 
  Return value:
  ==0         - Sector has been written to the device.
  <0          - An error has occured.
*/

int FS__lb_write(const FS__device_type *pDriver, FS_u32 Unit, FS_u32 Sector, void *pBuffer) {
  int x;

  if (pDriver->dev_write) {
    FS_X_OS_LockDeviceOp(pDriver, Unit);
    x = (pDriver->dev_write)(Unit, Sector, pBuffer);
#if FS_USE_LB_READCACHE
    if (x==0) {
      _FS_LB_UpdateInCache(pDriver, Unit, Sector, pBuffer);
    }
    else {
      _FS_LB_ClearCache(pDriver, Unit);
    }
#endif  /* FS_USE_LB_READCACHE */
    FS_X_OS_UnlockDeviceOp(pDriver, Unit);
    return x;
  }
  return -1;
}


/*********************************************************************
*
*             FS__lb_ioctl
*
  Description:
  FS internal function. Execute device command.

  Parameters:
  pDriver     - Pointer to a device driver structure.
  Unit        - Unit number.
  Cmd         - Command to be executed.
  Aux         - Parameter depending on command.
  pBuffer     - Pointer to a buffer used for the command.
 
  Return value:
  Command specific. In general a negative value means an error.
*/

int FS__lb_ioctl(const FS__device_type *pDriver, FS_u32 Unit, FS_i32 Cmd, FS_i32 Aux, void *pBuffer) {
  int x;

  if (pDriver->dev_ioctl) {
    FS_X_OS_LockDeviceOp(pDriver, Unit);
    x = (pDriver->dev_ioctl)(Unit, Cmd, Aux, pBuffer);
    FS_X_OS_UnlockDeviceOp(pDriver, Unit);
    return x;
  }
  return -1;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
蜜桃一区二区三区在线观看| 欧美日韩一区视频| 欧美色窝79yyyycom| 欧美大片免费久久精品三p| 成人免费在线视频观看| 极品少妇xxxx偷拍精品少妇| 在线观看视频一区二区欧美日韩| 精品国产乱码久久久久久浪潮| 亚洲精品国产精华液| 国产精品99久久久久久久女警 | 色婷婷av一区二区三区gif| 欧美一区二区精品在线| 亚洲精品国产a| 国产盗摄一区二区| 日韩免费高清电影| 午夜视频久久久久久| 一本久久a久久免费精品不卡| 久久综合九色综合欧美亚洲| 天天做天天摸天天爽国产一区| 97成人超碰视| 亚洲欧洲国产日韩| 成人黄色在线网站| 久久精品人人做人人综合| 日韩在线卡一卡二| 欧美日韩成人激情| 亚洲1区2区3区4区| 欧美在线观看你懂的| 亚洲美腿欧美偷拍| 92精品国产成人观看免费| 国产精品久久一级| 成人污污视频在线观看| 久久久久久久国产精品影院| 国内成+人亚洲+欧美+综合在线| 日韩一级完整毛片| 麻豆一区二区三区| 精品久久久影院| 国产在线国偷精品免费看| 26uuu国产在线精品一区二区| 久久黄色级2电影| 精品国产三级电影在线观看| 激情五月婷婷综合网| 久久久综合精品| 成人黄页在线观看| 亚洲女人****多毛耸耸8| 91香蕉视频在线| 亚洲一区二区精品久久av| 欧美日韩国产高清一区二区三区 | 天堂成人国产精品一区| 欧美日韩大陆一区二区| 日韩中文字幕区一区有砖一区 | 一区二区三区精密机械公司| 在线观看免费亚洲| 日韩福利电影在线| 精品精品国产高清a毛片牛牛 | 久久嫩草精品久久久久| 国产麻豆精品在线观看| 国产精品家庭影院| 在线观看亚洲a| 美国三级日本三级久久99| 国产欧美综合色| 色综合咪咪久久| 免费成人性网站| 亚洲国产高清aⅴ视频| 91欧美一区二区| 日本aⅴ免费视频一区二区三区| 久久这里只有精品6| 成人高清免费在线播放| 亚洲成a人片在线观看中文| 日韩精品在线一区二区| 成人黄页毛片网站| 丝袜亚洲另类丝袜在线| 国产欧美一区二区三区在线老狼| 色综合色狠狠综合色| 狠狠色丁香久久婷婷综| 一区二区三区四区高清精品免费观看| 欧美美女激情18p| 盗摄精品av一区二区三区| 亚洲国产精品影院| 国产午夜久久久久| 在线不卡中文字幕| 97久久超碰国产精品电影| 免费一级欧美片在线观看| 国产精品久久久久影院老司| 3atv一区二区三区| 一本到三区不卡视频| 狠狠色综合色综合网络| 亚洲综合激情小说| 欧美极品少妇xxxxⅹ高跟鞋| 欧美日高清视频| 91麻豆免费在线观看| 国产精品一区二区不卡| 日本视频在线一区| 亚洲精品中文在线影院| 久久精品人人做人人爽97| 欧美精品v国产精品v日韩精品| 懂色av中文字幕一区二区三区| 日韩成人免费看| 亚洲一区二区欧美激情| 亚洲日本乱码在线观看| 久久精品免费在线观看| 精品美女一区二区| 91精品国产综合久久精品麻豆| 91视频免费播放| www.日韩精品| va亚洲va日韩不卡在线观看| 国产乱码一区二区三区| 蜜桃久久久久久| 日本特黄久久久高潮| 日日摸夜夜添夜夜添国产精品| 亚洲综合色噜噜狠狠| 亚洲激情校园春色| 自拍偷在线精品自拍偷无码专区| 欧美韩国日本综合| 国产亚洲短视频| 欧美国产精品v| 国产精品欧美一区二区三区| 国产日韩影视精品| 久久久99精品免费观看不卡| 久久嫩草精品久久久精品一| 久久亚洲综合色| 欧美国产日本韩| 中文字幕一区二区三区在线播放 | 亚洲色图色小说| 亚洲欧洲另类国产综合| 亚洲天堂网中文字| 亚洲精品福利视频网站| 亚洲一区二区在线免费观看视频| 亚洲在线视频免费观看| 日韩精品色哟哟| 麻豆国产精品一区二区三区 | 一区二区免费视频| 亚洲mv在线观看| 美国欧美日韩国产在线播放| 韩国成人福利片在线播放| 国产盗摄一区二区三区| 91免费精品国自产拍在线不卡| 91九色最新地址| 欧美一区二区在线免费播放 | 美女网站一区二区| 国产精品白丝av| 91黄色免费看| 日韩欧美国产一区在线观看| 久久精品视频一区二区| 一区二区三区在线观看欧美| 亚洲成av人片www| 国产精品一区一区三区| 色婷婷av一区二区三区大白胸| 7777精品伊人久久久大香线蕉| 久久先锋影音av| 亚洲精品中文字幕乱码三区| 青青草97国产精品免费观看| 懂色av噜噜一区二区三区av| 欧美体内she精视频| 精品国产青草久久久久福利| 夜夜夜精品看看| 激情都市一区二区| 欧日韩精品视频| 欧美精品一区二区三区高清aⅴ| 国产精品久久久久婷婷| 日韩国产欧美三级| 成人在线视频一区| 欧美精品少妇一区二区三区 | 欧美一区二区三区人| 国产欧美日韩一区二区三区在线观看| 亚洲欧美日韩一区二区三区在线观看| 日本午夜精品视频在线观看| 99久久国产综合精品麻豆| 日韩一二三四区| 一区二区三区色| 国产丶欧美丶日本不卡视频| 欧美日韩三级视频| 国产精品第一页第二页第三页| 天堂午夜影视日韩欧美一区二区| 成人av在线网站| 精品少妇一区二区三区日产乱码| 亚洲黄色免费电影| 国产不卡高清在线观看视频| 欧美一区二区视频在线观看2020| 国产精品进线69影院| 国产一区二区电影| 在线电影院国产精品| 亚洲综合久久久| 91视频国产资源| 中文在线一区二区| 国产在线精品不卡| 日韩精品一区二区三区四区| 亚洲国产精品久久人人爱| 99re这里只有精品首页| 亚洲国产精华液网站w| 国内精品伊人久久久久av一坑| 欧美一区日本一区韩国一区| 亚洲国产精品一区二区尤物区| 91麻豆文化传媒在线观看| 中文字幕乱码一区二区免费| 国产一区二区免费看| 精品国免费一区二区三区| 久久电影网站中文字幕| 日韩欧美国产综合| 日韩av一区二| 欧美大片拔萝卜|