armOS  0.1.0
Minimal ARM Operating System for the Raspberry Pi - Documentation generated for Pi 4.
exceptions

Code for handling exceptions/interupts. More...

Files

file  irq.c
 Implementation of interrupt handling functions.
 
file  irq.h
 Definition of armv6 interrupt initialization functions.
 
file  irq.h
 Definition of armv8-a interrupt initialization functions.
 
file  irq.h
 Definition of interrupt handling functions.
 

Functions

void irq_vector_init ()
 
void irq_enable ()
 
void irq_disable ()
 
void enable_interrupt_controller ()
 
void show_invalid_entry_message (int type, unsigned long esr, unsigned long address)
 
void handle_irq ()
 
void handle_timer_1_irq ()
 
void handle_timer_3_irq ()
 
void handle_uart_irq ()
 

Detailed Description

Code for handling exceptions/interupts.

Function Documentation

◆ enable_interrupt_controller()

void enable_interrupt_controller ( )

Enables System Timer and UART interrupts.

See also
peripherals/irq.h

◆ handle_irq()

void handle_irq ( )

Exception handler for all IRQs.

Reads from the interrupt pending registers ( IRQ0_PENDING_0 or IRQ0_PENDING_1), and if a valid value is found we have an interrupt. Checks each bit for the interrupts we have enabled, and if it is set, it removes the bit we handled and calls the corresponding handler.

See also
handle_timer_1_irq(), handle_timer_3_irq(), handle_uart_irq()

◆ handle_timer_1_irq()

void handle_timer_1_irq ( )

Exception handler for System Timer 1.

Gets called when an interrupt is triggered from the System Timer 1.

  • Updates current counter value, for next interrupt with the same interval ( interval_1).
  • Set this value to be compared for System Timer 1 Interrupt.
  • Acknowledges the interrupt by writing 1 to the TIMER_CS register
  • Calls led_on_ms(), to pulse the LED for a small interval.
See also
peripherals/timer.h, handle_irq(), led_on_ms()

◆ handle_timer_3_irq()

void handle_timer_3_irq ( )

Exception handler for System Timer 3.

Gets called when an interrupt is triggered from the System Timer 3.

  • Updates current counter value, for next interrupt with the same interval ( interval_3).
  • Set this value to be compared for System Timer 3 Interrupt.
  • Acknowledges the interrupt by writing 1 to the TIMER_CS register
  • Calls timer_tick() for the scheduler.
See also
peripherals/timer.h, handle_irq(), timer_tick()

◆ handle_uart_irq()

void handle_uart_irq ( )

Exception handler for the UART (Asynchronous read from the serial input).

Gets called when an interrupt is triggered from the UART. While the receiver holds a valid bit, reads the byte and echoes back.

Note
If a Carriage Return (\r) char is found, it appends a New Line (\n) char.
See also
handle_irq(), uart_getc(), uart_putc()

◆ irq_disable()

void irq_disable ( )

Disables (Masks) interrupts.

◆ irq_enable()

void irq_enable ( )

Enables (Unmasks) interrupts.

◆ irq_vector_init()

void irq_vector_init ( )

Initializes interrupts, by moving the exception vector at address 0x0.

◆ show_invalid_entry_message()

void show_invalid_entry_message ( int  type,
unsigned long  esr,
unsigned long  address 
)

Prints information about the error, on an invalid exception.

Parameters
typeType of exception, defined in include/armv8-a/entry.h
esrException Syndrome Register (ESR), contains detailed information about what causes an exception.
addressThe address of the instruction that had been executed when the exception was generated.
See also
include/armv8-a/entry.h