Skip to content

Commit

Permalink
UART interrupt finish
Browse files Browse the repository at this point in the history
  • Loading branch information
JingWangTW committed May 6, 2020
1 parent 8887f65 commit dbf7458
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 149 deletions.
70 changes: 35 additions & 35 deletions kernel/exception/irq.c
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 );
}
}

Loading

0 comments on commit dbf7458

Please sign in to comment.