/* * Disable Timer Interrupts */ void disableTmrInt() { //Enable Interrupts for Timer XScuGic_Disable(&Intc, INTC_TMR_INT_ID); //Enable Timer Interrupts XTmrCtr_DisableIntr(tmrCtr.BaseAddress, 0); }
void DeviceDriverHandler(void *CallbackRef) { XScuGic_Disable(&InterruptController, INTC_DEVICE_INT_ID); /* * Indicate the interrupt has been processed using a shared variable */ result = MYMULTIPLIER_mReadReg(XPAR_MYMULTIPLIER_0_S00_AXI_BASEADDR, MYMULTIPLIER_S00_AXI_SLV_REG3_OFFSET); InterruptProcessed = TRUE; }
static void DisableIntrSystem(XScuGic *IntcInstancePtr, u32 IntrId) { /* Disconnect the interrupt */ XScuGic_Disable(IntcInstancePtr, IntrId); XScuGic_Disconnect(IntcInstancePtr, IntrId); }
/** * * This function disables the interrupts that occur for the Spi device. * * @param IntcInstancePtr is the pointer to an INTC instance. * @param SpiIntrId is the interrupt Id for an SPI device. * * @return None. * * @note None. * ******************************************************************************/ static void SpiDisableIntrSystem(XScuGic *IntcInstancePtr, u16 SpiIntrId) { /* * Disable the interrupt for the SPI device. */ XScuGic_Disable(IntcInstancePtr, SpiIntrId); /* * Disconnect and disable the interrupt for the Spi device. */ XScuGic_Disconnect(IntcInstancePtr, SpiIntrId); }
/** * * This function disables the interrupts that occur for the EmacLite device. * * @param IntcInstancePtr is the pointer to the instance of the INTC * component. * @param EmacLiteIntrId is the interrupt ID and is typically * XPAR_<INTC_instance>_<EMACLITE_instance>_VEC_ID * value from xparameters.h. * * @return None. * * @note None. * ******************************************************************************/ static void EmacLiteDisableIntrSystem(INTC *IntcInstancePtr, u16 EmacLiteIntrId) { /* * Disconnect and disable the interrupts for the EmacLite device. */ #ifdef XPAR_INTC_0_DEVICE_ID XIntc_Disconnect(IntcInstancePtr, EmacLiteIntrId); #else XScuGic_Disable(IntcInstancePtr, EmacLiteIntrId); XScuGic_Disconnect(IntcInstancePtr, EmacLiteIntrId); #endif }
/** * * This function disables the interrupts for the Timer. * * @param IntcInstancePtr is a reference to the Interrupt Controller * driver Instance. * @param IntrId is XPAR_<INTC_instance>_<Timer_instance>_VEC_ID * value from xparameters.h. * * @return None. * * @note None. * ******************************************************************************/ void TmrCtrDisableIntr(INTC* IntcInstancePtr, u16 IntrId) { /* * Disable the interrupt for the timer counter */ #ifdef XPAR_INTC_0_DEVICE_ID XIntc_Disable(IntcInstancePtr, IntrId); #else /* Disconnect the interrupt */ XScuGic_Disable(IntcInstancePtr, IntrId); XScuGic_Disconnect(IntcInstancePtr, IntrId); #endif return; }
int zed_ali3_controller_demo_touch_process(zed_ali3_controller_demo_t *pDemo) { int result = 0; interface_graphic_t graphic; touch_calibration_matrix_t touch_calibration_matrix; touch_location_t touch_location_raw; touch_location_t touch_location_cal; // Set the calibration matrix with the demo instance coefficients. touch_calibration_matrix.An = pDemo->calibration_An; touch_calibration_matrix.Bn = pDemo->calibration_Bn; touch_calibration_matrix.Cn = pDemo->calibration_Cn; touch_calibration_matrix.Dn = pDemo->calibration_Dn; touch_calibration_matrix.En = pDemo->calibration_En; touch_calibration_matrix.Fn = pDemo->calibration_Fn; touch_calibration_matrix.divisor = pDemo->calibration_divisor; /* * Check to see if any touch events have been registered. This call * needs to be thread safe with respect to the touch controller * interrupts. Disable interrupts before the call and re-enable * after the call to process the touch event. */ XScuGic_Disable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); // This call must be thread safe in order to maintain queue stability. result = tmg120_process_touch_event(pDemo); // Re-enable touch interrupts. XScuGic_Enable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); if (result == 1) { // Update the touch location with the most recent raw touch position. touch_location_raw.position_x = pDemo->touch_posx_raw; touch_location_raw.position_y = pDemo->touch_posy_raw; tmg120_translate_location(pDemo, &touch_location_raw, &touch_location_cal, &touch_calibration_matrix); // Update the calibrated touch location with translated location. pDemo->touch_posx_cal = touch_location_cal.position_x; pDemo->touch_posy_cal = touch_location_cal.position_y; /* * A little maintenance is needed on the translated points. Due to * the integer math involved, if a point is represented beyond the * display dimensions, it should get mapped to 0 because it is an * overflow calculation. */ if (pDemo->touch_posx_cal > pDemo->ali3_width) { pDemo->touch_posx_cal = 0; } if (pDemo->touch_posy_cal > pDemo->ali3_height) { pDemo->touch_posy_cal = 0; } if (pDemo->bVerbose > 0) { xil_printf("Processed PCAP Event:Raw PosX=0x%04X,Raw PosY=0x%04X,Cal PosX=%3d,Cal PosY=%3d\n\r", pDemo->touch_posx_raw, pDemo->touch_posy_raw, pDemo->touch_posx_cal, pDemo->touch_posy_cal ); } // Check to see how the touch event should be handled. if (pDemo->mode == draw) { // Draw the touch location indicator 'dot' to the display. if ((pDemo->touch_posx_cal > avnet_draw_pen_black_width) && (pDemo->touch_posx_cal < (pDemo->ali3_width - avnet_draw_pen_black_width))) { graphic.location_x = pDemo->touch_posx_cal - (avnet_draw_pen_black_width / 2); // Centered on graphic } else if (pDemo->touch_posx_cal >= (pDemo->ali3_width - avnet_draw_pen_black_width)) { graphic.location_x = pDemo->ali3_width - avnet_draw_pen_black_width; } else { graphic.location_x = avnet_draw_pen_black_width; } if ((pDemo->touch_posy_cal > avnet_draw_pen_black_height) && (pDemo->touch_posy_cal < (pDemo->ali3_height - avnet_draw_pen_black_height))) { graphic.location_y = pDemo->touch_posy_cal - (avnet_draw_pen_black_height / 2); // Centered on graphic } else if (pDemo->touch_posy_cal >= (pDemo->ali3_height - avnet_draw_pen_black_height)) { graphic.location_y = pDemo->ali3_height - avnet_draw_pen_black_height; } else { graphic.location_y = avnet_draw_pen_black_height; } graphic.size_x = avnet_draw_pen_black_width; graphic.size_y = avnet_draw_pen_black_height; graphic.default_image_data = avnet_draw_pen_black; draw_image_data(pDemo, &graphic); // Wait for DMA to synchronize. Xil_DCacheFlush(); } else if ((pDemo->mode == control) && (pDemo->touch_pen_down_transition == 1)) { /* * Decode touch location against control positions. */ if ((pDemo->touch_posx_cal >= LED0_POSITION_X) && (pDemo->touch_posx_cal <= (LED0_POSITION_X + avnet_control_led_off_width)) && (pDemo->touch_posy_cal >= LED0_POSITION_Y) && (pDemo->touch_posy_cal <= (LED0_POSITION_Y + avnet_control_led_off_height))) { // Touch event on LED0 control. if (pDemo->bVerbose) { xil_printf("Registered touch on LED 0 control.\n\r"); } if (pDemo->led0_state == 0) { // Old state was off, so new state should be on. zed_ali3_controller_demo_led(pDemo, 0, 1); } else { // Old state was on, so new state should be off. zed_ali3_controller_demo_led(pDemo, 0, 0); } } if ((pDemo->touch_posx_cal >= LED1_POSITION_X) && (pDemo->touch_posx_cal <= (LED1_POSITION_X + avnet_control_led_off_width)) && (pDemo->touch_posy_cal >= LED1_POSITION_Y) && (pDemo->touch_posy_cal <= (LED1_POSITION_Y + avnet_control_led_off_height))) { // Touch event on LED1 control. if (pDemo->bVerbose) { xil_printf("Registered touch on LED 1 control.\n\r"); } if (pDemo->led1_state == 0) { // Old state was off, so new state should be on. zed_ali3_controller_demo_led(pDemo, 1, 1); } else { // Old state was on, so new state should be off. zed_ali3_controller_demo_led(pDemo, 1, 0); } } if ((pDemo->touch_posx_cal >= LED2_POSITION_X) && (pDemo->touch_posx_cal <= (LED2_POSITION_X + avnet_control_led_off_width)) && (pDemo->touch_posy_cal >= LED2_POSITION_Y) && (pDemo->touch_posy_cal <= (LED2_POSITION_Y + avnet_control_led_off_height))) { // Touch event on LED2 control. if (pDemo->bVerbose) { xil_printf("Registered touch on LED 2 control.\n\r"); } if (pDemo->led2_state == 0) { // Old state was off, so new state should be on. zed_ali3_controller_demo_led(pDemo, 2, 1); } else { // Old state was on, so new state should be off. zed_ali3_controller_demo_led(pDemo, 2, 0); } } if ((pDemo->touch_posx_cal >= LED3_POSITION_X) && (pDemo->touch_posx_cal <= (LED3_POSITION_X + avnet_control_led_off_width)) && (pDemo->touch_posy_cal >= LED3_POSITION_Y) && (pDemo->touch_posy_cal <= (LED3_POSITION_Y + avnet_control_led_off_height))) { // Touch event on LED3 control. if (pDemo->bVerbose) { xil_printf("Registered touch on LED 3 control.\n\r"); } if (pDemo->led3_state == 0) { // Old state was off, so new state should be on. zed_ali3_controller_demo_led(pDemo, 3, 1); } else { // Old state was on, so new state should be off. zed_ali3_controller_demo_led(pDemo, 3, 0); } } } } return 0; }
int zed_ali3_controller_demo_touch_calibrate(zed_ali3_controller_demo_t *pDemo) { int result = 0; interface_graphic_t graphic; touch_calibration_data_t touch_calibration_data; touch_calibration_matrix_t touch_calibration_matrix; /* This routine must collect three sample points based upon the operators * actual touch input. To do this, three targets are drawn on the display * while we await touch input for each target location. The targets should * be widely separated but also need to avoid the areas near the edges * where touch sensor output tends to become non-linear. */ xil_printf("\n\r"); xil_printf("-----------------------------------------------------------------------\n\r"); xil_printf("-- Zed Display Kit --\n\r"); xil_printf("-- Starting Calibration Procedure, Touch Targets Shown On Display --\n\r"); xil_printf("-----------------------------------------------------------------------\n\r"); xil_printf("\n\r"); // Set first target location to 25% display width and 50% display height. touch_calibration_data.reference_touch_position1.position_x = (pDemo->ali3_width / 4); touch_calibration_data.reference_touch_position1.position_y = (pDemo->ali3_height / 2); // Set second target location to 50% display width and 25% display height. touch_calibration_data.reference_touch_position2.position_x = (pDemo->ali3_width / 2); touch_calibration_data.reference_touch_position2.position_y = (pDemo->ali3_height / 4); // Set third target location to 75% display width and 75% display height. touch_calibration_data.reference_touch_position3.position_x = (pDemo->ali3_width / 4) * 3; touch_calibration_data.reference_touch_position3.position_y = (pDemo->ali3_height / 4) * 3; // Blank the screen, draw_blank_screen(pDemo, COLOR_BLACK); // Wait for DMA to synchronize. Xil_DCacheFlush(); // Draw the first target to the display. graphic.location_x = touch_calibration_data.reference_touch_position1.position_x - (avnet_touch_target_width / 2); // Centered on graphic graphic.location_y = touch_calibration_data.reference_touch_position1.position_y - (avnet_touch_target_height / 2); // Centered on graphic graphic.size_x = avnet_touch_target_width; graphic.size_y = avnet_touch_target_height; graphic.default_image_data = avnet_touch_target; draw_image_data(pDemo, &graphic); // Wait for DMA to synchronize. Xil_DCacheFlush(); /* * Flush any registered touch events from the queue. This call must * be threadsafe since it operates on the queue itself. */ XScuGic_Disable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); // Flush any existing touch events. tmg120_flush_touch_events(pDemo); // Re-enable touch interrupts. XScuGic_Enable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); result = 0; while (result != 1) { /* * Check to see if any touch events have been registered. This call * needs to be thread safe with respect to the touch controller * interrupts. Disable interrupts before the call and re-enable * after the call to process the touch event. */ XScuGic_Disable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); // This call must be thread safe in order to maintain queue stability. result = tmg120_process_touch_event(pDemo); // Re-enable touch interrupts. XScuGic_Enable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); millisleep(100); } xil_printf("Processed PCAP Calibration Event: PosX=0x%04X, PoxY=0x%04X\n\r", pDemo->touch_posx_raw, pDemo->touch_posy_raw ); // Capture the sample information for the calibration matrix. touch_calibration_data.raw_touch_position1.position_x = pDemo->touch_posx_raw; touch_calibration_data.raw_touch_position1.position_y = pDemo->touch_posy_raw; // Blank the screen, draw_blank_screen(pDemo, COLOR_BLACK); // Wait for DMA to synchronize. Xil_DCacheFlush(); // Sleep while the display is updated. sleep(1); // Draw the second target to the display. graphic.location_x = touch_calibration_data.reference_touch_position2.position_x - (avnet_touch_target_width / 2); // Centered on graphic graphic.location_y = touch_calibration_data.reference_touch_position2.position_y - (avnet_touch_target_height / 2); // Centered on graphic graphic.size_x = avnet_touch_target_width; graphic.size_y = avnet_touch_target_height; graphic.default_image_data = avnet_touch_target; draw_image_data(pDemo, &graphic); // Wait for DMA to synchronize. Xil_DCacheFlush(); /* * Flush any registered touch events from the queue. This call must * be threadsafe since it operates on the queue itself. */ XScuGic_Disable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); // Flush any existing touch events. tmg120_flush_touch_events(pDemo); // Re-enable touch interrupts. XScuGic_Enable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); result = 0; while (result != 1) { /* * Check to see if any touch events have been registered. This call * needs to be thread safe with respect to the touch controller * interrupts. Disable interrupts before the call and re-enable * after the call to process the touch event. */ XScuGic_Disable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); // This call must be thread safe in order to maintain queue stability. result = tmg120_process_touch_event(pDemo); // Re-enable touch interrupts. XScuGic_Enable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); millisleep(100); } xil_printf("Processed PCAP Calibration Event: PosX=0x%04X, PoxY=0x%04X\n\r", pDemo->touch_posx_raw, pDemo->touch_posy_raw ); // Capture the sample information for the calibration matrix. touch_calibration_data.raw_touch_position2.position_x = pDemo->touch_posx_raw; touch_calibration_data.raw_touch_position2.position_y = pDemo->touch_posy_raw; // Blank the screen, draw_blank_screen(pDemo, COLOR_BLACK); // Wait for DMA to synchronize. Xil_DCacheFlush(); // Sleep while the display is updated. sleep(1); // Draw the third target to the display. graphic.location_x = touch_calibration_data.reference_touch_position3.position_x - (avnet_touch_target_width / 2); // Centered on graphic graphic.location_y = touch_calibration_data.reference_touch_position3.position_y - (avnet_touch_target_height / 2); // Centered on graphic graphic.size_x = avnet_touch_target_width; graphic.size_y = avnet_touch_target_height; graphic.default_image_data = avnet_touch_target; draw_image_data(pDemo, &graphic); // Wait for DMA to synchronize. Xil_DCacheFlush(); /* * Flush any registered touch events from the queue. This call must * be threadsafe since it operates on the queue itself. */ XScuGic_Disable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); // Flush any existing touch events. tmg120_flush_touch_events(pDemo); // Re-enable touch interrupts. XScuGic_Enable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); result = 0; while (result != 1) { /* * Check to see if any touch events have been registered. This call * needs to be thread safe with respect to the touch controller * interrupts. Disable interrupts before the call and re-enable * after the call to process the touch event. */ XScuGic_Disable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); // This call must be thread safe in order to maintain queue stability. result = tmg120_process_touch_event(pDemo); // Re-enable touch interrupts. XScuGic_Enable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); millisleep(100); } xil_printf("Processed PCAP Calibration Event: PosX=0x%04X, PoxY=0x%04X\n\r", pDemo->touch_posx_raw, pDemo->touch_posy_raw ); // Capture the sample information for the calibration matrix. touch_calibration_data.raw_touch_position3.position_x = pDemo->touch_posx_raw; touch_calibration_data.raw_touch_position3.position_y = pDemo->touch_posy_raw; // Blank the screen, draw_blank_screen(pDemo, COLOR_BLACK); // Wait for DMA to synchronize. Xil_DCacheFlush(); /* * Calculate the calibration matrix coefficients based upon the three * touch points that were just captured. */ result = tmg120_get_calibration_matrix(pDemo, &touch_calibration_data, &touch_calibration_matrix); // Update the demo instance with the new calibration coefficients. pDemo->calibration_An = touch_calibration_matrix.An; pDemo->calibration_Bn = touch_calibration_matrix.Bn; pDemo->calibration_Cn = touch_calibration_matrix.Cn; pDemo->calibration_Dn = touch_calibration_matrix.Dn; pDemo->calibration_En = touch_calibration_matrix.En; pDemo->calibration_Fn = touch_calibration_matrix.Fn; pDemo->calibration_divisor = touch_calibration_matrix.divisor; /* * Store the updated calibration matrix coefficients to SPI flash so * that they are persisted between power cycles. */ result = qspi_flash_store_calibration_data(pDemo); if (result != 0) { xil_printf("Calibration not written to Flash due to error.\n\r"); } return result; }
/****************************************************************************** * @brief Disable Interrupts * * @param intrNr - interrupt number * * @return None. ******************************************************************************/ void Ps7IntrDisable(int intrNr) { // Disable interrupts in order to use normal polling XScuGic_Disable(&IntcInstance, intrNr); }
void disconnect_intc_irq() { XScuGic_Disable(&m_gic, PL_INTC_IRQ_ID); XScuGic_Disconnect(&m_gic, PL_INTC_IRQ_ID); }
void disconnect_timer_irq() { XScuGic_Disable(&m_gic, TIMER_INTERRUPT); XScuGic_Disconnect(&m_gic, TIMER_INTERRUPT); }