Merge pull request #4450 from mysterywolf/x86

[x86][drivers] auto formatted
This commit is contained in:
Bernard Xiong authored and GitHub committed 2021-03-12 16:12:48 +08:00
commit ca867e8c06
11 files changed
+691 -691

No files matched your search

+10 -10
View File
@@ -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)
+1 -1
View File
@@ -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)
+7 -7
View File
@@ -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;
}
File diff suppressed because it is too large. Load diff
+4 -4
View File
@@ -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. */
+3 -3
View File
@@ -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");
}
+272 -272
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+193 -193
View File
File diff suppressed because it is too large. Load diff
+12 -12
View File
@@ -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);
}
+13 -13
View File
@@ -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;
}