本文整理汇总了C++中READ_REG函数的典型用法代码示例。如果您正苦于以下问题:C++ READ_REG函数的具体用法?C++ READ_REG怎么用?C++ READ_REG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了READ_REG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: grtm_hw_get_implementation
static void grtm_hw_get_implementation(struct grtm_priv *pDev, struct grtm_ioc_hw *hwcfg)
{
struct grtm_regs *regs = pDev->regs;
unsigned int cfg = READ_REG(pDev, ®s->cfg);
hwcfg->cs = (cfg & GRTM_CFG_SC) ? 1:0;
hwcfg->sp = (cfg & GRTM_CFG_SP) ? 1:0;
hwcfg->ce = (cfg & GRTM_CFG_CE) ? 1:0;
hwcfg->nrz = (cfg & GRTM_CFG_NRZ) ? 1:0;
hwcfg->psr = (cfg & GRTM_CFG_PSR) ? 1:0;
hwcfg->te = (cfg & GRTM_CFG_TE) ? 1:0;
hwcfg->rsdep = (cfg & GRTM_CFG_RSDEP)>>GRTM_CFG_RSDEP_BIT;
hwcfg->rs = (cfg & GRTM_CFG_RS)>>GRTM_CFG_RS_BIT;
hwcfg->aasm = (cfg & GRTM_CFG_AASM) ? 1:0;
hwcfg->fecf = (cfg & GRTM_CFG_FECF) ? 1:0;
hwcfg->ocf = (cfg & GRTM_CFG_OCF) ? 1:0;
hwcfg->evc = (cfg & GRTM_CFG_EVC) ? 1:0;
hwcfg->idle = (cfg & GRTM_CFG_IDLE) ? 1:0;
hwcfg->fsh = (cfg & GRTM_CFG_FSH) ? 1:0;
hwcfg->mcg = (cfg & GRTM_CFG_MCG) ? 1:0;
hwcfg->iz = (cfg & GRTM_CFG_IZ) ? 1:0;
hwcfg->fhec = (cfg & GRTM_CFG_FHEC) ? 1:0;
hwcfg->aos = (cfg & GRTM_CFG_AOS) ? 1:0;
hwcfg->cif = (cfg & GRTM_CFG_CIF) ? 1:0;
hwcfg->ocfb = (cfg & GRTM_CFG_OCFB) ? 1:0;
cfg = READ_REG(pDev, ®s->dma_cfg);
hwcfg->blk_size = (cfg & GRTM_DMA_CFG_BLKSZ) >> GRTM_DMA_CFG_BLKSZ_BIT;
hwcfg->fifo_size= (cfg & GRTM_DMA_CFG_FIFOSZ) >> GRTM_DMA_CFG_FIFOSZ_BIT;
}
示例2: USART3_IRQHandler
void USART3_IRQHandler() {
UART_HandleTypeDef* huart = &uart_handle;
uint32_t isrflags = READ_REG(huart->Instance->SR);
uint32_t cr1its = READ_REG(huart->Instance->CR1);
uint32_t cr3its = READ_REG(huart->Instance->CR3);
uint32_t errorflags = 0x00U;
/* If no error occurs */
errorflags = (isrflags & (uint32_t)(USART_SR_PE | USART_SR_FE | USART_SR_ORE |
USART_SR_NE));
if (errorflags == RESET) {
/* UART in mode Receiver -------------------------------------------------*/
if (((isrflags & USART_SR_RXNE) != RESET) &&
((cr1its & USART_CR1_RXNEIE) != RESET)) {
CircleBuffer_WriteByte(&rx_, huart->Instance->DR & 0x00ff);
return;
}
}
/* If some errors occur */
if ((errorflags != RESET) &&
(((cr3its & USART_CR3_EIE) != RESET) ||
((cr1its & (USART_CR1_RXNEIE | USART_CR1_PEIE)) != RESET))) {
/* UART parity error interrupt occurred ----------------------------------*/
if (((isrflags & USART_SR_PE) != RESET) &&
((cr1its & USART_CR1_PEIE) != RESET)) {
huart->ErrorCode |= HAL_UART_ERROR_PE;
}
/* UART noise error interrupt occurred -----------------------------------*/
if (((isrflags & USART_SR_NE) != RESET) &&
((cr3its & USART_CR3_EIE) != RESET)) {
huart->ErrorCode |= HAL_UART_ERROR_NE;
}
/* UART frame error interrupt occurred -----------------------------------*/
if (((isrflags & USART_SR_FE) != RESET) &&
((cr3its & USART_CR3_EIE) != RESET)) {
huart->ErrorCode |= HAL_UART_ERROR_FE;
}
/* UART Over-Run interrupt occurred --------------------------------------*/
if (((isrflags & USART_SR_ORE) != RESET) &&
((cr3its & USART_CR3_EIE) != RESET)) {
huart->ErrorCode |= HAL_UART_ERROR_ORE;
}
}
/* UART in mode Transmitter
* ------------------------------------------------*/
if (((isrflags & USART_SR_TXE) != RESET) &&
((cr1its & USART_CR1_TXEIE) != RESET)) {
huart->Instance->DR = CircleBuffer_ReadByte(&tx_);
if (CircleBuffer_GetCount(&tx_) == 0) {
CLEAR_BIT(huart->Instance->CR1, USART_CR1_TXEIE);
}
return;
}
}
示例3: enc_action
/**
* Handle events from the ENC28J60.
*/
void enc_action(void) {
uint8_t reg = READ_REG(ENC_EIR);
if (reg & ENC_EIR_PKTIF) {
while (READ_REG(ENC_EPKTCNT) > 0) {
enc_receive_packet();
}
}
}
示例4: spi_byte
u8 spi_byte(SPI_TypeDef *spi, u8 byte)
{
if(READ_BIT(spi->CR1, SPI_CR1_SPE | SPI_CR1_MSTR) == (SPI_CR1_SPE | SPI_CR1_MSTR))
{
READ_REG(spi->DR);
while(!READ_BIT(spi->SR, SPI_SR_TXE));
WRITE_REG(spi->DR, byte);
while(!READ_BIT(spi->SR, SPI_SR_RXNE));
}
return (u8)READ_REG(spi->DR);
}
示例5: ar7_wdt_prescale
static void ar7_wdt_prescale(u32 value)
{
WRITE_REG(ar7_wdt->prescale_lock, 0x5a5a);
if ((READ_REG(ar7_wdt->prescale_lock) & 3) == 1) {
WRITE_REG(ar7_wdt->prescale_lock, 0xa5a5);
if ((READ_REG(ar7_wdt->prescale_lock) & 3) == 3) {
WRITE_REG(ar7_wdt->prescale, value);
return;
}
}
pr_err("failed to unlock WDT prescale reg\n");
}
示例6: ar7_wdt_kick
static void ar7_wdt_kick(u32 value)
{
WRITE_REG(ar7_wdt->kick_lock, 0x5555);
if ((READ_REG(ar7_wdt->kick_lock) & 3) == 1) {
WRITE_REG(ar7_wdt->kick_lock, 0xaaaa);
if ((READ_REG(ar7_wdt->kick_lock) & 3) == 3) {
WRITE_REG(ar7_wdt->kick, value);
return;
}
}
printk(KERN_ERR DRVNAME ": failed to unlock WDT kick reg\n");
}
示例7: ar7_wdt_change
static void ar7_wdt_change(u32 value)
{
WRITE_REG(ar7_wdt->change_lock, 0x6666);
if ((READ_REG(ar7_wdt->change_lock) & 3) == 1) {
WRITE_REG(ar7_wdt->change_lock, 0xbbbb);
if ((READ_REG(ar7_wdt->change_lock) & 3) == 3) {
WRITE_REG(ar7_wdt->change, value);
return;
}
}
pr_err("failed to unlock WDT change reg\n");
}
示例8: ar7_wdt_kick
static void ar7_wdt_kick(u32 value)
{
WRITE_REG(ar7_wdt->kick_lock, 0x5555);
if ((READ_REG(ar7_wdt->kick_lock) & 3) == 1) {
WRITE_REG(ar7_wdt->kick_lock, 0xaaaa);
if ((READ_REG(ar7_wdt->kick_lock) & 3) == 3) {
WRITE_REG(ar7_wdt->kick, value);
return;
}
}
pr_err("failed to unlock WDT kick reg\n");
}
示例9: rf69_set_crc_enable
int rf69_set_crc_enable(struct spi_device *spi, enum optionOnOff optionOnOff)
{
#ifdef DEBUG
dev_dbg(&spi->dev, "set: crc enable");
#endif
switch (optionOnOff) {
case optionOn: return WRITE_REG(REG_PACKETCONFIG1, (READ_REG(REG_PACKETCONFIG1) | MASK_PACKETCONFIG1_CRC_ON));
case optionOff: return WRITE_REG(REG_PACKETCONFIG1, (READ_REG(REG_PACKETCONFIG1) & ~MASK_PACKETCONFIG1_CRC_ON));
default:
dev_dbg(&spi->dev, "set: illegal input param");
return -EINVAL;
}
}
示例10: rf69_set_packet_format
int rf69_set_packet_format(struct spi_device *spi, enum packetFormat packetFormat)
{
#ifdef DEBUG
dev_dbg(&spi->dev, "set: packet format");
#endif
switch (packetFormat) {
case packetLengthVar: return WRITE_REG(REG_PACKETCONFIG1, (READ_REG(REG_PACKETCONFIG1) | MASK_PACKETCONFIG1_PAKET_FORMAT_VARIABLE));
case packetLengthFix: return WRITE_REG(REG_PACKETCONFIG1, (READ_REG(REG_PACKETCONFIG1) & ~MASK_PACKETCONFIG1_PAKET_FORMAT_VARIABLE));
default:
dev_dbg(&spi->dev, "set: illegal input param");
return -EINVAL;
}
}
示例11: rf69_set_modulation
int rf69_set_modulation(struct spi_device *spi, enum modulation modulation)
{
#ifdef DEBUG
dev_dbg(&spi->dev, "set: modulation");
#endif
switch (modulation) {
case OOK: return WRITE_REG(REG_DATAMODUL, (READ_REG(REG_DATAMODUL) & ~MASK_DATAMODUL_MODULATION_TYPE) | DATAMODUL_MODULATION_TYPE_OOK);
case FSK: return WRITE_REG(REG_DATAMODUL, (READ_REG(REG_DATAMODUL) & ~MASK_DATAMODUL_MODULATION_TYPE) | DATAMODUL_MODULATION_TYPE_FSK);
default:
dev_dbg(&spi->dev, "set: illegal input param");
return -EINVAL;
}
}
示例12: rf69_set_fifo_fill_condition
int rf69_set_fifo_fill_condition(struct spi_device *spi, enum fifoFillCondition fifoFillCondition)
{
#ifdef DEBUG
dev_dbg(&spi->dev, "set: fifo fill condition");
#endif
switch (fifoFillCondition) {
case always: return WRITE_REG(REG_SYNC_CONFIG, (READ_REG(REG_SYNC_CONFIG) | MASK_SYNC_CONFIG_FIFO_FILL_CONDITION));
case afterSyncInterrupt: return WRITE_REG(REG_SYNC_CONFIG, (READ_REG(REG_SYNC_CONFIG) & ~MASK_SYNC_CONFIG_FIFO_FILL_CONDITION));
default:
dev_dbg(&spi->dev, "set: illegal input param");
return -EINVAL;
}
}
示例13: rf69_set_antenna_impedance
int rf69_set_antenna_impedance(struct spi_device *spi, enum antennaImpedance antennaImpedance)
{
#ifdef DEBUG
dev_dbg(&spi->dev, "set: antenna impedance");
#endif
switch (antennaImpedance) {
case fiftyOhm: return WRITE_REG(REG_LNA, (READ_REG(REG_LNA) & ~MASK_LNA_ZIN));
case twohundretOhm: return WRITE_REG(REG_LNA, (READ_REG(REG_LNA) | MASK_LNA_ZIN));
default:
dev_dbg(&spi->dev, "set: illegal input param");
return -EINVAL;
}
}
示例14: rf69_set_amplifier_2
int rf69_set_amplifier_2(struct spi_device *spi, enum optionOnOff optionOnOff)
{
#ifdef DEBUG
dev_dbg(&spi->dev, "set: amp #2");
#endif
switch (optionOnOff) {
case optionOn: return WRITE_REG(REG_PALEVEL, (READ_REG(REG_PALEVEL) | MASK_PALEVEL_PA2));
case optionOff: return WRITE_REG(REG_PALEVEL, (READ_REG(REG_PALEVEL) & ~MASK_PALEVEL_PA2));
default:
dev_dbg(&spi->dev, "set: illegal input param");
return -EINVAL;
}
}
示例15: dqsi_gw_dly_coarse_factor_handler
void dqsi_gw_dly_coarse_factor_handler(char *factor_value)
{
int curr_val = atoi(factor_value);
WRITE_REG((READ_REG(DRAMC_DQSCTL0/* 0xDC */) & 0xFF000000) /* Reserve original values for DRAMC_DQSCTL0[24:31] */
| ((curr_val & 0xFFF) << 0) /* DQS0CTL: DRAMC_DQSCTL0[0:11], 12 bits */
| ((curr_val & 0xFFF) << 12), /* DQS1CTL: DRAMC_DQSCTL0[12:23], 12 bits */
DRAMC_DQSCTL0/* 0xDC */);
WRITE_REG((READ_REG(DRAMC_DQSCTL1/* 0xE0 */) & 0xFF000000) /* Reserve original values for DRAMC_DQSCTL1[24:31] */
| ((curr_val & 0xFFF) << 0) /* DQS2CTL: DRAMC_DQSCTL1[0:11], 12 bits */
| ((curr_val & 0xFFF) << 12), /* DQS3CTL: DRAMC_DQSCTL1[12:23], 12 bits */
DRAMC_DQSCTL1/* 0xE0 */);
}