From 5e7d87b0eea9417e9ba52a56774970185eab24a6 Mon Sep 17 00:00:00 2001 From: Shikhin Sethi Date: Tue, 15 Oct 2013 11:26:35 +0530 Subject: [PATCH] tart: match new coding conventions. --- arch/arm/exceptions.S | 6 ++++++ arch/arm/include/arm.h | 3 +++ arch/arm/include/utility.h | 4 ++++ arch/arm/link.ld | 4 ++++ arch/arm/start.S | 28 ++++++++++++++++------------ include/asm.h | 8 ++++++-- kernel/init.c | 8 ++++++-- platform/bcm2835/include/gpio.h | 4 ++++ platform/bcm2835/include/uart.h | 4 ++++ platform/bcm2835/uart.c | 18 ++++++++---------- 10 files changed, 61 insertions(+), 26 deletions(-) diff --git a/arch/arm/exceptions.S b/arch/arm/exceptions.S index c3c17d2..a22a5a4 100644 --- a/arch/arm/exceptions.S +++ b/arch/arm/exceptions.S @@ -1,3 +1,7 @@ +/* + * Exceptions support. + */ + #include #include @@ -42,6 +46,8 @@ rfeia sp! .endm +#else + #error ARM versions below ARMv6 not supported yet. #endif /* diff --git a/arch/arm/include/arm.h b/arch/arm/include/arm.h index a8440a8..f5d0027 100644 --- a/arch/arm/include/arm.h +++ b/arch/arm/include/arm.h @@ -1,3 +1,6 @@ +/* + * ARM related definitions. + */ #ifndef _ARM_H #define _ARM_H diff --git a/arch/arm/include/utility.h b/arch/arm/include/utility.h index 7c75c00..a8f4c55 100644 --- a/arch/arm/include/utility.h +++ b/arch/arm/include/utility.h @@ -1,3 +1,7 @@ +/* + * Utility functions. + */ + #ifndef _UTILITY_H #define _UTILITY_H diff --git a/arch/arm/link.ld b/arch/arm/link.ld index 4cec4ca..fe62ad6 100644 --- a/arch/arm/link.ld +++ b/arch/arm/link.ld @@ -1,3 +1,7 @@ +/* + * Linker file for ARM architecture. + */ + ENTRY(_start) SECTIONS diff --git a/arch/arm/start.S b/arch/arm/start.S index d6700ab..d1ad138 100644 --- a/arch/arm/start.S +++ b/arch/arm/start.S @@ -1,3 +1,7 @@ +/* + * ARM entry point, and initialization code. + */ + #include #include @@ -109,21 +113,21 @@ start: mov r11, r0 mov r12, r0 -.bss_zero: - // Zero it out. - stmia r3!, {r5-r12} + .bss_zero: + // Zero it out. + stmia r3!, {r5-r12} - // If lower than end, continue. - cmp r3, r4 - blt .bss_zero + // If lower than end, continue. + cmp r3, r4 + blt .bss_zero - // Jump to init(). - blx init + // Jump to init(). + blx init -// DON'T RETURN HERE. -.halt: - wfe - b .halt + // DO NOT RETURN HERE. + .halt: + wfe + b .halt // Utility functions. diff --git a/include/asm.h b/include/asm.h index eaf430c..1fb4720 100644 --- a/include/asm.h +++ b/include/asm.h @@ -1,8 +1,12 @@ +/* + * Definitions to be used in assembly. + */ + #ifndef _ASM_H #define _ASM_H #define FUNCTION(x) .type x, STT_FUNC; x: -#define DATA(x) .type x, STT_OBJECT; x: -#define GLOBAL(x) .global x; +#define DATA(x) .type x, STT_OBJECT; x: +#define GLOBAL(x) .global x; #endif /* _ASM_H */ \ No newline at end of file diff --git a/kernel/init.c b/kernel/init.c index 9af9249..9612a85 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -1,13 +1,17 @@ +/* + * Kernel init. + */ + #include /* - * Init kernel. + * Kernel init. */ void init() { uart_init(); - while(1) + while (1) { uart_transmit(uart_receive()); } diff --git a/platform/bcm2835/include/gpio.h b/platform/bcm2835/include/gpio.h index f162e22..d50df83 100644 --- a/platform/bcm2835/include/gpio.h +++ b/platform/bcm2835/include/gpio.h @@ -1,3 +1,7 @@ +/* + * GPIO related definitions. + */ + #ifndef _GPIO_H #define _GPIO_H diff --git a/platform/bcm2835/include/uart.h b/platform/bcm2835/include/uart.h index 39c95d7..de85bf2 100644 --- a/platform/bcm2835/include/uart.h +++ b/platform/bcm2835/include/uart.h @@ -1,3 +1,7 @@ +/* + * UART related/handling definitions. + */ + #ifndef _UART_H #define _UART_H diff --git a/platform/bcm2835/uart.c b/platform/bcm2835/uart.c index 0cac7b5..f77f831 100644 --- a/platform/bcm2835/uart.c +++ b/platform/bcm2835/uart.c @@ -1,3 +1,7 @@ +/* + * UART handling code. + */ + #include /* @@ -55,14 +59,11 @@ void uart_init(void) void uart_transmit(uint8_t byte) { // Keep trying. - while(1) + while (1) { // If transmit FIFO isn't full. - if(!(*(volatile uint32_t*)(UART0_FR) & (1 << 5))) - { - // Break. + if (!(*(volatile uint32_t*)(UART0_FR) & (1 << 5))) break; - } } // So transmit FIFO isn't full, transmit the byte. @@ -78,14 +79,11 @@ void uart_transmit(uint8_t byte) uint8_t uart_receive(void) { // Keep trying. - while(1) + while (1) { // If receive FIFO isn't empty, break. - if(!(*(volatile uint32_t*)(UART0_FR) & (1 << 4))) - { - // Break. + if (!(*(volatile uint32_t*)(UART0_FR) & (1 << 4))) break; - } } // So receive FIFO isn't empty, receive a byte. -- 2.11.4.GIT