当前位置: 首页>>代码示例>>C++>>正文


C++ PMC_EnablePeripheral函数代码示例

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


在下文中一共展示了PMC_EnablePeripheral函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: aes_hard_init_CBC

void aes_hard_init_CBC(void) 
{
    unsigned char key[ENCRYPTION_KEY_LENGTH];
    unsigned char IV[ENCRYPTION_BLOCK_LENGTH];
  
    TRACE_DEBUG("aes_hard_init_CBC\n\r");

    // Activate peripheral clock
#ifdef AT91C_ID_AES
    PMC_EnablePeripheral( AT91C_ID_AES );
#elif AT91C_ID_AESTDES
    PMC_EnablePeripheral( AT91C_ID_AESTDES );
#elif AT91C_ID_TDES
    PMC_EnablePeripheral( AT91C_ID_TDES );
#else
#error AES undefined
#endif

    // Load mode
    AT91C_BASE_AES->AES_MR = AT91C_AES_SMOD_PDC   // PDC Mode
#if (ENCRYPTION_KEY_LENGTH == 32)
                           | AT91C_AES_KEYSIZE_256_BIT
#endif
#if (ENCRYPTION_KEY_LENGTH == 24)
                           | AT91C_AES_KEYSIZE_192_BIT
#endif
                           | AT91C_AES_OPMOD_CBC; // Cipher Block Chaining mode
  
    // Convert and load key
    ASCII2Hex((unsigned char*)ENCRYPTION_KEY, key, ENCRYPTION_KEY_LENGTH);

    AES_SetKey((unsigned int*)key, ENCRYPTION_KEY_LENGTH);

    // Convert and load IV
    ASCII2Hex((unsigned char*)ENCRYPTION_IV, IV, ENCRYPTION_BLOCK_LENGTH);

    AES_SetVector((unsigned int*)IV);
}
开发者ID:Flyagin,项目名称:BS-MRZV,代码行数:38,代码来源:aes_hardware.c

示例2: SensorsInit

void SensorsInit()
{
	char pinDirection = 0;
	int i;
	PIO_Configure(analogs, PIO_LISTSIZE(analogs));
	PIO_Configure(digitalIns, PIO_LISTSIZE(digitalIns));
	PIO_Configure(sensorsPower, PIO_LISTSIZE(sensorsPower));
	
	PMC_EnablePeripheral(AT91C_ID_PIOB);
	PMC_EnablePeripheral(AT91C_ID_PIOA);
	
	PMC_EnablePeripheral(AT91C_ID_ADC1);
	ADC_Initialize(AT91C_BASE_ADC1, AT91C_ID_ADC1, AT91C_ADC_TRGEN_DIS, \
				   0, AT91C_ADC_SLEEP_NORMAL_MODE, AT91C_ADC_LOWRES_10_BIT, \
				   MCK, BOARD_ADC_FREQ, 10, 3000);
	for(i = 0;i < 8;i++) ADC_EnableChannel(AT91C_BASE_ADC1, i);

	SetPitCallback(SensorsCallback,1);
	
	SelectAng0();		// select analog port 0 to be mesured instead of BattVoltage
	SensorPowerOn();	// turn on the Vcc line
	
	if(PMC_IsPeriphEnabled(AT91C_ID_TWI) == 0){
		PIO_Configure(twiPortPins, PIO_LISTSIZE(twiPortPins));
		PMC_EnablePeripheral(AT91C_ID_TWI);
		
		TWI_ConfigureMaster(AT91C_BASE_TWI,TWCK,MCK);
	}
	
	// set all pins on pullup chip to output
	WritePullupData(0x00,&pinDirection,1);
	WritePullupData(0x01,&pinDirection,1);
	
	for(i = 0;i < 8;i++){
		if(i>1) AnalogPullup(i,1);  // enable pullups if needed
		DigitalPullup(i,1);		// enable all digital pullups
	}
}
开发者ID:BotBallARDroneAPI,项目名称:CBC_Library,代码行数:38,代码来源:sensors.c

示例3: _ConfigureUsart

/**
 * Configure USART to work @ 115200
 */
static void _ConfigureUsart(void)
{
	PIO_Configure(pins, PIO_LISTSIZE(pins));
	PMC_EnablePeripheral(ID_USART);
	USART_DisableIt(BASE_USART, 0xFFFFFFFF);
	USART_Configure(BASE_USART,
					USART_MODE_ASYNCHRONOUS,
					115200,
					BOARD_MCK);

	USART_SetTransmitterEnabled(BASE_USART, 1);
	USART_SetReceiverEnabled(BASE_USART, 1);
	NVIC_EnableIRQ(USART2_IRQn);
}
开发者ID:gstroe,项目名称:Arm,代码行数:17,代码来源:main.c

