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


C++ CyEnterCriticalSection函数代码示例

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


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

示例1: USBFS_Resume

/*******************************************************************************
* Function Name: USBFS_Resume
********************************************************************************
*
* Summary:
*  This function enables the USBFS block after power down mode.
*
* Parameters:
*  None.
*
* Return:
*  None.
*
* Global variables:
*  USBFS_backup - checked.
*
* Reentrant:
*  No.
*
*******************************************************************************/
void USBFS_Resume(void) 
{
    uint8 enableInterrupts;
    enableInterrupts = CyEnterCriticalSection();

    if(USBFS_backup.enableState != 0u)
    {
        #if(USBFS_DP_ISR_REMOVE == 0u)
            CyIntDisable(USBFS_DP_INTC_VECT_NUM);
        #endif /*  USBFS_DP_ISR_REMOVE */

        /* Enable USB block */
        USBFS_PM_ACT_CFG_REG |= USBFS_PM_ACT_EN_FSUSB;
        /* Enable USB block for Standby Power Mode */
        USBFS_PM_STBY_CFG_REG |= USBFS_PM_STBY_EN_FSUSB;
        /* Enable core clock */
        USBFS_USB_CLK_EN_REG |= USBFS_USB_CLK_ENABLE;

        /* Enable the USBIO reference by setting PM.USB_CR0.fsusbio_ref_en.*/
        USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_REF_EN;
        /* The reference will be available ~40us after power restored */
        CyDelayUs(40u);
        /* Return VRegulator*/
        USBFS_CR1_REG |= USBFS_backup.mode;
        CyDelayUs(0u);  /*~50ns delay */
        /* Enable USBIO */
        USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_PD_N;
        CyDelayUs(2u);
        /* Set the USBIO pull-up enable */
        USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_PD_PULLUP_N;

        /* Re-init Arbiter configuration for DMA transfers */
        #if(USBFS_EP_MM != USBFS__EP_MANUAL)
            /* Usb arb interrupt enable */
            USBFS_ARB_INT_EN_REG = USBFS_ARB_INT_MASK;
            #if(USBFS_EP_MM == USBFS__EP_DMAMANUAL)
                USBFS_ARB_CFG_REG = USBFS_ARB_CFG_MANUAL_DMA;
            #endif   /*  USBFS_EP_MM == USBFS__EP_DMAMANUAL */
            #if(USBFS_EP_MM == USBFS__EP_DMAAUTO)
                /*Set cfg cmplt this rises DMA request when the full configuration is done */
                USBFS_ARB_CFG_REG = USBFS_ARB_CFG_AUTO_DMA | USBFS_ARB_CFG_AUTO_MEM;
            #endif   /*  USBFS_EP_MM == USBFS__EP_DMAAUTO */
        #endif   /*  USBFS_EP_MM != USBFS__EP_MANUAL */

        /* STALL_IN_OUT */
        CY_SET_REG8(USBFS_EP0_CR_PTR, USBFS_MODE_STALL_IN_OUT);
        /* Enable the SIE with a last address */
        USBFS_CR0_REG |= USBFS_CR0_ENABLE;
        CyDelayCycles(1u);
        /* Finally, Enable d+ pullup and select iomode to USB mode*/
        CY_SET_REG8(USBFS_USBIO_CR1_PTR, USBFS_USBIO_CR1_USBPUEN);

        /* Restore USB register settings */
        USBFS_RestoreConfig();
    }

    CyExitCriticalSection(enableInterrupts);
}
开发者ID:boseji,项目名称:RPiSoC_Bootloader,代码行数:78,代码来源:USBFS_pm.c

示例2: USBFS_Suspend

