Void intEnable: For enabling the interrupt source.
Void intDisbale: for disabling the interrupt source. Void intRegister: for entering the handlers address in the table. Void intUnregister: for removing the handlers address from the table.
Note: By default, the register table is filled with pointer to an internal
handler that loops forever. It is an error for an interrupt to occur when there is not handler registered in the table. Thus the handler must be registered before enabling the register source and the source must be disbled first before unregistering the handlers address from the table.
Void intMasterEnable: for enabling the main processor interrupt.
Void intMasterDisable: for disabling the main processor interrupt Function documentations 1.) void IntDisable(unsigned long ulInterrupt) Parameters: ulInterruptspecifies the interrupt to be disabled. Description: The specified interrupt is disabled in the interrupt controller. Other enables for the interrupt. 2.) void IntEnable(unsigned long ulInterrupt) Parameters: ulInterrupt specifies the interrupt to be enabled. 3.) IntMasterDisable (void) Disables the processor interrupt. Prevents the processor from receiving interrupts. This does not affect the set of interrupts enabled in the interrupt controller; it just gates the single interrupt from the controller to the processor. Returns: Returns true if interrupts were already disabled when the function was called or false 4.) IntMasterEnable Enables the processor interrupt. Description: Allows the processor to respond to interrupts. This does not affect the set of interrupts enabled in the interrupt controller; it just gates the single interrupt from the controller to the processor. Returns true if interrupts were disabled when the function was called or false if they were initially enabled. 5.) IntRegister Registers a function to be called when an interrupt occurs. Prototype: void IntRegister(unsigned long ulInterrupt,void (*pfnHandler)(void)) Description: Assumes PIE is enabled Parameters: ulInterrupt specifies the interrupt in question. pfnHandler is a pointer to the function to be called. 5.) IntUnregister Unregisters the function to be called when an interrupt occurs. Prototype: Void IntUnregister(unsigned long ulInterrupt) Parameters: ulInterrupt specifies the interrupt in question. The following example shows how to use the Interrupt Controller API to register an interrupt handler and enable the interrupt. // // The interrupt handler function. // extern void IntHandler(void); // // Register the interrupt handler function for interrupt 5. // IntRegister(5, IntHandler); // // Enable interrupt 5. // IntEnable(5); // // Enable interrupt 5. // IntMasterEnable(); Program steps InitSysCtrl(); Initialise system control and goes from RAM to FLASH memory which is a non-volatile memory. InitGpio(); Initialise the general purpose input-output function to initial state. DINT; - Clear all interrupts of the PIE vector table (interrupt handler). - Disable the CPU interrupts. InitPieCtrl(); Initialise the PIE control registers to their default state i.e. all interrupts disabled by setting the registers to 0. Maskable vs non-maskable interrupts Maskable: the interrupts whose request can be denied by microprocessor. These can be supressed by software/codes. Usually there are standard interrupt masking for every processor so that it may not be interrupted while performing some crucial task. Maskable interrupts can be ignored using these methods. Non maskable: the interrupts whose request cant be denied by microprocessor. These cant ignored. So, events like critical hardware failure, system reset etc are attached to non maskable interrupt to ensure that there is a way out. E.g Ctrl + Alt + Delete Interrupt flags Why to clear? If interrupts were allowed to occur when you were modifying the table, you wont know if the old or the new handler address was going to be used. What is a flag? In programming, a flag is a predefined bit or a bit sequence that holds a binary value. Typically, a program uses a flag to remember something or to leave a sign for another program. Flag is a variable that is used to indicate one of the many limited states. Ier = interrupt enable register. Ifr = interrupt flag register. If a maskable interrupt is pending, the corresponding IFR bit is 1; otherwise the IFR bit is 0. to identify the pending interrupt, use the PUSH IFR instruction and then test the value on the stack. Use the OR IFR instruction to set IFR bits and use the AND IFR instruction to clear the pending interrupt. When the hardware interrupt is serviced or when an INTR instruction is executed, the corresponding IFR bit is cleared. All pending interrupts are cleared by the AND IFR, #0 instruction or by hardware reset. PIE (peripheral interrupt extension) It multiplexes interrupts from a number of peripherals to a single CPU interrupt. Pie block can support 96 individual interrupts that are grouped into blocks of eight.