示例4: ConfigureTc0

/**
 *  \brief TC0 configuration
 *
 * Configures Timer Counter 0 (TC0) to generate an interrupt every second.
 *
 */
static void ConfigureTc0( void )
{

    /* Enable TC0 peripheral clock*/
    PMC_EnablePeripheral( ID_TC0 ) ;

    /* Configure TC for a 1s (= 1Hz) tick*/
    TC_Configure(TC0,0, 0x4 | TC_CMR0_ACPC_SET | TC_CMR0_WAVE
            | TC_CMR0_ACPA_CLEAR | (0x2 << 13));

    /* 50% duty ,1s frequency*/
    TC0->TC_CHANNEL[0].TC_RA = SAMPLING_PERIOD/2;
    TC0->TC_CHANNEL[0].TC_RC = SAMPLING_PERIOD;
}
开发者ID:cxjlante,项目名称:at91sam3s,代码行数:20,代码来源:frontend_potentiometer.c

示例5: ConfigureUsart

/**
 * Configure USART to work @ 115200
 */
static void ConfigureUsart(void)
{
    PIO_Configure(pinsUsart, PIO_LISTSIZE(pinsUsart));
    PMC_EnablePeripheral(ID_USART);
    BASE_USART->US_IDR = 0xFFFFFFFF;
    USART_Configure(BASE_USART,
                    USART_MODE_ASYNCHRONOUS,
                    115200,
                    BOARD_MCK);

    USART_SetTransmitterEnabled(BASE_USART, 1);
    USART_SetReceiverEnabled(BASE_USART, 1);
    NVIC_EnableIRQ(IRQn_USART);
}
开发者ID:cxjlante,项目名称:at91sam3s,代码行数:17,代码来源:main.c

示例6: platform_init

int platform_init()
{
  int i;
   
  // Enable the peripherals we use in the PMC
  PMC_EnablePeripheral( AT91C_ID_US0 );  
  PMC_EnablePeripheral( AT91C_ID_US1 );
  PMC_EnablePeripheral( AT91C_ID_PIOA );
  PMC_EnablePeripheral( AT91C_ID_PIOB );
  PMC_EnablePeripheral( AT91C_ID_TC0 );
  PMC_EnablePeripheral( AT91C_ID_TC1 );
  PMC_EnablePeripheral( AT91C_ID_TC2 );
  PMC_EnablePeripheral( AT91C_ID_PWMC );  
  
  // Configure the timers
  AT91C_BASE_TCB->TCB_BMR = 0x15;
  for( i = 0; i < 3; i ++ )
    TC_Configure( ( AT91S_TC* )timer_base[ i ], AT91C_TC_CLKS_TIMER_DIV5_CLOCK | AT91C_TC_WAVE );
        
  // PWM setup (only the clocks are set at this point)
  PWMC_ConfigureClocks( BOARD_MCK, BOARD_MCK, BOARD_MCK );
  PWMC_ConfigureChannel( 0, AT91C_PWMC_CPRE_MCKA, 0, 0 );
  PWMC_ConfigureChannel( 1, AT91C_PWMC_CPRE_MCKA, 0, 0 );  
  PWMC_ConfigureChannel( 2, AT91C_PWMC_CPRE_MCKB, 0, 0 );
  PWMC_ConfigureChannel( 3, AT91C_PWMC_CPRE_MCKB, 0, 0 );    
  for( i = 0; i < 4; i ++ )
  {
    PWMC_EnableChannel( i );
    PWMC_EnableChannelIt( i );
  }

  cmn_platform_init();
  
#if VTMR_NUM_TIMERS > 0
  // Virtual timer initialization
  TC_Configure( AT91C_BASE_TC2, AT91C_TC_CLKS_TIMER_DIV5_CLOCK | AT91C_TC_WAVE | AT91C_TC_WAVESEL_UP_AUTO );
  AT91C_BASE_TC2->TC_RC = ( BOARD_MCK / 1024 ) / VTMR_FREQ_HZ;
  AIC_DisableIT( AT91C_ID_TC2 );
  AIC_ConfigureIT( AT91C_ID_TC2, 0, ISR_Tc2 );
  AT91C_BASE_TC2->TC_IER = AT91C_TC_CPCS;
  AIC_EnableIT( AT91C_ID_TC2 );  
  TC_Start( AT91C_BASE_TC2 );
#endif
    
  return PLATFORM_OK;
} 
开发者ID:Theemuts,项目名称:eLuaBrain,代码行数:46,代码来源:platform.c

