- refactored libsys
- added critical section - added interrupt global enable/disable - added console::getInstanveByName git-svn-id: http://moon:8086/svn/mips@76 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
+11
-15
@@ -5,11 +5,7 @@
|
||||
#include <sys/times.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <console.h>
|
||||
#include "libsys.h"
|
||||
#include "irq.h"
|
||||
#include "mips_gfx.h"
|
||||
#include "mips_ps2.h"
|
||||
|
||||
#define PS2_NUM_IF 2
|
||||
static volatile int32_t mouse_x;
|
||||
@@ -19,10 +15,10 @@ static gfx_t gfx;
|
||||
static volatile int _g_posx, _g_posy;
|
||||
static volatile g_btn_l, g_btn_r;
|
||||
static volatile uint32_t g_color;
|
||||
static int ps2_fd[PS2_NUM_IF];
|
||||
static char *ps2_name[PS2_NUM_IF] = {"PS2-0", "PS2-1"};
|
||||
|
||||
// -------------------------------------------------------------
|
||||
void handler5(void)
|
||||
void handler5(struct xcptcontext *xcp)
|
||||
{
|
||||
uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL;
|
||||
|
||||
@@ -31,10 +27,10 @@ void handler5(void)
|
||||
|
||||
}
|
||||
|
||||
void handler6(void)
|
||||
void handler6(struct xcptcontext *xcp)
|
||||
{
|
||||
int p, i;
|
||||
ps2_if_t const *pIF;
|
||||
ps2_if_t *pIF;
|
||||
uint8_t mouse_rsp[3];
|
||||
uint32_t timeout_count, key;
|
||||
|
||||
@@ -42,7 +38,7 @@ void handler6(void)
|
||||
|
||||
for (p=0; p < PS2_NUM_IF; p++)
|
||||
{
|
||||
pIF = (ps2_if_t const *)con_getPort(ps2_fd[p])->pInst;
|
||||
pIF = (ps2_if_t*)con_getInstanceByName(ps2_name[p]);
|
||||
if (SYS_PS2_BIT_RX_ERR_FLAG & *pIF->pCTRL)
|
||||
fprintf(stderr, "PS2[%d]: Status = 0x%08X\n", p, *pIF->pCTRL);
|
||||
|
||||
@@ -140,8 +136,8 @@ int main(void)
|
||||
interrupt_register(6, (void*)handler6);
|
||||
|
||||
srand(clock());
|
||||
UART1_setbaud(460800);
|
||||
|
||||
UART_setbaud(con_getInstanceByName("UART-1"), 460800);
|
||||
|
||||
*pVGA_cgcol = 0x00FFFFFF;
|
||||
_g_posx = _g_posy = 0;
|
||||
rmb_posx = rmb_posy = 0;
|
||||
@@ -157,12 +153,12 @@ int main(void)
|
||||
GFX_show(&gfx);
|
||||
printf("VGA status = %08X\n", *pVGA_ctrl);
|
||||
|
||||
ps2_fd[0] = open("PS2-0", 0, 0);
|
||||
ps2_fd[1] = open("PS2-1", 0, 0);
|
||||
PS2_init((ps2_if_t*)con_getInstanceByName(ps2_name[0]));
|
||||
PS2_init((ps2_if_t*)con_getInstanceByName(ps2_name[1]));
|
||||
|
||||
// Flush buffer
|
||||
PS2_flush((ps2_if_t*)(con_getPort(ps2_fd[0])->pInst));
|
||||
PS2_flush((ps2_if_t*)(con_getPort(ps2_fd[1])->pInst));
|
||||
PS2_flush((ps2_if_t*)con_getInstanceByName(ps2_name[0]));
|
||||
PS2_flush((ps2_if_t*)con_getInstanceByName(ps2_name[1]));
|
||||
|
||||
// interrupt_enable(5);
|
||||
interrupt_enable(6);
|
||||
|
||||
Reference in New Issue
Block a user