/*******************************************************************************
* Function Name: USBFS_Suspend
********************************************************************************
*
* Summary:
*  This function disables the USBFS block and prepares for power down mode.
*
* Parameters:
*  None.
*
* Return:
*   None.
*
* Global variables:
*  USBFS_backup.enable:  modified.
*
* Reentrant:
*  No.
*
*******************************************************************************/
void USBFS_Suspend(void) 
{
    uint8 enableInterrupts;
    enableInterrupts = CyEnterCriticalSection();

    if((CY_GET_REG8(USBFS_CR0_PTR) & USBFS_CR0_ENABLE) != 0u)
    {   /* USB block is enabled */
        USBFS_backup.enableState = 1u;

        #if(USBFS_EP_MM != USBFS__EP_MANUAL)
            USBFS_Stop_DMA(USBFS_MAX_EP);     /* Stop all DMAs */
        #endif   /*  USBFS_EP_MM != USBFS__EP_MANUAL */

        /* Ensure USB transmit enable is low (USB_USBIO_CR0.ten). - Manual Transmission - Disabled */
        USBFS_USBIO_CR0_REG &= (uint8)~USBFS_USBIO_CR0_TEN;
        CyDelayUs(0u);  /*~50ns delay */

        /* Disable the USBIO by asserting PM.USB_CR0.fsusbio_pd_n(Inverted) and pd_pullup_hv(Inverted) high. */
        USBFS_PM_USB_CR0_REG &=
                                (uint8)~(USBFS_PM_USB_CR0_PD_N | USBFS_PM_USB_CR0_PD_PULLUP_N);

        /* Disable the SIE */
        USBFS_CR0_REG &= (uint8)~USBFS_CR0_ENABLE;

        CyDelayUs(0u);  /* ~50ns delay */
        /* Store mode and Disable VRegulator*/
        USBFS_backup.mode = USBFS_CR1_REG & USBFS_CR1_REG_ENABLE;
        USBFS_CR1_REG &= (uint8)~USBFS_CR1_REG_ENABLE;

        CyDelayUs(1u);  /* 0.5 us min delay */
        /* Disable the USBIO reference by setting PM.USB_CR0.fsusbio_ref_en.*/
        USBFS_PM_USB_CR0_REG &= (uint8)~USBFS_PM_USB_CR0_REF_EN;

        /* Switch DP and DM terminals to GPIO mode and disconnect 1.5k pullup*/
        USBFS_USBIO_CR1_REG |= USBFS_USBIO_CR1_IOMODE;

        /* Disable USB in ACT PM */
        USBFS_PM_ACT_CFG_REG &= (uint8)~USBFS_PM_ACT_EN_FSUSB;
        /* Disable USB block for Standby Power Mode */
        USBFS_PM_STBY_CFG_REG &= (uint8)~USBFS_PM_STBY_EN_FSUSB;
        CyDelayUs(1u); /* min  0.5us delay required */

    }
    else
    {
        USBFS_backup.enableState = 0u;
    }
    
    CyExitCriticalSection(enableInterrupts);

    /* Set the DP Interrupt for wake-up from sleep mode. */
    #if(USBFS_DP_ISR_REMOVE == 0u)
        (void) CyIntSetVector(USBFS_DP_INTC_VECT_NUM, &USBFS_DP_ISR);
        CyIntSetPriority(USBFS_DP_INTC_VECT_NUM, USBFS_DP_INTC_PRIOR);
        CyIntClearPending(USBFS_DP_INTC_VECT_NUM);
        CyIntEnable(USBFS_DP_INTC_VECT_NUM);
    #endif /* (USBFS_DP_ISR_REMOVE == 0u) */
}
开发者ID:boseji,项目名称:RPiSoC_Bootloader,代码行数:78,代码来源:USBFS_pm.c

示例3: EzI2C_RestoreConfig

