本文整理汇总了C++中sdio_memcpy_toio函数的典型用法代码示例。如果您正苦于以下问题:C++ sdio_memcpy_toio函数的具体用法?C++ sdio_memcpy_toio怎么用?C++ sdio_memcpy_toio使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sdio_memcpy_toio函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: smssdio_sendrequest
static int smssdio_sendrequest(void *context, void *buffer, size_t size)
{
int ret = 0;
struct smssdio_device *smsdev;
smsdev = context;
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:
sdio_release_host(smsdev->func);
return ret;
}
示例2: linux_sdio_cmd53
int linux_sdio_cmd53(sdio_cmd53_t *cmd)
{
struct sdio_func *func = g_linux_wlan->wilc_sdio_func;
int size, ret;
sdio_claim_host(func);
func->num = cmd->function;
func->cur_blksize = cmd->block_size;
if (cmd->block_mode)
size = cmd->count * cmd->block_size;
else
size = cmd->count;
if (cmd->read_write) { /* write */
ret = sdio_memcpy_toio(func, cmd->address, (void *)cmd->buffer, size);
} else { /* read */
ret = sdio_memcpy_fromio(func, (void *)cmd->buffer, cmd->address, size);
}
sdio_release_host(func);
if (ret < 0) {
PRINT_ER("wilc_sdio_cmd53..failed, err(%d)\n", ret);
return 0;
}
return 1;
}
示例3: wl1271_sdio_raw_write
static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
size_t len, bool fixed)
{
int ret;
struct sdio_func *func = wl_to_func(wl);
sdio_claim_host(func);
if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
sdio_f0_writeb(func, ((u8 *)buf)[0], addr, &ret);
wl1271_debug(DEBUG_SDIO, "sdio write 52 addr 0x%x, byte 0x%02x",
addr, ((u8 *)buf)[0]);
} else {
wl1271_debug(DEBUG_SDIO, "sdio write 53 addr 0x%x, %zu bytes",
addr, len);
wl1271_dump_ascii(DEBUG_SDIO, "data: ", buf, len);
if (fixed)
ret = sdio_writesb(func, addr, buf, len);
else
ret = sdio_memcpy_toio(func, addr, buf, len);
}
sdio_release_host(func);
if (ret)
wl1271_error("sdio write failed (%d)", ret);
}
示例4: __i2400ms_send_barker
/*
* Sends a barker buffer to the device
*
* This helper will allocate a kmalloced buffer and use it to transmit
* (then free it). Reason for this is that the SDIO host controller
* expects alignment (unknown exactly which) which the stack won't
* really provide and certain arches/host-controller combinations
* cannot use stack/vmalloc/text areas for DMA transfers.
*/
static
int __i2400ms_send_barker(struct i2400ms *i2400ms,
const __le32 *barker, size_t barker_size)
{
int ret;
struct sdio_func *func = i2400ms->func;
struct device *dev = &func->dev;
void *buffer;
ret = -ENOMEM;
buffer = kmalloc(I2400MS_BLK_SIZE, GFP_KERNEL);
if (buffer == NULL)
goto error_kzalloc;
memcpy(buffer, barker, barker_size);
sdio_claim_host(func);
ret = sdio_memcpy_toio(func, 0, buffer, I2400MS_BLK_SIZE);
sdio_release_host(func);
if (ret < 0)
d_printf(0, dev, "E: barker error: %d\n", ret);
kfree(buffer);
error_kzalloc:
return ret;
}
示例5: ks7010_sdio_write
/* Write length bytes to device address from buffer (CMD53) */
static int ks7010_sdio_write(struct ks_wlan_private *priv, unsigned int address,
unsigned char *buffer, int length)
{
struct sdio_func *func = priv->ks_sdio_card->func;
return sdio_memcpy_toio(func, address, buffer, length);
}
示例6: sdioDrv_WriteSync
int sdioDrv_WriteSync (unsigned int uFunc,
unsigned int uHwAddr,
void * pData,
unsigned int uLen,
unsigned int bIncAddr,
unsigned int bMore)
{
int ret;
PDEBUG("%s: uFunc %d uHwAddr %d pData %x uLen %d bIncAddr %d\n", __func__, uFunc, uHwAddr, (unsigned int)pData, uLen, bIncAddr);
/* If request is either for sdio function 0 or not a multiple of 4 (OMAP DMA limit)
then we have to use CMD 52's */
if (uFunc == SDIO_CTRL_FUNC || uLen % 4 != 0)
{
ret = generic_write_bytes(uFunc, uHwAddr, pData, uLen, bIncAddr, bMore);
}
else
{
if (bIncAddr)
ret = sdio_memcpy_toio(tiwlan_func[uFunc], uHwAddr, pData, uLen);
else
ret = sdio_writesb(tiwlan_func[uFunc], uHwAddr, pData, uLen);
}
if (ret) {
printk(KERN_ERR "%s: sdio error: %d\n", __func__, ret);
return -1;
}
return 0;
}
示例7: SDIO_SyncWrite
SDIO_Status SDIO_SyncWrite(SDIO_Handle Handle, SDIO_Request_t *Req)
{
struct sdio_func *func = (struct sdio_func *)Handle;
int rc;
void *src = Req->buffer;
if (Req->buffer_len >= DMA_THRESHOLD_SIZE) {
#if USE_SKETCHY_WRITES
if (is_vmalloc_addr(src)) {
if (!spans_page(src, Req->buffer_len)) {
src = vmalloc_to_unity(src);
dmac_clean_range(Req->buffer,
Req->buffer + Req->buffer_len);
} else {
#endif
src = sdio_dma_ptr;
memcpy(src, Req->buffer, Req->buffer_len);
#if USE_SKETCHY_WRITES
}
}
#endif
}
rc = sdio_memcpy_toio(func, Req->peripheral_addr, src,
Req->buffer_len);
if (!rc)
return SDIO_SUCCESS;
printk(KERN_ERR "%s: failed (%d)\n", __func__, rc);
return SDIO_FAILURE;
}
示例8: sd_send_data
u_int sd_send_data(struct net_adapter *adapter, struct buffer_descriptor *dsc)
{
int nRet = 0;
int nWriteIdx;
dsc->length += (dsc->length & 1) ? 1 : 0;
#ifdef HARDWARE_USE_ALIGN_HEADER
if (dsc->length > SDIO_MAX_BYTE_SIZE)
dsc->length = (dsc->length + SDIO_MAX_BYTE_SIZE)
& ~(SDIO_MAX_BYTE_SIZE);
#endif
if (adapter->halted) {
dump_debug("Halted Already");
return STATUS_UNSUCCESSFUL;
}
hwSdioWriteBankIndex(adapter, &nWriteIdx, &nRet);
if (nRet || (nWriteIdx < 0)) {
dump_debug("sd_send_data : "
" error fetch bank index!! nRet = %d", nRet);
return STATUS_UNSUCCESSFUL;
}
sdio_writeb(adapter->func, (nWriteIdx + 1) % 15,
SDIO_H2C_WP_REG, NULL);
nRet = sdio_memcpy_toio(adapter->func,
SDIO_TX_BANK_ADDR+(SDIO_BANK_SIZE * nWriteIdx)+4,
dsc->buffer, dsc->length);
if (nRet < 0)
dump_debug("sd_send_data :"
" error writing dsc packet!! nRet = %d", nRet);
nRet = sdio_memcpy_toio(adapter->func,
SDIO_TX_BANK_ADDR + (SDIO_BANK_SIZE * nWriteIdx),
&(dsc->length), 4);
if (nRet < 0)
dump_debug("sd_send_data :"
"error writing bank length info!! nRet = %d", nRet);
return nRet;
}
示例9: sdio_writew
/**
* sdio_writew - write a 16 bit integer to a SDIO function
* @func: SDIO function to access
* @b: integer to write
* @addr: address to write to
* @err_ret: optional status value from transfer
*
* Writes a 16 bit integer to the address space of a given SDIO
* function. @err_ret will contain the status of the actual
* transfer.
*/
void sdio_writew(struct sdio_func *func, u16 b, unsigned int addr, int *err_ret)
{
int ret;
*(__le16 *)func->tmpbuf = cpu_to_le16(b);
ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 2);
if (err_ret)
*err_ret = ret;
}
示例10: sdio_writel
/**
* sdio_writel - write a 32 bit integer to a SDIO function
* @func: SDIO function to access
* @b: integer to write
* @addr: address to write to
* @err_ret: optional status value from transfer
*
* Writes a 32 bit integer to the address space of a given SDIO
* function. @err_ret will contain the status of the actual
* transfer.
*/
void sdio_writel(struct sdio_func *func, u32 b, unsigned int addr, int *err_ret)
{
int ret;
*(__le32 *)func->tmpbuf = cpu_to_le32(b);
ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 4);
if (err_ret)
*err_ret = ret;
}
示例11: 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;
}
示例12: wl1251_sdio_write
static void wl1251_sdio_write(struct wl1251 *wl, int addr,
void *buf, size_t len)
{
int ret;
struct sdio_func *func = wl_to_func(wl);
sdio_claim_host(func);
ret = sdio_memcpy_toio(func, addr, buf, len);
if (ret)
wl1251_error("sdio write failed (%d)", ret);
sdio_release_host(func);
}
示例13: brcmf_sdioh_request_data
/* precondition: host controller is claimed */
static int
brcmf_sdioh_request_data(struct brcmf_sdio_dev *sdiodev, uint write, bool fifo,
uint func, uint addr, struct sk_buff *pkt, uint pktlen)
{
int err_ret = 0;
if ((write) && (!fifo)) {
err_ret = sdio_memcpy_toio(sdiodev->func[func], addr,
((u8 *) (pkt->data)), pktlen);
} else if (write) {
err_ret = sdio_memcpy_toio(sdiodev->func[func], addr,
((u8 *) (pkt->data)), pktlen);
} else if (fifo) {
err_ret = sdio_readsb(sdiodev->func[func],
((u8 *) (pkt->data)), addr, pktlen);
} else {
err_ret = sdio_memcpy_fromio(sdiodev->func[func],
((u8 *) (pkt->data)),
addr, pktlen);
}
return err_ret;
}
示例14: _sd_write
/*
* Use CMD53 to write data to SDIO device.
* This function MUST be called after sdio_claim_host() or
* in SDIO ISR(host had been claimed).
*
* Parameters:
* psdio pointer of SDIO_DATA
* addr address to write
* cnt amount to write
* pdata data pointer, this should be a "DMA:able scratch buffer"!
*
* Return:
* 0 Success
* others Fail
*/
s32 _sd_write(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, void *pdata)
{
PADAPTER padapter;
struct dvobj_priv *psdiodev;
PSDIO_DATA psdio;
struct sdio_func *func;
u32 size;
s32 err=-EPERM;
_func_enter_;
padapter = pintfhdl->padapter;
psdiodev = pintfhdl->pintf_dev;
psdio = &psdiodev->intf_data;
if(padapter->bSurpriseRemoved){
//DBG_871X(" %s (padapter->bSurpriseRemoved )!!!\n",__FUNCTION__);
return err;
}
func = psdio->func;
// size = sdio_align_size(func, cnt);
if (unlikely((cnt==1) || (cnt==2)))
{
int i;
u8 *pbuf = (u8*)pdata;
for (i = 0; i < cnt; i++)
{
sdio_writeb(func, *(pbuf+i), addr+i, &err);
if (err) {
DBG_871X(KERN_ERR "%s: FAIL!(%d) addr=0x%05x val=0x%02x\n", __func__, err, addr, *(pbuf+i));
break;
}
}
return err;
}
size = cnt;
err = sdio_memcpy_toio(func, addr, pdata, size);
if (err) {
DBG_871X(KERN_ERR "%s: FAIL(%d)! ADDR=%#x Size=%d(%d)\n", __func__, err, addr, cnt, size);
}
_func_exit_;
return err;
}
示例15: i2400ms_bus_bm_cmd_send
ssize_t i2400ms_bus_bm_cmd_send(struct i2400m *i2400m,
const struct i2400m_bootrom_header *_cmd,
size_t cmd_size, int flags)
{
ssize_t result;
struct device *dev = i2400m_dev(i2400m);
struct i2400ms *i2400ms = container_of(i2400m, struct i2400ms, i2400m);
int opcode = _cmd == NULL ? -1 : i2400m_brh_get_opcode(_cmd);
struct i2400m_bootrom_header *cmd;
size_t cmd_size_a = ALIGN(cmd_size, I2400MS_BLK_SIZE);
d_fnstart(5, dev, "(i2400m %p cmd %p size %zu)\n",
i2400m, _cmd, cmd_size);
result = -E2BIG;
if (cmd_size > I2400M_BM_CMD_BUF_SIZE)
goto error_too_big;
if (_cmd != i2400m->bm_cmd_buf)
memmove(i2400m->bm_cmd_buf, _cmd, cmd_size);
cmd = i2400m->bm_cmd_buf;
if (cmd_size_a > cmd_size)
memset(i2400m->bm_cmd_buf + cmd_size, 0, cmd_size_a - cmd_size);
if ((flags & I2400M_BM_CMD_RAW) == 0) {
if (WARN_ON(i2400m_brh_get_response_required(cmd) == 0))
dev_warn(dev, "SW BUG: response_required == 0\n");
i2400m_bm_cmd_prepare(cmd);
}
d_printf(4, dev, "BM cmd %d: %zu bytes (%zu padded)\n",
opcode, cmd_size, cmd_size_a);
d_dump(5, dev, cmd, cmd_size);
sdio_claim_host(i2400ms->func);
result = sdio_memcpy_toio(i2400ms->func, I2400MS_DATA_ADDR,
i2400m->bm_cmd_buf, cmd_size_a);
sdio_release_host(i2400ms->func);
if (result < 0) {
dev_err(dev, "BM cmd %d: cannot send: %ld\n",
opcode, (long) result);
goto error_cmd_send;
}
result = cmd_size;
error_cmd_send:
error_too_big:
d_fnend(5, dev, "(i2400m %p cmd %p size %zu) = %d\n",
i2400m, _cmd, cmd_size, (int) result);
return result;
}