summaryrefslogtreecommitdiff
path: root/bsp/x86/drivers/console.c
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-05-28 16:20:08 +0800
committerGitHub <[email protected]>2021-05-28 16:20:08 +0800
commit92beddf3bccf6346e26aa097f82464456fb8e6bd (patch)
tree197e4a108118dda016ea02274172f0c40e7ee8ed /bsp/x86/drivers/console.c
parentb18a99b44240ec3152011e159cc24a5af8dff0ce (diff)
parent03f4d40e30f3c94e1db0b3a65b3610dee695694a (diff)
Merge pull request #4737 from mysterywolf/3,1,xformatv3.1.5
[lts 3.1.x] format codes
Diffstat (limited to 'bsp/x86/drivers/console.c')
-rw-r--r--bsp/x86/drivers/console.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/bsp/x86/drivers/console.c b/bsp/x86/drivers/console.c
index e8fc66093a..6741efb714 100644
--- a/bsp/x86/drivers/console.c
+++ b/bsp/x86/drivers/console.c
@@ -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;
}
@@ -214,47 +214,47 @@ static rt_size_t rt_console_read(rt_device_t dev, rt_off_t pos, void* buffer, rt
static void rt_console_isr(int vector, void* param)
{
char c;
- rt_bool_t ret;
+ rt_bool_t ret;
rt_base_t level;
- if(INTUART0_RX == vector)
- {
- c = rt_serial_getc();
- ret = RT_TRUE;
- }
- else
- {
- rt_keyboard_isr();
+ if(INTUART0_RX == vector)
+ {
+ c = rt_serial_getc();
+ ret = RT_TRUE;
+ }
+ else
+ {
+ rt_keyboard_isr();
- ret = rt_keyboard_getc(&c);
- }
+ ret = rt_keyboard_getc(&c);
+ }
- if(ret == RT_FALSE)
- {
- /* do nothing */
- }
- else
- {
- /* disable interrupt */
- level = rt_hw_interrupt_disable();
+ if(ret == RT_FALSE)
+ {
+ /* do nothing */
+ }
+ else
+ {
+ /* disable interrupt */
+ level = rt_hw_interrupt_disable();
- /* save character */
- rx_buffer[save_index] = c;
- save_index ++;
- if (save_index >= CONSOLE_RX_BUFFER_SIZE)
- save_index = 0;
+ /* save character */
+ rx_buffer[save_index] = c;
+ save_index ++;
+ if (save_index >= CONSOLE_RX_BUFFER_SIZE)
+ save_index = 0;
- /* if the next position is read index, discard this 'read char' */
- if (save_index == read_index)
- {
- read_index ++;
- if (read_index >= CONSOLE_RX_BUFFER_SIZE)
- read_index = 0;
- }
+ /* if the next position is read index, discard this 'read char' */
+ if (save_index == read_index)
+ {
+ read_index ++;
+ if (read_index >= CONSOLE_RX_BUFFER_SIZE)
+ read_index = 0;
+ }
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
- }
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+ }
/* invoke callback */
if (console_device.rx_indicate != RT_NULL)
@@ -263,8 +263,8 @@ static void rt_console_isr(int vector, void* param)
/* get rx length */
rx_length = read_index > save_index ?
- CONSOLE_RX_BUFFER_SIZE - read_index + save_index :
- save_index - read_index;
+ CONSOLE_RX_BUFFER_SIZE - read_index + save_index :
+ save_index - read_index;
if(rx_length > 0)
{
@@ -284,8 +284,8 @@ static void rt_console_isr(int vector, void* param)
void rt_hw_console_init(void)
{
rt_cga_init();
- rt_serial_init();
- init_keyboard();
+ rt_serial_init();
+ init_keyboard();
/* install keyboard isr */
rt_hw_interrupt_install(INTKEYBOARD, rt_console_isr, RT_NULL, "kbd");
@@ -294,14 +294,14 @@ void 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;
@@ -318,8 +318,8 @@ void rt_hw_console_init(void)
* @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)