本文整理汇总了C++中sdio_claim_host函数的典型用法代码示例。如果您正苦于以下问题:C++ sdio_claim_host函数的具体用法?C++ sdio_claim_host怎么用?C++ sdio_claim_host使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sdio_claim_host函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disable_sdio_interrupt
void disable_sdio_interrupt(void){
#ifndef ATWILC_SDIO_IRQ_GPIO
int ret;
if(sdio_intr_lock == ATWILC_SDIO_HOST_IRQ_TAKEN )
wait_event_interruptible(sdio_intr_waitqueue, sdio_intr_lock == ATWILC_SDIO_HOST_NO_TAKEN );
sdio_intr_lock = ATWILC_SDIO_HOST_DIS_TAKEN;
sdio_claim_host(local_sdio_func);
ret = sdio_release_irq(local_sdio_func);
if (ret < 0) {
PRINT_ER("can't release sdio_irq, err(%d)\n", ret);
}
sdio_release_host(local_sdio_func);
sdio_intr_lock = ATWILC_SDIO_HOST_NO_TAKEN;
#endif
}
示例2: woal_sdio_read_write_cmd52
/**
* @brief This function updates card reg based on the Cmd52 value in dev structure
*
* @param priv A pointer to moal_handle structure
* @param func A pointer to store func variable
* @param reg A pointer to store reg variable
* @param val A pointer to store val variable
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
*/
int
woal_sdio_read_write_cmd52(moal_handle * handle, int func, int reg, int val)
{
int ret = MLAN_STATUS_SUCCESS;
struct sdio_mmc_card *card = (struct sdio_mmc_card *) handle->card;
ENTER();
/* Save current func and reg for read */
handle->cmd52_func = func;
handle->cmd52_reg = reg;
sdio_claim_host(card->func);
if (val >= 0) {
/* Perform actual write only if val is provided */
if (func)
sdio_writeb(card->func, val, reg, &ret);
else
sdio_f0_writeb(card->func, val, reg, &ret);
if (ret) {
PRINTM(MERROR, "Cannot write value (0x%x) to func %d reg 0x%x\n",
val, func, reg);
} else {
PRINTM(MMSG, "write value (0x%x) to func %d reg 0x%x\n", (u8) val,
func, reg);
handle->cmd52_val = val;
}
} else {
if (func)
val = sdio_readb(card->func, reg, &ret);
else
val = sdio_f0_readb(card->func, reg, &ret);
if (ret) {
PRINTM(MERROR, "Cannot read value from func %d reg 0x%x\n", func,
reg);
} else {
PRINTM(MMSG, "read value (0x%x) from func %d reg 0x%x\n", (u8) val,
func, reg);
handle->cmd52_val = val;
}
}
sdio_release_host(card->func);
LEAVE();
return ret;
}
示例3: woal_register_dev
/**
* @brief This function registers the device
*
* @param handle A pointer to moal_handle structure
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
*/
mlan_status
woal_register_dev(moal_handle * handle)
{
int ret = MLAN_STATUS_SUCCESS;
struct sdio_mmc_card *card = handle->card;
struct sdio_func *func;
ENTER();
func = card->func;
sdio_claim_host(func);
/* Request the SDIO IRQ */
ret = sdio_claim_irq(func, woal_sdio_interrupt);
if (ret) {
PRINTM(MFATAL, "sdio_claim_irq failed: ret=%d\n", ret);
goto release_host;
}
/* Set block size */
ret = sdio_set_block_size(card->func, MLAN_SDIO_BLOCK_SIZE);
if (ret) {
PRINTM(MERROR, "sdio_set_block_seize(): cannot set SDIO block size\n");
ret = MLAN_STATUS_FAILURE;
goto release_irq;
}
sdio_release_host(func);
sdio_set_drvdata(func, card);
handle->hotplug_device = &func->dev;
LEAVE();
return MLAN_STATUS_SUCCESS;
release_irq:
sdio_release_irq(func);
release_host:
sdio_release_host(func);
handle->card = NULL;
LEAVE();
return MLAN_STATUS_FAILURE;
}
示例4: if_sdio_send_chunk
static int if_sdio_send_chunk(struct iwm_priv *iwm, u8 *buf, int count)
{
struct iwm_sdio_priv *hw = iwm_to_if_sdio(iwm);
int aligned_count = ALIGN(count, hw->blk_size);
int ret;
if ((unsigned long)buf & 0x3) {
IWM_ERR(iwm, "buf <%p> is not dword aligned\n", buf);
return -EINVAL;
}
sdio_claim_host(hw->func);
ret = sdio_memcpy_toio(hw->func, IWM_SDIO_DATA_ADDR, buf,
aligned_count);
sdio_release_host(hw->func);
return ret;
}
示例5: woal_unregister_dev
/**
* @brief This function de-registers the device
*
* @param handle A pointer to moal_handle structure
* @return N/A
*/
void
woal_unregister_dev(moal_handle * handle)
{
ENTER();
if (handle->card) {
/* Release the SDIO IRQ */
sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func);
sdio_release_irq(((struct sdio_mmc_card *)handle->card)->func);
sdio_disable_func(((struct sdio_mmc_card *)handle->card)->func);
sdio_release_host(((struct sdio_mmc_card *)handle->card)->func);
sdio_set_drvdata(((struct sdio_mmc_card *)handle->card)->func,
NULL);
PRINTM(MWARN, "Making the sdio dev card as NULL\n");
}
LEAVE();
}
示例6: sd_f0_read8
u8 sd_f0_read8(PSDIO_DATA psdio, u32 addr, s32 *err)
{
u8 v;
struct sdio_func *func;
_func_enter_;
func = psdio->func;
sdio_claim_host(func);
v = sdio_f0_readb(func, addr, err);
sdio_release_host(func);
if (err && *err)
printk(KERN_ERR "%s: FAIL!(%d) addr=0x%05x\n", __func__, *err, addr);
_func_exit_;
return v;
}
示例7: smssdio_sendrequest
static int smssdio_sendrequest(void *context, void *buffer, size_t size)
{
int ret = 0;
struct smssdio_device *smsdev;
void* auxbuf = NULL;
smsdev = context;
if (size & 3)
{
/* Make sure size is aligned to 32 bits, round up if required*/
auxbuf = kmalloc((size + 3) & 0xfffffffc, GFP_KERNEL);
memcpy (auxbuf, buffer, size);
buffer = auxbuf;
size = (size + 3) & 0xfffffffc;
}
sdio_claim_host(smsdev->func);
while (size >= smsdev->func->cur_blksize) {
ret = sdio_memcpy_toio(smsdev->func, SMSSDIO_DATA,
buffer, smsdev->func->cur_blksize);
if (ret)
goto out;
buffer += smsdev->func->cur_blksize;
size -= smsdev->func->cur_blksize;
}
if (size) {
ret = sdio_memcpy_toio(smsdev->func, SMSSDIO_DATA,
buffer, size);
}
out:
if (auxbuf)
kfree(auxbuf);
sdio_release_host(smsdev->func);
return ret;
}
示例8: mwifiex_register_dev
/*
* This function registers the SDIO device.
*
* SDIO IRQ is claimed, block size is set and driver data is initialized.
*/
static int mwifiex_register_dev(struct mwifiex_adapter *adapter)
{
int ret = 0;
struct sdio_mmc_card *card = adapter->card;
struct sdio_func *func = card->func;
/* save adapter pointer in card */
card->adapter = adapter;
sdio_claim_host(func);
/* Request the SDIO IRQ */
ret = sdio_claim_irq(func, mwifiex_sdio_interrupt);
if (ret) {
pr_err("claim irq failed: ret=%d\n", ret);
goto disable_func;
}
/* Set block size */
ret = sdio_set_block_size(card->func, MWIFIEX_SDIO_BLOCK_SIZE);
if (ret) {
pr_err("cannot set SDIO block size\n");
ret = -1;
goto release_irq;
}
sdio_release_host(func);
sdio_set_drvdata(func, card);
adapter->dev = &func->dev;
return 0;
release_irq:
sdio_release_irq(func);
disable_func:
sdio_disable_func(func);
sdio_release_host(func);
adapter->card = NULL;
return -1;
}
示例9: woal_read_data_sync
/**
* @brief This function reads multiple bytes from card memory
*
* @param handle A Pointer to the moal_handle structure
* @param pmbuf Pointer to mlan_buffer structure
* @param port Port
* @param timeout Time out value
*
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
*/
mlan_status
woal_read_data_sync(moal_handle *handle, mlan_buffer *pmbuf, t_u32 port,
t_u32 timeout)
{
mlan_status ret = MLAN_STATUS_FAILURE;
t_u8 *buffer = (t_u8 *)(pmbuf->pbuf + pmbuf->data_offset);
t_u8 blkmode =
(port & MLAN_SDIO_BYTE_MODE_MASK) ? BYTE_MODE : BLOCK_MODE;
t_u32 blksz = (blkmode == BLOCK_MODE) ? MLAN_SDIO_BLOCK_SIZE : 1;
t_u32 blkcnt =
(blkmode ==
BLOCK_MODE) ? (pmbuf->data_len /
MLAN_SDIO_BLOCK_SIZE) : pmbuf->data_len;
t_u32 ioport = (port & MLAN_SDIO_IO_PORT_MASK);
int status = 0;
if (pmbuf->use_count > 1)
return woal_sdio_rw_mb(handle, pmbuf, port, MFALSE);
#ifdef SDIO_MMC_DEBUG
handle->cmd53r = 1;
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func);
#endif
status = sdio_readsb(((struct sdio_mmc_card *)handle->card)->func,
buffer, ioport, blkcnt * blksz);
if (!status) {
ret = MLAN_STATUS_SUCCESS;
} else {
PRINTM(MERROR, "cmd53 read error=%d\n", status);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
/* issue abort cmd52 command through F0*/
sdio_f0_writeb(((struct sdio_mmc_card *)handle->card)->func, 0x01, SDIO_CCCR_ABORT, &status);
#endif
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
sdio_release_host(((struct sdio_mmc_card *)handle->card)->func);
#endif
#ifdef SDIO_MMC_DEBUG
handle->cmd53r = 2;
#endif
return ret;
}
示例10: mtk_sdio_remove
static void mtk_sdio_remove(struct sdio_func *func)
{
/* printk(KERN_INFO DRV_NAME"mtk_sdio_remove()\n"); */
#if CFG_DBG_GPIO_PINS
/* printk(KERN_INFO "[%s] deinit debug gpio\n", __FUNCTION__); */
debug_gpio_deinit();
#endif
ASSERT(func);
/* printk(KERN_INFO DRV_NAME"pfWlanRemove done\n"); */
pfWlanRemove();
sdio_claim_host(func);
sdio_disable_func(func);
/* printk(KERN_INFO DRV_NAME"sdio_disable_func() done\n"); */
sdio_release_host(func);
/* printk(KERN_INFO DRV_NAME"mtk_sdio_remove() done\n"); */
}
示例11: sbi_enable_host_int
/**
* @brief This function enables the host interrupts.
*
* @param priv A pointer to bt_private structure
* @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE
*/
int
sbi_enable_host_int(bt_private * priv)
{
struct sdio_mmc_card *card = priv->bt_dev.card;
int ret;
ENTER();
if (!card || !card->func) {
LEAVE();
return BT_STATUS_FAILURE;
}
sdio_claim_host(card->func);
ret = sd_enable_host_int_mask(priv, HIM_ENABLE);
sd_get_rx_unit(priv);
sdio_release_host(card->func);
LEAVE();
return ret;
}
示例12: sd_f0_write8
void sd_f0_write8(PSDIO_DATA psdio, u32 addr, u8 v, s32 *err)
{
struct sdio_func *func;
bool claim_needed;
_func_enter_;
func = psdio->func;
claim_needed = rtw_sdio_claim_host_needed(func);
if (claim_needed)
sdio_claim_host(func);
sdio_f0_writeb(func, v, addr, err);
if (claim_needed)
sdio_release_host(func);
if (err && *err)
DBG_871X(KERN_ERR "%s: FAIL!(%d) addr=0x%05x val=0x%02x\n", __func__, *err, addr, v);
_func_exit_;
}
示例13: mtlte_sys_sdio_remove_irq
static int mtlte_sys_sdio_remove_irq(struct sdio_func *sdiofunc)
{
int ret = 0 ;
KAL_RAWPRINT(("[REMOVE] =======> mtlte_sys_sdio_remove_irq\n"));
lte_sdio_disable_eirq();
sdio_claim_host(sdiofunc);
ret = sdio_release_irq(sdiofunc);
sdio_release_host(sdiofunc);
if (ret){
KAL_RAWPRINT(("[REMOVE] XXXXXX mtlte_sys_sdio_remove_irq fail, %d \n", ret ));
return (ret);
}
KAL_RAWPRINT(("[REMOVE] <======= mtlte_sys_sdio_remove_irq\n"));
return 0 ;
}
示例14: sif_enable_irq
void sif_enable_irq(struct esp_pub *epub)
{
int err;
struct esp_sdio_ctrl *sctrl = NULL;
sctrl = (struct esp_sdio_ctrl *)epub->sif;
sdio_claim_host(sctrl->func);
err = sdio_claim_irq(sctrl->func, sif_dsr);
if (err)
esp_dbg(ESP_DBG_ERROR, "sif %s failed\n", __func__);
atomic_set(&epub->sip->state, SIP_BOOT);
atomic_set(&sctrl->irq_installed, 1);
sdio_release_host(sctrl->func);
}
示例15: if_sdio_enable
/* Bus ops */
static int if_sdio_enable(struct iwm_priv *iwm)
{
struct iwm_sdio_priv *hw = iwm_to_if_sdio(iwm);
int ret;
sdio_claim_host(hw->func);
ret = sdio_enable_func(hw->func);
if (ret) {
IWM_ERR(iwm, "Couldn't enable the device: is TOP driver "
"loaded and functional?\n");
goto release_host;
}
iwm_reset(iwm);
ret = sdio_claim_irq(hw->func, iwm_sdio_isr);
if (ret) {
IWM_ERR(iwm, "Failed to claim irq: %d\n", ret);
goto release_host;
}
sdio_writeb(hw->func, 1, IWM_SDIO_INTR_ENABLE_ADDR, &ret);
if (ret < 0) {
IWM_ERR(iwm, "Couldn't enable INTR: %d\n", ret);
goto release_irq;
}
sdio_release_host(hw->func);
IWM_DBG_SDIO(iwm, INFO, "IWM SDIO enable\n");
return 0;
release_irq:
sdio_release_irq(hw->func);
release_host:
sdio_release_host(hw->func);
return ret;
}