[x86][drivers] auto formatted
This commit is contained in:
parent
849c99d2fa
commit
ed97957e32
|
@ -87,7 +87,7 @@ static void rt_cga_putc(int c)
|
|||
break;
|
||||
case '\n':
|
||||
crt_pos += CRT_COLS;
|
||||
/* cascade */
|
||||
/* cascade */
|
||||
case '\r':
|
||||
crt_pos -= (crt_pos % CRT_COLS);
|
||||
break;
|
||||
|
@ -99,7 +99,7 @@ static void rt_cga_putc(int c)
|
|||
rt_console_putc(' ');
|
||||
break;
|
||||
default:
|
||||
crt_buf[crt_pos++] = c; /* write the character */
|
||||
crt_buf[crt_pos++] = c; /* write the character */
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -289,14 +289,14 @@ int rt_hw_console_init(void)
|
|||
rt_hw_interrupt_install(INTUART0_RX, rt_console_isr, RT_NULL, "COM1");
|
||||
rt_hw_interrupt_umask(INTUART0_RX);
|
||||
|
||||
console_device.type = RT_Device_Class_Char;
|
||||
console_device.type = RT_Device_Class_Char;
|
||||
console_device.rx_indicate = RT_NULL;
|
||||
console_device.tx_complete = RT_NULL;
|
||||
console_device.init = rt_console_init;
|
||||
console_device.open = rt_console_open;
|
||||
console_device.close = rt_console_close;
|
||||
console_device.read = rt_console_read;
|
||||
console_device.write = rt_console_write;
|
||||
console_device.init = rt_console_init;
|
||||
console_device.open = rt_console_open;
|
||||
console_device.close = rt_console_close;
|
||||
console_device.read = rt_console_read;
|
||||
console_device.write = rt_console_write;
|
||||
console_device.control = rt_console_control;
|
||||
console_device.user_data = RT_NULL;
|
||||
|
||||
|
@ -316,8 +316,8 @@ INIT_DEVICE_EXPORT(rt_hw_console_init);
|
|||
* @param str the displayed string
|
||||
*
|
||||
* Modified:
|
||||
* caoxl 2009-10-14
|
||||
* the name is change to rt_hw_console_output in the v0.3.0
|
||||
* caoxl 2009-10-14
|
||||
* the name is change to rt_hw_console_output in the v0.3.0
|
||||
*
|
||||
*/
|
||||
void rt_hw_console_output(const char* str)
|
||||
|
|
|
@ -101,7 +101,7 @@ static __inline__ void ClearDmaFF(unsigned int dmanr)
|
|||
OUTB(0, DMA2_CLEAR_FF_REG);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* 清空DMA 晶体计数器
|
||||
*/
|
||||
static __inline__ void SetDmaMode(unsigned int dmanr, char mode)
|
||||
|
|
|
@ -31,7 +31,7 @@ typedef rt_int32_t s32;
|
|||
|
||||
static u8 floppy_buffer[512]; /* 软盘高速缓冲区地址指针 */
|
||||
|
||||
#define MAX_REPLIES 7
|
||||
#define MAX_REPLIES 7
|
||||
static u8 floppy_reply_buffer[MAX_REPLIES]; /* 软驱回应缓冲区 */
|
||||
#define ST0 (floppy_reply_buffer[0]) /* 软驱回应0号字节 */
|
||||
#define ST1 (floppy_reply_buffer[1]) /* 软驱回应1号字节 */
|
||||
|
@ -114,7 +114,7 @@ u32 floppy_get_info(void)
|
|||
u8 CmType, FdType;
|
||||
|
||||
floppy_sendbyte(0x10);
|
||||
i = floppy_getbyte();
|
||||
i = floppy_getbyte();
|
||||
|
||||
switch (i)
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ void floppy_motorOff( void )
|
|||
|
||||
|
||||
void floppy_setmode(void)
|
||||
{
|
||||
{
|
||||
floppy_sendbyte (FD_SPECIFY);
|
||||
floppy_sendbyte (0xcf);
|
||||
floppy_sendbyte (0x06);
|
||||
|
@ -197,7 +197,7 @@ void block_to_hts(u32 block, u32 *head, u32 *track, u32 *sector )
|
|||
|
||||
|
||||
void floppy_setupDMA(void)
|
||||
{
|
||||
{
|
||||
u32 eflags;
|
||||
_local_irq_save(eflags);
|
||||
DisableDma(2);
|
||||
|
@ -235,7 +235,7 @@ void floppy_read_cmd(u32 blk)
|
|||
floppy_sendbyte (18);
|
||||
//floppy_sendbyte (sector+secs-1); /* Last sector in track:here are sectors count */
|
||||
floppy_sendbyte (0x1B);
|
||||
floppy_sendbyte (0xff);
|
||||
floppy_sendbyte (0xff);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -282,12 +282,12 @@ static rt_size_t rt_floppy_read(rt_device_t device, rt_off_t position, void *buf
|
|||
{
|
||||
panic("ST0 %d ST1 %d ST2 %d\n",ST0,ST1,ST2);
|
||||
}
|
||||
|
||||
|
||||
rt_memcpy(buffer, floppy_buffer, 512);
|
||||
|
||||
floppy_motorOff();
|
||||
io_delay();
|
||||
|
||||
|
||||
position += 1;
|
||||
size -= 1;
|
||||
}
|
||||
|
|
|
@ -15,127 +15,127 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
/* Timer Register */
|
||||
/*******************************************************************/
|
||||
#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
|
||||
#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
|
||||
#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
|
||||
#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
|
||||
#define TIMER_SEL0 0x00 /* select counter 0 */
|
||||
#define TIMER_SEL1 0x40 /* select counter 1 */
|
||||
#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
|
||||
#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
|
||||
#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
|
||||
#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
|
||||
#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
|
||||
#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
|
||||
#define TIMER_LATCH 0x00 /* latch counter for reading */
|
||||
#define TIMER_LSB 0x10 /* r/w counter LSB */
|
||||
#define TIMER_MSB 0x20 /* r/w counter MSB */
|
||||
#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
|
||||
#define TIMER_BCD 0x01 /* count in BCD */
|
||||
#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
|
||||
#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
|
||||
#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
|
||||
#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
|
||||
#define TIMER_SEL0 0x00 /* select counter 0 */
|
||||
#define TIMER_SEL1 0x40 /* select counter 1 */
|
||||
#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
|
||||
#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
|
||||
#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
|
||||
#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
|
||||
#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
|
||||
#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
|
||||
#define TIMER_LATCH 0x00 /* latch counter for reading */
|
||||
#define TIMER_LSB 0x10 /* r/w counter LSB */
|
||||
#define TIMER_MSB 0x20 /* r/w counter MSB */
|
||||
#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
|
||||
#define TIMER_BCD 0x01 /* count in BCD */
|
||||
|
||||
#define TIMER_FREQ 1193182
|
||||
#define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x))
|
||||
#define TIMER_FREQ 1193182
|
||||
#define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x))
|
||||
|
||||
#define IO_TIMER1 0x040 /* 8253 Timer #1 */
|
||||
#define IO_TIMER1 0x040 /* 8253 Timer #1 */
|
||||
|
||||
/*******************************************************************/
|
||||
/* Interrupt Controller */
|
||||
/*******************************************************************/
|
||||
/* these are processor defined */
|
||||
#define T_DIVIDE 0 /* divide error */
|
||||
#define T_DEBUG 1 /* debug exception */
|
||||
#define T_NMI 2 /* non-maskable interrupt */
|
||||
#define T_BRKPT 3 /* breakpoint */
|
||||
#define T_OFLOW 4 /* overflow */
|
||||
#define T_BOUND 5 /* bounds check */
|
||||
#define T_ILLOP 6 /* illegal opcode */
|
||||
#define T_DEVICE 7 /* device not available */
|
||||
#define T_DBLFLT 8 /* double fault */
|
||||
#define T_DIVIDE 0 /* divide error */
|
||||
#define T_DEBUG 1 /* debug exception */
|
||||
#define T_NMI 2 /* non-maskable interrupt */
|
||||
#define T_BRKPT 3 /* breakpoint */
|
||||
#define T_OFLOW 4 /* overflow */
|
||||
#define T_BOUND 5 /* bounds check */
|
||||
#define T_ILLOP 6 /* illegal opcode */
|
||||
#define T_DEVICE 7 /* device not available */
|
||||
#define T_DBLFLT 8 /* double fault */
|
||||
/* 9 is reserved */
|
||||
#define T_TSS 10 /* invalid task switch segment */
|
||||
#define T_SEGNP 11 /* segment not present */
|
||||
#define T_STACK 12 /* stack exception */
|
||||
#define T_GPFLT 13 /* genernal protection fault */
|
||||
#define T_PGFLT 14 /* page fault */
|
||||
#define T_TSS 10 /* invalid task switch segment */
|
||||
#define T_SEGNP 11 /* segment not present */
|
||||
#define T_STACK 12 /* stack exception */
|
||||
#define T_GPFLT 13 /* genernal protection fault */
|
||||
#define T_PGFLT 14 /* page fault */
|
||||
/* 15 is reserved */
|
||||
#define T_FPERR 16 /* floating point error */
|
||||
#define T_ALIGN 17 /* aligment check */
|
||||
#define T_MCHK 18 /* machine check */
|
||||
#define T_DEFAULT 500 /* catchall */
|
||||
#define T_FPERR 16 /* floating point error */
|
||||
#define T_ALIGN 17 /* aligment check */
|
||||
#define T_MCHK 18 /* machine check */
|
||||
#define T_DEFAULT 500 /* catchall */
|
||||
|
||||
#define INTTIMER0 0
|
||||
#define INTKEYBOARD 1
|
||||
#define INTUART0_RX 4
|
||||
#define CLOCK_IRQ 0
|
||||
#define KEYBOARD_IRQ 1
|
||||
#define CASCADE_IRQ 2 /* cascade enable for 2nd AT controller */
|
||||
#define ETHER_IRQ 3 /* default ethernet interrupt vector */
|
||||
#define SECONDARY_IRQ 3 /* RS232 interrupt vector for port 2 */
|
||||
#define RS232_IRQ 4 /* RS232 interrupt vector for port 1 */
|
||||
#define XT_WINI_IRQ 5 /* xt winchester */
|
||||
#define FLOPPY_IRQ 6 /* floppy disk */
|
||||
#define PRINTER_IRQ 7
|
||||
#define AT_WINI_IRQ 14 /* at winchester */
|
||||
#define INTTIMER0 0
|
||||
#define INTKEYBOARD 1
|
||||
#define INTUART0_RX 4
|
||||
#define CLOCK_IRQ 0
|
||||
#define KEYBOARD_IRQ 1
|
||||
#define CASCADE_IRQ 2 /* cascade enable for 2nd AT controller */
|
||||
#define ETHER_IRQ 3 /* default ethernet interrupt vector */
|
||||
#define SECONDARY_IRQ 3 /* RS232 interrupt vector for port 2 */
|
||||
#define RS232_IRQ 4 /* RS232 interrupt vector for port 1 */
|
||||
#define XT_WINI_IRQ 5 /* xt winchester */
|
||||
#define FLOPPY_IRQ 6 /* floppy disk */
|
||||
#define PRINTER_IRQ 7
|
||||
#define AT_WINI_IRQ 14 /* at winchester */
|
||||
/* I/O Addresses of the two 8259A programmable interrupt controllers */
|
||||
#define IO_PIC1 0x20 /* Master(IRQs 0-7) */
|
||||
#define IO_PIC2 0xa0 /* Slave(IRQs 8-15) */
|
||||
#define IRQ_SLAVE 0x2 /* IRQ at which slave connects to master */
|
||||
#define IRQ_OFFSET 0x20 /* IRQ 0 corresponds to int IRQ_OFFSET */
|
||||
#define IO_PIC1 0x20 /* Master(IRQs 0-7) */
|
||||
#define IO_PIC2 0xa0 /* Slave(IRQs 8-15) */
|
||||
#define IRQ_SLAVE 0x2 /* IRQ at which slave connects to master */
|
||||
#define IRQ_OFFSET 0x20 /* IRQ 0 corresponds to int IRQ_OFFSET */
|
||||
|
||||
#define MAX_HANDLERS 16 /*max number of isr handler*/
|
||||
#define MAX_HANDLERS 16 /*max number of isr handler*/
|
||||
|
||||
/*******************************************************************/
|
||||
/* CRT Register */
|
||||
/*******************************************************************/
|
||||
#define MONO_BASE 0x3b4
|
||||
#define MONO_BUF 0xb0000
|
||||
#define CGA_BASE 0x3d4
|
||||
#define CGA_BUF 0xb8000
|
||||
#define MONO_BASE 0x3b4
|
||||
#define MONO_BUF 0xb0000
|
||||
#define CGA_BASE 0x3d4
|
||||
#define CGA_BUF 0xb8000
|
||||
|
||||
#define CRT_ROWS 25
|
||||
#define CRT_COLS 80
|
||||
#define CRT_SIZE (CRT_ROWS * CRT_COLS)
|
||||
#define CRT_ROWS 25
|
||||
#define CRT_COLS 80
|
||||
#define CRT_SIZE (CRT_ROWS * CRT_COLS)
|
||||
|
||||
/*******************************************************************/
|
||||
/* Keyboard Register */
|
||||
/*******************************************************************/
|
||||
#define KBSTATP 0x64 /* kbd controller status port(I) */
|
||||
#define KBS_DIB 0x01 /* kbd data in buffer */
|
||||
#define KBDATAP 0x60 /* kbd data port(I) */
|
||||
#define KBSTATP 0x64 /* kbd controller status port(I) */
|
||||
#define KBS_DIB 0x01 /* kbd data in buffer */
|
||||
#define KBDATAP 0x60 /* kbd data port(I) */
|
||||
/* AT keyboard */
|
||||
/* 8042 ports */
|
||||
#define KB_DATA 0x60 /* I/O port for keyboard data
|
||||
* Read : Read Output Buffer
|
||||
#define KB_DATA 0x60 /* I/O port for keyboard data
|
||||
* Read : Read Output Buffer
|
||||
* Write: Write Input Buffer(8042 Data&8048 Command) */
|
||||
#define KB_CMD 0x64 /* I/O port for keyboard command
|
||||
#define KB_CMD 0x64 /* I/O port for keyboard command
|
||||
* Read : Read Status Register
|
||||
* Write: Write Input Buffer(8042 Command) */
|
||||
#define LED_CODE 0xED
|
||||
#define KB_ACK 0xFA
|
||||
#define LED_CODE 0xED
|
||||
#define KB_ACK 0xFA
|
||||
|
||||
/*******************************************************************/
|
||||
/* Serial Register */
|
||||
/*******************************************************************/
|
||||
/*Serial I/O code */
|
||||
#define COM1 0x3F8
|
||||
#define COMSTATUS 5
|
||||
#define COMDATA 0x01
|
||||
#define COMREAD 0
|
||||
#define COMWRITE 0
|
||||
#define COM1 0x3F8
|
||||
#define COMSTATUS 5
|
||||
#define COMDATA 0x01
|
||||
#define COMREAD 0
|
||||
#define COMWRITE 0
|
||||
|
||||
/* Bits definition of the Line Status Register (LSR)*/
|
||||
#define DR 0x01 /* Data Ready */
|
||||
#define OE 0x02 /* Overrun Error */
|
||||
#define PE 0x04 /* Parity Error */
|
||||
#define FE 0x08 /* Framing Error */
|
||||
#define BI 0x10 /* Break Interrupt */
|
||||
#define THRE 0x20 /* Transmitter Holding Register Empty */
|
||||
#define TEMT 0x40 /* Transmitter Empty */
|
||||
#define ERFIFO 0x80 /* Error receive Fifo */
|
||||
#define DR 0x01 /* Data Ready */
|
||||
#define OE 0x02 /* Overrun Error */
|
||||
#define PE 0x04 /* Parity Error */
|
||||
#define FE 0x08 /* Framing Error */
|
||||
#define BI 0x10 /* Break Interrupt */
|
||||
#define THRE 0x20 /* Transmitter Holding Register Empty */
|
||||
#define TEMT 0x40 /* Transmitter Empty */
|
||||
#define ERFIFO 0x80 /* Error receive Fifo */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-10-09 Bernard the grub related definitions
|
||||
* 2006-10-09 Bernard the grub related definitions
|
||||
* (multiboot)
|
||||
*/
|
||||
|
||||
|
@ -13,13 +13,13 @@
|
|||
#define __GRUB_H__
|
||||
|
||||
/* the magic number for the multiboot header. */
|
||||
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
|
||||
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
|
||||
|
||||
/* the flags for the multiboot header. */
|
||||
#define MULTIBOOT_HEADER_FLAGS 0x00000003
|
||||
#define MULTIBOOT_HEADER_FLAGS 0x00000003
|
||||
|
||||
/* the magic number passed by a multiboot-compliant boot loader. */
|
||||
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
|
||||
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
|
||||
|
||||
#ifndef __ASM__
|
||||
/* the multiboot header. */
|
||||
|
|
|
@ -44,9 +44,9 @@ static __inline unsigned int inl(int port)
|
|||
|
||||
static __inline void insl(int port, void *addr, int cnt)
|
||||
{
|
||||
__asm __volatile("cld\n\trepne\n\tinsl" :
|
||||
"=D" (addr), "=c" (cnt) :
|
||||
"d" (port), "0" (addr), "1" (cnt) :
|
||||
__asm __volatile("cld\n\trepne\n\tinsl" :
|
||||
"=D" (addr), "=c" (cnt) :
|
||||
"d" (port), "0" (addr), "1" (cnt) :
|
||||
"memory", "cc");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -19,290 +19,290 @@
|
|||
#define FALSE RT_FALSE
|
||||
#define TRUE RT_TRUE
|
||||
#define PRIVATE static
|
||||
#define PUBLIC
|
||||
#define PUBLIC
|
||||
#define t_bool rt_bool_t
|
||||
#define t_8 rt_uint8_t
|
||||
#define t_32 rt_uint32_t
|
||||
|
||||
PRIVATE KB_INPUT kb_in;
|
||||
PRIVATE t_bool code_with_E0 = FALSE;
|
||||
PRIVATE t_bool shift_l; /* l shift state */
|
||||
PRIVATE t_bool shift_r; /* r shift state */
|
||||
PRIVATE t_bool alt_l; /* l alt state */
|
||||
PRIVATE t_bool alt_r; /* r left state */
|
||||
PRIVATE t_bool ctrl_l; /* l ctrl state */
|
||||
PRIVATE t_bool ctrl_r; /* l ctrl state */
|
||||
PRIVATE t_bool caps_lock; /* Caps Lock */
|
||||
PRIVATE t_bool num_lock; /* Num Lock */
|
||||
PRIVATE t_bool scroll_lock; /* Scroll Lock */
|
||||
PRIVATE int column = 0; /* keyrow[column] is one value of keymap */
|
||||
PRIVATE KB_INPUT kb_in;
|
||||
PRIVATE t_bool code_with_E0 = FALSE;
|
||||
PRIVATE t_bool shift_l; /* l shift state */
|
||||
PRIVATE t_bool shift_r; /* r shift state */
|
||||
PRIVATE t_bool alt_l; /* l alt state */
|
||||
PRIVATE t_bool alt_r; /* r left state */
|
||||
PRIVATE t_bool ctrl_l; /* l ctrl state */
|
||||
PRIVATE t_bool ctrl_r; /* l ctrl state */
|
||||
PRIVATE t_bool caps_lock; /* Caps Lock */
|
||||
PRIVATE t_bool num_lock; /* Num Lock */
|
||||
PRIVATE t_bool scroll_lock; /* Scroll Lock */
|
||||
PRIVATE int column = 0; /* keyrow[column] is one value of keymap */
|
||||
|
||||
PRIVATE t_8 get_byte_from_kb_buf();
|
||||
PRIVATE void set_leds();
|
||||
PRIVATE void kb_wait();
|
||||
PRIVATE void kb_ack();
|
||||
PRIVATE t_8 get_byte_from_kb_buf();
|
||||
PRIVATE void set_leds();
|
||||
PRIVATE void kb_wait();
|
||||
PRIVATE void kb_ack();
|
||||
|
||||
PUBLIC void init_keyboard()
|
||||
{
|
||||
kb_in.count = 0;
|
||||
kb_in.p_head = kb_in.p_tail = kb_in.buf;
|
||||
kb_in.count = 0;
|
||||
kb_in.p_head = kb_in.p_tail = kb_in.buf;
|
||||
|
||||
caps_lock = 0;
|
||||
num_lock = 1;
|
||||
scroll_lock = 0;
|
||||
caps_lock = 0;
|
||||
num_lock = 1;
|
||||
scroll_lock = 0;
|
||||
|
||||
set_leds();
|
||||
set_leds();
|
||||
}
|
||||
PUBLIC rt_bool_t keyboard_read(rt_uint32_t *pkey)
|
||||
{
|
||||
t_8 scan_code;
|
||||
t_bool make; /* TRUE : make */
|
||||
/* FALSE: break */
|
||||
t_32 key = 0;
|
||||
t_32* keyrow;
|
||||
t_8 scan_code;
|
||||
t_bool make; /* TRUE : make */
|
||||
/* FALSE: break */
|
||||
t_32 key = 0;
|
||||
t_32* keyrow;
|
||||
|
||||
if(kb_in.count > 0){
|
||||
code_with_E0 = FALSE;
|
||||
scan_code = get_byte_from_kb_buf();
|
||||
if(kb_in.count > 0){
|
||||
code_with_E0 = FALSE;
|
||||
scan_code = get_byte_from_kb_buf();
|
||||
|
||||
/* start scan */
|
||||
if (scan_code == 0xE1) {
|
||||
int i;
|
||||
static const t_8 pausebreak_scan_code[] = {0xE1, 0x1D, 0x45, 0xE1, 0x9D, 0xC5};
|
||||
t_bool is_pausebreak = TRUE;
|
||||
for(i=1;i<6;i++){
|
||||
if (get_byte_from_kb_buf() != pausebreak_scan_code[i]) {
|
||||
is_pausebreak = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (is_pausebreak) {
|
||||
key = PAUSEBREAK;
|
||||
}
|
||||
}
|
||||
else if (scan_code == 0xE0) {
|
||||
code_with_E0 = TRUE;
|
||||
scan_code = get_byte_from_kb_buf();
|
||||
/* start scan */
|
||||
if (scan_code == 0xE1) {
|
||||
int i;
|
||||
static const t_8 pausebreak_scan_code[] = {0xE1, 0x1D, 0x45, 0xE1, 0x9D, 0xC5};
|
||||
t_bool is_pausebreak = TRUE;
|
||||
for(i=1;i<6;i++){
|
||||
if (get_byte_from_kb_buf() != pausebreak_scan_code[i]) {
|
||||
is_pausebreak = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (is_pausebreak) {
|
||||
key = PAUSEBREAK;
|
||||
}
|
||||
}
|
||||
else if (scan_code == 0xE0) {
|
||||
code_with_E0 = TRUE;
|
||||
scan_code = get_byte_from_kb_buf();
|
||||
|
||||
/* PrintScreen pressed */
|
||||
if (scan_code == 0x2A) {
|
||||
code_with_E0 = FALSE;
|
||||
if ((scan_code = get_byte_from_kb_buf()) == 0xE0) {
|
||||
code_with_E0 = TRUE;
|
||||
if ((scan_code = get_byte_from_kb_buf()) == 0x37) {
|
||||
key = PRINTSCREEN;
|
||||
make = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* PrintScreen released */
|
||||
else if (scan_code == 0xB7) {
|
||||
code_with_E0 = FALSE;
|
||||
if ((scan_code = get_byte_from_kb_buf()) == 0xE0) {
|
||||
code_with_E0 = TRUE;
|
||||
if ((scan_code = get_byte_from_kb_buf()) == 0xAA) {
|
||||
key = PRINTSCREEN;
|
||||
make = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* if is not PrintScreen, scan_code is the one after 0xE0 */
|
||||
if ((key != PAUSEBREAK) && (key != PRINTSCREEN)) {
|
||||
/* is Make Code or Break Code */
|
||||
make = (scan_code & FLAG_BREAK ? FALSE : TRUE);
|
||||
|
||||
keyrow = &keymap[(scan_code & 0x7F) * MAP_COLS];
|
||||
/* PrintScreen pressed */
|
||||
if (scan_code == 0x2A) {
|
||||
code_with_E0 = FALSE;
|
||||
if ((scan_code = get_byte_from_kb_buf()) == 0xE0) {
|
||||
code_with_E0 = TRUE;
|
||||
if ((scan_code = get_byte_from_kb_buf()) == 0x37) {
|
||||
key = PRINTSCREEN;
|
||||
make = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* PrintScreen released */
|
||||
else if (scan_code == 0xB7) {
|
||||
code_with_E0 = FALSE;
|
||||
if ((scan_code = get_byte_from_kb_buf()) == 0xE0) {
|
||||
code_with_E0 = TRUE;
|
||||
if ((scan_code = get_byte_from_kb_buf()) == 0xAA) {
|
||||
key = PRINTSCREEN;
|
||||
make = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* if is not PrintScreen, scan_code is the one after 0xE0 */
|
||||
if ((key != PAUSEBREAK) && (key != PRINTSCREEN)) {
|
||||
/* is Make Code or Break Code */
|
||||
make = (scan_code & FLAG_BREAK ? FALSE : TRUE);
|
||||
|
||||
column = 0;
|
||||
keyrow = &keymap[(scan_code & 0x7F) * MAP_COLS];
|
||||
|
||||
t_bool caps = shift_l || shift_r;
|
||||
if (caps_lock) {
|
||||
if ((keyrow[0] >= 'a') && (keyrow[0] <= 'z')){
|
||||
caps = !caps;
|
||||
}
|
||||
}
|
||||
if (caps) {
|
||||
column = 1;
|
||||
}
|
||||
column = 0;
|
||||
|
||||
if (code_with_E0) {
|
||||
column = 2;
|
||||
}
|
||||
t_bool caps = shift_l || shift_r;
|
||||
if (caps_lock) {
|
||||
if ((keyrow[0] >= 'a') && (keyrow[0] <= 'z')){
|
||||
caps = !caps;
|
||||
}
|
||||
}
|
||||
if (caps) {
|
||||
column = 1;
|
||||
}
|
||||
|
||||
key = keyrow[column];
|
||||
if (code_with_E0) {
|
||||
column = 2;
|
||||
}
|
||||
|
||||
switch(key) {
|
||||
case SHIFT_L:
|
||||
shift_l = make;
|
||||
break;
|
||||
case SHIFT_R:
|
||||
shift_r = make;
|
||||
break;
|
||||
case CTRL_L:
|
||||
ctrl_l = make;
|
||||
break;
|
||||
case CTRL_R:
|
||||
ctrl_r = make;
|
||||
break;
|
||||
case ALT_L:
|
||||
alt_l = make;
|
||||
break;
|
||||
case ALT_R:
|
||||
alt_l = make;
|
||||
break;
|
||||
case CAPS_LOCK:
|
||||
if (make) {
|
||||
caps_lock = !caps_lock;
|
||||
set_leds();
|
||||
}
|
||||
break;
|
||||
case NUM_LOCK:
|
||||
if (make) {
|
||||
num_lock = !num_lock;
|
||||
set_leds();
|
||||
}
|
||||
break;
|
||||
case SCROLL_LOCK:
|
||||
if (make) {
|
||||
scroll_lock = !scroll_lock;
|
||||
set_leds();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
key = keyrow[column];
|
||||
|
||||
if(make){ /* ignore Break Code */
|
||||
t_bool pad = FALSE;
|
||||
switch(key) {
|
||||
case SHIFT_L:
|
||||
shift_l = make;
|
||||
break;
|
||||
case SHIFT_R:
|
||||
shift_r = make;
|
||||
break;
|
||||
case CTRL_L:
|
||||
ctrl_l = make;
|
||||
break;
|
||||
case CTRL_R:
|
||||
ctrl_r = make;
|
||||
break;
|
||||
case ALT_L:
|
||||
alt_l = make;
|
||||
break;
|
||||
case ALT_R:
|
||||
alt_l = make;
|
||||
break;
|
||||
case CAPS_LOCK:
|
||||
if (make) {
|
||||
caps_lock = !caps_lock;
|
||||
set_leds();
|
||||
}
|
||||
break;
|
||||
case NUM_LOCK:
|
||||
if (make) {
|
||||
num_lock = !num_lock;
|
||||
set_leds();
|
||||
}
|
||||
break;
|
||||
case SCROLL_LOCK:
|
||||
if (make) {
|
||||
scroll_lock = !scroll_lock;
|
||||
set_leds();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle the small pad first */
|
||||
if ((key >= PAD_SLASH) && (key <= PAD_9)) {
|
||||
pad = TRUE;
|
||||
switch(key) { /* '/', '*', '-', '+', and 'Enter' in num pad */
|
||||
case PAD_SLASH:
|
||||
key = '/';
|
||||
break;
|
||||
case PAD_STAR:
|
||||
key = '*';
|
||||
break;
|
||||
case PAD_MINUS:
|
||||
key = '-';
|
||||
break;
|
||||
case PAD_PLUS:
|
||||
key = '+';
|
||||
break;
|
||||
case PAD_ENTER:
|
||||
key = ENTER;
|
||||
break;
|
||||
default: /* keys whose value depends on the NumLock */
|
||||
if (num_lock) { /* '0' ~ '9' and '.' in num pad */
|
||||
if ((key >= PAD_0) && (key <= PAD_9)) {
|
||||
key = key - PAD_0 + '0';
|
||||
}
|
||||
else if (key == PAD_DOT) {
|
||||
key = '.';
|
||||
}
|
||||
}
|
||||
else{
|
||||
switch(key) {
|
||||
case PAD_HOME:
|
||||
key = HOME;
|
||||
break;
|
||||
case PAD_END:
|
||||
key = END;
|
||||
break;
|
||||
case PAD_PAGEUP:
|
||||
key = PAGEUP;
|
||||
break;
|
||||
case PAD_PAGEDOWN:
|
||||
key = PAGEDOWN;
|
||||
break;
|
||||
case PAD_INS:
|
||||
key = INSERT;
|
||||
break;
|
||||
case PAD_UP:
|
||||
key = UP;
|
||||
break;
|
||||
case PAD_DOWN:
|
||||
key = DOWN;
|
||||
break;
|
||||
case PAD_LEFT:
|
||||
key = LEFT;
|
||||
break;
|
||||
case PAD_RIGHT:
|
||||
key = RIGHT;
|
||||
break;
|
||||
case PAD_DOT:
|
||||
key = DELETE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
key |= shift_l ? FLAG_SHIFT_L : 0;
|
||||
key |= shift_r ? FLAG_SHIFT_R : 0;
|
||||
key |= ctrl_l ? FLAG_CTRL_L : 0;
|
||||
key |= ctrl_r ? FLAG_CTRL_R : 0;
|
||||
key |= alt_l ? FLAG_ALT_L : 0;
|
||||
key |= alt_r ? FLAG_ALT_R : 0;
|
||||
key |= pad ? FLAG_PAD : 0;
|
||||
if(make){ /* ignore Break Code */
|
||||
t_bool pad = FALSE;
|
||||
|
||||
*pkey = key;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
/* handle the small pad first */
|
||||
if ((key >= PAD_SLASH) && (key <= PAD_9)) {
|
||||
pad = TRUE;
|
||||
switch(key) { /* '/', '*', '-', '+', and 'Enter' in num pad */
|
||||
case PAD_SLASH:
|
||||
key = '/';
|
||||
break;
|
||||
case PAD_STAR:
|
||||
key = '*';
|
||||
break;
|
||||
case PAD_MINUS:
|
||||
key = '-';
|
||||
break;
|
||||
case PAD_PLUS:
|
||||
key = '+';
|
||||
break;
|
||||
case PAD_ENTER:
|
||||
key = ENTER;
|
||||
break;
|
||||
default: /* keys whose value depends on the NumLock */
|
||||
if (num_lock) { /* '0' ~ '9' and '.' in num pad */
|
||||
if ((key >= PAD_0) && (key <= PAD_9)) {
|
||||
key = key - PAD_0 + '0';
|
||||
}
|
||||
else if (key == PAD_DOT) {
|
||||
key = '.';
|
||||
}
|
||||
}
|
||||
else{
|
||||
switch(key) {
|
||||
case PAD_HOME:
|
||||
key = HOME;
|
||||
break;
|
||||
case PAD_END:
|
||||
key = END;
|
||||
break;
|
||||
case PAD_PAGEUP:
|
||||
key = PAGEUP;
|
||||
break;
|
||||
case PAD_PAGEDOWN:
|
||||
key = PAGEDOWN;
|
||||
break;
|
||||
case PAD_INS:
|
||||
key = INSERT;
|
||||
break;
|
||||
case PAD_UP:
|
||||
key = UP;
|
||||
break;
|
||||
case PAD_DOWN:
|
||||
key = DOWN;
|
||||
break;
|
||||
case PAD_LEFT:
|
||||
key = LEFT;
|
||||
break;
|
||||
case PAD_RIGHT:
|
||||
key = RIGHT;
|
||||
break;
|
||||
case PAD_DOT:
|
||||
key = DELETE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
key |= shift_l ? FLAG_SHIFT_L : 0;
|
||||
key |= shift_r ? FLAG_SHIFT_R : 0;
|
||||
key |= ctrl_l ? FLAG_CTRL_L : 0;
|
||||
key |= ctrl_r ? FLAG_CTRL_R : 0;
|
||||
key |= alt_l ? FLAG_ALT_L : 0;
|
||||
key |= alt_r ? FLAG_ALT_R : 0;
|
||||
key |= pad ? FLAG_PAD : 0;
|
||||
|
||||
return FALSE;
|
||||
*pkey = key;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PRIVATE t_8 get_byte_from_kb_buf()
|
||||
{
|
||||
t_8 scan_code;
|
||||
t_8 scan_code;
|
||||
|
||||
RT_ASSERT(kb_in.count>0);
|
||||
scan_code = *(kb_in.p_tail);
|
||||
kb_in.p_tail++;
|
||||
if (kb_in.p_tail == kb_in.buf + KB_IN_BYTES) {
|
||||
kb_in.p_tail = kb_in.buf;
|
||||
}
|
||||
kb_in.count--;
|
||||
RT_ASSERT(kb_in.count>0);
|
||||
scan_code = *(kb_in.p_tail);
|
||||
kb_in.p_tail++;
|
||||
if (kb_in.p_tail == kb_in.buf + KB_IN_BYTES) {
|
||||
kb_in.p_tail = kb_in.buf;
|
||||
}
|
||||
kb_in.count--;
|
||||
|
||||
return scan_code;
|
||||
return scan_code;
|
||||
}
|
||||
|
||||
PRIVATE void kb_wait() /* wait inpit cache of 8042 */
|
||||
{
|
||||
t_8 kb_stat;
|
||||
t_8 kb_stat;
|
||||
|
||||
do {
|
||||
kb_stat = inb(KB_CMD);
|
||||
} while (kb_stat & 0x02);
|
||||
do {
|
||||
kb_stat = inb(KB_CMD);
|
||||
} while (kb_stat & 0x02);
|
||||
}
|
||||
|
||||
PRIVATE void kb_ack()
|
||||
{
|
||||
t_8 kb_read;
|
||||
t_8 kb_read;
|
||||
|
||||
do {
|
||||
kb_read = inb(KB_DATA);
|
||||
} while (kb_read != KB_ACK);
|
||||
do {
|
||||
kb_read = inb(KB_DATA);
|
||||
} while (kb_read != KB_ACK);
|
||||
}
|
||||
|
||||
PRIVATE void set_leds()
|
||||
{
|
||||
t_8 leds = (caps_lock << 2) | (num_lock << 1) | scroll_lock;
|
||||
t_8 leds = (caps_lock << 2) | (num_lock << 1) | scroll_lock;
|
||||
|
||||
kb_wait();
|
||||
outb(KB_DATA, LED_CODE);
|
||||
kb_ack();
|
||||
kb_wait();
|
||||
outb(KB_DATA, LED_CODE);
|
||||
kb_ack();
|
||||
|
||||
kb_wait();
|
||||
outb(KB_DATA, leds);
|
||||
kb_ack();
|
||||
kb_wait();
|
||||
outb(KB_DATA, leds);
|
||||
kb_ack();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -312,51 +312,51 @@ PRIVATE void set_leds()
|
|||
|
||||
void rt_keyboard_isr(void)
|
||||
{
|
||||
rt_uint8_t data;
|
||||
rt_uint8_t data;
|
||||
|
||||
if ((inb(KBSTATP) & KBS_DIB) == 0)
|
||||
return ;
|
||||
if ((inb(KBSTATP) & KBS_DIB) == 0)
|
||||
return ;
|
||||
|
||||
data = inb(KBDATAP);
|
||||
data = inb(KBDATAP);
|
||||
|
||||
if (kb_in.count < KB_IN_BYTES) {
|
||||
*(kb_in.p_head) = data;
|
||||
kb_in.p_head++;
|
||||
if (kb_in.p_head == kb_in.buf + KB_IN_BYTES) {
|
||||
kb_in.p_head = kb_in.buf;
|
||||
}
|
||||
kb_in.count++;
|
||||
}
|
||||
if (kb_in.count < KB_IN_BYTES) {
|
||||
*(kb_in.p_head) = data;
|
||||
kb_in.p_head++;
|
||||
if (kb_in.p_head == kb_in.buf + KB_IN_BYTES) {
|
||||
kb_in.p_head = kb_in.buf;
|
||||
}
|
||||
kb_in.count++;
|
||||
}
|
||||
}
|
||||
/* generally, this should be called in task level for all key inpit support,
|
||||
but here only support a key that is composed of 2 bytes */
|
||||
rt_bool_t rt_keyboard_getc(char* c)
|
||||
{
|
||||
if(kb_in.count>=2)
|
||||
{
|
||||
rt_uint32_t key = 0;
|
||||
rt_bool_t rv=keyboard_read(&key);
|
||||
if(kb_in.count>=2)
|
||||
{
|
||||
rt_uint32_t key = 0;
|
||||
rt_bool_t rv=keyboard_read(&key);
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case TAB:
|
||||
*c = '\t';
|
||||
break;
|
||||
case ENTER:
|
||||
*c = '\n';
|
||||
break;
|
||||
case BACKSPACE:
|
||||
*c = '\b';
|
||||
break;
|
||||
default:
|
||||
*c = key;
|
||||
break;
|
||||
}
|
||||
switch(key)
|
||||
{
|
||||
case TAB:
|
||||
*c = '\t';
|
||||
break;
|
||||
case ENTER:
|
||||
*c = '\n';
|
||||
break;
|
||||
case BACKSPACE:
|
||||
*c = '\b';
|
||||
break;
|
||||
default:
|
||||
*c = key;
|
||||
break;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
return RT_FALSE;
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -12,115 +12,115 @@
|
|||
Forrest Yu, 2005
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
|
||||
#ifndef _TINIX_KEYBOARD_H_
|
||||
#define _TINIX_KEYBOARD_H_
|
||||
#ifndef _TINIX_KEYBOARD_H_
|
||||
#define _TINIX_KEYBOARD_H_
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* Macros Declaration */
|
||||
/************************************************************************/
|
||||
#define KB_IN_BYTES 32 /* size of keyboard input buffer */
|
||||
#define MAP_COLS 3 /* Number of columns in keymap */
|
||||
#define NR_SCAN_CODES 0x80 /* Number of scan codes (rows in keymap) */
|
||||
#define KB_IN_BYTES 32 /* size of keyboard input buffer */
|
||||
#define MAP_COLS 3 /* Number of columns in keymap */
|
||||
#define NR_SCAN_CODES 0x80 /* Number of scan codes (rows in keymap) */
|
||||
|
||||
#define FLAG_BREAK 0x0080 /* Break Code */
|
||||
#define FLAG_EXT 0x0100 /* Normal function keys */
|
||||
#define FLAG_SHIFT_L 0x0200 /* Shift key */
|
||||
#define FLAG_SHIFT_R 0x0400 /* Shift key */
|
||||
#define FLAG_CTRL_L 0x0800 /* Control key */
|
||||
#define FLAG_CTRL_R 0x1000 /* Control key */
|
||||
#define FLAG_ALT_L 0x2000 /* Alternate key */
|
||||
#define FLAG_ALT_R 0x4000 /* Alternate key */
|
||||
#define FLAG_PAD 0x8000 /* keys in num pad */
|
||||
#define FLAG_BREAK 0x0080 /* Break Code */
|
||||
#define FLAG_EXT 0x0100 /* Normal function keys */
|
||||
#define FLAG_SHIFT_L 0x0200 /* Shift key */
|
||||
#define FLAG_SHIFT_R 0x0400 /* Shift key */
|
||||
#define FLAG_CTRL_L 0x0800 /* Control key */
|
||||
#define FLAG_CTRL_R 0x1000 /* Control key */
|
||||
#define FLAG_ALT_L 0x2000 /* Alternate key */
|
||||
#define FLAG_ALT_R 0x4000 /* Alternate key */
|
||||
#define FLAG_PAD 0x8000 /* keys in num pad */
|
||||
|
||||
#define MASK_RAW 0x01FF /* raw key value = code passed to tty & MASK_RAW
|
||||
the value can be found either in the keymap column 0
|
||||
or in the list below */
|
||||
#define MASK_RAW 0x01FF /* raw key value = code passed to tty & MASK_RAW
|
||||
the value can be found either in the keymap column 0
|
||||
or in the list below */
|
||||
|
||||
/* Special keys */
|
||||
#define ESC (0x01 + FLAG_EXT) /* Esc */
|
||||
#define TAB (0x02 + FLAG_EXT) /* Tab */
|
||||
#define ENTER (0x03 + FLAG_EXT) /* Enter */
|
||||
#define BACKSPACE (0x04 + FLAG_EXT) /* BackSpace */
|
||||
#define ESC (0x01 + FLAG_EXT) /* Esc */
|
||||
#define TAB (0x02 + FLAG_EXT) /* Tab */
|
||||
#define ENTER (0x03 + FLAG_EXT) /* Enter */
|
||||
#define BACKSPACE (0x04 + FLAG_EXT) /* BackSpace */
|
||||
|
||||
#define GUI_L (0x05 + FLAG_EXT) /* L GUI */
|
||||
#define GUI_R (0x06 + FLAG_EXT) /* R GUI */
|
||||
#define APPS (0x07 + FLAG_EXT) /* APPS */
|
||||
#define GUI_L (0x05 + FLAG_EXT) /* L GUI */
|
||||
#define GUI_R (0x06 + FLAG_EXT) /* R GUI */
|
||||
#define APPS (0x07 + FLAG_EXT) /* APPS */
|
||||
|
||||
/* Shift, Ctrl, Alt */
|
||||
#define SHIFT_L (0x08 + FLAG_EXT) /* L Shift */
|
||||
#define SHIFT_R (0x09 + FLAG_EXT) /* R Shift */
|
||||
#define CTRL_L (0x0A + FLAG_EXT) /* L Ctrl */
|
||||
#define CTRL_R (0x0B + FLAG_EXT) /* R Ctrl */
|
||||
#define ALT_L (0x0C + FLAG_EXT) /* L Alt */
|
||||
#define ALT_R (0x0D + FLAG_EXT) /* R Alt */
|
||||
#define SHIFT_L (0x08 + FLAG_EXT) /* L Shift */
|
||||
#define SHIFT_R (0x09 + FLAG_EXT) /* R Shift */
|
||||
#define CTRL_L (0x0A + FLAG_EXT) /* L Ctrl */
|
||||
#define CTRL_R (0x0B + FLAG_EXT) /* R Ctrl */
|
||||
#define ALT_L (0x0C + FLAG_EXT) /* L Alt */
|
||||
#define ALT_R (0x0D + FLAG_EXT) /* R Alt */
|
||||
|
||||
/* Lock keys */
|
||||
#define CAPS_LOCK (0x0E + FLAG_EXT) /* Caps Lock */
|
||||
#define NUM_LOCK (0x0F + FLAG_EXT) /* Number Lock */
|
||||
#define SCROLL_LOCK (0x10 + FLAG_EXT) /* Scroll Lock */
|
||||
#define CAPS_LOCK (0x0E + FLAG_EXT) /* Caps Lock */
|
||||
#define NUM_LOCK (0x0F + FLAG_EXT) /* Number Lock */
|
||||
#define SCROLL_LOCK (0x10 + FLAG_EXT) /* Scroll Lock */
|
||||
|
||||
/* Function keys */
|
||||
#define F1 (0x11 + FLAG_EXT) /* F1 */
|
||||
#define F2 (0x12 + FLAG_EXT) /* F2 */
|
||||
#define F3 (0x13 + FLAG_EXT) /* F3 */
|
||||
#define F4 (0x14 + FLAG_EXT) /* F4 */
|
||||
#define F5 (0x15 + FLAG_EXT) /* F5 */
|
||||
#define F6 (0x16 + FLAG_EXT) /* F6 */
|
||||
#define F7 (0x17 + FLAG_EXT) /* F7 */
|
||||
#define F8 (0x18 + FLAG_EXT) /* F8 */
|
||||
#define F9 (0x19 + FLAG_EXT) /* F9 */
|
||||
#define F10 (0x1A + FLAG_EXT) /* F10 */
|
||||
#define F11 (0x1B + FLAG_EXT) /* F11 */
|
||||
#define F12 (0x1C + FLAG_EXT) /* F12 */
|
||||
#define F1 (0x11 + FLAG_EXT) /* F1 */
|
||||
#define F2 (0x12 + FLAG_EXT) /* F2 */
|
||||
#define F3 (0x13 + FLAG_EXT) /* F3 */
|
||||
#define F4 (0x14 + FLAG_EXT) /* F4 */
|
||||
#define F5 (0x15 + FLAG_EXT) /* F5 */
|
||||
#define F6 (0x16 + FLAG_EXT) /* F6 */
|
||||
#define F7 (0x17 + FLAG_EXT) /* F7 */
|
||||
#define F8 (0x18 + FLAG_EXT) /* F8 */
|
||||
#define F9 (0x19 + FLAG_EXT) /* F9 */
|
||||
#define F10 (0x1A + FLAG_EXT) /* F10 */
|
||||
#define F11 (0x1B + FLAG_EXT) /* F11 */
|
||||
#define F12 (0x1C + FLAG_EXT) /* F12 */
|
||||
|
||||
/* Control Pad */
|
||||
#define PRINTSCREEN (0x1D + FLAG_EXT) /* Print Screen */
|
||||
#define PAUSEBREAK (0x1E + FLAG_EXT) /* Pause/Break */
|
||||
#define INSERT (0x1F + FLAG_EXT) /* Insert */
|
||||
#define DELETE (0x20 + FLAG_EXT) /* Delete */
|
||||
#define HOME (0x21 + FLAG_EXT) /* Home */
|
||||
#define END (0x22 + FLAG_EXT) /* End */
|
||||
#define PAGEUP (0x23 + FLAG_EXT) /* Page Up */
|
||||
#define PAGEDOWN (0x24 + FLAG_EXT) /* Page Down */
|
||||
#define UP (0x25 + FLAG_EXT) /* Up */
|
||||
#define DOWN (0x26 + FLAG_EXT) /* Down */
|
||||
#define LEFT (0x27 + FLAG_EXT) /* Left */
|
||||
#define RIGHT (0x28 + FLAG_EXT) /* Right */
|
||||
#define PRINTSCREEN (0x1D + FLAG_EXT) /* Print Screen */
|
||||
#define PAUSEBREAK (0x1E + FLAG_EXT) /* Pause/Break */
|
||||
#define INSERT (0x1F + FLAG_EXT) /* Insert */
|
||||
#define DELETE (0x20 + FLAG_EXT) /* Delete */
|
||||
#define HOME (0x21 + FLAG_EXT) /* Home */
|
||||
#define END (0x22 + FLAG_EXT) /* End */
|
||||
#define PAGEUP (0x23 + FLAG_EXT) /* Page Up */
|
||||
#define PAGEDOWN (0x24 + FLAG_EXT) /* Page Down */
|
||||
#define UP (0x25 + FLAG_EXT) /* Up */
|
||||
#define DOWN (0x26 + FLAG_EXT) /* Down */
|
||||
#define LEFT (0x27 + FLAG_EXT) /* Left */
|
||||
#define RIGHT (0x28 + FLAG_EXT) /* Right */
|
||||
|
||||
/* ACPI keys */
|
||||
#define POWER (0x29 + FLAG_EXT) /* Power */
|
||||
#define SLEEP (0x2A + FLAG_EXT) /* Sleep */
|
||||
#define WAKE (0x2B + FLAG_EXT) /* Wake Up */
|
||||
#define POWER (0x29 + FLAG_EXT) /* Power */
|
||||
#define SLEEP (0x2A + FLAG_EXT) /* Sleep */
|
||||
#define WAKE (0x2B + FLAG_EXT) /* Wake Up */
|
||||
|
||||
/* Num Pad */
|
||||
#define PAD_SLASH (0x2C + FLAG_EXT) /* / */
|
||||
#define PAD_STAR (0x2D + FLAG_EXT) /* * */
|
||||
#define PAD_MINUS (0x2E + FLAG_EXT) /* - */
|
||||
#define PAD_PLUS (0x2F + FLAG_EXT) /* + */
|
||||
#define PAD_ENTER (0x30 + FLAG_EXT) /* Enter */
|
||||
#define PAD_DOT (0x31 + FLAG_EXT) /* . */
|
||||
#define PAD_0 (0x32 + FLAG_EXT) /* 0 */
|
||||
#define PAD_1 (0x33 + FLAG_EXT) /* 1 */
|
||||
#define PAD_2 (0x34 + FLAG_EXT) /* 2 */
|
||||
#define PAD_3 (0x35 + FLAG_EXT) /* 3 */
|
||||
#define PAD_4 (0x36 + FLAG_EXT) /* 4 */
|
||||
#define PAD_5 (0x37 + FLAG_EXT) /* 5 */
|
||||
#define PAD_6 (0x38 + FLAG_EXT) /* 6 */
|
||||
#define PAD_7 (0x39 + FLAG_EXT) /* 7 */
|
||||
#define PAD_8 (0x3A + FLAG_EXT) /* 8 */
|
||||
#define PAD_9 (0x3B + FLAG_EXT) /* 9 */
|
||||
#define PAD_UP PAD_8 /* Up */
|
||||
#define PAD_DOWN PAD_2 /* Down */
|
||||
#define PAD_LEFT PAD_4 /* Left */
|
||||
#define PAD_RIGHT PAD_6 /* Right */
|
||||
#define PAD_HOME PAD_7 /* Home */
|
||||
#define PAD_END PAD_1 /* End */
|
||||
#define PAD_PAGEUP PAD_9 /* Page Up */
|
||||
#define PAD_PAGEDOWN PAD_3 /* Page Down */
|
||||
#define PAD_INS PAD_0 /* Ins */
|
||||
#define PAD_MID PAD_5 /* Middle key */
|
||||
#define PAD_DEL PAD_DOT /* Del */
|
||||
#define PAD_SLASH (0x2C + FLAG_EXT) /* / */
|
||||
#define PAD_STAR (0x2D + FLAG_EXT) /* * */
|
||||
#define PAD_MINUS (0x2E + FLAG_EXT) /* - */
|
||||
#define PAD_PLUS (0x2F + FLAG_EXT) /* + */
|
||||
#define PAD_ENTER (0x30 + FLAG_EXT) /* Enter */
|
||||
#define PAD_DOT (0x31 + FLAG_EXT) /* . */
|
||||
#define PAD_0 (0x32 + FLAG_EXT) /* 0 */
|
||||
#define PAD_1 (0x33 + FLAG_EXT) /* 1 */
|
||||
#define PAD_2 (0x34 + FLAG_EXT) /* 2 */
|
||||
#define PAD_3 (0x35 + FLAG_EXT) /* 3 */
|
||||
#define PAD_4 (0x36 + FLAG_EXT) /* 4 */
|
||||
#define PAD_5 (0x37 + FLAG_EXT) /* 5 */
|
||||
#define PAD_6 (0x38 + FLAG_EXT) /* 6 */
|
||||
#define PAD_7 (0x39 + FLAG_EXT) /* 7 */
|
||||
#define PAD_8 (0x3A + FLAG_EXT) /* 8 */
|
||||
#define PAD_9 (0x3B + FLAG_EXT) /* 9 */
|
||||
#define PAD_UP PAD_8 /* Up */
|
||||
#define PAD_DOWN PAD_2 /* Down */
|
||||
#define PAD_LEFT PAD_4 /* Left */
|
||||
#define PAD_RIGHT PAD_6 /* Right */
|
||||
#define PAD_HOME PAD_7 /* Home */
|
||||
#define PAD_END PAD_1 /* End */
|
||||
#define PAD_PAGEUP PAD_9 /* Page Up */
|
||||
#define PAD_PAGEDOWN PAD_3 /* Page Down */
|
||||
#define PAD_INS PAD_0 /* Ins */
|
||||
#define PAD_MID PAD_5 /* Middle key */
|
||||
#define PAD_DEL PAD_DOT /* Del */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -128,10 +128,10 @@
|
|||
/************************************************************************/
|
||||
/* Keyboard structure, 1 per console. */
|
||||
typedef struct s_kb {
|
||||
char* p_head; /* input cache pointer */
|
||||
char* p_tail; /* read cache pointer */
|
||||
int count;
|
||||
char buf[KB_IN_BYTES];
|
||||
char* p_head; /* input cache pointer */
|
||||
char* p_tail; /* read cache pointer */
|
||||
int count;
|
||||
char buf[KB_IN_BYTES];
|
||||
}KB_INPUT;
|
||||
|
||||
|
||||
|
|
|
@ -17,227 +17,227 @@
|
|||
/* It should be and can only be included by keyboard.c! */
|
||||
/********************************************************************/
|
||||
|
||||
#ifndef _TINIX_KEYMAP_H_
|
||||
#define _TINIX_KEYMAP_H_
|
||||
#ifndef _TINIX_KEYMAP_H_
|
||||
#define _TINIX_KEYMAP_H_
|
||||
|
||||
|
||||
/* Keymap for US MF-2 keyboard. */
|
||||
|
||||
rt_uint32_t keymap[NR_SCAN_CODES * MAP_COLS] = {
|
||||
|
||||
/* scan-code !Shift Shift E0 XX */
|
||||
/* scan-code !Shift Shift E0 XX */
|
||||
/* ==================================================================== */
|
||||
/* 0x00 - none */ 0, 0, 0,
|
||||
/* 0x01 - ESC */ ESC, ESC, 0,
|
||||
/* 0x02 - '1' */ '1', '!', 0,
|
||||
/* 0x03 - '2' */ '2', '@', 0,
|
||||
/* 0x04 - '3' */ '3', '#', 0,
|
||||
/* 0x05 - '4' */ '4', '$', 0,
|
||||
/* 0x06 - '5' */ '5', '%', 0,
|
||||
/* 0x07 - '6' */ '6', '^', 0,
|
||||
/* 0x08 - '7' */ '7', '&', 0,
|
||||
/* 0x09 - '8' */ '8', '*', 0,
|
||||
/* 0x0A - '9' */ '9', '(', 0,
|
||||
/* 0x0B - '0' */ '0', ')', 0,
|
||||
/* 0x0C - '-' */ '-', '_', 0,
|
||||
/* 0x0D - '=' */ '=', '+', 0,
|
||||
/* 0x0E - BS */ BACKSPACE, BACKSPACE, 0,
|
||||
/* 0x0F - TAB */ TAB, TAB, 0,
|
||||
/* 0x10 - 'q' */ 'q', 'Q', 0,
|
||||
/* 0x11 - 'w' */ 'w', 'W', 0,
|
||||
/* 0x12 - 'e' */ 'e', 'E', 0,
|
||||
/* 0x13 - 'r' */ 'r', 'R', 0,
|
||||
/* 0x14 - 't' */ 't', 'T', 0,
|
||||
/* 0x15 - 'y' */ 'y', 'Y', 0,
|
||||
/* 0x16 - 'u' */ 'u', 'U', 0,
|
||||
/* 0x17 - 'i' */ 'i', 'I', 0,
|
||||
/* 0x18 - 'o' */ 'o', 'O', 0,
|
||||
/* 0x19 - 'p' */ 'p', 'P', 0,
|
||||
/* 0x1A - '[' */ '[', '{', 0,
|
||||
/* 0x1B - ']' */ ']', '}', 0,
|
||||
/* 0x1C - CR/LF */ ENTER, ENTER, PAD_ENTER,
|
||||
/* 0x1D - l. Ctrl */ CTRL_L, CTRL_L, CTRL_R,
|
||||
/* 0x1E - 'a' */ 'a', 'A', 0,
|
||||
/* 0x1F - 's' */ 's', 'S', 0,
|
||||
/* 0x20 - 'd' */ 'd', 'D', 0,
|
||||
/* 0x21 - 'f' */ 'f', 'F', 0,
|
||||
/* 0x22 - 'g' */ 'g', 'G', 0,
|
||||
/* 0x23 - 'h' */ 'h', 'H', 0,
|
||||
/* 0x24 - 'j' */ 'j', 'J', 0,
|
||||
/* 0x25 - 'k' */ 'k', 'K', 0,
|
||||
/* 0x26 - 'l' */ 'l', 'L', 0,
|
||||
/* 0x27 - ';' */ ';', ':', 0,
|
||||
/* 0x28 - '\'' */ '\'', '"', 0,
|
||||
/* 0x29 - '`' */ '`', '~', 0,
|
||||
/* 0x2A - l. SHIFT */ SHIFT_L, SHIFT_L, 0,
|
||||
/* 0x2B - '\' */ '\\', '|', 0,
|
||||
/* 0x2C - 'z' */ 'z', 'Z', 0,
|
||||
/* 0x2D - 'x' */ 'x', 'X', 0,
|
||||
/* 0x2E - 'c' */ 'c', 'C', 0,
|
||||
/* 0x2F - 'v' */ 'v', 'V', 0,
|
||||
/* 0x30 - 'b' */ 'b', 'B', 0,
|
||||
/* 0x31 - 'n' */ 'n', 'N', 0,
|
||||
/* 0x32 - 'm' */ 'm', 'M', 0,
|
||||
/* 0x33 - ',' */ ',', '<', 0,
|
||||
/* 0x34 - '.' */ '.', '>', 0,
|
||||
/* 0x35 - '/' */ '/', '?', PAD_SLASH,
|
||||
/* 0x36 - r. SHIFT */ SHIFT_R, SHIFT_R, 0,
|
||||
/* 0x37 - '*' */ '*', '*', 0,
|
||||
/* 0x38 - ALT */ ALT_L, ALT_L, ALT_R,
|
||||
/* 0x39 - ' ' */ ' ', ' ', 0,
|
||||
/* 0x3A - CapsLock */ CAPS_LOCK, CAPS_LOCK, 0,
|
||||
/* 0x3B - F1 */ F1, F1, 0,
|
||||
/* 0x3C - F2 */ F2, F2, 0,
|
||||
/* 0x3D - F3 */ F3, F3, 0,
|
||||
/* 0x3E - F4 */ F4, F4, 0,
|
||||
/* 0x3F - F5 */ F5, F5, 0,
|
||||
/* 0x40 - F6 */ F6, F6, 0,
|
||||
/* 0x41 - F7 */ F7, F7, 0,
|
||||
/* 0x42 - F8 */ F8, F8, 0,
|
||||
/* 0x43 - F9 */ F9, F9, 0,
|
||||
/* 0x44 - F10 */ F10, F10, 0,
|
||||
/* 0x45 - NumLock */ NUM_LOCK, NUM_LOCK, 0,
|
||||
/* 0x46 - ScrLock */ SCROLL_LOCK, SCROLL_LOCK, 0,
|
||||
/* 0x47 - Home */ PAD_HOME, '7', HOME,
|
||||
/* 0x48 - CurUp */ PAD_UP, '8', UP,
|
||||
/* 0x49 - PgUp */ PAD_PAGEUP, '9', PAGEUP,
|
||||
/* 0x4A - '-' */ PAD_MINUS, '-', 0,
|
||||
/* 0x4B - Left */ PAD_LEFT, '4', LEFT,
|
||||
/* 0x4C - MID */ PAD_MID, '5', 0,
|
||||
/* 0x4D - Right */ PAD_RIGHT, '6', RIGHT,
|
||||
/* 0x4E - '+' */ PAD_PLUS, '+', 0,
|
||||
/* 0x4F - End */ PAD_END, '1', END,
|
||||
/* 0x50 - Down */ PAD_DOWN, '2', DOWN,
|
||||
/* 0x51 - PgDown */ PAD_PAGEDOWN, '3', PAGEDOWN,
|
||||
/* 0x52 - Insert */ PAD_INS, '0', INSERT,
|
||||
/* 0x53 - Delete */ PAD_DOT, '.', DELETE,
|
||||
/* 0x54 - Enter */ 0, 0, 0,
|
||||
/* 0x55 - ??? */ 0, 0, 0,
|
||||
/* 0x56 - ??? */ 0, 0, 0,
|
||||
/* 0x57 - F11 */ F11, F11, 0,
|
||||
/* 0x58 - F12 */ F12, F12, 0,
|
||||
/* 0x59 - ??? */ 0, 0, 0,
|
||||
/* 0x5A - ??? */ 0, 0, 0,
|
||||
/* 0x5B - ??? */ 0, 0, GUI_L,
|
||||
/* 0x5C - ??? */ 0, 0, GUI_R,
|
||||
/* 0x5D - ??? */ 0, 0, APPS,
|
||||
/* 0x5E - ??? */ 0, 0, 0,
|
||||
/* 0x5F - ??? */ 0, 0, 0,
|
||||
/* 0x60 - ??? */ 0, 0, 0,
|
||||
/* 0x61 - ??? */ 0, 0, 0,
|
||||
/* 0x62 - ??? */ 0, 0, 0,
|
||||
/* 0x63 - ??? */ 0, 0, 0,
|
||||
/* 0x64 - ??? */ 0, 0, 0,
|
||||
/* 0x65 - ??? */ 0, 0, 0,
|
||||
/* 0x66 - ??? */ 0, 0, 0,
|
||||
/* 0x67 - ??? */ 0, 0, 0,
|
||||
/* 0x68 - ??? */ 0, 0, 0,
|
||||
/* 0x69 - ??? */ 0, 0, 0,
|
||||
/* 0x6A - ??? */ 0, 0, 0,
|
||||
/* 0x6B - ??? */ 0, 0, 0,
|
||||
/* 0x6C - ??? */ 0, 0, 0,
|
||||
/* 0x6D - ??? */ 0, 0, 0,
|
||||
/* 0x6E - ??? */ 0, 0, 0,
|
||||
/* 0x6F - ??? */ 0, 0, 0,
|
||||
/* 0x70 - ??? */ 0, 0, 0,
|
||||
/* 0x71 - ??? */ 0, 0, 0,
|
||||
/* 0x72 - ??? */ 0, 0, 0,
|
||||
/* 0x73 - ??? */ 0, 0, 0,
|
||||
/* 0x74 - ??? */ 0, 0, 0,
|
||||
/* 0x75 - ??? */ 0, 0, 0,
|
||||
/* 0x76 - ??? */ 0, 0, 0,
|
||||
/* 0x77 - ??? */ 0, 0, 0,
|
||||
/* 0x78 - ??? */ 0, 0, 0,
|
||||
/* 0x78 - ??? */ 0, 0, 0,
|
||||
/* 0x7A - ??? */ 0, 0, 0,
|
||||
/* 0x7B - ??? */ 0, 0, 0,
|
||||
/* 0x7C - ??? */ 0, 0, 0,
|
||||
/* 0x7D - ??? */ 0, 0, 0,
|
||||
/* 0x7E - ??? */ 0, 0, 0,
|
||||
/* 0x7F - ??? */ 0, 0, 0
|
||||
/* 0x00 - none */ 0, 0, 0,
|
||||
/* 0x01 - ESC */ ESC, ESC, 0,
|
||||
/* 0x02 - '1' */ '1', '!', 0,
|
||||
/* 0x03 - '2' */ '2', '@', 0,
|
||||
/* 0x04 - '3' */ '3', '#', 0,
|
||||
/* 0x05 - '4' */ '4', '$', 0,
|
||||
/* 0x06 - '5' */ '5', '%', 0,
|
||||
/* 0x07 - '6' */ '6', '^', 0,
|
||||
/* 0x08 - '7' */ '7', '&', 0,
|
||||
/* 0x09 - '8' */ '8', '*', 0,
|
||||
/* 0x0A - '9' */ '9', '(', 0,
|
||||
/* 0x0B - '0' */ '0', ')', 0,
|
||||
/* 0x0C - '-' */ '-', '_', 0,
|
||||
/* 0x0D - '=' */ '=', '+', 0,
|
||||
/* 0x0E - BS */ BACKSPACE, BACKSPACE, 0,
|
||||
/* 0x0F - TAB */ TAB, TAB, 0,
|
||||
/* 0x10 - 'q' */ 'q', 'Q', 0,
|
||||
/* 0x11 - 'w' */ 'w', 'W', 0,
|
||||
/* 0x12 - 'e' */ 'e', 'E', 0,
|
||||
/* 0x13 - 'r' */ 'r', 'R', 0,
|
||||
/* 0x14 - 't' */ 't', 'T', 0,
|
||||
/* 0x15 - 'y' */ 'y', 'Y', 0,
|
||||
/* 0x16 - 'u' */ 'u', 'U', 0,
|
||||
/* 0x17 - 'i' */ 'i', 'I', 0,
|
||||
/* 0x18 - 'o' */ 'o', 'O', 0,
|
||||
/* 0x19 - 'p' */ 'p', 'P', 0,
|
||||
/* 0x1A - '[' */ '[', '{', 0,
|
||||
/* 0x1B - ']' */ ']', '}', 0,
|
||||
/* 0x1C - CR/LF */ ENTER, ENTER, PAD_ENTER,
|
||||
/* 0x1D - l. Ctrl */ CTRL_L, CTRL_L, CTRL_R,
|
||||
/* 0x1E - 'a' */ 'a', 'A', 0,
|
||||
/* 0x1F - 's' */ 's', 'S', 0,
|
||||
/* 0x20 - 'd' */ 'd', 'D', 0,
|
||||
/* 0x21 - 'f' */ 'f', 'F', 0,
|
||||
/* 0x22 - 'g' */ 'g', 'G', 0,
|
||||
/* 0x23 - 'h' */ 'h', 'H', 0,
|
||||
/* 0x24 - 'j' */ 'j', 'J', 0,
|
||||
/* 0x25 - 'k' */ 'k', 'K', 0,
|
||||
/* 0x26 - 'l' */ 'l', 'L', 0,
|
||||
/* 0x27 - ';' */ ';', ':', 0,
|
||||
/* 0x28 - '\'' */ '\'', '"', 0,
|
||||
/* 0x29 - '`' */ '`', '~', 0,
|
||||
/* 0x2A - l. SHIFT */ SHIFT_L, SHIFT_L, 0,
|
||||
/* 0x2B - '\' */ '\\', '|', 0,
|
||||
/* 0x2C - 'z' */ 'z', 'Z', 0,
|
||||
/* 0x2D - 'x' */ 'x', 'X', 0,
|
||||
/* 0x2E - 'c' */ 'c', 'C', 0,
|
||||
/* 0x2F - 'v' */ 'v', 'V', 0,
|
||||
/* 0x30 - 'b' */ 'b', 'B', 0,
|
||||
/* 0x31 - 'n' */ 'n', 'N', 0,
|
||||
/* 0x32 - 'm' */ 'm', 'M', 0,
|
||||
/* 0x33 - ',' */ ',', '<', 0,
|
||||
/* 0x34 - '.' */ '.', '>', 0,
|
||||
/* 0x35 - '/' */ '/', '?', PAD_SLASH,
|
||||
/* 0x36 - r. SHIFT */ SHIFT_R, SHIFT_R, 0,
|
||||
/* 0x37 - '*' */ '*', '*', 0,
|
||||
/* 0x38 - ALT */ ALT_L, ALT_L, ALT_R,
|
||||
/* 0x39 - ' ' */ ' ', ' ', 0,
|
||||
/* 0x3A - CapsLock */ CAPS_LOCK, CAPS_LOCK, 0,
|
||||
/* 0x3B - F1 */ F1, F1, 0,
|
||||
/* 0x3C - F2 */ F2, F2, 0,
|
||||
/* 0x3D - F3 */ F3, F3, 0,
|
||||
/* 0x3E - F4 */ F4, F4, 0,
|
||||
/* 0x3F - F5 */ F5, F5, 0,
|
||||
/* 0x40 - F6 */ F6, F6, 0,
|
||||
/* 0x41 - F7 */ F7, F7, 0,
|
||||
/* 0x42 - F8 */ F8, F8, 0,
|
||||
/* 0x43 - F9 */ F9, F9, 0,
|
||||
/* 0x44 - F10 */ F10, F10, 0,
|
||||
/* 0x45 - NumLock */ NUM_LOCK, NUM_LOCK, 0,
|
||||
/* 0x46 - ScrLock */ SCROLL_LOCK, SCROLL_LOCK, 0,
|
||||
/* 0x47 - Home */ PAD_HOME, '7', HOME,
|
||||
/* 0x48 - CurUp */ PAD_UP, '8', UP,
|
||||
/* 0x49 - PgUp */ PAD_PAGEUP, '9', PAGEUP,
|
||||
/* 0x4A - '-' */ PAD_MINUS, '-', 0,
|
||||
/* 0x4B - Left */ PAD_LEFT, '4', LEFT,
|
||||
/* 0x4C - MID */ PAD_MID, '5', 0,
|
||||
/* 0x4D - Right */ PAD_RIGHT, '6', RIGHT,
|
||||
/* 0x4E - '+' */ PAD_PLUS, '+', 0,
|
||||
/* 0x4F - End */ PAD_END, '1', END,
|
||||
/* 0x50 - Down */ PAD_DOWN, '2', DOWN,
|
||||
/* 0x51 - PgDown */ PAD_PAGEDOWN, '3', PAGEDOWN,
|
||||
/* 0x52 - Insert */ PAD_INS, '0', INSERT,
|
||||
/* 0x53 - Delete */ PAD_DOT, '.', DELETE,
|
||||
/* 0x54 - Enter */ 0, 0, 0,
|
||||
/* 0x55 - ??? */ 0, 0, 0,
|
||||
/* 0x56 - ??? */ 0, 0, 0,
|
||||
/* 0x57 - F11 */ F11, F11, 0,
|
||||
/* 0x58 - F12 */ F12, F12, 0,
|
||||
/* 0x59 - ??? */ 0, 0, 0,
|
||||
/* 0x5A - ??? */ 0, 0, 0,
|
||||
/* 0x5B - ??? */ 0, 0, GUI_L,
|
||||
/* 0x5C - ??? */ 0, 0, GUI_R,
|
||||
/* 0x5D - ??? */ 0, 0, APPS,
|
||||
/* 0x5E - ??? */ 0, 0, 0,
|
||||
/* 0x5F - ??? */ 0, 0, 0,
|
||||
/* 0x60 - ??? */ 0, 0, 0,
|
||||
/* 0x61 - ??? */ 0, 0, 0,
|
||||
/* 0x62 - ??? */ 0, 0, 0,
|
||||
/* 0x63 - ??? */ 0, 0, 0,
|
||||
/* 0x64 - ??? */ 0, 0, 0,
|
||||
/* 0x65 - ??? */ 0, 0, 0,
|
||||
/* 0x66 - ??? */ 0, 0, 0,
|
||||
/* 0x67 - ??? */ 0, 0, 0,
|
||||
/* 0x68 - ??? */ 0, 0, 0,
|
||||
/* 0x69 - ??? */ 0, 0, 0,
|
||||
/* 0x6A - ??? */ 0, 0, 0,
|
||||
/* 0x6B - ??? */ 0, 0, 0,
|
||||
/* 0x6C - ??? */ 0, 0, 0,
|
||||
/* 0x6D - ??? */ 0, 0, 0,
|
||||
/* 0x6E - ??? */ 0, 0, 0,
|
||||
/* 0x6F - ??? */ 0, 0, 0,
|
||||
/* 0x70 - ??? */ 0, 0, 0,
|
||||
/* 0x71 - ??? */ 0, 0, 0,
|
||||
/* 0x72 - ??? */ 0, 0, 0,
|
||||
/* 0x73 - ??? */ 0, 0, 0,
|
||||
/* 0x74 - ??? */ 0, 0, 0,
|
||||
/* 0x75 - ??? */ 0, 0, 0,
|
||||
/* 0x76 - ??? */ 0, 0, 0,
|
||||
/* 0x77 - ??? */ 0, 0, 0,
|
||||
/* 0x78 - ??? */ 0, 0, 0,
|
||||
/* 0x78 - ??? */ 0, 0, 0,
|
||||
/* 0x7A - ??? */ 0, 0, 0,
|
||||
/* 0x7B - ??? */ 0, 0, 0,
|
||||
/* 0x7C - ??? */ 0, 0, 0,
|
||||
/* 0x7D - ??? */ 0, 0, 0,
|
||||
/* 0x7E - ??? */ 0, 0, 0,
|
||||
/* 0x7F - ??? */ 0, 0, 0
|
||||
};
|
||||
|
||||
/*====================================================================================*
|
||||
Appendix: Scan code set 1
|
||||
Appendix: Scan code set 1
|
||||
*====================================================================================*
|
||||
|
||||
KEY MAKE BREAK ----- KEY MAKE BREAK ----- KEY MAKE BREAK
|
||||
KEY MAKE BREAK ----- KEY MAKE BREAK ----- KEY MAKE BREAK
|
||||
--------------------------------------------------------------------------------------
|
||||
A 1E 9E 9 0A 8A [ 1A 9A
|
||||
B 30 B0 ` 29 89 INSERT E0,52 E0,D2
|
||||
C 2E AE - 0C 8C HOME E0,47 E0,C7
|
||||
D 20 A0 = 0D 8D PG UP E0,49 E0,C9
|
||||
E 12 92 \ 2B AB DELETE E0,53 E0,D3
|
||||
F 21 A1 BKSP 0E 8E END E0,4F E0,CF
|
||||
G 22 A2 SPACE 39 B9 PG DN E0,51 E0,D1
|
||||
H 23 A3 TAB 0F 8F U ARROW E0,48 E0,C8
|
||||
I 17 97 CAPS 3A BA L ARROW E0,4B E0,CB
|
||||
J 24 A4 L SHFT 2A AA D ARROW E0,50 E0,D0
|
||||
K 25 A5 L CTRL 1D 9D R ARROW E0,4D E0,CD
|
||||
L 26 A6 L GUI E0,5B E0,DB NUM 45 C5
|
||||
M 32 B2 L ALT 38 B8 KP / E0,35 E0,B5
|
||||
N 31 B1 R SHFT 36 B6 KP * 37 B7
|
||||
O 18 98 R CTRL E0,1D E0,9D KP - 4A CA
|
||||
P 19 99 R GUI E0,5C E0,DC KP + 4E CE
|
||||
Q 10 19 R ALT E0,38 E0,B8 KP EN E0,1C E0,9C
|
||||
R 13 93 APPS E0,5D E0,DD KP . 53 D3
|
||||
S 1F 9F ENTER 1C 9C KP 0 52 D2
|
||||
T 14 94 ESC 01 81 KP 1 4F CF
|
||||
U 16 96 F1 3B BB KP 2 50 D0
|
||||
V 2F AF F2 3C BC KP 3 51 D1
|
||||
W 11 91 F3 3D BD KP 4 4B CB
|
||||
X 2D AD F4 3E BE KP 5 4C CC
|
||||
Y 15 95 F5 3F BF KP 6 4D CD
|
||||
Z 2C AC F6 40 C0 KP 7 47 C7
|
||||
0 0B 8B F7 41 C1 KP 8 48 C8
|
||||
1 02 82 F8 42 C2 KP 9 49 C9
|
||||
2 03 83 F9 43 C3 ] 1B 9B
|
||||
3 04 84 F10 44 C4 ; 27 A7
|
||||
4 05 85 F11 57 D7 ' 28 A8
|
||||
5 06 86 F12 58 D8 , 33 B3
|
||||
A 1E 9E 9 0A 8A [ 1A 9A
|
||||
B 30 B0 ` 29 89 INSERT E0,52 E0,D2
|
||||
C 2E AE - 0C 8C HOME E0,47 E0,C7
|
||||
D 20 A0 = 0D 8D PG UP E0,49 E0,C9
|
||||
E 12 92 \ 2B AB DELETE E0,53 E0,D3
|
||||
F 21 A1 BKSP 0E 8E END E0,4F E0,CF
|
||||
G 22 A2 SPACE 39 B9 PG DN E0,51 E0,D1
|
||||
H 23 A3 TAB 0F 8F U ARROW E0,48 E0,C8
|
||||
I 17 97 CAPS 3A BA L ARROW E0,4B E0,CB
|
||||
J 24 A4 L SHFT 2A AA D ARROW E0,50 E0,D0
|
||||
K 25 A5 L CTRL 1D 9D R ARROW E0,4D E0,CD
|
||||
L 26 A6 L GUI E0,5B E0,DB NUM 45 C5
|
||||
M 32 B2 L ALT 38 B8 KP / E0,35 E0,B5
|
||||
N 31 B1 R SHFT 36 B6 KP * 37 B7
|
||||
O 18 98 R CTRL E0,1D E0,9D KP - 4A CA
|
||||
P 19 99 R GUI E0,5C E0,DC KP + 4E CE
|
||||
Q 10 19 R ALT E0,38 E0,B8 KP EN E0,1C E0,9C
|
||||
R 13 93 APPS E0,5D E0,DD KP . 53 D3
|
||||
S 1F 9F ENTER 1C 9C KP 0 52 D2
|
||||
T 14 94 ESC 01 81 KP 1 4F CF
|
||||
U 16 96 F1 3B BB KP 2 50 D0
|
||||
V 2F AF F2 3C BC KP 3 51 D1
|
||||
W 11 91 F3 3D BD KP 4 4B CB
|
||||
X 2D AD F4 3E BE KP 5 4C CC
|
||||
Y 15 95 F5 3F BF KP 6 4D CD
|
||||
Z 2C AC F6 40 C0 KP 7 47 C7
|
||||
0 0B 8B F7 41 C1 KP 8 48 C8
|
||||
1 02 82 F8 42 C2 KP 9 49 C9
|
||||
2 03 83 F9 43 C3 ] 1B 9B
|
||||
3 04 84 F10 44 C4 ; 27 A7
|
||||
4 05 85 F11 57 D7 ' 28 A8
|
||||
5 06 86 F12 58 D8 , 33 B3
|
||||
|
||||
6 07 87 PRTSCRN E0,2A E0,B7 . 34 B4
|
||||
E0,37 E0,AA
|
||||
6 07 87 PRTSCRN E0,2A E0,B7 . 34 B4
|
||||
E0,37 E0,AA
|
||||
|
||||
7 08 88 SCROLL 46 C6 / 35 B5
|
||||
7 08 88 SCROLL 46 C6 / 35 B5
|
||||
|
||||
8 09 89 PAUSE E1,1D,45 -NONE-
|
||||
E1,9D,C5
|
||||
8 09 89 PAUSE E1,1D,45 -NONE-
|
||||
E1,9D,C5
|
||||
|
||||
|
||||
-----------------
|
||||
ACPI Scan Codes:
|
||||
-------------------------------------------
|
||||
Key Make Code Break Code
|
||||
Key Make Code Break Code
|
||||
-------------------------------------------
|
||||
Power E0, 5E E0, DE
|
||||
Sleep E0, 5F E0, DF
|
||||
Wake E0, 63 E0, E3
|
||||
Power E0, 5E E0, DE
|
||||
Sleep E0, 5F E0, DF
|
||||
Wake E0, 63 E0, E3
|
||||
|
||||
|
||||
-------------------------------
|
||||
Windows Multimedia Scan Codes:
|
||||
-------------------------------------------
|
||||
Key Make Code Break Code
|
||||
Key Make Code Break Code
|
||||
-------------------------------------------
|
||||
Next Track E0, 19 E0, 99
|
||||
Previous Track E0, 10 E0, 90
|
||||
Stop E0, 24 E0, A4
|
||||
Play/Pause E0, 22 E0, A2
|
||||
Mute E0, 20 E0, A0
|
||||
Volume Up E0, 30 E0, B0
|
||||
Volume Down E0, 2E E0, AE
|
||||
Media Select E0, 6D E0, ED
|
||||
E-Mail E0, 6C E0, EC
|
||||
Calculator E0, 21 E0, A1
|
||||
My Computer E0, 6B E0, EB
|
||||
WWW Search E0, 65 E0, E5
|
||||
WWW Home E0, 32 E0, B2
|
||||
WWW Back E0, 6A E0, EA
|
||||
WWW Forward E0, 69 E0, E9
|
||||
WWW Stop E0, 68 E0, E8
|
||||
WWW Refresh E0, 67 E0, E7
|
||||
WWW Favorites E0, 66 E0, E6
|
||||
Next Track E0, 19 E0, 99
|
||||
Previous Track E0, 10 E0, 90
|
||||
Stop E0, 24 E0, A4
|
||||
Play/Pause E0, 22 E0, A2
|
||||
Mute E0, 20 E0, A0
|
||||
Volume Up E0, 30 E0, B0
|
||||
Volume Down E0, 2E E0, AE
|
||||
Media Select E0, 6D E0, ED
|
||||
E-Mail E0, 6C E0, EC
|
||||
Calculator E0, 21 E0, A1
|
||||
My Computer E0, 6B E0, EB
|
||||
WWW Search E0, 65 E0, E5
|
||||
WWW Home E0, 32 E0, B2
|
||||
WWW Back E0, 6A E0, EA
|
||||
WWW Forward E0, 69 E0, E9
|
||||
WWW Stop E0, 68 E0, E8
|
||||
WWW Refresh E0, 67 E0, E7
|
||||
WWW Favorites E0, 66 E0, E6
|
||||
|
||||
*=====================================================================================*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -24,17 +24,17 @@
|
|||
*/
|
||||
void rt_serial_init(void)
|
||||
{
|
||||
outb(COM1+3,0x80); /* set DLAB of line control reg */
|
||||
outb(COM1,0x0c); /* LS of divisor (48 -> 2400 bps */
|
||||
outb(COM1+1,0x00); /* MS of divisor */
|
||||
outb(COM1+3,0x03); /* reset DLAB */
|
||||
outb(COM1+4,0x0b); /* set DTR,RTS, OUT_2 */
|
||||
outb(COM1+1,0x0d); /* enable all intrs but writes */
|
||||
inb(COM1); /* read data port to reset things (?) */
|
||||
outb(COM1+3,0x80); /* set DLAB of line control reg */
|
||||
outb(COM1,0x0c); /* LS of divisor (48 -> 2400 bps */
|
||||
outb(COM1+1,0x00); /* MS of divisor */
|
||||
outb(COM1+3,0x03); /* reset DLAB */
|
||||
outb(COM1+4,0x0b); /* set DTR,RTS, OUT_2 */
|
||||
outb(COM1+1,0x0d); /* enable all intrs but writes */
|
||||
inb(COM1); /* read data port to reset things (?) */
|
||||
}
|
||||
|
||||
/**
|
||||
* This function read a character from serial without interrupt enable mode
|
||||
* This function read a character from serial without interrupt enable mode
|
||||
*
|
||||
* @return the read char
|
||||
*/
|
||||
|
@ -53,13 +53,13 @@ char rt_serial_getc(void)
|
|||
void rt_serial_putc(const char c)
|
||||
{
|
||||
int val;
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
if ((val = inb(COM1+COMSTATUS)) & THRE)
|
||||
if ((val = inb(COM1+COMSTATUS)) & THRE)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
outb(COM1+COMWRITE, c&0xff);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,28 +9,28 @@ extern void rt_kprintf(const char* fmt,...);
|
|||
|
||||
int add(int a, int b)
|
||||
{
|
||||
return a+b;
|
||||
return a+b;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
char str[32] = "Hello World\n";
|
||||
int i;
|
||||
char str[32] = "Hello World\n";
|
||||
|
||||
for(i=0; i<argc; i++)
|
||||
{
|
||||
printf("argv[%d]='%s'\n", i, argv[i]);
|
||||
}
|
||||
for(i=0; i<argc; i++)
|
||||
{
|
||||
printf("argv[%d]='%s'\n", i, argv[i]);
|
||||
}
|
||||
|
||||
printf(str);
|
||||
printf(str);
|
||||
|
||||
printf("g_str address is %ph\n",g_str);
|
||||
puts(g_str);
|
||||
printf("g_str address is %ph\n",g_str);
|
||||
puts(g_str);
|
||||
|
||||
rt_kprintf("\nnative rt_kprintf a(%ph)=%d, b(%ph)=%d\n", &a, a, &b, b);
|
||||
rt_kprintf("\nnative rt_kprintf a(%ph)=%d, b(%ph)=%d\n", &a, a, &b, b);
|
||||
|
||||
printf("%d+%d=%d\n", 4, 5, add(4, 5));
|
||||
printf("%d+%d=%d\n", 4, 5, add(4, 5));
|
||||
|
||||
return 0xdeadbeef;
|
||||
return 0xdeadbeef;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue