📄 sd_pap.c
字号:
/**************************************************************************** File: sd_pap.c - Plug and Play* * The content of this file or document is CONFIDENTIAL and PROPRIETARY* to Jade Technologies Co., Ltd. It is subject to the terms of a* License Agreement between Licensee and Jade Technologies Co., Ltd.* restricting among other things, the use, reproduction, distribution* and transfer. Each of the embodiments, including this information * and any derivative work shall retain this copyright notice.* * Copyright (c) 2005 Jade Technologies Co., Ltd. * All rights reserved.****************************************************************************/#include "sd.h"//------------------------------------------------------------------------------// Global Variables in SD_PAP.C//------------------------------------------------------------------------------extern int g_CardStatus; //------------------------------------------------------------------------------// // Inform OS that the card is inserted// See also: SDI_DetectStatus////------------------------------------------------------------------------------void SDI_DetectInsert(void){}//------------------------------------------------------------------------------//// Inform OS that the card is removed// See also: SDI_DetectStatus////------------------------------------------------------------------------------void SDI_DetectRemove(void){}//------------------------------------------------------------------------------//// Plug & Play Thread - created when the driver is loaded, and check the status// of the card. When the status changed, the routine called the two functions// above, to force OS open or close an instance. //// Arguments:// controller - handle of the instance passed from the main thread. ////------------------------------------------------------------------------------unsigned long SDI_DetectStatus(LPVOID controller){// at test period, we suppose the card is always in the socket. return 1; if (controller == NULL || g_CardStatus == STATE_TEST) return 0; while (g_CardStatus != STATE_DEINITING) { if (g_CardStatus == STATE_OPENED) { if (!SDI_IsCardIn((SD_controller*)controller, NULL)) SDI_DetectRemove(); } if (g_CardStatus == STATE_CLOSED || g_CardStatus == STATE_INITING) { if (SDI_IsCardIn((SD_controller*)controller, NULL)) SDI_DetectInsert(); } if (g_CardStatus == STATE_DEAD) { break; } msleep(100); } g_CardStatus = STATE_DEAD; return 1;}//------------------------------------------------------------------------------//// Check if the card is in the socket. //// Arguments:// controller - handle of the instance. // errorcode - record error. ////------------------------------------------------------------------------------BOOL SDI_IsCardIn(SD_controller* controller, unsigned long* errorcode){ unsigned long error = 0; if (!controller) error = 1;// at test period, we suppose the card is always in the socket. return TRUE; // if ((*(controller->SysDetect)) & 0x01) return TRUE; if (error) { if (errorcode) *errorcode = error; } return FALSE;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -