本文整理汇总了C++中OSDRV_CALLBACKS类的典型用法代码示例。如果您正苦于以下问题:C++ OSDRV_CALLBACKS类的具体用法?C++ OSDRV_CALLBACKS怎么用?C++ OSDRV_CALLBACKS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OSDRV_CALLBACKS类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hifDeviceRemoved
static void hifDeviceRemoved(struct sdio_func *func)
{
A_STATUS status = A_OK;
HIF_DEVICE *device;
AR_DEBUG_ASSERT(func != NULL);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceRemoved\n"));
device = getHifDevice(func);
if (device->claimedContext != NULL) {
status = osdrvCallbacks.deviceRemovedHandler(device->claimedContext, device);
}
if (device->is_suspend) {
device->is_suspend = FALSE;
} else {
if (hifDisableFunc(device, func)!=0) {
status = A_ERROR;
}
}
CleanupHIFScatterResources(device);
delHifDevice(device);
AR_DEBUG_ASSERT(status == A_OK);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n"));
}
示例2: hifDeviceRemoved
static void hifDeviceRemoved(struct sdio_func *func)
{
A_STATUS status = A_OK;
HIF_DEVICE *device;
int ret;
AR_DEBUG_ASSERT(func != NULL);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceRemoved\n"));
device = getHifDevice(func);
if (device->claimedContext != NULL) {
status = osdrvCallbacks.deviceRemovedHandler(device->claimedContext, device);
}
do {
if (device->is_suspend) {
device->is_suspend = FALSE;
break;
}
if (!IS_ERR(device->async_task)) {
init_completion(&device->async_completion);
device->async_shutdown = 1;
up(&device->sem_async);
wait_for_completion(&device->async_completion);
device->async_task = NULL;
}
/* Disable the card */
sdio_claim_host(device->func);
ret = sdio_disable_func(device->func);
sdio_release_host(device->func);
} while (0);
delHifDevice(device);
AR_DEBUG_ASSERT(status == A_OK);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n"));
}
示例3: resume_task
/* handle HTC startup via thread*/
static int resume_task(void *param)
{
HIF_DEVICE *device;
device = (HIF_DEVICE *)param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: call HTC from resume_task\n"));
/* start up inform DRV layer */
if (device && device->claimedContext && osdrvCallbacks.deviceResumeHandler &&
osdrvCallbacks.deviceResumeHandler(device->claimedContext) != A_OK) {
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Device rejected\n"));
}
return 0;
}
示例4: 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;
}
示例5: hifDeviceSuspend
static int hifDeviceSuspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
A_STATUS status = A_OK;
HIF_DEVICE *device;
device = getHifDevice(func);
if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
status = osdrvCallbacks.deviceSuspendHandler(device->claimedContext);
}
if (status == A_OK) {
int oldresetvalue = reset_sdio_on_unload;
reset_sdio_on_unload = 1;
hifDisableFunc(device, func);
reset_sdio_on_unload = oldresetvalue;
device->is_suspend = TRUE;
} else if (status == A_EBUSY) {
A_INT32 cnt = 10;
A_UINT8 host_int_status;
do {
while (atomic_read(&device->irqHandling)) {
/* wait until irq handler finished all the jobs */
schedule_timeout(HZ/10);
}
/* check if there is any pending irq due to force done */
host_int_status = 0;
status = HIFReadWrite(device, HOST_INT_STATUS_ADDRESS,
(A_UINT8 *)&host_int_status, sizeof(host_int_status),
HIF_RD_SYNC_BYTE_INC, NULL);
host_int_status = A_SUCCESS(status) ? (host_int_status & (1 << 0)) : 0;
if (host_int_status) {
schedule(); /* schedule for next dsrHandler */
}
} while (host_int_status && --cnt > 0);
if (host_int_status && cnt == 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("AR6000: %s(), Unable clear up pending IRQ before the system suspended\n",
__FUNCTION__));
}
#if 1
status = A_OK; /* assume that sdio host controller will take care the power of wifi chip */
#else
return -EBUSY; /* Return -EBUSY if customer use all android patch of mmc stack provided by us */
#endif
}
return A_SUCCESS(status) ? 0 : status;
}
示例6: hifDeviceSuspend
static int hifDeviceSuspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
A_STATUS status = A_OK;
HIF_DEVICE *device;
device = getHifDevice(func);
if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
status = osdrvCallbacks.deviceSuspendHandler(device->claimedContext);
}
if (status == A_OK) {
hifDisableFunc(device, func);
device->is_suspend = TRUE;
} else if (status == A_EBUSY) {
status = A_OK; /* assume that sdio host controller will take care the power of wifi chip */
}
return A_SUCCESS(status) ? 0 : status;
}
示例7: hifCleanupDevice
void
hifDeviceRemoved(SDFUNCTION *function, SDDEVICE *handle)
{
A_STATUS status = A_OK;
HIF_DEVICE *device;
AR_DEBUG_ASSERT(function != NULL);
AR_DEBUG_ASSERT(handle != NULL);
/* our device is the IRQ context we stored */
device = (HIF_DEVICE *)handle->IrqContext;
if (device->claimedContext != NULL) {
status = osdrvCallbacks.deviceRemovedHandler(device->claimedContext, device);
}
/* cleanup the instance */
hifCleanupDevice(device);
AR_DEBUG_ASSERT(status == A_OK);
}
示例8: getHifDevice
void
hifDeviceRemoved(SD_DEVICE_HANDLE *handle)
{
A_STATUS status;
HIF_DEVICE *device;
NDIS_DEBUG_PRINTF(1, "%s() : + Enter \r\n", __FUNCTION__);
device = getHifDevice(handle);
if (device->claimedContext != NULL) {
status = osdrvCallbacks.deviceRemovedHandler(device->claimedContext, device);
}
delHifDevice(handle);
AR_DEBUG_ASSERT(status == A_OK);
return;
}
示例9: HIFDoDeviceSuspend
int HIFDoDeviceSuspend(HIF_DEVICE *device)
{
A_STATUS status = A_OK;
if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
status = osdrvCallbacks.deviceSuspendHandler(device->claimedContext);
}
if (status == A_OK) {
/* Waiting for all pending request */
if (!IS_ERR(device->async_task)) {
init_completion(&device->async_completion);
device->async_shutdown = 1;
up(&device->sem_async);
wait_for_completion(&device->async_completion);
device->async_task = NULL;
}
device->is_suspend = TRUE;
} else if (status == A_EBUSY) {
return -EBUSY; /* Return -1 if customer use all android patch of mmc stack provided by us */
}
return A_SUCCESS(status) ? 0 : status;
}
示例10: 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;
}
示例11: resume_task
/* handle HTC startup via thread*/
static int resume_task(void *param)
{
HIF_DEVICE *device;
device = (HIF_DEVICE *)param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: call HTC from resume_task\n"));
/* ATHENV */
#ifdef ANDROID_ENV
wake_lock(&ar6k_init_wake_lock);
#endif
/* ATHENV */
/* start up inform DRV layer */
if (device && device->claimedContext && osdrvCallbacks.deviceResumeHandler &&
osdrvCallbacks.deviceResumeHandler(device->claimedContext) != 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;
}
示例12: addHifDevice
BOOL
hifDeviceInserted(SD_DEVICE_HANDLE *handle)
{
HIF_DEVICE *device;
#if 0
SD_API_STATUS sdStatus;
SDIO_CARD_INFO sdioInfo;
SD_HOST_BLOCK_CAPABILITY blockCap;
SD_CARD_RCA cardRCA;
A_UCHAR rgucTuple[SD_CISTPLE_MAX_BODY_SIZE];
PSD_CISTPL_FUNCE_FUNCTION pFunce = (PSD_CISTPL_FUNCE_FUNCTION) rgucTuple;
A_UINT32 ulLength = 0;
A_UCHAR ucRegVal;
A_BOOL blockMode;
SD_CARD_INTERFACE ci;
SD_IO_FUNCTION_ENABLE_INFO fData;
DWORD bData;
//SDCONFIG_FUNC_SLOT_CURRENT_DATA slotCurrent;
//HANDLE hIrqThread;
#endif
HANDLE hThread;
device = addHifDevice(handle);
NDIS_DEBUG_PRINTF(1, "hifDeviceInserted: Enter\r\n");
#if 0
/* Enable SDIO [dragon] function */
fData.Interval = DEFAULT_SDIO_FUNCTION_RETRY_TIMEOUT;
fData.ReadyRetryCount = DEFAULT_SDIO_FUNCTION_RETRIES;
sdStatus = SDSetCardFeature (handle, SD_IO_FUNCTION_ENABLE, &fData, sizeof(fData));
if (!SD_API_SUCCESS(sdStatus))
{
return FALSE;
}
/*
* Issue commands to get the manufacturer ID and stuff and compare it
* against the rev Id derived from the ID registered during the
* initialization process. Report the device only in the case there
* is a match.
*/
sdStatus = SDCardInfoQuery(handle, SD_INFO_SDIO, &sdioInfo, sizeof(sdioInfo));
if (!SD_API_SUCCESS(sdStatus))
{
return FALSE;
}
funcNo = sdioInfo.FunctionNumber;
sdStatus = SDCardInfoQuery(handle, SD_INFO_REGISTER_RCA, &cardRCA, sizeof(cardRCA));
NDIS_DEBUG_PRINTF(1, " Card RCA is 0x%x \r\n", cardRCA);
/* Configure the SDIO Bus Width */
memset(&ci, 0, sizeof(ci));
if (sdio1bitmode) {
ci.InterfaceMode = SD_INTERFACE_SD_MMC_1BIT;
} else {
ci.InterfaceMode = SD_INTERFACE_SD_4BIT;
}
if (sdiobusspeedlow) {
ci.ClockRate = SDIO_CLOCK_FREQUENCY_REDUCED;
} else {
ci.ClockRate = SDIO_CLOCK_FREQUENCY_DEFAULT;
}
sdStatus = SDSetCardFeature(handle, SD_SET_CARD_INTERFACE, &ci, sizeof(ci));
if (!SD_API_SUCCESS(sdStatus)) {
return FALSE;
}
/* Check if the target supports block mode */
sdStatus = SDReadWriteRegistersDirect(handle, SD_IO_READ, 0, 0x08, FALSE, &ucRegVal, 1);
if (!SD_API_SUCCESS(sdStatus)) {
return FALSE;
}
blockMode = (ucRegVal & 0x2) >> 1; // SMB is bit 1
if (!blockMode)
{
NDIS_DEBUG_PRINTF(DBG_ERR, "[HIF] Function does not support block mode \r\n");
return FALSE;
}
else
{
NDIS_DEBUG_PRINTF(DBG_LEVEL_HIF, "[HIF] Function supports block mode \r\n");
blockCap.ReadBlocks = blockCap.WriteBlocks = 8;
blockCap.ReadBlockSize = blockCap.WriteBlockSize = HIF_MBOX_BLOCK_SIZE;
sdStatus = SDCardInfoQuery(handle, SD_INFO_HOST_BLOCK_CAPABILITY,
//.........这里部分代码省略.........
示例13: 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;
}