示例7: SPID_ConfigureCS

/**
 * \brief Configures the parameters for the device corresponding to the cs value.
 *
 * \param pSpid  Pointer to a Spid instance.
 * \param cs number corresponding to the SPI chip select.
 * \param csr SPI_CSR value to setup.
 */
void SPID_ConfigureCS( Spid *pSpid, 
                       uint32_t dwCS, 
                       uint32_t dwCsr)
{
    Spi *pSpiHw = pSpid->pSpiHw;
    
    /* Enable the SPI Peripheral */
    PMC_EnablePeripheral (pSpid->spiId );
    /* Configure SPI Chip Select Register */
    SPI_ConfigureNPCS( pSpiHw, dwCS, dwCsr );
    
    /* Disable the SPI Peripheral */
    PMC_DisablePeripheral (pSpid->spiId );
    
}
开发者ID:bleuelotus,项目名称:SweepRobot_Testing_Host,代码行数:22,代码来源:spi_dma.c

示例8: TWID_Initialize

/**
 * \brief Initializes a TWI driver instance, using the given TWI peripheral.
 * \note The peripheral must have been initialized properly before calling this function.
 * \param pTwid  Pointer to the Twid instance to initialize.
 * \param pTwi  Pointer to the TWI peripheral to use.
 */
Twi* TWID_Initialize(uint8_t ucDeviceID,Twi* pTwi, uint32_t dwTwCk, uint32_t dwMCk)
{
    uint32_t dwCkDiv = 0 ;
    uint32_t dwClDiv ;
    uint32_t dwOk = 0 ;

    TRACE_DEBUG( "TWID_Initialize()\n\r" ) ;
    assert( pTwi != NULL ) ;

	PMC_EnablePeripheral(ucDeviceID);

    /* SVEN: TWI Slave Mode Enabled */
    pTwi->TWI_CR = TWI_CR_SVEN ;
    /* Reset the TWI */
    pTwi->TWI_CR = TWI_CR_SWRST ;
    pTwi->TWI_RHR ;

    /* TWI Slave Mode Disabled, TWI Master Mode Disabled. */
    pTwi->TWI_CR = TWI_CR_SVDIS ;
    pTwi->TWI_CR = TWI_CR_MSDIS ;

    /* Set master mode */
    pTwi->TWI_CR = TWI_CR_MSEN ;

    /* Configure clock */
    while ( !dwOk )
    {
        dwClDiv = ((dwMCk / (2 * dwTwCk)) - 4) / (1<<dwCkDiv) ;

        if ( dwClDiv <= 255 )
        {
            dwOk = 1 ;
        }
        else
        {
            dwCkDiv++ ;
        }
    }

    assert( dwCkDiv < 8 ) ;
    TRACE_DEBUG( "Using CKDIV = %u and CLDIV/CHDIV = %u\n\r", dwCkDiv, dwClDiv ) ;

    pTwi->TWI_CWGR = 0 ;
    pTwi->TWI_CWGR = (dwCkDiv << 16) | (dwClDiv << 8) | dwClDiv ;

	return pTwi;

}
开发者ID:yunfei-ma,项目名称:hprfs,代码行数:54,代码来源:twi.c

示例9: MCI_SetSpeed

/**
 * Configure the  MCI CLKDIV in the MCI_MR register. The max. for MCI clock is
 * MCK/2 and corresponds to CLKDIV = 0
 * \param pMci  Pointer to the low level MCI driver.
 * \param mciSpeed  MCI clock speed in Hz, 0 will not change current speed.
 * \param mck       MCK to generate MCI Clock, in Hz
 * \return The actual speed used, 0 for fail.
 */
uint32_t MCI_SetSpeed( Mcid* pMci, uint32_t mciSpeed, uint32_t mck )
{
    Hsmci *pMciHw = pMci->pMciHw;
    uint32_t mciMr;
    uint32_t clkdiv;
    uint8_t  mciDis;

    assert(pMci);
    assert(pMciHw);

    PMC_EnablePeripheral(pMci->mciId);
    mciDis = PMC_IsPeriphEnabled(pMci->mciId);

    mciMr = pMciHw->HSMCI_MR & (~(uint32_t)HSMCI_MR_CLKDIV_Msk);
    /* Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
     * divided by (2*(CLKDIV+1))
     * mciSpeed = MCK / (2*(CLKDIV+1)) */
    if (mciSpeed > 0)
    {
        clkdiv = (mck / 2 / mciSpeed);
        /* Speed should not bigger than expired one */
        if (mciSpeed < mck/2/clkdiv)
        {
            clkdiv ++;
        }
		
        if ( clkdiv > 0 )
        {
            clkdiv -= 1;
        }
        assert( (clkdiv & 0xFFFFFF00) == 0 ) ; /* "mciSpeed too small" */
    }
    else
    {
	    clkdiv = 0 ;
    }

    /* Actual MCI speed */
    mciSpeed = mck / 2 / (clkdiv + 1);
    /* Modify MR */
    pMciHw->HSMCI_MR = mciMr | clkdiv;
    if ( mciDis )
    {
        PMC_DisablePeripheral( pMci->mciId ) ;
    }

    return (mciSpeed);
}
开发者ID:Blone,项目名称:my-project-hihack,代码行数:56,代码来源:hsmci_pdc.c

