本文整理汇总了C++中R_REG函数的典型用法代码示例。如果您正苦于以下问题:C++ R_REG函数的具体用法?C++ R_REG怎么用?C++ R_REG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了R_REG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sb_read_sbreg
static uint32
sb_read_sbreg(si_info_t *sii, volatile uint32 *sbr)
{
uint8 tmp;
uint32 val, intr_val = 0;
/*
* compact flash only has 11 bits address, while we needs 12 bits address.
* MEM_SEG will be OR'd with other 11 bits address in hardware,
* so we program MEM_SEG with 12th bit when necessary(access sb regsiters).
* For normal PCMCIA bus(CFTable_regwinsz > 2k), do nothing special
*/
if (PCMCIA(sii)) {
INTR_OFF(sii, intr_val);
tmp = 1;
OSL_PCMCIA_WRITE_ATTR(sii->osh, MEM_SEG, &tmp, 1);
sbr = (volatile uint32 *)((uintptr)sbr & ~(1 << 11)); /* mask out bit 11 */
}
val = R_REG(sii->osh, sbr);
if (PCMCIA(sii)) {
tmp = 0;
OSL_PCMCIA_WRITE_ATTR(sii->osh, MEM_SEG, &tmp, 1);
INTR_RESTORE(sii, intr_val);
}
return (val);
}
示例2: pcicore_pmecap
/* return TRUE if PM capability exists in the pci config space
* Uses and caches the information using core handle
*/
static bool
pcicore_pmecap(pcicore_info_t *pi)
{
uint8 cap_ptr;
uint32 pmecap;
sbpcieregs_t *pcieregs = pi->regs.pcieregs;
uint16*reg16;
if (!pi->pmecap_offset) {
cap_ptr = pcicore_find_pci_capability(pi->osh, PCI_CAP_POWERMGMTCAP_ID, NULL, NULL);
if (!cap_ptr)
return FALSE;
pi->pmecap_offset = cap_ptr;
reg16 = &pcieregs->sprom[SRSH_CLKREQ_OFFSET_REV8];
pi->pmebits = R_REG(pi->osh, reg16);
pmecap = OSL_PCI_READ_CONFIG(pi->osh, pi->pmecap_offset, sizeof(uint32));
/* At least one state can generate PME */
pi->pmecap = (pmecap & PME_CAP_PM_STATES) != 0;
}
return (pi->pmecap);
}
示例3: pcie2_mdiosetblock
static bool
pcie2_mdiosetblock(pcicore_info_t *pi, uint blk)
{
sbpcieregs_t *pcieregs = pi->regs.pcieregs;
uint mdiodata, mdioctrl, i = 0;
uint pcie_serdes_spinwait = 200;
mdioctrl = MDIOCTL2_DIVISOR_VAL | (0x1F << MDIOCTL2_REGADDR_SHF);
W_REG(pi->osh, &pcieregs->u.pcie2.mdiocontrol, mdioctrl);
mdiodata = (blk << MDIODATA2_DEVADDR_SHF) | MDIODATA2_DONE;
W_REG(pi->osh, &pcieregs->u.pcie2.mdiowrdata, mdiodata);
PR28829_DELAY();
/* retry till the transaction is complete */
while (i < pcie_serdes_spinwait) {
if (!(R_REG(pi->osh, &(pcieregs->u.pcie2.mdiowrdata)) & MDIODATA2_DONE)) {
break;
}
OSL_DELAY(1000);
i++;
}
if (i >= pcie_serdes_spinwait) {
PCI_ERROR(("pcie_mdiosetblock: timed out\n"));
return FALSE;
}
return TRUE;
}
示例4: BCMINITFN
bool
BCMINITFN(sb_cc_register_isr)(sb_t *sbh, cc_isr_fn isr, uint32 ccintmask, void *cbdata)
{
bool done = FALSE;
chipcregs_t *regs;
uint origidx;
uint i;
/* Save the current core index */
origidx = sb_coreidx(sbh);
regs = sb_setcore(sbh, SB_CC, 0);
ASSERT(regs);
for (i = 0; i < MAX_CC_INT_SOURCE; i++) {
if (cc_isr_desc[i].isr == NULL) {
cc_isr_desc[i].isr = isr;
cc_isr_desc[i].cbdata = cbdata;
cc_isr_desc[i].intmask = ccintmask;
done = TRUE;
break;
}
}
if (done) {
cc_intmask = R_REG(sb_osh(sbh), ®s->intmask);
cc_intmask |= ccintmask;
W_REG(sb_osh(sbh), ®s->intmask, cc_intmask);
}
/* restore original coreidx */
sb_setcoreidx(sbh, origidx);
return done;
}
示例5: si_intflag
uint
si_intflag(si_t *sih)
{
si_info_t *sii = SI_INFO(sih);
if (CHIPTYPE(sih->socitype) == SOCI_SB) {
sbconfig_t *ccsbr = (sbconfig_t *)((uintptr)((ulong)
(sii->common_info->coresba[SI_CC_IDX]) + SBCONFIGOFF));
return R_REG(sii->osh, &ccsbr->sbflagst);
} else if (CHIPTYPE(sih->socitype) == SOCI_AI)
return R_REG(sii->osh, ((uint32 *)(uintptr)
(sii->common_info->oob_router + OOB_STATUSA)));
else {
ASSERT(0);
return 0;
}
}
示例6: hnd_jtagm_disable
void
hnd_jtagm_disable(si_t *sih, void *h)
{
chipcregs_t *cc = (chipcregs_t *)h;
W_REG(NULL, &cc->jtagctrl, R_REG(NULL, &cc->jtagctrl) & ~JCTRL_EN);
}
示例7: dma_getnextrxp
void *
dma_getnextrxp(dma_info_t *di, bool forceall)
{
uint i;
void *rxp;
/* if forcing, dma engine must be disabled */
ASSERT(!forceall || !dma_rxenabled(di));
i = di->rxin;
/* return if no packets posted */
if (i == di->rxout)
return (NULL);
/* ignore curr if forceall */
if (!forceall && (i == B2I(R_REG(&di->regs->rcvstatus) & RS_CD_MASK)))
return (NULL);
/* get the packet pointer that corresponds to the rx descriptor */
rxp = di->rxp[i];
ASSERT(rxp);
di->rxp[i] = NULL;
/* clear this packet from the descriptor ring */
DMA_UNMAP(di->dev, (BUS_SWAP32(R_SM(&di->rxd[i].addr)) - di->dataoffset),
di->rxbufsize, DMA_RX, rxp);
W_SM(&di->rxd[i].addr, 0);
di->rxin = NEXTRXD(i);
return (rxp);
}
示例8: nios2_get_register_alias
/*
On success, the total number of characters written is returned. This count does not include the additional null-character automatically appended at the end of the string.
On failure, a negative number is returned.
*/
int
nios2_get_register_alias(char *alias, int alias_size, const char *reg_name, int config_num, int is_dest)
{
int gp_reg_num = nios2_get_register_num(reg_name, R_REG());
if (gp_reg_num == -1)
return -1;
const struct nios2_ext_reg_map ext_reg_map = nios2_builtin_ext_reg_maps[config_num];
if (ext_reg_map.rx_tx.num_regs > 0 )
{
int r_offset = gp_reg_num - ext_reg_map.rx_tx.offset;
if (r_offset >= 0 && r_offset < ext_reg_map.rx_tx.num_regs)
{
if (is_dest)
{
if (alias_size > (int)(strlen(TX_REG()) + 3))
return sprintf(alias,TX_REG(%d),r_offset);
}
else
{
if (alias_size > (int)(strlen(RX_REG()) + 3))
return sprintf(alias,RX_REG(%d),r_offset);
}
}
示例9: si_pcihb_read_config
/**
* Read host bridge PCI config registers from Silicon Backplane ( >= rev8 ).
*
* It returns TRUE to indicate that access to the host bridge's pci config
* from SI is ok, and values in 'addr' and 'val' are valid.
*
* It can only read registers at multiple of 4-bytes. Callers must pick up
* needed bytes from 'val' based on 'off' value. Value in 'addr' reflects
* the register address where value in 'val' is read.
*/
static bool
si_pcihb_read_config(si_t *sih, uint coreunit, uint bus, uint dev, uint func,
uint off, uint32 **addr, uint32 *val)
{
sbpciregs_t *pci;
osl_t *osh;
uint coreidx;
bool ret = FALSE;
/* sanity check */
ASSERT(hndpci_is_hostbridge(bus, dev));
/* we support only two functions on device 0 */
if (func > 1)
return FALSE;
osh = si_osh(sih);
/* read pci config when core rev >= 8 */
coreidx = si_coreidx(sih);
pci = (sbpciregs_t *)si_setcore(sih, PCI_CORE_ID, coreunit);
if (pci) {
if (si_corerev(sih) >= PCI_HBSBCFG_REV) {
*addr = (uint32 *)&pci->pcicfg[func][off >> 2];
*val = R_REG(osh, *addr);
ret = TRUE;
}
} else {
示例10: pcie_mdiosetblock
static bool
pcie_mdiosetblock(pcicore_info_t *pi, uint blk)
{
sbpcieregs_t *pcieregs = pi->regs.pcieregs;
uint mdiodata, i = 0;
uint pcie_serdes_spinwait = 200;
mdiodata = MDIODATA_START | MDIODATA_WRITE | (MDIODATA_DEV_ADDR << MDIODATA_DEVADDR_SHF) |
(MDIODATA_BLK_ADDR << MDIODATA_REGADDR_SHF) | MDIODATA_TA | (blk << 4);
W_REG(pi->osh, &pcieregs->u.pcie1.mdiodata, mdiodata);
PR28829_DELAY();
/* retry till the transaction is complete */
while (i < pcie_serdes_spinwait) {
if (R_REG(pi->osh, &(pcieregs->u.pcie1.mdiocontrol)) & MDIOCTL_ACCESS_DONE) {
break;
}
OSL_DELAY(1000);
i++;
}
if (i >= pcie_serdes_spinwait) {
PCI_ERROR(("pcie_mdiosetblock: timed out\n"));
return FALSE;
}
return TRUE;
}
示例11: sb_jtagm_disable
void
sb_jtagm_disable(osl_t *osh, void *h)
{
chipcregs_t *cc = (chipcregs_t *)h;
W_REG(osh, &cc->jtagctrl, R_REG(osh, &cc->jtagctrl) & ~JCTRL_EN);
}
示例12: dma_rxenabled
bool
dma_rxenabled(dma_info_t *di)
{
uint32 rc;
rc = R_REG(&di->regs->rcvcontrol);
return ((rc != 0xffffffff) && (rc & RC_RE));
}
示例13: jtag_rwreg
uint32 jtag_rwreg(osl_t * osh, void *h, uint32 ir, uint32 dr)
{
chipcregs_t *cc = (chipcregs_t *) h;
uint32 tmp;
W_REG(osh, &cc->jtagir, ir);
W_REG(osh, &cc->jtagdr, dr);
tmp = JCMD_START | JCMD_ACC_IRDR |
((IRWIDTH - 1) << JCMD_IRW_SHIFT) | (DRWIDTH - 1);
W_REG(osh, &cc->jtagcmd, tmp);
while (((tmp = R_REG(osh, &cc->jtagcmd)) & JCMD_BUSY) == JCMD_BUSY) {
/* OSL_DELAY(1); */
}
tmp = R_REG(osh, &cc->jtagdr);
return (tmp);
}
示例14: bcm947xx_pcm_close
static int bcm947xx_pcm_close(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
bcm947xx_i2s_info_t *snd_bcm = rtd->dai->cpu_dai->private_data;
struct bcm947xx_runtime_data *brtd = substream->runtime->private_data;
DBG("%s %s\n", __FUNCTION__, bcm947xx_direction_str(substream));
DBG("%s: i2s intstatus 0x%x intmask 0x%x\n", __FUNCTION__,
R_REG(snd_bcm->osh, &snd_bcm->regs->intstatus),
R_REG(snd_bcm->osh, &snd_bcm->regs->intmask));
/* #if required because dma_dump is unavailable in non-debug builds. */
#if BCM947XX_DUMP_RING_BUFFER_ON_PCM_CLOSE_ON
{
/* dump dma rings to console */
#if !defined(FIFOERROR_DUMP_SIZE)
#define FIFOERROR_DUMP_SIZE 8192
#endif
char *tmp;
struct bcmstrbuf b;
if (snd_bcm->di[0] && (tmp = MALLOC(snd_bcm->osh, FIFOERROR_DUMP_SIZE))) {
bcm_binit(&b, tmp, FIFOERROR_DUMP_SIZE);
dma_dump(snd_bcm->di[0], &b, TRUE);
printbig(tmp);
MFREE(snd_bcm->osh, tmp, FIFOERROR_DUMP_SIZE);
}
}
#endif /* BCM947XX_DUMP_RING_BUFFER_ON_PCM_CLOSE_ON */
/* reclaim all descriptors */
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
dma_rxreset(snd_bcm->di[0]);
dma_rxreclaim(snd_bcm->di[0]);
} else {
dma_txreset(snd_bcm->di[0]);
dma_txreclaim(snd_bcm->di[0], HNDDMA_RANGE_ALL);
}
if (brtd)
kfree(brtd);
else
DBG("%s: called with brtd == NULL\n", __FUNCTION__);
return 0;
}
示例15: sflash_read
/* Read len bytes starting at offset into buf. Returns number of bytes read. */
int
sflash_read(si_t *sih, chipcregs_t *cc, uint offset, uint len, uchar *buf)
{
uint8 *from, *to;
int cnt, i;
osl_t *osh;
ASSERT(sih);
if (!len)
return 0;
if ((offset + len) > sflash.size)
return -22;
if ((len >= 4) && (offset & 3))
cnt = 4 - (offset & 3);
else if ((len >= 4) && ((uintptr)buf & 3))
cnt = 4 - ((uintptr)buf & 3);
else
cnt = len;
osh = si_osh(sih);
from = (uint8 *)OSL_UNCACHED(SI_FLASH2 + offset);
to = (uint8 *)buf;
if (cnt < 4) {
for (i = 0; i < cnt; i ++) {
*to = R_REG(osh, from);
from ++;
to ++;
}
return cnt;
}
while (cnt >= 4) {
*(uint32 *)to = R_REG(osh, (uint32 *)from);
from += 4;
to += 4;
cnt -= 4;
}
return (len - cnt);
}