/*******************************************************************************
* Function Name: EzI2C_RestoreConfig
********************************************************************************
*
* Summary:
*  The Enable wakeup from Sleep Mode selection influences this function
*  implementation:
*   Unchecked: Restores the component non-retention configuration registers
*              to the state they were in before I2C_Sleep() or I2C_SaveConfig()
*              was called.
*   Checked:   Disables the backup regulator of the I2C hardware. Sets up the
*              regular component interrupt handler and generates the component
*              interrupt if it was wake up source to release the bus and
*              continue in-coming I2C transaction.
*
* Parameters:
*  None.
*
* Return:
*  None.
*
* Global variables:
*  EzI2C_backup - the non-retention registers are restored from.
*
* Reentrant:
*  No.
*
* Side Effects:
*  Calling this function before EzI2C_SaveConfig() or
*  EzI2C_Sleep() may produce unexpected behavior.
*
*******************************************************************************/
void EzI2C_RestoreConfig(void) 
{
    uint8 intState;

    if (0u != (EzI2C_PWRSYS_CR1_I2C_BACKUP & EzI2C_PWRSYS_CR1_REG))
    /* Exit from Sleep */
    {
        /* Disable I2C backup regulator */
        intState = CyEnterCriticalSection();
        EzI2C_PWRSYS_CR1_REG &= (uint8) ~EzI2C_PWRSYS_CR1_I2C_BACKUP;
        CyExitCriticalSection(intState);
    }
    else /* Exit from Hibernate (bit is cleared) or wakeup disabled */
    {
    #if (EzI2C_WAKEUP_ENABLED)
        /* Disable power to I2C block before register restore */
        intState = CyEnterCriticalSection();
        EzI2C_PM_ACT_CFG_REG  &= (uint8) ~EzI2C_ACT_PWR_EN;
        EzI2C_PM_STBY_CFG_REG &= (uint8) ~EzI2C_STBY_PWR_EN;
        CyExitCriticalSection(intState);

        /* Enable component after restore complete */
        EzI2C_backup.enableState = EzI2C_ENABLED;
    #endif /* (EzI2C_WAKEUP_ENABLED) */

        /* Restore component registers: Hibernate disable power */
        EzI2C_CFG_REG     = EzI2C_backup.cfg;
        EzI2C_XCFG_REG    = EzI2C_backup.xcfg;
        EzI2C_ADDR_REG    = EzI2C_backup.adr;
        EzI2C_CLKDIV1_REG = EzI2C_backup.clkDiv1;
        EzI2C_CLKDIV2_REG = EzI2C_backup.clkDiv2;
    }

#if (EzI2C_WAKEUP_ENABLED)
    /* Set I2C interrupt to be pending if component is source of wake up */
    EzI2C_DisableInt();
    (void) CyIntSetVector(EzI2C_ISR_NUMBER, &EzI2C_ISR);
    if (0u != EzI2C_wakeupSource)
    {
        /* Generate interrupt to release I2C bus */
        (void) CyIntSetPending(EzI2C_ISR_NUMBER);
    }
    EzI2C_EnableInt();
#endif /* (EzI2C_WAKEUP_ENABLED) */
}
开发者ID:isengard412,项目名称:freeDSPPSoC-GuitarEffect,代码行数:77,代码来源:EzI2C_PM.c

示例4: Backlight_PWM_Stop

/*******************************************************************************
* Function Name: Backlight_PWM_Stop
********************************************************************************
*
* Summary:
*  Disables the Backlight_PWM.
*
* Parameters:
*  None
*
* Return:
*  None
*
*******************************************************************************/
void Backlight_PWM_Stop(void)
{
    uint8 enableInterrupts;

    enableInterrupts = CyEnterCriticalSection();

    Backlight_PWM_BLOCK_CONTROL_REG &= (uint32)~Backlight_PWM_MASK;

    CyExitCriticalSection(enableInterrupts);
}
开发者ID:777string,项目名称:reload-pro,代码行数:24,代码来源:Backlight_PWM.c

示例5: Backlight_PWM_TriggerCommand

/*******************************************************************************
* Function Name: Backlight_PWM_TriggerCommand
********************************************************************************
*
* Summary:
*  Triggers the designated command to occur on the designated TCPWM instances.
*  The mask can be used to apply this command simultaneously to more than one
*  instance.  This allows multiple TCPWM instances to be synchronized.
*
* Parameters:
*  mask: Combination of mask bits for each instance of the TCPWM that the
*        command should apply to.  This function from one instance can be used
*        to apply the command to any of the instances in the design.
*        The mask value for a specific instance is available with the MASK
*        define.
*  command: Enumerated command values. Capture command only applicable for
*           Timer/Counter with Capture and PWM modes.
*   Values:
*     - Backlight_PWM_CMD_CAPTURE    - Trigger Capture command
*     - Backlight_PWM_CMD_RELOAD     - Trigger Reload command
*     - Backlight_PWM_CMD_STOP       - Trigger Stop command
*     - Backlight_PWM_CMD_START      - Trigger Start command
*
* Return:
*  None
*
*******************************************************************************/
void Backlight_PWM_TriggerCommand(uint32 mask, uint32 command)
{
    uint8 enableInterrupts;

    enableInterrupts = CyEnterCriticalSection();

    Backlight_PWM_COMMAND_REG = ((uint32)(mask << command));

    CyExitCriticalSection(enableInterrupts);
}
开发者ID:777string,项目名称:reload-pro,代码行数:37,代码来源:Backlight_PWM.c

示例6: TILT_Stop

/*******************************************************************************
* Function Name: TILT_Stop
********************************************************************************
*
* Summary:
*  Disables the TILT.
*
* Parameters:
*  None
*
* Return:
*  None
*
*******************************************************************************/
void TILT_Stop(void)
{
    uint8 enableInterrupts;

    enableInterrupts = CyEnterCriticalSection();

    TILT_BLOCK_CONTROL_REG &= (uint32)~TILT_MASK;

    CyExitCriticalSection(enableInterrupts);
}
开发者ID:Rensselaer-Motorsport,项目名称:E-Throttle,代码行数:24,代码来源:TILT.c

示例7: MessageReceived_SetPriority

/*******************************************************************************
* Function Name: MessageReceived_SetPriority
********************************************************************************
*
* Summary:
*   Sets the Priority of the Interrupt. Note calling MessageReceived_Start
*   or MessageReceived_StartEx will override any effect this method would 
*   have had. This method should only be called after MessageReceived_Start or 
*   MessageReceived_StartEx has been called. To set the initial
*   priority for the component use the cydwr file in the tool.
*
* Parameters:
*   priority: Priority of the interrupt. 0 - 3, 0 being the highest.
*
* Return:
*   None
*
*******************************************************************************/
void MessageReceived_SetPriority(uint8 priority)
{
	uint8 interruptState;
    uint32 priorityOffset = ((MessageReceived__INTC_NUMBER % 4u) * 8u) + 6u;
    
	interruptState = CyEnterCriticalSection();
    *MessageReceived_INTC_PRIOR = (*MessageReceived_INTC_PRIOR & (uint32)(~MessageReceived__INTC_PRIOR_MASK)) |
                                    ((uint32)priority << priorityOffset);
	CyExitCriticalSection(interruptState);
}
开发者ID:EmbeddedSam,项目名称:Modbus-Slave-for-PSoC4,代码行数:28,代码来源:MessageReceived.c

示例8: PhaseCounter_Intr_SetPriority

/*******************************************************************************
* Function Name: PhaseCounter_Intr_SetPriority
********************************************************************************
*
* Summary:
*   Sets the Priority of the Interrupt. 
*
*   Note calling PhaseCounter_Intr_Start or PhaseCounter_Intr_StartEx will 
*   override any effect this API would have had. This API should only be called
*   after PhaseCounter_Intr_Start or PhaseCounter_Intr_StartEx has been called. 
*   To set the initial priority for the component, use the Design-Wide Resources
*   Interrupt Editor.
*
*   Note This API has no effect on Non-maskable interrupt NMI).
*
* Parameters:
*   priority: Priority of the interrupt, 0 being the highest priority
*             PSoC 3 and PSoC 5LP: Priority is from 0 to 7.
*             PSoC 4: Priority is from 0 to 3.
*
* Return:
*   None
*
*******************************************************************************/
void PhaseCounter_Intr_SetPriority(uint8 priority)
{
	uint8 interruptState;
    uint32 priorityOffset = ((PhaseCounter_Intr__INTC_NUMBER % 4u) * 8u) + 6u;
    
	interruptState = CyEnterCriticalSection();
    *PhaseCounter_Intr_INTC_PRIOR = (*PhaseCounter_Intr_INTC_PRIOR & (uint32)(~PhaseCounter_Intr__INTC_PRIOR_MASK)) |
                                    ((uint32)priority << priorityOffset);
	CyExitCriticalSection(interruptState);
}
开发者ID:tslator,项目名称:DualBoard-043,代码行数:34,代码来源:PhaseCounter_Intr.c

示例9: start_int_SetPriority

/*******************************************************************************
* Function Name: start_int_SetPriority
********************************************************************************
*
* Summary:
*   Sets the Priority of the Interrupt. 
*
*   Note calling start_int_Start or start_int_StartEx will 
*   override any effect this API would have had. This API should only be called
*   after start_int_Start or start_int_StartEx has been called. 
*   To set the initial priority for the component, use the Design-Wide Resources
*   Interrupt Editor.
*
*   Note This API has no effect on Non-maskable interrupt NMI).
*
* Parameters:
*   priority: Priority of the interrupt, 0 being the highest priority
*             PSoC 3 and PSoC 5LP: Priority is from 0 to 7.
*             PSoC 4: Priority is from 0 to 3.
*
* Return:
*   None
*
*******************************************************************************/
void start_int_SetPriority(uint8 priority)
{
	uint8 interruptState;
    uint32 priorityOffset = ((start_int__INTC_NUMBER % 4u) * 8u) + 6u;
    
	interruptState = CyEnterCriticalSection();
    *start_int_INTC_PRIOR = (*start_int_INTC_PRIOR & (uint32)(~start_int__INTC_PRIOR_MASK)) |
                                    ((uint32)priority << priorityOffset);
	CyExitCriticalSection(interruptState);
}
开发者ID:andrey-mcs,项目名称:start-finish-system,代码行数:34,代码来源:start_int.c

