本文整理匯總了C++中Enable_global_interrupt函數的典型用法代碼示例。如果您正苦於以下問題:C++ Enable_global_interrupt函數的具體用法?C++ Enable_global_interrupt怎麽用?C++ Enable_global_interrupt使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Enable_global_interrupt函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: twi_slave_init
int twi_slave_init(volatile avr32_twi_t *twi, const twi_options_t *opt, const twi_slave_fct_t *slave_fct)
{
bool global_interrupt_enabled = Is_global_interrupt_enabled();
// Set pointer to TWIM instance for IT
twi_inst = twi;
// Disable TWI interrupts
if (global_interrupt_enabled) Disable_global_interrupt();
twi->idr = ~0UL;
twi->sr;
// Reset TWI
twi->cr = AVR32_TWI_CR_SWRST_MASK;
if (global_interrupt_enabled) Enable_global_interrupt();
// Dummy read in SR
twi->sr;
// Disable all interrupts
Disable_global_interrupt();
// Register TWI handler on level 2
INTC_register_interrupt( &twi_slave_interrupt_handler, AVR32_TWI_IRQ, AVR32_INTC_INT1);
// Enable all interrupts
Enable_global_interrupt();
// Set slave address
twi->smr = (opt->chip << AVR32_TWI_SMR_SADR_OFFSET);
// Disable master transfer
twi->cr = AVR32_TWI_CR_MSDIS_MASK;
// Enable slave
twi->cr = AVR32_TWI_CR_SVEN_MASK;
// get a pointer to applicative routines
twi_slave_fct = *slave_fct;
// Slave Access Interrupt Enable
twi_it_mask = AVR32_TWI_IER_SVACC_MASK;
twi->ier = twi_it_mask;
// Everything went ok
return TWI_SUCCESS;
}
示例2: boardsupport_init
void boardsupport_init(void)
{
central_data_t *central_data;
irq_initialize_vectors();
cpu_irq_enable();
Disable_global_interrupt();
sysclk_init();
//delay_init(sysclk_get_cpu_hz());
INTC_init_interrupts();
central_data=central_data_get_pointer_to_struct();
#ifdef TELEMETRY_USE_UART
uart_int_set_usart_conf(TELEMETRY_UART_INDEX, asv_debug_uart_conf());
//uart configuration
uart_int_init(TELEMETRY_UART_INDEX);
uart_int_register_write_stream(uart_int_get_uart_handle(TELEMETRY_UART_INDEX), &(central_data->wired_out_stream));
// Registering streams
buffer_make_buffered_stream_lossy(&(wired_in_buffer), &(central_data->wired_in_stream));
uart_int_register_read_stream(uart_int_get_uart_handle(TELEMETRY_UART_INDEX), &(central_data->wired_in_stream));
central_data->debug_in_stream=¢ral_data->wired_in_stream;
central_data->debug_out_stream=¢ral_data->wired_out_stream;
#endif
central_data_init();
Enable_global_interrupt();
}
示例3: DFU_UsbStop
void DFU_UsbStop (void)
{
Disable_global_interrupt();
Usb_disable();
(void)Is_usb_enabled();
Enable_global_interrupt();
}
示例4: avr32EthEnableIrq
void avr32EthEnableIrq(NetInterface *interface)
{
//Enable Ethernet MAC interrupts
Enable_global_interrupt();
//Enable Ethernet PHY interrupts
interface->phyDriver->enableIrq(interface);
}
示例5: encoder_init_all
void encoder_init_all ()
{
uint8_t isr_counter = 0;
Disable_global_interrupt();
/* Initialization loop, this loop inits all required IO and interrupts
* for EIC module and pins used to read encoders. */
while(isr_counter < ENCODER_COUNT)
{
/* Init io for interrupt line and state poll line. */
gpio_enable_gpio_pin(encoder_handle[isr_counter].a_pin);
gpio_enable_gpio_pin(encoder_handle[isr_counter].b_pin);
/* Set pullup for both gpio channels. */
gpio_enable_pin_pull_up(encoder_handle[isr_counter].a_pin);
gpio_enable_pin_pull_up(encoder_handle[isr_counter].b_pin);
/* Init interrupt from encoder A line */
gpio_enable_pin_interrupt(encoder_handle[isr_counter].a_pin, GPIO_FALLING_EDGE);
gpio_disable_pin_interrupt(encoder_handle[isr_counter].b_pin);
INTC_register_interrupt(&encoders_and_buttons_isr,
AVR32_GPIO_IRQ_0 + (encoder_handle[isr_counter].a_pin/8),
AVR32_INTC_INT0);
isr_counter++;
}
Enable_global_interrupt();
}
示例6: tc_configure_interrupts
int tc_configure_interrupts(volatile avr32_tc_t *tc, unsigned int channel, const tc_interrupt_t *bitfield)
{
bool global_interrupt_enabled = Is_global_interrupt_enabled();
// Check for valid input.
if (channel >= TC_NUMBER_OF_CHANNELS)
return TC_INVALID_ARGUMENT;
// Enable the appropriate interrupts.
tc->channel[channel].ier = bitfield->etrgs << AVR32_TC_ETRGS_OFFSET |
bitfield->ldrbs << AVR32_TC_LDRBS_OFFSET |
bitfield->ldras << AVR32_TC_LDRAS_OFFSET |
bitfield->cpcs << AVR32_TC_CPCS_OFFSET |
bitfield->cpbs << AVR32_TC_CPBS_OFFSET |
bitfield->cpas << AVR32_TC_CPAS_OFFSET |
bitfield->lovrs << AVR32_TC_LOVRS_OFFSET |
bitfield->covfs << AVR32_TC_COVFS_OFFSET;
// Disable the appropriate interrupts.
if (global_interrupt_enabled) Disable_global_interrupt();
tc->channel[channel].idr = (~bitfield->etrgs & 1) << AVR32_TC_ETRGS_OFFSET |
(~bitfield->ldrbs & 1) << AVR32_TC_LDRBS_OFFSET |
(~bitfield->ldras & 1) << AVR32_TC_LDRAS_OFFSET |
(~bitfield->cpcs & 1) << AVR32_TC_CPCS_OFFSET |
(~bitfield->cpbs & 1) << AVR32_TC_CPBS_OFFSET |
(~bitfield->cpas & 1) << AVR32_TC_CPAS_OFFSET |
(~bitfield->lovrs & 1) << AVR32_TC_LOVRS_OFFSET |
(~bitfield->covfs & 1) << AVR32_TC_COVFS_OFFSET;
tc->channel[channel].sr;
if (global_interrupt_enabled) Enable_global_interrupt();
return 0;
}
示例7: Actividad2
void Actividad2(void){
pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP); //osc0 a 12Mhz
center=0;
//Interrupciones
Disable_global_interrupt();
INTC_init_interrupts();
INTC_register_interrupt(&tecla_lrc_isr, 71, 0);
INTC_register_interrupt(&tecla_lrc_isr, 70,0);
gpio_enable_pin_interrupt(QT1081_TOUCH_SENSOR_LEFT,GPIO_RISING_EDGE);
gpio_enable_pin_interrupt(QT1081_TOUCH_SENSOR_RIGHT,GPIO_RISING_EDGE);
gpio_enable_pin_interrupt(QT1081_TOUCH_SENSOR_ENTER,GPIO_RISING_EDGE);
gpio_enable_pin_interrupt(QT1081_TOUCH_SENSOR_UP,GPIO_RISING_EDGE);
gpio_enable_pin_interrupt(QT1081_TOUCH_SENSOR_DOWN,GPIO_RISING_EDGE);
Enable_global_interrupt();
while (1){}
}
示例8: at42qt1060_register_eic_int
/** \brief Register an external interrupt handler for the touch event.
*
*/
void at42qt1060_register_eic_int(void (*touch_detect_callback)(void))
{
eic_options_t eic_options[1];
at42qt1060.touch_detect_callback = touch_detect_callback;
gpio_enable_module_pin(AT42QT1060_DETECT_PIN, AT42QT1060_EIC_EXTINT_FUNCTION);
Disable_global_interrupt();
INTC_register_interrupt(&at42qt1060_detect_eic_int_handler, AT42QT1060_EIC_EXTINT_IRQ,
AT42QT1060_EIC_EXTINT_LEVEL);
eic_options[0].eic_mode = EIC_MODE_EDGE_TRIGGERED;
eic_options[0].eic_level = EIC_EDGE_FALLING_EDGE;
eic_options[0].eic_async = EIC_SYNCH_MODE;
eic_options[0].eic_line = AT42QT1060_EIC_LINE;
eic_init(&AVR32_EIC, &eic_options[0], 1);
eic_enable_lines(&AVR32_EIC, (1 << eic_options[0].eic_line));
eic_enable_interrupt_lines(&AVR32_EIC, (1 << eic_options[0].eic_line));
Enable_global_interrupt();
return;
}
示例9: sio_putstr
void sio_putstr(char *cptr)
{
uint8_t byteSend = 0;
Disable_global_interrupt();
if( checkIfFifoEmpty & (!checkIfDataToSend) )
{ // nothing in queue data can be transmited directly
// to uart FIFO
resetFifo;
while( (*cptr!='\0') & (byteSend < UART_TX_FIFO_SIZE) )
{
UART_SendByte(SERIAL_USART, (*cptr++) );
byteSend++;
}
}
//FIFO full save data in buffer
while(*cptr)
{
uartDataToSend.txbuf[uartDataToSend.lastPtr++] = (*cptr++);
byteSend = 0xff;
}
if(byteSend == 0xff)
{
uartDataToSend.txbuf[uartDataToSend.lastPtr] = '\0';
}
Enable_global_interrupt();
return;
}
示例10: b_pushb3_init
/*!
* \brief Init the push button 3 sensor.
*
* \return true upon success, false if error.
*/
bool b_pushb3_init ( void )
{
portCHAR token[6];
// Get the xCFGMutex.
if( pdTRUE == x_supervisor_SemaphoreTake( xCFGMutex, 20 ) )
{
// get the field
if (config_file_get_value(SENSOR_PB3_CONFIG_FILE, "alarm" , token) >= 0)
{
// update value
if (!strcmp(token, "on"))
{
bAlarm3 = pdTRUE;
}
}
// Release the xCFGMutex.
x_supervisor_SemaphoreGive( xCFGMutex );
}
/* configure push button to produce IT on input change */
gpio_enable_pin_interrupt(PB3_POSITION , GPIO_PIN_CHANGE);
/* Disable all interrupts */
Disable_global_interrupt();
/* register push button 3 handler on level 3 */
INTC_register_interrupt( (__int_handler)&vpushb_ISR, AVR32_GPIO_IRQ_0 + (PB3_POSITION/8), AVR32_INTC_INT3);
/* Enable all interrupts */
Enable_global_interrupt();
return (true);
}
示例11: rtouch_prepare_detect
/** \brief Prepare the rtouch detect function.
*
* A touch can be detected by setting the Y lines (or X lines) as inputs and
* enabling the internal pull-ups for these pins. The other lines, X in this
* case are connected to GND. By a touch the Y lines will be pulled low and an
* interrupt can be triggered on a low level detect.
*
* This function does the registering of the interrupt handler for the touch
* detect. Currently we use a GPIO interrupt, but here it is only possible to
* trigger on edges but actually we should trigger on a low level. Anyway this
* should work too.
* Here we use the YL line as source input for the edge detection but it is
* also possible to use YH.
*/
static void inline rtouch_prepare_detect(void)
{
Disable_global_interrupt();
INTC_register_interrupt(&rtouch_detect_int_handler,
AVR32_GPIO_IRQ_0 + rtouch_gpio_ymap[0].pin / 8, 0);
Enable_global_interrupt();
}
示例12: BUFFERED_SIO_SendHandler
void BUFFERED_SIO_SendHandler (void)
{
// Something to send ?
if (BUFFERED_SIO_TxBuffer_StartPointer == BUFFERED_SIO_TxBuffer_EndPointer)
{
return;
}
BUFFERED_SIO_TxBuffer_StartPointer++;
// Rollover ?
if (BUFFERED_SIO_TX_BUFFER_SIZE <= BUFFERED_SIO_TxBuffer_StartPointer)
{
BUFFERED_SIO_TxBuffer_StartPointer = 0;
}
// Send char
usart_putchar (BUFFERED_SIO_USART, BUFFERED_SIO_TxBuffer[BUFFERED_SIO_TxBuffer_StartPointer]);
// Enable USART Tx interrupt for transmitting all chars
Disable_global_interrupt ();
BUFFERED_SIO_USART->IER.txempty = 1;
Enable_global_interrupt ();
}
示例13: mdma_configure_interrupts
void mdma_configure_interrupts(volatile avr32_mdma_t *mdma, const mdma_interrupt_t *bitfield)
{
bool global_interrupt_enabled = Is_global_interrupt_enabled();
// Enable the appropriate interrupts.
mdma->ier = bitfield->ch0c << AVR32_MDMA_IER_CH0C_OFFSET |
bitfield->ch1c << AVR32_MDMA_IER_CH1C_OFFSET |
bitfield->ch2c << AVR32_MDMA_IER_CH2C_OFFSET |
bitfield->ch3c << AVR32_MDMA_IER_CH3C_OFFSET |
bitfield->berr0 << AVR32_MDMA_IER_BERR0_OFFSET |
bitfield->berr1 << AVR32_MDMA_IER_BERR1_OFFSET |
bitfield->berr2 << AVR32_MDMA_IER_BERR2_OFFSET |
bitfield->berr3 << AVR32_MDMA_IER_BERR3_OFFSET ;
// Disable the appropriate interrupts.
if (global_interrupt_enabled) Disable_global_interrupt();
mdma->idr = (~bitfield->ch0c & 1) << AVR32_MDMA_IDR_CH0C_OFFSET |
(~bitfield->ch1c & 1) << AVR32_MDMA_IDR_CH1C_OFFSET |
(~bitfield->ch2c & 1) << AVR32_MDMA_IDR_CH2C_OFFSET |
(~bitfield->ch3c & 1) << AVR32_MDMA_IDR_CH3C_OFFSET |
(~bitfield->berr0 & 1) << AVR32_MDMA_IDR_BERR0_OFFSET |
(~bitfield->berr1 & 1) << AVR32_MDMA_IDR_BERR1_OFFSET |
(~bitfield->berr2 & 1) << AVR32_MDMA_IDR_BERR2_OFFSET |
(~bitfield->berr3 & 1) << AVR32_MDMA_IDR_BERR3_OFFSET ;
if (global_interrupt_enabled) Enable_global_interrupt();
}
示例14: BUFFERED_SIO_WriteString
u8 BUFFERED_SIO_WriteString (u16 Len, u8 * String_pu8)
{
u16 Value;
// Save end pointer
Value = BUFFERED_SIO_TxBuffer_EndPointer;
Disable_global_interrupt ();
// For each byte
while (0 < Len)
{
Value++;
// End of buffer ?
if (BUFFERED_SIO_TX_BUFFER_SIZE <= Value)
{
// Set pointer to start of buffer
Value = 0;
}
// Buffer full ?
if (Value == BUFFERED_SIO_TxBuffer_StartPointer)
{
// Abort sending
Enable_global_interrupt ();
return (FALSE);
}
// Write byte into buffer
BUFFERED_SIO_TxBuffer_EndPointer = Value;
#ifdef STICK_20_SEND_DEBUGINFOS_VIA_HID
BUFFERED_SIO_HID_TxBuffer_EndPointer = Value;
#endif
BUFFERED_SIO_TxBuffer[Value] = *String_pu8;
// Todo ISR Lock start
// Pointers to next byte
String_pu8++;
Len--;
// Todo ISR Lock end
}
Enable_global_interrupt ();
return (TRUE);
}
示例15: isrInternalClok
void isrInternalClok(void){
RTC->MODE0.CTRL.reg &= 0b1111111111111101;//stop timer
Disable_global_interrupt();
//printf("+");
static bool state;
state=stateLed;
timeManage.halfmillis+=VALUE_TIMER;
if(timeManage.halfmillis<(RTC_FREQ/2)){//all 500ms
stateLed=LOW;
}
else{
stateLed=HIGH;
}
if(state!=stateLed){
led = stateLed;
// if(synchroLed!=NULL){
// xSemaphoreGiveFromISR( synchroLed,NULL);
// }
}
timeManage.second+=timeManage.halfmillis/RTC_FREQ;
timeManage.halfmillis=timeManage.halfmillis%RTC_FREQ;
if((valueCor!=0)){
if (timeCorr==0){
timeCorr=timeCorrection;
Clock off;
off.second=(unsigned int )abs(valueCor)/RTC_FREQ;
off.halfmillis=(unsigned int)abs(valueCor)%RTC_FREQ;
if(valueCor<0){
off.sign=false;
}
else{
off.sign=true;
}
//change the time
timeManage=sumClock(timeManage,off);
//change the correction offset
sumOffset=sumClock(sumOffset,off);//ok
}
else{
timeCorr--;
}
sumOffset.second+=sumOffset.halfmillis/RTC_FREQ;
sumOffset.halfmillis=sumOffset.halfmillis%RTC_FREQ;
timeManage.second+=timeManage.halfmillis/RTC_FREQ;
timeManage.halfmillis=timeManage.halfmillis%RTC_FREQ;
}
Enable_global_interrupt();
RTC->MODE0.CTRL.reg |= RTC_MODE0_CTRL_ENABLE; //enable timer
}