Skip to content

Commit ca867e8

Browse files
authored
Merge pull request #4450 from mysterywolf/x86
[x86][drivers] auto formatted
2 parents 7ae652c + ed97957 commit ca867e8

File tree

11 files changed

+715
-715
lines changed

11 files changed

+715
-715
lines changed

bsp/x86/drivers/console.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static void rt_cga_putc(int c)
8787
break;
8888
case '\n':
8989
crt_pos += CRT_COLS;
90-
/* cascade */
90+
/* cascade */
9191
case '\r':
9292
crt_pos -= (crt_pos % CRT_COLS);
9393
break;
@@ -99,7 +99,7 @@ static void rt_cga_putc(int c)
9999
rt_console_putc(' ');
100100
break;
101101
default:
102-
crt_buf[crt_pos++] = c; /* write the character */
102+
crt_buf[crt_pos++] = c; /* write the character */
103103
break;
104104
}
105105

@@ -289,14 +289,14 @@ int rt_hw_console_init(void)
289289
rt_hw_interrupt_install(INTUART0_RX, rt_console_isr, RT_NULL, "COM1");
290290
rt_hw_interrupt_umask(INTUART0_RX);
291291

292-
console_device.type = RT_Device_Class_Char;
292+
console_device.type = RT_Device_Class_Char;
293293
console_device.rx_indicate = RT_NULL;
294294
console_device.tx_complete = RT_NULL;
295-
console_device.init = rt_console_init;
296-
console_device.open = rt_console_open;
297-
console_device.close = rt_console_close;
298-
console_device.read = rt_console_read;
299-
console_device.write = rt_console_write;
295+
console_device.init = rt_console_init;
296+
console_device.open = rt_console_open;
297+
console_device.close = rt_console_close;
298+
console_device.read = rt_console_read;
299+
console_device.write = rt_console_write;
300300
console_device.control = rt_console_control;
301301
console_device.user_data = RT_NULL;
302302

@@ -316,8 +316,8 @@ INIT_DEVICE_EXPORT(rt_hw_console_init);
316316
* @param str the displayed string
317317
*
318318
* Modified:
319-
* caoxl 2009-10-14
320-
* the name is change to rt_hw_console_output in the v0.3.0
319+
* caoxl 2009-10-14
320+
* the name is change to rt_hw_console_output in the v0.3.0
321321
*
322322
*/
323323
void rt_hw_console_output(const char* str)

bsp/x86/drivers/dma.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static __inline__ void ClearDmaFF(unsigned int dmanr)
101101
OUTB(0, DMA2_CLEAR_FF_REG);
102102
}
103103

104-
/*
104+
/*
105105
* 清空DMA 晶体计数器
106106
*/
107107
static __inline__ void SetDmaMode(unsigned int dmanr, char mode)

bsp/x86/drivers/floppy.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ typedef rt_int32_t s32;
3131

3232
static u8 floppy_buffer[512]; /* 软盘高速缓冲区地址指针 */
3333

34-
#define MAX_REPLIES 7
34+
#define MAX_REPLIES 7
3535
static u8 floppy_reply_buffer[MAX_REPLIES]; /* 软驱回应缓冲区 */
3636
#define ST0 (floppy_reply_buffer[0]) /* 软驱回应0号字节 */
3737
#define ST1 (floppy_reply_buffer[1]) /* 软驱回应1号字节 */
@@ -114,7 +114,7 @@ u32 floppy_get_info(void)
114114
u8 CmType, FdType;
115115

116116
floppy_sendbyte(0x10);
117-
i = floppy_getbyte();
117+
i = floppy_getbyte();
118118

