本文整理汇总了C++中OSDRV_CALLBACKS::deviceInsertedHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ OSDRV_CALLBACKS::deviceInsertedHandler方法的具体用法?C++ OSDRV_CALLBACKS::deviceInsertedHandler怎么用?C++ OSDRV_CALLBACKS::deviceInsertedHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSDRV_CALLBACKS
的用法示例。
在下文中一共展示了OSDRV_CALLBACKS::deviceInsertedHandler方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startup_task
/* handle HTC startup via thread*/
static int startup_task(void *param)
{
HIF_DEVICE *device;
device = (HIF_DEVICE *)param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: call HTC from startup_task\n"));
/* start up inform DRV layer */
if ((osdrvCallbacks.deviceInsertedHandler(osdrvCallbacks.context,device)) != A_OK) {
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Device rejected\n"));
}
return 0;
}
示例2: startup_task
/* handle HTC startup via thread*/
static int startup_task(void *param)
{
HIF_DEVICE *device;
device = (HIF_DEVICE *)param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: call HTC from startup_task\n"));
/* ATHENV */
#ifdef ANDROID_ENV
wake_lock(&ar6k_init_wake_lock);
#endif
/* ATHENV */
/* start up inform DRV layer */
if ((osdrvCallbacks.deviceInsertedHandler(osdrvCallbacks.context,device)) != A_OK) {
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Device rejected\n"));
}
/* ATHENV */
#ifdef ANDROID_ENV
wake_unlock(&ar6k_init_wake_lock);
#endif
/* ATHENV */
return 0;
}
示例3: addHifDevice
//.........这里部分代码省略.........
if (blockCap.ReadBlockSize < blockCap.WriteBlockSize) {
maxBlockSize = blockCap.ReadBlockSize;
} else {
maxBlockSize = blockCap.WriteBlockSize;
}
if (blockCap.ReadBlocks < blockCap.WriteBlocks) {
maxBlocks = blockCap.ReadBlocks;
} else {
maxBlocks = blockCap.WriteBlocks;
}
sdStatus = SDGetTuple(handle, SD_CISTPL_FUNCE, NULL, &ulLength, FALSE);
if ((!SD_API_SUCCESS(sdStatus)) || (ulLength > sizeof(rgucTuple)) ) {
return FALSE;
}
sdStatus = SDGetTuple(handle, SD_CISTPL_FUNCE, rgucTuple, &ulLength, FALSE);
if ((!SD_API_SUCCESS(sdStatus)) || (pFunce->bType != SD_CISTPL_FUNCE_FUNCTION_TYPE) ) {
return FALSE;
}
if (maxBlockSize > pFunce->wMaxBlkSize) {
maxBlockSize = pFunce->wMaxBlkSize;
}
bData = (DWORD)maxBlockSize;
sdStatus = SDSetCardFeature(handle, SD_IO_FUNCTION_SET_BLOCK_SIZE, &bData, sizeof(bData));
}
NDIS_DEBUG_PRINTF(DBG_LEVEL_HIF,
"Bytes Per Block: %d bytes, Block Count:%d \r\n",
maxBlockSize, maxBlocks);
/* Allocate the slot current */
/* Kowsalya : commenting as there is no equivalent for this in WINCE */
/*
status = SDLIB_GetDefaultOpCurrent(handle, &slotCurrent.SlotCurrent);
if (SDIO_SUCCESS(status)) {
HIF_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("Allocating Slot current: %d mA\n",
slotCurrent.SlotCurrent));
status = SDLIB_IssueConfig(handle, SDCONFIG_FUNC_ALLOC_SLOT_CURRENT,
&slotCurrent, sizeof(slotCurrent));
if (!SDIO_SUCCESS(status)) {
HIF_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("Failed to allocate slot current %d\n", status));
return FALSE;
}
}
*/
/* Initialize the bus requests to be used later */
A_MEMZERO(device->busRequest, sizeof(device->busRequest));
for (count = 0; count < BUS_REQUEST_MAX_NUM; count ++) {
NdisInitializeEvent(&device->busRequest[count].sem_req);
hifFreeBusRequest(device, &device->busRequest[count]);
}
#else
SetupSlotPowerControl(device);
if (!SetupSDIOInterface(device)) {
return FALSE;
}
#endif
InitializeCriticalSection(&gCriticalSection); //ÃʱâÈ
device->async_shutdown = 0;
hThread = CreateThread(NULL, 0, async_task, (void *)device, 0, NULL);
CeSetThreadPriority(hThread, 200);
CloseHandle(hThread);
NdisInitializeEvent(&device->sem_async);
#if USE_IRQ_THREAD
hThread = CreateThread(NULL, 0, hifIRQThread, (void *)device, 0, NULL);
CeSetThreadPriority(hThread, 200);
CloseHandle(hThread);
NdisInitializeEvent(&hifIRQEvent);
#endif
/* start up inform DRV layer */
if ((osdrvCallbacks.deviceInsertedHandler(osdrvCallbacks.context,device)) != A_OK) {
NDIS_DEBUG_PRINTF(DBG_ERR, "[HIF] AR6000: Device rejected \r\n");
}
NDIS_DEBUG_PRINTF(DBG_LEVEL_HIF, " %s() -Exit \r\n",__FUNCTION__);
return TRUE;
}
示例4: CriticalSectionInit
BOOL
hifDeviceInserted(SDFUNCTION *function, SDDEVICE *handle)
{
A_UINT32 count;
HIF_DEVICE *device;
BOOL accepted = FALSE;
AR_DEBUG_ASSERT(function != NULL);
AR_DEBUG_ASSERT(handle != NULL);
do {
device = (HIF_DEVICE *)KernelAlloc(sizeof(HIF_DEVICE));
if (NULL == device) {
break;
}
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("Device: %p\n", device));
ZERO_POBJECT(device);
CriticalSectionInit(&device->lock);
device->busrequestfreelist = NULL;
device->handle = handle;
device->enabledSpiInts = ATH_SPI_INTR_PKT_AVAIL | ATH_SPI_INTR_CPU_INTR;
/* set the IRQ Handler which associates the instance with the SDDEVICE */
SDDEVICE_SET_IRQ_HANDLER(device->handle, hifIRQHandler, device);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("Device: %p\n", device));
if (handle->pId[0].CardFlags & CARD_RAW) {
if (strstr(SDDEVICE_GET_HCDNAME(handle), SDIO_RAW_BD_BASE) == NULL) {
/* Not supported */
break;
}
}
/* Card identification */
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,
("SPI card: %s\n", SDDEVICE_GET_HCDNAME(handle)));
/* Version information */
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("Stack version: %d.%d\n",
SDDEVICE_GET_VERSION_MAJOR(handle),
SDDEVICE_GET_VERSION_MINOR(handle)));
/* Get the maximum block size supported */
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("Maximum block length: %d bytes\n",
SDDEVICE_GET_MAX_BLOCK_LEN(handle)));
device->curBlockSize = SDDEVICE_GET_OPER_BLOCK_LEN(handle);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("Current block length: %d bytes\n",
device->curBlockSize));
/* Allocate the bus requests to be used later */
for (count = 0; count < BUS_REQUEST_MAX_NUM_TOTAL; count ++) {
if ((device->busrequestblob[count].request = SDDeviceAllocRequest(handle)) == NULL){
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("Unable to allocate bus request\n"));
break;
}
/* free to the list */
hifFreeBusRequest(device, &device->busrequestblob[count]);
}
if (count != BUS_REQUEST_MAX_NUM_TOTAL) {
break;
}
/* Configure the SPI interface */
if ((hifConfigureSPI(device)) != A_OK) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("Failed to configure the device\n"));
break;
}
/* Inform HTC */
if ((osdrvCallbacks.deviceInsertedHandler(osdrvCallbacks.context, (void *)device)) != A_OK) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("Device rejected\n"));
return FALSE;
}
accepted = TRUE;
} while (FALSE);
if (!accepted & (device != NULL)) {
/* cleanup device */
hifCleanupDevice(device);
}
return accepted;
}