forked from GrassLab/osdi2020
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8887f65
commit dbf7458
Showing
3 changed files
with
147 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,98 @@ | ||
#include "irq.h" | ||
|
||
#include "kernel/peripherals/gpio.h" | ||
#include "kernel/peripherals/uart.h" | ||
|
||
#include "irq.h" | ||
#include "timer.h" | ||
|
||
void irq_controller_el1 ( ) | ||
{ | ||
int irq_source = *CORE0_IRQ_SOURCE; | ||
int deal = 0; | ||
int deal = 0; | ||
|
||
if ( irq_source & 0b10 ) | ||
{ | ||
uart_printf("Core Timer Interrupt\n"); | ||
core_timer_reload (); | ||
uart_printf ( "Core Timer Interrupt\n" ); | ||
core_timer_reload ( ); | ||
|
||
deal = 1; | ||
} | ||
|
||
if (irq_source & 0b100000000000 ) | ||
if ( irq_source & 0b100000000000 ) | ||
{ | ||
uart_printf("Local Timer Interrupt\n"); | ||
local_timer_reload (); | ||
uart_printf ( "Local Timer Interrupt\n" ); | ||
local_timer_reload ( ); | ||
|
||
deal = 1; | ||
} | ||
|
||
// GPU IRQ Pending | ||
if ( *GPU_IRQ_PENDING_BASIC & 0x1 << 25 ) | ||
if ( *GPU_IRQ_PENDING_BASIC & 0x1 << 19 ) | ||
{ | ||
char r; | ||
int r; | ||
unsigned int status = *UART_MIS; | ||
|
||
// input from uart | ||
// read some data | ||
if ( *UART_RIS & 0x10 ) | ||
// read some data | ||
if ( status & 0x10 ) | ||
{ | ||
while (*UART_FR & 0x40) | ||
while ( *UART_FR & 0x40 ) | ||
{ | ||
// receive | ||
r = (char)(*UART_DR); | ||
r = (char) ( *UART_DR ); | ||
|
||
uart_push ( READ, r ); | ||
} | ||
*UART_ICR = 0b01 << 4; // Clears the UARTTXINTR interrupt | ||
} | ||
|
||
// output to uart | ||
// write to uart | ||
if ( *UART_RIS & 0x20 ) | ||
*UART_ICR = status; // Clears the UARTTXINTR interrupt | ||
deal = 1; | ||
} | ||
else | ||
{ | ||
while ( ( r = uart_pop ( WRITE ) ) != -1 ) | ||
{ | ||
while (*UART_FR & 0x20) | ||
asm volatile("nop"); | ||
while ( *UART_FR & 0x20 ) | ||
asm volatile( "nop" ); | ||
*UART_DR = r; | ||
} | ||
|
||
*UART_ICR = 0b10 << 4; | ||
*UART_ICR = status; | ||
deal = 1; | ||
} | ||
|
||
// *UART_ICR = 1 << 4; | ||
} | ||
|
||
if ( !deal ) | ||
{ | ||
uart_printf("Some Interrupt Happened. I don't like it\n"); | ||
uart_printf("%x\n", irq_source); | ||
uart_printf ( "Some Interrupt Happened. I don't like it\n" ); | ||
uart_printf ( "%x\n", irq_source ); | ||
} | ||
} | ||
|
||
void irq_controller_el2 ( ) | ||
{ | ||
int irq_source = *CORE0_IRQ_SOURCE; | ||
int deal = 0; | ||
int deal = 0; | ||
|
||
if ( irq_source & 0b10 ) | ||
{ | ||
uart_printf("Core Timer Interrupt\n"); | ||
core_timer_reload (); | ||
uart_printf ( "Core Timer Interrupt\n" ); | ||
core_timer_reload ( ); | ||
|
||
deal = 1; | ||
} | ||
if (irq_source & 0b100000000000 ) | ||
|
||
if ( irq_source & 0b100000000000 ) | ||
{ | ||
uart_printf("Local Timer Interrupt\n"); | ||
local_timer_reload (); | ||
uart_printf ( "Local Timer Interrupt\n" ); | ||
local_timer_reload ( ); | ||
|
||
deal = 1; | ||
} | ||
|
||
if ( !deal ) | ||
{ | ||
uart_printf("Some Interrupt Happened. I don't like it\n"); | ||
uart_printf("%x\n", irq_source); | ||
uart_printf ( "Some Interrupt Happened. I don't like it\n" ); | ||
uart_printf ( "%x\n", irq_source ); | ||
} | ||
} | ||
|
Oops, something went wrong.