119119
switch (i)
120120
{
@@ -180,7 +180,7 @@ void floppy_motorOff( void )
180180

181181

182182
void floppy_setmode(void)
183-
{
183+
{
184184
floppy_sendbyte (FD_SPECIFY);
185185
floppy_sendbyte (0xcf);
186186
floppy_sendbyte (0x06);
@@ -197,7 +197,7 @@ void block_to_hts(u32 block, u32 *head, u32 *track, u32 *sector )
197197

198198

199199
void floppy_setupDMA(void)
200-
{
200+
{
201201
u32 eflags;
202202
_local_irq_save(eflags);
203203
DisableDma(2);
@@ -235,7 +235,7 @@ void floppy_read_cmd(u32 blk)
235235
floppy_sendbyte (18);
236236
//floppy_sendbyte (sector+secs-1); /* Last sector in track:here are sectors count */
237237
floppy_sendbyte (0x1B);
238-
floppy_sendbyte (0xff);
238+
floppy_sendbyte (0xff);
239239
return;
240240
}
241241

@@ -282,12 +282,12 @@ static rt_size_t rt_floppy_read(rt_device_t device, rt_off_t position, void *buf
282282
{
283283
panic("ST0 %d ST1 %d ST2 %d\n",ST0,ST1,ST2);
284284
}
285-
285+
286286
rt_memcpy(buffer, floppy_buffer, 512);
287287

288288
floppy_motorOff();
289289
io_delay();
290-
290+
291291
position += 1;
292292
size -= 1;
293293
}

bsp/x86/drivers/include/bsp.h

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -15,127 +15,127 @@
1515
#ifdef __cplusplus
1616
extern "C" {
1717
#endif
18-
18+
1919
/*******************************************************************/
2020
/* Timer Register */
2121
/*******************************************************************/
22-
#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
23-
#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
24-
#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
25-
#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
26-
#define TIMER_SEL0 0x00 /* select counter 0 */
27-
#define TIMER_SEL1 0x40 /* select counter 1 */
28-
#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
29-
#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
30-
#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
31-
#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
32-
#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
33-
#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
34-
#define TIMER_LATCH 0x00 /* latch counter for reading */
35-
#define TIMER_LSB 0x10 /* r/w counter LSB */
36-
#define TIMER_MSB 0x20 /* r/w counter MSB */
37-
#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
38-
#define TIMER_BCD 0x01 /* count in BCD */
39-
40-
#define TIMER_FREQ 1193182
41-
#define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x))
42-
43-
#define IO_TIMER1 0x040 /* 8253 Timer #1 */
22+
#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
23+
#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
24+
#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
25+
#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
26+
#define TIMER_SEL0 0x00 /* select counter 0 */
27+
#define TIMER_SEL1 0x40 /* select counter 1 */
28+
#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
29+
#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
30+
#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
31+
#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
32+
#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
33+
#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
34+
#define TIMER_LATCH 0x00 /* latch counter for reading */
35+
#define TIMER_LSB 0x10 /* r/w counter LSB */
36+
#define TIMER_MSB 0x20 /* r/w counter MSB */
37+
#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
38+
#define TIMER_BCD 0x01 /* count in BCD */
39+
40+
#define TIMER_FREQ 1193182
41+
#define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x))
42+
43+
#define IO_TIMER1 0x040 /* 8253 Timer #1 */
4444

4545
/*******************************************************************/
4646
/* Interrupt Controller */
4747
/*******************************************************************/
4848
/* these are processor defined */
49-
#define T_DIVIDE 0 /* divide error */
50-
#define T_DEBUG 1 /* debug exception */
51-
#define T_NMI 2 /* non-maskable interrupt */
52-
#define T_BRKPT 3 /* breakpoint */
53-
#define T_OFLOW 4 /* overflow */
54-
#define T_BOUND 5 /* bounds check */
55-
#define T_ILLOP 6 /* illegal opcode */
56-
#define T_DEVICE 7 /* device not available */
57-
#define T_DBLFLT 8 /* double fault */
49+
#define T_DIVIDE 0 /* divide error */
50+
#define T_DEBUG 1 /* debug exception */
51+
#define T_NMI 2 /* non-maskable interrupt */
52+
#define T_BRKPT 3 /* breakpoint */
53+
#define T_OFLOW 4 /* overflow */
54+
#define T_BOUND 5 /* bounds check */
55+
#define T_ILLOP 6 /* illegal opcode */
56+
#define T_DEVICE 7 /* device not available */
57+
#define T_DBLFLT 8 /* double fault */
5858
/* 9 is reserved */
59-
#define T_TSS 10 /* invalid task switch segment */
60-
#define T_SEGNP 11 /* segment not present */
61-
#define T_STACK 12 /* stack exception */
62-
#define T_GPFLT 13 /* genernal protection fault */
63-
#define T_PGFLT 14 /* page fault */
59+
#define T_TSS 10 /* invalid task switch segment */
60+
#define T_SEGNP 11 /* segment not present */
61+
#define T_STACK 12 /* stack exception */
62+
#define T_GPFLT 13 /* genernal protection fault */
63+
#define T_PGFLT 14 /* page fault */
6464
/* 15 is reserved */
65-
#define T_FPERR 16 /* floating point error */
66-
#define T_ALIGN 17 /* aligment check */
67-
#define T_MCHK 18 /* machine check */
68-
#define T_DEFAULT 500 /* catchall */
69-
70-
#define INTTIMER0 0
71-
#define INTKEYBOARD 1
72-
#define INTUART0_RX 4
73-
#define CLOCK_IRQ 0
74-
#define KEYBOARD_IRQ 1
75-
#define CASCADE_IRQ 2 /* cascade enable for 2nd AT controller */
76-
#define ETHER_IRQ 3 /* default ethernet interrupt vector */
77-
#define SECONDARY_IRQ 3 /* RS232 interrupt vector for port 2 */
78-
#define RS232_IRQ 4 /* RS232 interrupt vector for port 1 */
79-
#define XT_WINI_IRQ 5 /* xt winchester */
80-
#define FLOPPY_IRQ 6 /* floppy disk */
81-
#define PRINTER_IRQ 7
82-
#define AT_WINI_IRQ 14 /* at winchester */
65+
#define T_FPERR 16 /* floating point error */
66+
#define T_ALIGN 17 /* aligment check */
67+
#define T_MCHK 18 /* machine check */
68+
#define T_DEFAULT 500 /* catchall */
69+
70+
#define INTTIMER0 0
71+
#define INTKEYBOARD 1
72+
#define INTUART0_RX 4
73+
#define CLOCK_IRQ 0
74+
#define KEYBOARD_IRQ 1
75+
#define CASCADE_IRQ 2 /* cascade enable for 2nd AT controller */
76+
#define ETHER_IRQ 3 /* default ethernet interrupt vector */
77+
#define SECONDARY_IRQ 3 /* RS232 interrupt vector for port 2 */
78+
#define RS232_IRQ 4 /* RS232 interrupt vector for port 1 */
79+
#define XT_WINI_IRQ 5 /* xt winchester */
80+
#define FLOPPY_IRQ 6 /* floppy disk */
81+
#define PRINTER_IRQ 7
82+
#define AT_WINI_IRQ 14 /* at winchester */
8383
/* I/O Addresses of the two 8259A programmable interrupt controllers */
84-
#define IO_PIC1 0x20 /* Master(IRQs 0-7) */
85-
#define IO_PIC2 0xa0 /* Slave(IRQs 8-15) */
86-
#define IRQ_SLAVE 0x2 /* IRQ at which slave connects to master */
87-
#define IRQ_OFFSET 0x20 /* IRQ 0 corresponds to int IRQ_OFFSET */
84+
#define IO_PIC1 0x20 /* Master(IRQs 0-7) */
85+
#define IO_PIC2 0xa0 /* Slave(IRQs 8-15) */
86+
#define IRQ_SLAVE 0x2 /* IRQ at which slave connects to master */
87+
#define IRQ_OFFSET 0x20 /* IRQ 0 corresponds to int IRQ_OFFSET */
8888

89-
#define MAX_HANDLERS 16 /*max number of isr handler*/
89+
#define MAX_HANDLERS 16 /*max number of isr handler*/
9090

9191
/*******************************************************************/
9292
/* CRT Register */
9393
/*******************************************************************/
94-
#define MONO_BASE 0x3b4
95-
#define MONO_BUF 0xb0000
96-
#define CGA_BASE 0x3d4
97-
#define CGA_BUF 0xb8000
94+
#define MONO_BASE 0x3b4
95+
#define MONO_BUF 0xb0000
96+
#define CGA_BASE 0x3d4
97+
#define CGA_BUF 0xb8000
9898

99-
#define CRT_ROWS 25
100-
#define CRT_COLS 80
101-
#define CRT_SIZE (CRT_ROWS * CRT_COLS)
99+
#define CRT_ROWS 25
100+
#define CRT_COLS 80
101+
#define CRT_SIZE (CRT_ROWS * CRT_COLS)
102102

103103
/*******************************************************************/
104104
/* Keyboard Register */
105105
/*******************************************************************/
106-
#define KBSTATP 0x64 /* kbd controller status port(I) */
107-
#define KBS_DIB 0x01 /* kbd data in buffer */
108-
#define KBDATAP 0x60 /* kbd data port(I) */
106+
#define KBSTATP 0x64 /* kbd controller status port(I) */
107+
#define KBS_DIB 0x01 /* kbd data in buffer */
108+
#define KBDATAP 0x60 /* kbd data port(I) */
109109
/* AT keyboard */
110110
/* 8042 ports */
111-
#define KB_DATA 0x60 /* I/O port for keyboard data
112-
* Read : Read Output Buffer
111+
#define KB_DATA 0x60 /* I/O port for keyboard data
112+
* Read : Read Output Buffer
113113
* Write: Write Input Buffer(8042 Data&8048 Command) */
114-
#define KB_CMD 0x64 /* I/O port for keyboard command
114+
#define KB_CMD 0x64 /* I/O port for keyboard command
115115
* Read : Read Status Register
116116
* Write: Write Input Buffer(8042 Command) */
117-
#define LED_CODE 0xED
118-
#define KB_ACK 0xFA
117+
#define LED_CODE 0xED
118+
#define KB_ACK 0xFA
119119

120120
/*******************************************************************/
121121
/* Serial Register */
122122
/*******************************************************************/
123123
/*Serial I/O code */
124-
#define COM1 0x3F8
125-
#define COMSTATUS 5
126-
#define COMDATA 0x01
127-
#define COMREAD 0
128-
#define COMWRITE 0
124+
#define COM1 0x3F8
125+
#define COMSTATUS 5
126+
#define COMDATA 0x01
127+
#define COMREAD 0
128+
#define COMWRITE 0
129129

130130
/* Bits definition of the Line Status Register (LSR)*/
131-
#define DR 0x01 /* Data Ready */
132-
#define OE 0x02 /* Overrun Error */
133-
#define PE 0x04 /* Parity Error */
134-
#define FE 0x08 /* Framing Error */
135-
#define BI 0x10 /* Break Interrupt */
136-
#define THRE 0x20 /* Transmitter Holding Register Empty */
137-
#define TEMT 0x40 /* Transmitter Empty */
138-
#define ERFIFO 0x80 /* Error receive Fifo */
131+
#define DR 0x01 /* Data Ready */
132+
#define OE 0x02 /* Overrun Error */
133+
#define PE 0x04 /* Parity Error */
134+
#define FE 0x08 /* Framing Error */
135+
#define BI 0x10 /* Break Interrupt */
136+
#define THRE 0x20 /* Transmitter Holding Register Empty */
137+
#define TEMT 0x40 /* Transmitter Empty */
138+
#define ERFIFO 0x80 /* Error receive Fifo */
139139

140140
#ifdef __cplusplus
141141
}

bsp/x86/drivers/include/grub.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
*
66
* Change Logs:
77
* Date Author Notes
8-
* 2006-10-09 Bernard the grub related definitions
8+
* 2006-10-09 Bernard the grub related definitions
99
* (multiboot)
1010
*/
1111

1212
#ifndef __GRUB_H__
1313
#define __GRUB_H__
1414

1515
/* the magic number for the multiboot header. */
16-
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
16+
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
1717

1818
/* the flags for the multiboot header. */
19-
#define MULTIBOOT_HEADER_FLAGS 0x00000003
19+
#define MULTIBOOT_HEADER_FLAGS 0x00000003
2020

2121
/* the magic number passed by a multiboot-compliant boot loader. */
22-
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
22+
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
2323

2424
#ifndef __ASM__
2525
/* the multiboot header. */

bsp/x86/drivers/include/i386.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ static __inline unsigned int inl(int port)
4444

4545
static __inline void insl(int port, void *addr, int cnt)
4646
{
47-
__asm __volatile("cld\n\trepne\n\tinsl" :
48-
"=D" (addr), "=c" (cnt) :
49-
"d" (port), "0" (addr), "1" (cnt) :
47+
__asm __volatile("cld\n\trepne\n\tinsl" :
48+
"=D" (addr), "=c" (cnt) :
49+
"d" (port), "0" (addr), "1" (cnt) :
5050
"memory", "cc");
5151
}
5252

0 commit comments

Comments
 (0)