示例10: GMACD_Init

/**
 * \brief Initialize the GMAC with the Gmac controller address
 *  \param pGmacd Pointer to GMAC Driver instance. 
 *  \param pHw    Pointer to HW address for registers.
 *  \param bID     HW ID for power management
 *  \param enableCAF    Enable/Disable CopyAllFrame.
 *  \param enableNBC    Enable/Disable NoBroadCast.
 */
 void GMACD_Init(sGmacd *pGmacd,
                Gmac *pHw,
                uint8_t bID, 
                uint8_t enableCAF, 
                uint8_t enableNBC )
{
    uint32_t dwNcfgr;
    
    /* Check parameters */
    assert(GRX_BUFFERS * GMAC_RX_UNITSIZE > GMAC_FRAME_LENTGH_MAX);

    TRACE_DEBUG("GMAC_Init\n\r");

    /* Initialize struct */
    pGmacd->pHw = pHw;
    pGmacd->bId = bID;

    /* Power ON */
    PMC_EnablePeripheral(bID);

    /* Disable TX & RX and more */
    GMAC_NetworkControl(pHw, 0);
    GMAC_DisableIt(pHw, ~0u);
    
    GMAC_ClearStatistics(pHw);
    /* Clear all status bits in the receive status register. */
    GMAC_ClearRxStatus(pHw, GMAC_RSR_RXOVR | GMAC_RSR_REC | GMAC_RSR_BNA |GMAC_RSR_HNO);

    /* Clear all status bits in the transmit status register */
    GMAC_ClearTxStatus(pHw, GMAC_TSR_UBR | GMAC_TSR_COL | GMAC_TSR_RLE
                            | GMAC_TSR_TXGO | GMAC_TSR_TFC | GMAC_TSR_TXCOMP
                            | GMAC_TSR_UND | GMAC_TSR_HRESP | GMAC_TSR_LCO);

    /* Clear interrupts */
    GMAC_GetItStatus(pHw);

    /* Enable the copy of data into the buffers
       ignore broadcasts, and don't copy FCS. */
    dwNcfgr = GMAC_NCFGR_FD | GMAC_NCFGR_GBE | GMAC_NCFGR_DBW_DBW64 | GMAC_NCFGR_CLK_MCK_64;
    if( enableCAF ) {
        dwNcfgr |= GMAC_NCFGR_CAF;
    }
    if( enableNBC ) {
        dwNcfgr |= GMAC_NCFGR_NBC;
    }
    
    GMAC_Configure(pHw, dwNcfgr);
}
开发者ID:vmandrews,项目名称:CSDC-OBC-Software,代码行数:56,代码来源:gmacd.c

示例11: ConfigureTc0

/**
 * Configure TC0 to generate an interrupt every 4ms
 */
static void ConfigureTc0(void)
{
    uint32_t div, tcclks;

    /* Enable TC0 peripheral */
    PMC_EnablePeripheral(ID_TC0);
    /* Configure TC0 for 250Hz frequency and trigger on RC compare */
    TC_FindMckDivisor(250, BOARD_MCK, &div, &tcclks, BOARD_MCK);
    TC_Configure(TC0, 0, tcclks | TC_CMR_CPCTRG);
    TC0->TC_CHANNEL[0].TC_RC = (BOARD_MCK / div) / 250;
    /* Configure and enable interrupt on RC compare */
    NVIC_EnableIRQ(TC0_IRQn);
    TC0->TC_CHANNEL[0].TC_IER = TC_IER_CPCS;
    /* Start TC as event timer */
    TC_Start(TC0, 0);
}
开发者ID:cxjlante,项目名称:at91sam3s,代码行数:19,代码来源:main.c

示例12: _ConfigureTc0

static void _ConfigureTc0( void )
{
    /* Enable TC0 peripheral clock*/
    PMC_EnablePeripheral( ID_TC0 ) ;

    /* Configure TC for a 1s (= 1Hz) tick*/
    TC_Configure( TC0, 0, 0x4 | TC_CMR_CPCTRG ) ;

    TC0->TC_CHANNEL[0].TC_RC = 32768 ;

    /* Configure interrupt on RC compare*/
    TC0->TC_CHANNEL[0].TC_IER = TC_SR_CPCS ;

    NVIC_EnableIRQ( TC0_IRQn ) ;

}
开发者ID:cxjlante,项目名称:at91sam3s,代码行数:16,代码来源:main.c

示例13: ADC_Initialize

/**
 * \brief Initialize the ADC controller
 *
 * \param pAdc Pointer to an Adc instance.
 * \param dwID ADC Index
 */
extern void ADC_Initialize( Adc* pAdc, uint32_t dwID )
{
    /* Enable peripheral clock*/
    PMC_EnablePeripheral(dwID);

    /*  Reset the controller */
    pAdc->ADC_CR = ADC_CR_SWRST;

    /* Reset Mode Register */
    pAdc->ADC_MR = 0;

    /* Reset PDC transfer */
    pAdc->ADC_PTCR = (ADC_PTCR_RXTDIS | ADC_PTCR_TXTDIS);
    pAdc->ADC_RCR = 0;
    pAdc->ADC_RNCR = 0;
}
开发者ID:Dimitech,项目名称:DTX1-1740P,代码行数:22,代码来源:adc.c

示例14: usart0_init

/* _____GLOBAL FUNCTIONS_____________________________________________________ */
void usart0_init(void)
{
    // Clear flag
    usart0_tx_finished_flag = FALSE;

    // Initialise ring buffers
    ring_buffer_init(&usart0_rx_ring_buffer, usart0_rx_buffer, USART0_RX_BUFFER_SIZE);
    ring_buffer_init(&usart0_tx_ring_buffer, usart0_tx_buffer, USART0_TX_BUFFER_SIZE);

    // Configure PIO pins for USART0 peripheral
    PIO_Configure(USART0_Pins, PIO_LISTSIZE(USART0_Pins));    

    // Disable the interrupt on the interrupt controller
    AIC_DisableIT(AT91C_ID_US0);

    // Enable USART0 clock
    PMC_EnablePeripheral(AT91C_ID_US0);

    // Disable all USART0 interrupts
    AT91C_BASE_US0->US_IDR = 0xFFFFFFFF;

    // Configure USART
    USART_Configure(AT91C_BASE_US0,
                    AT91C_US_USMODE_NORMAL |
                    AT91C_US_CLKS_CLOCK    |
                    AT91C_US_CHRL_8_BITS   | 
                    AT91C_US_PAR_NONE      | 
                    AT91C_US_NBSTOP_1_BIT,
                    115200,
                    BOARD_MCK);

    USART_SetTransmitterEnabled(AT91C_BASE_US0, 1);
    USART_SetReceiverEnabled(AT91C_BASE_US0, 1);

    // Configure the AIC for USART0 interrupts
    AIC_ConfigureIT(AT91C_ID_US0, AT91C_AIC_PRIOR_LOWEST | AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, usart0_interrupt);

    // Enable the interrupt on the interrupt controller
    AIC_EnableIT(AT91C_ID_US0);

    // Enable selected USART0 interrupts
    AT91C_BASE_US0->US_IER = AT91C_US_RXRDY     |
                             AT91C_US_RXBRK     |
                             AT91C_US_OVRE      |
                             AT91C_US_FRAME     |
                             AT91C_US_PARE;
}
开发者ID:BackupTheBerlios,项目名称:piconomic-svn,代码行数:48,代码来源:usart0.c

示例15: _ConfigureUsartAsSpiSlave

/**
 * \brief Configures USART in spi slave mode
 */
static void _ConfigureUsartAsSpiSlave(void)
{
	uint32_t usartMode;

	/* Configure usart slave mode */
	usartMode = 0
		| US_MR_USART_MODE_SPI_SLAVE
		| US_MR_CHRL_8_BIT
		| US_SPI_BPMODE_1;
	PMC_EnablePeripheral(ID_USART);
	USART_SPI_Configure(USART, usartMode, spiClock, BOARD_MCK);

	NVIC_ClearPendingIRQ(USART_IRQn);
	NVIC_SetPriority(USART_IRQn ,1);
	NVIC_EnableIRQ(USART_IRQn);
	USART_DisableIt(USART, 0xffffffff);
}
开发者ID:gstroe,项目名称:Arm,代码行数:20,代码来源:main.c


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