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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? usr_blk_dev.c

?? 包含MMC協(xié)議,驅(qū)動源碼. 在LINUX操作系統(tǒng)下通過.
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* * Copyright 2005 Motorola, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   * 02111-1307, USA * *//*! * @file usr_blk_dev.c * * @ingroup usr_blk_dev * * @brief This is the main file for the user block driver. * * <B>Overview:</B><BR> *    The user block driver is a removable media block driver intended to allow * for user space drivers for the media. * *    This driver operates by creating an entry on /proc and using the entry * to communicate commands to user space.  See ::USR_BLK_DEV_CMD_ID_T for a list * of these commands.  Commands are sent from a kernel thread through /proc * to user space.  Once the user space process has completed the command it * responds with a write to the proc entry.  Only one command can be processed * at a time by a user space process and a kernel thread.  A thread is used * for the commands in order to keep the request queue from blocking which is * not allowed. * *    At this time a single thread is used for all devices attached.  This * is not intended to be the final design, but was done to speed up development. * This will be acceptable for systems which implement only one device.  If * more than one device is to be supported, then multiple threads should be * used, one per /proc entry.  This will speed up throughput, since one part * will not block the others. * * There are two different levels of command processing within this driver. * Commands from interrupts, the request queue and general file operations * (open, revalidate, check_media) are placed in the command structure * (usr_blk_dev_cmd_s) within the information structure (::USR_BLK_DEV_INFO_T) * for the device.  These commands are then processed by the kernel thread * (usr_blk_dev_thread()) and sent to user space.  Once they are processed by * user space, the kernel thread copies any return data and informs the source * of the command that it has been completed. * *   Part detection is done via a switch in the socket which is connected to * GPIO on the part.  An interrupt is generated on both the rising edge and the * falling edge of the signal.  Once an interrupt is detected a timer is used * do debounce the signal.  After the signal has achieved a steady state the * interrupt is re-enabled and the timer stopped. * * <B>Devices Created:</B><BR> *    -# /proc/usr_blk_dev0: The read/write interface to the user space driver *       for device 0. *    -# /proc/usr_blk_devn: The read/write interface to the user space driver *       for device n. * <B>Devices Used:</B><BR> *    -# /dev/mmca0: The root for the first detected card in the first slot. *    -# /dev/mmca\<n\>: The partitions of the detected card (up to 8 partitions *       are supported). *    -# /dev/mmcb0: The root for the card in the second slot if detected. *       Additional cards continue to increment the letter (c, d, e, ...). *    -# /dev/mmcb\<n\>: The partitions of the card in the second slot. *       Additional cards continue to increment the letter (c, d, e, ...). * * <B>Command Lifecycle:</B><BR> *    When a command is sent to the user block thread it transitions through * the states described in ::USR_BLK_DEV_CMD_STATE_T.  As they enter a new * state they may wait on a wait queue or wake up another queue as they * complete.  It is necessary for commands to cycle through the states or * they can hold up all subsequent commands. * *    The following describes the states and the wait queues used within them. * The state for the commands are stored in * usr_blk_dev_info[dev_num].cmd[cmd_src].state * * <B>#USR_BLK_DEV_CMD_STATE_NONE:</B><BR> *   This state can be considered the idle state of the driver.  This value sits * in the state variable when the no command is active.  A transition to the * ::USR_BLK_DEV_CMD_STATE_NEW state starts a command executing in the user block * thread.<BR> * * <B>#USR_BLK_DEV_CMD_STATE_NEW:</B><BR> *   This is the state a requester must put in the state value in order to start * a command executing.  In the case of commands which come from locations which * can block the wait queue usr_blk_dev_info[dev_num].cmd[cmd_src].wait_for_completion * must be used before the new command can be added. * * <B>#USR_BLK_DEV_CMD_STATE_THREAD:</B><BR> *   This value is placed in the state control variable as soon as the user block * thread detects the command is new.  It does not wait on any queues. * * <B>#USR_BLK_DEV_CMD_STATE_USR_READ</B><BR> *   When a command is in this state it has woken up the * usr_blk_dev_info[dev_num].wait_for_usr_read queue which controls when user * reads of the /proc entry happen. * * <B>#USR_BLK_DEV_CMD_STATE_USR_WAIT:</B><BR> *   This state is transitioned to as soon as the user process reads the command * from the /proc entry.  The command will remain in this state until the * response is written to the /proc entry from the user driver.  Commands in * this state (as well as the ::USR_BLK_DEV_CMD_STATE_USR_READ) are waiting on * the usr_blk_dev_info[dev_num].wait_for_usr_write queue. * * <B>#USR_BLK_DEV_CMD_STATE_USR_DONE:</B><BR> *   This state is entered as soon as the usr_blk_dev_info[dev_num].wait_for_usr_write * queue is awakened.  At this point the user block thread continues by processing * any necessary data.  If the data was from the request queue * (::USR_BLK_DEV_CMD_SRC_REQ) or an interrupt (::USR_BLK_DEV_CMD_SRC_IRQ) the command * is transitioned to ::USR_BLK_DEV_CMD_STATE_NONE since no more processing is * necessary. If it is not from one of these sources it will wake up the * usr_blk_dev_info[dev_num].cmd[cmd_src].wait_for_thread queue to allow the * requester to process the data. * * <B>#USR_BLK_DEV_CMD_STATE_THREAD_DONE:</B><BR> *   Once the user block thread is done executing a command the * usr_blk_dev_info[dev_num].cmd[cmd_src].wait_for_thread will be awakened and the * requester of the command will transition to this state.  Within this state * the requester will act upon the date returned and set the state back to * #USR_BLK_DEV_CMD_STATE_NONE. * * For more data on the individual commands see the ::USR_BLK_DEV_CMD_ID_T. */#include <linux/config.h>#include <linux/module.h>#include <linux/kernel.h>#include <stdbool.h>#include <asm/arch/hardware.h>#include <linux/blk.h>#include <linux/blkdev.h>#include <linux/blkpg.h>#include <linux/fs.h>#include <linux/genhd.h>#include <linux/hdreg.h>#include <linux/init.h>#include <asm/irq.h>#include <linux/proc_fs.h>#include <linux/sched.h>#include <linux/poll.h>#include <linux/timer.h>#include <asm/uaccess.h>#include <linux/wait.h>#include <linux/usr_blk_dev.h>/******************************************************************************* Local constants and macros******************************************************************************//*! * @brief The number of successive times the sample of the device attach signal must * match before the device state is changed. */#define USR_BLK_DEV_DEBOUNCE_CNT 4#ifndef CONFIG_ARCH_SCMA11/*! @brief Port to which the media card detect switch is attached. */#define USR_BLK_DEV_DEV1_INT_GPIO 11 /*! @brief Returns non zero if the media card is attached. */# define USR_BLK_DEV_IS_DEV1_ATTACHED ((GPLR(USR_BLK_DEV_DEV1_INT_GPIO) & GPIO_bit(USR_BLK_DEV_DEV1_INT_GPIO)) != 0)#endif/*! @brief The name of the /proc entry as it will appear in the directory /proc. */#define USR_BLK_DEV_PROC_ENTRY_STR  "usr_blk_dev"/*! @brief The number of characters in USR_BLK_DEV_PROC_ENTRY_STR. */#define USR_BLK_DEV_PROC_ENTRY_LEN  11/*! * @brief The number of times the proc entry for a device can be opened. * * The number of times the proc entry for a device can be opened.  This is set * to one since only one user driver is needed to drive a device and if more * than one user process opens the entry, bad things would happen. */#define USR_BLK_DEV_MAX_PROC_OPENS 1/*! @brief Name of the user block device. */#define USR_BLK_DEV_DEVICE_NAME_STR "usr_blk_dev"/*! @brief Support 8 partitions per card. */#define USR_BLK_DEV_SHIFT   3/* @brief The maximum number of sectors which can be included in a single request. */#define USR_BLK_DEV_MAX_SECTORS_PER_REQ 128/*! @brief Used to enable debugging messages to be sent out the system log. *//* #define USR_BLK_DEV_DEBUG *//*! @brief Macro used to send debug messages to the system log. */#ifdef USR_BLK_DEV_DEBUG# define tracemsg(fmt,args...)  printk(__FILE__": %s: "fmt,__func__,##args)#else# define tracemsg(fmt,args...)#endif/*! * @brief Macro to extract the device number from the device node. *  * Each device has 8 minor numbers since* USR_BLK_DEV_SHIFT is currently 3. * This results in the device number being stored in upper bits. */#define USR_BLK_DEV_DEVICE_NR(i_rdev) (MINOR(i_rdev)>>USR_BLK_DEV_SHIFT)/*!  * @brief Timer used to debounce the insertion of a card. * * Only one timer is used for all of the devices. */static struct timer_list usr_blk_dev_timer;/*! * @brief The possible states of the media detection state machine. * * A list of the possible states of the card detection state machine which is * implemented in usr_blk_dev_poll_card_attach(). * * @note Removal is not debounced since a media card may have its power removed * at the point at which it is detected as removed only once.  In this case the * safest thing to do is to reinitialize the card. */typedef enum{    /*! @brief The media is currently not connected. */    USR_BLK_DEV_DEBOUNCE_STATE_REMOVED,    /*!     * @brief The media card has been detected as inserted and is being debounced.     *     * The media card has been detected as inserted at least once.  The number of     * states determines the number of times the card must be detected as inserted     * before it will be reported as such.     */    /* @{ */    USR_BLK_DEV_DEBOUNCE_STATE_INSERTING,    USR_BLK_DEV_DEBOUNCE_STATE_INSERTING1,    USR_BLK_DEV_DEBOUNCE_STATE_INSERTING2,    USR_BLK_DEV_DEBOUNCE_STATE_INSERTING3,    USR_BLK_DEV_DEBOUNCE_STATE_INSERTING4,    /* @} */    /*!     * @brief The card has been debounced as inserted, the driver must be informed.     *     * Once the card is detected as inserted the rest of the driver must be informed.     * However, this may take several iterations if the thread still has not received     * the previous state change.  This state will wait until the thread is ready to     * receive the indication before sending it.     */    USR_BLK_DEV_DEBOUNCE_STATE_UPDATE_INSERT,    /* @brief The media is currently inserted. */    USR_BLK_DEV_DEBOUNCE_STATE_INSERTED,    /* Removal is not debounced, so no REMOVING state exists. */    /*!     * @brief The card has been debounced as removed, the driver must be informed.     *     * Once the card is detected as removed the rest of the driver must be informed.     * However, this may take several iterations if the thread still has not received     * the previous state change.  This state will wait until the thread is ready to     * receive the indication before sending it.     */    USR_BLK_DEV_DEBOUNCE_STATE_UPDATE_REMOVAL} USR_BLK_DEV_DEBOUNCE_STATE_T;/*! * @brief The possible sources of commands for the kernel thread to send. * * There are three different sources of a command from the kernel: *   - The detect interrupt, *   - The request queue, *   - A user process calling open, close, read, write etc. */typedef enum{    USR_BLK_DEV_CMD_SRC_IRQ,  /*!< The command came from the detect interrupt. */    USR_BLK_DEV_CMD_SRC_REQ,  /*!< The command came from the request queue. */    USR_BLK_DEV_CMD_SRC_GEN,  /*!< The command came from a general source which can block. */    USR_BLK_DEV_CMD_SRC__END} USR_BLK_DEV_CMD_SRC_T;/*! * @brief The state of the command being processed. * * A typical command will have the following states.  If the command originated * in an interrupt or from the request queue, it will not progress though the * final states, since there is no need to respond to the calling layer.  Please * note there is a difference between a command which came from the kernel * request queue and once which is being handled by the RW code from within the * thread.  The thread based read write commands progress through all of the * states. */typedef enum{    /*! No command is active. */     USR_BLK_DEV_CMD_STATE_NONE    /*! A command request has been made by one of the three sources. */,    USR_BLK_DEV_CMD_STATE_NEW,    /*! The thread has received the command and has begun to act upon it. */    USR_BLK_DEV_CMD_STATE_THREAD,    /*! The thread is waiting for the user space driver to read the command. */    USR_BLK_DEV_CMD_STATE_USR_READ,    /*!     * The command has been read by the user space process and the kernel thread     * is waiting on the response.     */    USR_BLK_DEV_CMD_STATE_USR_WAIT,    /*!     * The user space process has acted upon the command and written a response     * to the /proc entry.     */    USR_BLK_DEV_CMD_STATE_USR_DONE,     /*!      * The thread has completed operating on the command, and passed the data      * back to the originator of the command.      */    USR_BLK_DEV_CMD_STATE_THREAD_DONE} USR_BLK_DEV_CMD_STATE_T;/*! * @brief Structure which holds information on the devices attached. * * The following is used as an array indexed by the device number to store any * data needed by the driver.  Please see the individual entries for details on * what is stored. */typedef struct{    /*!     * @brief The current state of debouncing for the device.     *      * A simple state machine is used for debouncing the insertion and removal     * of the card.  This is the state counter for that machine.  It can also     * be used to determine the status of the card at any time while running.     */    USR_BLK_DEV_DEBOUNCE_STATE_T debounce_state;    /*!     * @brief Used to track the connection state of the media.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
秋霞成人午夜伦在线观看| 6080国产精品一区二区| 国内欧美视频一区二区 | 成人深夜福利app| 国产在线视频不卡二| 久久99精品久久久久| 喷白浆一区二区| 韩国成人在线视频| 成人自拍视频在线| 91丨porny丨国产入口| 欧美性猛交xxxx乱大交退制版| 91美女蜜桃在线| 欧美丝袜丝交足nylons| 91精品国产一区二区人妖| 69堂精品视频| 欧美大片一区二区| 亚洲国产高清在线观看视频| 国产精品久久久久久久久免费丝袜| 欧美国产精品劲爆| 亚洲永久精品国产| 免费成人你懂的| 国产91高潮流白浆在线麻豆| 91小视频在线观看| 欧美一级免费大片| 国产日韩影视精品| 亚洲精品国产视频| 久久精品国产澳门| 暴力调教一区二区三区| 欧美日产国产精品| 国产日韩欧美麻豆| 亚洲国产成人va在线观看天堂| 日韩电影在线看| 成人午夜视频在线观看| 欧美日韩国产乱码电影| 久久久亚洲精品一区二区三区| 亚洲视频一二三| 蜜桃av一区二区在线观看| 成人av在线网站| 日韩欧美在线1卡| 依依成人精品视频| 国产一区二区三区| 欧美日韩aaa| 亚洲三级久久久| 国产真实乱子伦精品视频| 欧美性受xxxx黑人xyx| 国产清纯在线一区二区www| 午夜电影久久久| 99久久婷婷国产综合精品| 26uuu久久天堂性欧美| 婷婷综合久久一区二区三区| 成人av手机在线观看| 日韩精品一区二区三区中文不卡| 亚洲精品日韩综合观看成人91| 成人国产精品免费观看动漫| 欧美高清视频不卡网| 中文字幕欧美一区| 国产成人在线观看| 精品少妇一区二区三区免费观看 | 狠狠色丁香九九婷婷综合五月| 一本大道久久精品懂色aⅴ| 国产日韩欧美不卡| 国产美女视频一区| 精品剧情v国产在线观看在线| 午夜精品一区二区三区三上悠亚| 色综合网色综合| 最新国产の精品合集bt伙计| 成人小视频在线| 中文字幕精品—区二区四季| 国产精品亚洲成人| 久久久久国色av免费看影院| 精品一区二区三区在线播放| 欧美大肚乱孕交hd孕妇| 秋霞午夜鲁丝一区二区老狼| 8v天堂国产在线一区二区| 偷拍一区二区三区| 在线电影一区二区三区| 日韩制服丝袜av| 欧美一区二区三区在线观看| 日本女人一区二区三区| 亚洲美女淫视频| 91丨九色丨蝌蚪丨老版| 亚洲精品国产高清久久伦理二区| 91美女视频网站| 亚洲成av人影院| 91精品国产色综合久久不卡蜜臀| 欧美aaaaaa午夜精品| 精品黑人一区二区三区久久 | 亚洲香肠在线观看| 欧美情侣在线播放| 久久疯狂做爰流白浆xx| 国产午夜精品久久久久久久| 福利视频网站一区二区三区| 亚洲婷婷综合色高清在线| 不卡的av在线| 亚洲成av人综合在线观看| 欧美tickling网站挠脚心| 盗摄精品av一区二区三区| 国产精品网曝门| 欧美日韩成人激情| 国产精品亚洲成人| 日韩一区在线免费观看| 欧美日韩在线播放三区四区| 日韩高清在线不卡| 日本一区二区三级电影在线观看 | 日韩女优av电影在线观看| 青青草国产成人av片免费| 精品国产乱码久久久久久夜甘婷婷 | 欧美高清hd18日本| 国产美女娇喘av呻吟久久| 一区二区在线免费| 久久一区二区三区国产精品| 色综合久久久久综合体| 久久99这里只有精品| 亚洲免费观看高清完整版在线| 日韩一区二区三区电影在线观看 | 欧美一二三区精品| 99热国产精品| 美女视频免费一区| 一区二区三区日韩欧美| 久久精品日韩一区二区三区| 欧美日韩高清不卡| a4yy欧美一区二区三区| 久久99精品一区二区三区 | 国产婷婷色一区二区三区在线| 欧美综合天天夜夜久久| 高清在线不卡av| 久久激五月天综合精品| 亚洲chinese男男1069| 中文字幕亚洲电影| 国产亚洲一区二区在线观看| 欧美精品在线观看一区二区| 91麻豆文化传媒在线观看| 国产精品资源在线看| 蜜桃久久久久久久| 青青青伊人色综合久久| 一区二区在线观看视频在线观看| 国产精品久久久久久久久久免费看| 日韩欧美一二三| 欧美妇女性影城| 欧美人动与zoxxxx乱| 在线视频一区二区三| 99天天综合性| 国产精品1区二区.| 看电影不卡的网站| 日韩精品久久久久久| 亚洲一区二区三区在线看| 亚洲欧洲另类国产综合| 国产日韩欧美综合一区| 国产日产精品1区| 精品国产网站在线观看| 日韩女同互慰一区二区| 欧美一区二区成人| 欧美一区二区三区播放老司机| 69精品人人人人| 精品久久久久久亚洲综合网| 精品理论电影在线观看| 欧美精品一区二区高清在线观看| 精品国内二区三区| 国产日韩在线不卡| 亚洲欧美一区二区三区孕妇| 亚洲免费在线电影| 午夜久久久久久久久久一区二区| 五月综合激情婷婷六月色窝| 美女性感视频久久| 国产在线视视频有精品| 成人午夜免费电影| 在线免费视频一区二区| 制服视频三区第一页精品| 欧美v国产在线一区二区三区| 久久精品欧美日韩精品 | 欧美电视剧免费全集观看| 精品免费国产一区二区三区四区| 久久亚区不卡日本| 国产精品狼人久久影院观看方式| 亚洲精品福利视频网站| 日韩综合一区二区| 国产高清一区日本| 91福利国产精品| 欧美大白屁股肥臀xxxxxx| 国产精品久久久久影院亚瑟| 亚洲制服丝袜在线| 极品尤物av久久免费看| 91碰在线视频| 日韩精品一区二区三区swag| 国产精品久久久久久久久免费桃花| 亚洲国产日韩精品| 国产麻豆成人精品| 在线视频国内一区二区| 精品欧美乱码久久久久久1区2区| 国产精品成人网| 精油按摩中文字幕久久| 在线视频欧美区| 欧美韩日一区二区三区四区| 亚洲国产精品久久久男人的天堂| 国产一区二区三区香蕉| 在线观看一区二区精品视频| 久久嫩草精品久久久精品| 亚洲成av人片观看| 99re6这里只有精品视频在线观看| 欧美日韩国产bt|