示例10: XBEE_RX_INT_SetPriority

/*******************************************************************************
* Function Name: XBEE_RX_INT_SetPriority
********************************************************************************
*
* Summary:
*   Sets the Priority of the Interrupt. 
*
*   Note calling XBEE_RX_INT_Start or XBEE_RX_INT_StartEx will 
*   override any effect this API would have had. This API should only be called
*   after XBEE_RX_INT_Start or XBEE_RX_INT_StartEx has been called. 
*   To set the initial priority for the component, use the Design-Wide Resources
*   Interrupt Editor.
*
*   Note This API has no effect on Non-maskable interrupt NMI).
*
* Parameters:
*   priority: Priority of the interrupt, 0 being the highest priority
*             PSoC 3 and PSoC 5LP: Priority is from 0 to 7.
*             PSoC 4: Priority is from 0 to 3.
*
* Return:
*   None
*
*******************************************************************************/
void XBEE_RX_INT_SetPriority(uint8 priority)
{
	uint8 interruptState;
    uint32 priorityOffset = ((XBEE_RX_INT__INTC_NUMBER % 4u) * 8u) + 6u;
    
	interruptState = CyEnterCriticalSection();
    *XBEE_RX_INT_INTC_PRIOR = (*XBEE_RX_INT_INTC_PRIOR & (uint32)(~XBEE_RX_INT__INTC_PRIOR_MASK)) |
                                    ((uint32)priority << priorityOffset);
	CyExitCriticalSection(interruptState);
}
开发者ID:pablobacho,项目名称:XBee-PSoC,代码行数:34,代码来源:XBEE_RX_INT.c

示例11: Tuner_RunTuner

void Tuner_RunTuner(void)
{
    uint8 interruptState;
    uint8 suspended = 0;
    uint16 command;
    uint16 previousCompleteBit; /* COMPLETE_BIT in tunerCmd at time of last send to tuner host */

    Tuner_SendBuffer();

    /* Handle suspend command to avoid deadlock later in CapSense_RunTuner */
    do 
    {
        Tuner_RefreshBuffer();
        interruptState = CyEnterCriticalSection();  /* Avoid ints between read and modify tunerCmd */
        command = CapSense_dsRam.tunerCmd;
        switch (command)
        {
            case CapSense_TU_CMD_SUSPEND_E:
                suspended = 1;
                CapSense_dsRam.tunerCmd |= CapSense_TU_CMD_COMPLETE_BIT;
                CyExitCriticalSection(interruptState); /* Enable ints during SendBuffer */
                Tuner_SendBuffer(); /* Send buffer with updated COMPLETE_BIT to tuner host */
                interruptState = CyEnterCriticalSection();
                break;
                
            case CapSense_TU_CMD_RESUME_E:    
            case CapSense_TU_CMD_RESTART_E:
            case CapSense_TU_CMD_RUN_SNR_TEST_E:
                suspended = 0;
                break;
                
            default:
                break;
        }
        CyExitCriticalSection(interruptState);
    } while (suspended); 

    previousCompleteBit = CapSense_dsRam.tunerCmd & CapSense_TU_CMD_COMPLETE_BIT;
    CapSense_RunTuner(); 
    
    if ( previousCompleteBit != (CapSense_dsRam.tunerCmd & CapSense_TU_CMD_COMPLETE_BIT) )
        Tuner_SendBuffer(); /* Send buffer with updated COMPLETE_BIT to tuner host */
}
开发者ID:hakanjansson,项目名称:psoc_nuggets,代码行数:43,代码来源:tuner.c

示例12: CYBLE_bless_isr_SetPriority

/*******************************************************************************
* Function Name: CYBLE_bless_isr_SetPriority
********************************************************************************
*
* Summary:
*   Sets the Priority of the Interrupt. 
*
*   Note calling CYBLE_bless_isr_Start or CYBLE_bless_isr_StartEx will 
*   override any effect this API would have had. This API should only be called
*   after CYBLE_bless_isr_Start or CYBLE_bless_isr_StartEx has been called. 
*   To set the initial priority for the component, use the Design-Wide Resources
*   Interrupt Editor.
*
*   Note This API has no effect on Non-maskable interrupt NMI).
*
* Parameters:
*   priority: Priority of the interrupt, 0 being the highest priority
*             PSoC 3 and PSoC 5LP: Priority is from 0 to 7.
*             PSoC 4: Priority is from 0 to 3.
*
* Return:
*   None
*
*******************************************************************************/
void CYBLE_bless_isr_SetPriority(uint8 priority)
{
	uint8 interruptState;
    uint32 priorityOffset = ((CYBLE_bless_isr__INTC_NUMBER % 4u) * 8u) + 6u;
    
	interruptState = CyEnterCriticalSection();
    *CYBLE_bless_isr_INTC_PRIOR = (*CYBLE_bless_isr_INTC_PRIOR & (uint32)(~CYBLE_bless_isr__INTC_PRIOR_MASK)) |
                                    ((uint32)priority << priorityOffset);
	CyExitCriticalSection(interruptState);
}
开发者ID:mmoiyadi,项目名称:IoT,代码行数:34,代码来源:CYBLE_bless_isr.c

示例13: I2S_DisableRx

    /*******************************************************************************
    * Function Name: I2S_DisableRx
    ********************************************************************************
    *
    * Summary:
    *  Disables the Rx direction of the I2S interface.
    *
    * Parameters:
    *  None.
    *
    * Return:
    *  None.
    *
    *******************************************************************************/
    void I2S_DisableRx(void) 
    {
        uint8 enableInterrupts;

        I2S_CONTROL_REG &= ((uint8) ~I2S_RX_EN);

        enableInterrupts = CyEnterCriticalSection();
        I2S_RX_STATUS_AUX_CONTROL_REG &= ((uint8) ~I2S_RX_INT_EN);
        CyExitCriticalSection(enableInterrupts);
    }
开发者ID:yourskp,项目名称:USB_Audio,代码行数:24,代码来源:I2S.c

示例14: I2S_Enable

/*******************************************************************************
* Function Name: I2S_Enable
********************************************************************************
*
* Summary:
*  Enables I2S interface.
*
* Parameters:
*  None.
*
* Return:
*  None.
*
*******************************************************************************/
void I2S_Enable(void) 
{
    uint8 enableInterrupts;

    enableInterrupts = CyEnterCriticalSection();
    I2S_AUX_CONTROL_REG |= I2S_CNTR7_EN;
    CyExitCriticalSection(enableInterrupts);

    I2S_CONTROL_REG |= I2S_EN;
}
开发者ID:yourskp,项目名称:USB_Audio,代码行数:24,代码来源:I2S.c

示例15: Ramp_LED_SetPriority

/*******************************************************************************
* Function Name: Ramp_LED_SetPriority
********************************************************************************
*
* Summary:
*   Sets the Priority of the Interrupt. 
*
*   Note calling Ramp_LED_Start or Ramp_LED_StartEx will 
*   override any effect this API would have had. This API should only be called
*   after Ramp_LED_Start or Ramp_LED_StartEx has been called. 
*   To set the initial priority for the component, use the Design-Wide Resources
*   Interrupt Editor.
*
*   Note This API has no effect on Non-maskable interrupt NMI).
*
* Parameters:
*   priority: Priority of the interrupt, 0 being the highest priority
*             PSoC 3 and PSoC 5LP: Priority is from 0 to 7.
*             PSoC 4: Priority is from 0 to 3.
*
* Return:
*   None
*
*******************************************************************************/
void Ramp_LED_SetPriority(uint8 priority)
{
	uint8 interruptState;
    uint32 priorityOffset = ((Ramp_LED__INTC_NUMBER % 4u) * 8u) + 6u;
    
	interruptState = CyEnterCriticalSection();
    *Ramp_LED_INTC_PRIOR = (*Ramp_LED_INTC_PRIOR & (uint32)(~Ramp_LED__INTC_PRIOR_MASK)) |
                                    ((uint32)priority << priorityOffset);
	CyExitCriticalSection(interruptState);
}
开发者ID:f16falcona46,项目名称:PSoC,代码行数:34,代码来源:Ramp_LED.c


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