• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ READ_REG函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中READ_REG函数的典型用法代码示例。如果您正苦于以下问题:C++ READ_REG函数的具体用法?C++ READ_REG怎么用?C++ READ_REG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了READ_REG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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, &regs->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, &regs->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;
}
开发者ID:FullMentalPanic,项目名称:RTEMS_NEW_TOOL_CHAIN,代码行数:31,代码来源:grtm_rmap.c


示例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;
  }
}
开发者ID:kevins963,项目名称:BalancingRobot,代码行数:59,代码来源:debug_comm_hw.c


示例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();
		}
	}

}
开发者ID:mota37,项目名称:Modbus,代码行数:13,代码来源:enc28j60.c


示例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);
}
开发者ID:l-patpat,项目名称:mcu-frame,代码行数:11,代码来源:spi.c


示例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");
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:12,代码来源:ar7_wdt.c


示例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");
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:12,代码来源:ar7_wdt.c


示例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");
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:12,代码来源:ar7_wdt.c


示例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");
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:12,代码来源:ar7_wdt.c


示例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;
	}
}
开发者ID:val2k,项目名称:linux,代码行数:14,代码来源:rf69.c


示例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;
	}
}
开发者ID:val2k,项目名称:linux,代码行数:14,代码来源:rf69.c


示例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;
	}
}
开发者ID:val2k,项目名称:linux,代码行数:14,代码来源:rf69.c


示例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;
	}
}
开发者ID:val2k,项目名称:linux,代码行数:14,代码来源:rf69.c


示例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;
	}
}
开发者ID:val2k,项目名称:linux,代码行数:14,代码来源:rf69.c


示例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;
	}
}
开发者ID:val2k,项目名称:linux,代码行数:14,代码来源:rf69.c


示例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 */);
}
开发者ID:4Fwolf,项目名称:motorola-hawk-kernel-3.4.67,代码行数:14,代码来源:dramc_dqs_gw.c


示例16: HAL_FIREWALL_GetConfig

/**
  * @brief Retrieve the Firewall configuration.
  * @param fw_config: Firewall configuration, type is same as initialization structure
  * @note This API can't be executed inside a code area protected by the Firewall
  *       when the Firewall is enabled
  * @note If NVDSL register is different from 0, that is, if the non volatile data segment 
  *       is defined, this API can't be executed when the Firewall is enabled.      
  * @note User should resort to __HAL_FIREWALL_GET_PREARM() macro to retrieve FPA bit status            
  * @retval None
  */
void HAL_FIREWALL_GetConfig(FIREWALL_InitTypeDef * fw_config)
{

  /* Enable Firewall clock, in case no Firewall configuration has been carried 
     out up to this point */
  __HAL_RCC_FIREWALL_CLK_ENABLE();

  /* Retrieve code segment protection setting */
  fw_config->CodeSegmentStartAddress = (READ_REG(FIREWALL->CSSA) & FW_CSSA_ADD);
  fw_config->CodeSegmentLength = (READ_REG(FIREWALL->CSL) & FW_CSL_LENG);
  
  /* Retrieve non volatile data segment protection setting */
  fw_config->NonVDataSegmentStartAddress = (READ_REG(FIREWALL->NVDSSA) & FW_NVDSSA_ADD);
  fw_config->NonVDataSegmentLength = (READ_REG(FIREWALL->NVDSL) & FW_NVDSL_LENG);
  
  /* Retrieve volatile data segment protection setting */
  fw_config->VDataSegmentStartAddress = (READ_REG(FIREWALL->VDSSA) & FW_VDSSA_ADD);
  fw_config->VDataSegmentLength = (READ_REG(FIREWALL->VDSL) & FW_VDSL_LENG);     
  
  /* Retrieve volatile data execution setting */
  fw_config->VolatileDataExecution = (READ_REG(FIREWALL->CR) & FW_CR_VDE);
  
  /* Retrieve volatile data shared setting */
  fw_config->VolatileDataShared = (READ_REG(FIREWALL->CR) & FW_CR_VDS);
  
  return;
}
开发者ID:Montanari9,项目名称:BLE_SendString,代码行数:37,代码来源:stm32l0xx_hal_firewall.c


示例17: rf69_set_tx_start_condition

int rf69_set_tx_start_condition(struct spi_device *spi, enum txStartCondition txStartCondition)
{
	#ifdef DEBUG
		dev_dbg(&spi->dev, "set: start condition");
	#endif

	switch (txStartCondition) {
	case fifoLevel:	   return WRITE_REG(REG_FIFO_THRESH, (READ_REG(REG_FIFO_THRESH) & ~MASK_FIFO_THRESH_TXSTART));
	case fifoNotEmpty: return WRITE_REG(REG_FIFO_THRESH, (READ_REG(REG_FIFO_THRESH) |  MASK_FIFO_THRESH_TXSTART));
	default:
		dev_dbg(&spi->dev, "set: illegal input param");
		return -EINVAL;
	}
}
开发者ID:val2k,项目名称:linux,代码行数:14,代码来源:rf69.c


示例18: hiir_config

static void hiir_config(void)
{
    int value = 0;

/* TODO: ASIC config pin share */
#if 0
    value = READ_REG(IOCONFIG);
    value = 0;
    WRITE_REG(IOCONFIG, value);
#endif

    WRITE_REG(IR_ENABLE, 0x01);
    while(READ_REG(IR_BUSY))
    {
        hiir_dbg("IR_BUSY. Wait...\n");
        //udelay(1);
    }

    value = (hiir_dev.dev_parm.codetype << 14);
    value |= (hiir_dev.dev_parm.code_len - 1) << 8;
    value |= (hiir_dev.dev_parm.frequence - 1);
    WRITE_REG(IR_CONFIG, value);

    value = hiir_dev.dev_parm.leads_min << 16;
    value |= hiir_dev.dev_parm.leads_max;
    WRITE_REG(CNT_LEADS, value);

    value = hiir_dev.dev_parm.leade_min << 16;
    value |= hiir_dev.dev_parm.leade_max;
    WRITE_REG(CNT_LEADE, value);

    value = hiir_dev.dev_parm.sleade_min << 16;
    value |= hiir_dev.dev_parm.sleade_max;
    WRITE_REG(CNT_SLEADE, value);

    value = hiir_dev.dev_parm.cnt0_b_min << 16;
    value |= hiir_dev.dev_parm.cnt0_b_max;
    WRITE_REG(CNT0_B, value);

    value = hiir_dev.dev_parm.cnt1_b_min << 16;
    value |= hiir_dev.dev_parm.cnt1_b_max;
    WRITE_REG(CNT1_B, value);

    WRITE_REG(IR_INTM, 0x00);
    WRITE_REG(IR_START, 0x00);

    //hiir_dbg("current config is...\n");
    //hiir_show_reg();
}
开发者ID:thatking,项目名称:liteos_3516c,代码行数:49,代码来源:hiir.c


示例19: rf69_set_ook_threshold_type

int rf69_set_ook_threshold_type(struct spi_device *spi, enum thresholdType thresholdType)
{
	#ifdef DEBUG
		dev_dbg(&spi->dev, "set: threshold type");
	#endif

	switch (thresholdType) {
	case fixed:	return WRITE_REG(REG_OOKPEAK, ((READ_REG(REG_OOKPEAK) & ~MASK_OOKPEAK_THRESTYPE) | OOKPEAK_THRESHTYPE_FIXED));
	case peak:	return WRITE_REG(REG_OOKPEAK, ((READ_REG(REG_OOKPEAK) & ~MASK_OOKPEAK_THRESTYPE) | OOKPEAK_THRESHTYPE_PEAK));
	case average:	return WRITE_REG(REG_OOKPEAK, ((READ_REG(REG_OOKPEAK) & ~MASK_OOKPEAK_THRESTYPE) | OOKPEAK_THRESHTYPE_AVERAGE));
	default:
		dev_dbg(&spi->dev, "set: illegal input param");
		return -EINVAL;
	}
}
开发者ID:val2k,项目名称:linux,代码行数:15,代码来源:rf69.c


示例20: ar7_wdt_disable

static void ar7_wdt_disable(u32 value)
{
	WRITE_REG(ar7_wdt->disable_lock, 0x7777);
	if ((READ_REG(ar7_wdt->disable_lock) & 3) == 1) {
		WRITE_REG(ar7_wdt->disable_lock, 0xcccc);
		if ((READ_REG(ar7_wdt->disable_lock) & 3) == 2) {
			WRITE_REG(ar7_wdt->disable_lock, 0xdddd);
			if ((READ_REG(ar7_wdt->disable_lock) & 3) == 3) {
				WRITE_REG(ar7_wdt->disable, value);
				return;
			}
		}
	}
	pr_err("failed to unlock WDT disable reg\n");
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:15,代码来源:ar7_wdt.c



注:本文中的READ_REG函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ READ_REG32函数代码示例发布时间:2022-05-30
下一篇:
C++ READ_PORT_UCHAR函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap