本文整理汇总了C++中writeq函数的典型用法代码示例。如果您正苦于以下问题:C++ writeq函数的具体用法?C++ writeq怎么用?C++ writeq使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeq函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cpld_reconfigure
static ssize_t cpld_reconfigure(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct kp2000_device *pcard = dev_get_drvdata(dev);
long wr_val;
int rv;
rv = kstrtol(buf, 0, &wr_val);
if (rv < 0)
return rv;
if (wr_val > 7)
return -EINVAL;
wr_val = wr_val << 8;
wr_val |= 0x1; // Set the "Configure Go" bit
writeq(wr_val, pcard->sysinfo_regs_base + REG_CPLD_CONFIG);
return count;
}
示例2: cvm_mmc_reset_bus
static void cvm_mmc_reset_bus(struct cvm_mmc_slot *slot)
{
struct cvm_mmc_host *host = slot->host;
u64 emm_switch, wdog;
emm_switch = readq(slot->host->base + MIO_EMM_SWITCH(host));
emm_switch &= ~(MIO_EMM_SWITCH_EXE | MIO_EMM_SWITCH_ERR0 |
MIO_EMM_SWITCH_ERR1 | MIO_EMM_SWITCH_ERR2);
set_bus_id(&emm_switch, slot->bus_id);
wdog = readq(slot->host->base + MIO_EMM_WDOG(host));
do_switch(slot->host, emm_switch);
slot->cached_switch = emm_switch;
msleep(20);
writeq(wdog, slot->host->base + MIO_EMM_WDOG(host));
}
示例3: finish_dma_sg
static int finish_dma_sg(struct cvm_mmc_host *host, struct mmc_data *data)
{
u64 fifo_cfg;
int count;
/* Check if there are any pending requests left */
fifo_cfg = readq(host->dma_base + MIO_EMM_DMA_FIFO_CFG(host));
count = FIELD_GET(MIO_EMM_DMA_FIFO_CFG_COUNT, fifo_cfg);
if (count)
dev_err(host->dev, "%u requests still pending\n", count);
data->bytes_xfered = data->blocks * data->blksz;
data->error = 0;
/* Clear and disable FIFO */
writeq(BIT_ULL(16), host->dma_base + MIO_EMM_DMA_FIFO_CFG(host));
dma_unmap_sg(host->dev, data->sg, data->sg_len, get_dma_dir(data));
return 1;
}
示例4: cvm_mmc_interrupt
irqreturn_t cvm_mmc_interrupt(int irq, void *dev_id)
{
struct cvm_mmc_host *host = dev_id;
struct mmc_request *req;
unsigned long flags = 0;
u64 emm_int, rsp_sts;
bool host_done;
if (host->need_irq_handler_lock)
spin_lock_irqsave(&host->irq_handler_lock, flags);
else
__acquire(&host->irq_handler_lock);
/* Clear interrupt bits (write 1 clears ). */
emm_int = readq(host->base + MIO_EMM_INT(host));
writeq(emm_int, host->base + MIO_EMM_INT(host));
if (emm_int & MIO_EMM_INT_SWITCH_ERR)
check_switch_errors(host);
req = host->current_req;
if (!req)
goto out;
rsp_sts = readq(host->base + MIO_EMM_RSP_STS(host));
/*
* dma_val set means DMA is still in progress. Don't touch
* the request and wait for the interrupt indicating that
* the DMA is finished.
*/
if ((rsp_sts & MIO_EMM_RSP_STS_DMA_VAL) && host->dma_active)
goto out;
if (!host->dma_active && req->data &&
(emm_int & MIO_EMM_INT_BUF_DONE)) {
unsigned int type = (rsp_sts >> 7) & 3;
if (type == 1)
do_read(host, req, rsp_sts & MIO_EMM_RSP_STS_DBUF);
else if (type == 2)
do_write(req);
}
示例5: mlxbf_gpio_resume
static int mlxbf_gpio_resume(struct platform_device *pdev)
{
struct mlxbf_gpio_state *gs = platform_get_drvdata(pdev);
writeq(gs->csave_regs.scratchpad, gs->base + MLXBF_GPIO_SCRATCHPAD);
writeq(gs->csave_regs.pad_control[0],
gs->base + MLXBF_GPIO_PAD_CONTROL_FIRST_WORD);
writeq(gs->csave_regs.pad_control[1],
gs->base + MLXBF_GPIO_PAD_CONTROL_1_FIRST_WORD);
writeq(gs->csave_regs.pad_control[2],
gs->base + MLXBF_GPIO_PAD_CONTROL_2_FIRST_WORD);
writeq(gs->csave_regs.pad_control[3],
gs->base + MLXBF_GPIO_PAD_CONTROL_3_FIRST_WORD);
writeq(gs->csave_regs.pin_dir_i, gs->base + MLXBF_GPIO_PIN_DIR_I);
writeq(gs->csave_regs.pin_dir_o, gs->base + MLXBF_GPIO_PIN_DIR_O);
return 0;
}
示例6: define
void UmlActivityPartition::html(Q3CString pfix, unsigned int rank, unsigned int level) {
define();
chapter("Activity partition", pfix, rank, "activitypartition", level);
Q3CString s = description();
if (!s.isEmpty()) {
fw.write("<p>");
writeq(s);
fw.write("<br /></p>");
}
if (isDimension())
fw.write((isExternal())
? "<p>is dimension, is external</p>\n"
: "<p>is dimension</p>\n");
else if (isExternal())
fw.write("<p>is external</p>\n");
if (represents() != 0) {
fw.write("<p>represents ");
represents()->write();
fw.write("</p>");
}
write_dependencies();
UmlDiagram * d = associatedDiagram();
if (d != 0) {
fw.write("<p>Diagram : ");
d->write();
fw.write("</p>\n");
}
write_properties();
write_children(pfix, rank, level);
unload(FALSE, FALSE);
}
示例7: acpi_os_write_memory
acpi_status
acpi_os_write_memory(acpi_physical_address phys_addr, u64 value, u32 width)
{
void __iomem *virt_addr;
unsigned int size = width / 8;
bool unmap = false;
rcu_read_lock();
virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
if (!virt_addr) {
rcu_read_unlock();
virt_addr = acpi_os_ioremap(phys_addr, size);
if (!virt_addr)
return AE_BAD_ADDRESS;
unmap = true;
}
switch (width) {
case 8:
writeb(value, virt_addr);
break;
case 16:
writew(value, virt_addr);
break;
case 32:
writel(value, virt_addr);
break;
case 64:
writeq(value, virt_addr);
break;
default:
BUG();
}
if (unmap)
iounmap(virt_addr);
else
rcu_read_unlock();
return AE_OK;
}
示例8: vnic_wq_init_start
void vnic_wq_init_start(struct vnic_wq *wq, unsigned int cq_index,
unsigned int fetch_index, unsigned int posted_index,
unsigned int error_interrupt_enable,
unsigned int error_interrupt_offset)
{
u64 paddr;
unsigned int count = wq->ring.desc_count;
paddr = (u64)wq->ring.base_addr | VNIC_PADDR_TARGET;
writeq(paddr, &wq->ctrl->ring_base);
iowrite32(count, &wq->ctrl->ring_size);
iowrite32(fetch_index, &wq->ctrl->fetch_index);
iowrite32(posted_index, &wq->ctrl->posted_index);
iowrite32(cq_index, &wq->ctrl->cq_index);
iowrite32(error_interrupt_enable, &wq->ctrl->error_interrupt_enable);
iowrite32(error_interrupt_offset, &wq->ctrl->error_interrupt_offset);
iowrite32(0, &wq->ctrl->error_status);
wq->head_idx = fetch_index;
wq->tail_idx = wq->head_idx;
}
示例9: vnic_wq_init_start
void vnic_wq_init_start(struct vnic_wq *wq, unsigned int cq_index,
unsigned int fetch_index, unsigned int posted_index,
unsigned int error_interrupt_enable,
unsigned int error_interrupt_offset)
{
u64 paddr;
paddr = (u64)wq->ring.base_addr | VNIC_PADDR_TARGET;
writeq(paddr, &wq->ctrl->ring_base);
iowrite32(wq->ring.desc_count, &wq->ctrl->ring_size);
iowrite32(fetch_index, &wq->ctrl->fetch_index);
iowrite32(posted_index, &wq->ctrl->posted_index);
iowrite32(cq_index, &wq->ctrl->cq_index);
iowrite32(error_interrupt_enable, &wq->ctrl->error_interrupt_enable);
iowrite32(error_interrupt_offset, &wq->ctrl->error_interrupt_offset);
iowrite32(0, &wq->ctrl->error_status);
wq->to_use = wq->to_clean =
&wq->bufs[fetch_index / VNIC_WQ_BUF_BLK_ENTRIES]
[fetch_index % VNIC_WQ_BUF_BLK_ENTRIES];
}
示例10: octeon_mbox_cancel
int octeon_mbox_cancel(struct octeon_device *oct, int q_no)
{
struct octeon_mbox *mbox = oct->mbox[q_no];
struct octeon_mbox_cmd *mbox_cmd;
unsigned long flags = 0;
spin_lock_irqsave(&mbox->lock, flags);
mbox_cmd = &mbox->mbox_resp;
if (!(mbox->state & OCTEON_MBOX_STATE_RESPONSE_PENDING)) {
spin_unlock_irqrestore(&mbox->lock, flags);
return 1;
}
mbox->state = OCTEON_MBOX_STATE_IDLE;
memset(mbox_cmd, 0, sizeof(*mbox_cmd));
writeq(OCTEON_PFVFSIG, mbox->mbox_read_reg);
spin_unlock_irqrestore(&mbox->lock, flags);
return 0;
}
示例11: writeq
void ReaderQueue::insertQueL(Xtray *xt, Xtray::QueId off)
{
Xdeque &q = writeq();
if (q.size() == off) {
// the nicely growing queue
q.push_back(xt);
lastId_++;
} else {
if (q.size() < off) {
q.resize(off+1);
lastId_ = prevId_ + off + 1;
wrhole_ = true; // this created a hole in the middle
}
q[off] = xt;
}
if (off == 0) { // the front of the queue became readable
wrReady_ = true; // before notification!
qev_->signal();
}
}
示例12: g_malloc
QVRingIndirectDesc *qvring_indirect_desc_setup(QVirtioDevice *d,
QGuestAllocator *alloc, uint16_t elem)
{
int i;
QVRingIndirectDesc *indirect = g_malloc(sizeof(*indirect));
indirect->index = 0;
indirect->elem = elem;
indirect->desc = guest_alloc(alloc, sizeof(QVRingDesc)*elem);
for (i = 0; i < elem - 1; ++i) {
/* indirect->desc[i].addr */
writeq(indirect->desc + (16 * i), 0);
/* indirect->desc[i].flags */
writew(indirect->desc + (16 * i) + 12, QVRING_DESC_F_NEXT);
/* indirect->desc[i].next */
writew(indirect->desc + (16 * i) + 14, i + 1);
}
return indirect;
}
示例13: cn23xx_setup_vf_mbox
static int cn23xx_setup_vf_mbox(struct octeon_device *oct)
{
struct octeon_mbox *mbox = NULL;
mbox = vmalloc(sizeof(*mbox));
if (!mbox)
return 1;
memset(mbox, 0, sizeof(struct octeon_mbox));
spin_lock_init(&mbox->lock);
mbox->oct_dev = oct;
mbox->q_no = 0;
mbox->state = OCTEON_MBOX_STATE_IDLE;
/* VF mbox interrupt reg */
mbox->mbox_int_reg =
(u8 *)oct->mmio[0].hw_addr + CN23XX_VF_SLI_PKT_MBOX_INT(0);
/* VF reads from SIG0 reg */
mbox->mbox_read_reg =
(u8 *)oct->mmio[0].hw_addr + CN23XX_SLI_PKT_PF_VF_MBOX_SIG(0, 0);
/* VF writes into SIG1 reg */
mbox->mbox_write_reg =
(u8 *)oct->mmio[0].hw_addr + CN23XX_SLI_PKT_PF_VF_MBOX_SIG(0, 1);
INIT_DELAYED_WORK(&mbox->mbox_poll_wk.work,
cn23xx_vf_mbox_thread);
mbox->mbox_poll_wk.ctxptr = mbox;
oct->mbox[0] = mbox;
writeq(OCTEON_PFVFSIG, mbox->mbox_read_reg);
return 0;
}
示例14: qvring_indirect_desc_add
void qvring_indirect_desc_add(QVRingIndirectDesc *indirect, uint64_t data,
uint32_t len, bool write)
{
uint16_t flags;
g_assert_cmpint(indirect->index, <, indirect->elem);
flags = readw(indirect->desc + (16 * indirect->index) + 12);
if (write) {
flags |= QVRING_DESC_F_WRITE;
}
/* indirect->desc[indirect->index].addr */
writeq(indirect->desc + (16 * indirect->index), data);
/* indirect->desc[indirect->index].len */
writel(indirect->desc + (16 * indirect->index) + 8, len);
/* indirect->desc[indirect->index].flags */
writew(indirect->desc + (16 * indirect->index) + 12, flags);
indirect->index++;
}
示例15: aclpci_write_small
/* Write a small number of bytes taken from user space */
ssize_t aclpci_write_small (void *write_addr, void __user* src_addr, ssize_t len) {
ssize_t copy_res = 0;
switch (len) {
case 1: {
u8 d;
copy_res = copy_from_user ( &d, src_addr, sizeof(d) );
writeb ( d, write_addr );
break;
}
case 2: {
u16 d;
copy_res = copy_from_user ( &d, src_addr, sizeof(d) );
writew ( d, write_addr );
break;
}
case 4: {
u32 d;
copy_res = copy_from_user ( &d, src_addr, sizeof(d) );
writel ( d, write_addr );
break;
}
case 8: {
u64 d;
copy_res = copy_from_user ( &d, src_addr, sizeof(d) );
writeq ( d, write_addr );
break;
}
default:
break;
}
if (copy_res) {
return -EFAULT;
} else {
return 0;
}
}