This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

change formatting

Ivan Ilak (May 18, 2023, 5:24 PM +0200) 4d67f638 7a438319

+160 -154
+5 -1
.clang-format
··· 39 39 PointerAlignment: Right 40 40 SortIncludes: false 41 41 SpaceBeforeParens: Never 42 - SpacesInContainerLiterals: false 42 + SpacesInContainerLiterals: false 43 + AlignConsecutiveAssignments: true 44 + AlignConsecutiveDeclarations: true 45 + BinPackArguments: false 46 + BinPackParameters: false
+19 -19
os/include/kernel/atag.h
··· 22 22 */ 23 23 enum ATAG_TYPE 24 24 { 25 - ATAG_NONE = 0, /**< Empty tag used to end the list */ 26 - ATAG_CORE = 0x54410001, /**< First tag used to start the list */ 27 - ATAG_MEM = 0x54410002, /**< Describes a physical area of memory */ 25 + ATAG_NONE = 0, /**< Empty tag used to end the list */ 26 + ATAG_CORE = 0x54410001, /**< First tag used to start the list */ 27 + ATAG_MEM = 0x54410002, /**< Describes a physical area of memory */ 28 28 ATAG_VIDEOTEXT = 0x54410003, /**< VGA text screen information */ 29 - ATAG_RAMDISK = 0x54410004, /**< Describes how the ramdisk will be used */ 30 - ATAG_INITRD2 = 0x54420005, /**< Describes where the compressed ramdisk 29 + ATAG_RAMDISK = 0x54410004, /**< Describes how the ramdisk will be used */ 30 + ATAG_INITRD2 = 0x54420005, /**< Describes where the compressed ramdisk 31 31 image is placed in memory */ 32 - ATAG_SERIAL = 0x54410006, /**< Board serial number */ 32 + ATAG_SERIAL = 0x54410006, /**< Board serial number */ 33 33 ATAG_REVISION = 0x54410007, /**< Board revision */ 34 34 ATAG_VIDEOLFB = 0x54410008, /**< Framebuffer information */ 35 - ATAG_CMDLINE = 0x54410009 /**< Command line */ 35 + ATAG_CMDLINE = 0x54410009 /**< Command line */ 36 36 }; 37 37 38 38 /** ··· 132 132 */ 133 133 typedef struct atag_videolfb 134 134 { 135 - uint16_t width; /**< Width of buffer */ 136 - uint16_t height; /**< Height */ 137 - uint16_t depth; /**< Bits/pixel */ 138 - uint16_t linelength; /**< Length of a line in bytes */ 139 - uint32_t address; /**< Base address of buffer */ 140 - uint32_t size; /**< Size of buffer */ 135 + uint16_t width; /**< Width of buffer */ 136 + uint16_t height; /**< Height */ 137 + uint16_t depth; /**< Bits/pixel */ 138 + uint16_t linelength; /**< Length of a line in bytes */ 139 + uint32_t address; /**< Base address of buffer */ 140 + uint32_t size; /**< Size of buffer */ 141 141 unsigned char redsize; /**< Number of red bits in each pixel */ 142 142 unsigned char redpos; /**< Position of red bits in pixel */ 143 143 unsigned char greensize; /**< Number of green bits in each pixel */ ··· 168 168 atag_header header; /**< Standard header */ 169 169 union 170 170 { 171 - atag_core core; /**< Core tag */ 172 - atag_mem mem; /**< Memory tag */ 173 - atag_ramdisk ramdisk; /**< Ramdisk tag */ 174 - atag_initrd2 initrd2; /**< Initrd2 tag */ 175 - atag_serial serial; /**< Serial tag */ 171 + atag_core core; /**< Core tag */ 172 + atag_mem mem; /**< Memory tag */ 173 + atag_ramdisk ramdisk; /**< Ramdisk tag */ 174 + atag_initrd2 initrd2; /**< Initrd2 tag */ 175 + atag_serial serial; /**< Serial tag */ 176 176 atag_revision revision; /**< Revision tag */ 177 177 atag_videolfb videolfb; /**< Videolfb tag */ 178 - atag_cmdline cmdline; /**< Cmdline tag */ 178 + atag_cmdline cmdline; /**< Cmdline tag */ 179 179 }; 180 180 } atag_t; /**< ATAG structure */ 181 181
+1 -1
os/include/kernel/framebuffer.h
··· 26 26 uint32_t width; /**< Width of the framebuffer in pixels */ 27 27 uint32_t height; /**< Height of the framebuffer in pixels */ 28 28 uint32_t pitch; /**< Number of bytes per row */ 29 - void *buf; /**< Pointer to the framebuffer */ 29 + void *buf; /**< Pointer to the framebuffer */ 30 30 uint32_t buf_size; /**< Size of the framebuffer in bytes */ 31 31 uint32_t chars_width; /**< Width of the framebuffer in characters */ 32 32 uint32_t chars_height; /**< Height of the framebuffer in characters */
+10 -10
os/include/kernel/list.h
··· 51 51 { \ 52 52 struct nodeType *head; \ 53 53 struct nodeType *tail; \ 54 - uint32_t size; \ 54 + uint32_t size; \ 55 55 } nodeType##_list_t; 56 56 57 57 #define DEFINE_LINK(nodeType) \ ··· 60 60 61 61 #define INITIALIZE_LIST(list) \ 62 62 list.head = list.tail = (void *)0; \ 63 - list.size = 0; 63 + list.size = 0; 64 64 65 65 #define IMPLEMENT_LIST(nodeType) \ 66 66 void append_##nodeType##_list(nodeType##_list_t *list, \ 67 - struct nodeType *node) \ 67 + struct nodeType *node) \ 68 68 { \ 69 69 list->tail->next##nodeType = node; \ 70 - node->prev##nodeType = list->tail; \ 71 - list->tail = node; \ 72 - node->next##nodeType = NULL; \ 70 + node->prev##nodeType = list->tail; \ 71 + list->tail = node; \ 72 + node->next##nodeType = NULL; \ 73 73 list->size += 1; \ 74 74 if(list->head == NULL) \ 75 75 { \ ··· 78 78 } \ 79 79 \ 80 80 void push_##nodeType##_list(nodeType##_list_t *list, \ 81 - struct nodeType *node) \ 81 + struct nodeType *node) \ 82 82 { \ 83 83 node->next##nodeType = list->head; \ 84 84 node->prev##nodeType = NULL; \ 85 - list->head = node; \ 85 + list->head = node; \ 86 86 list->size += 1; \ 87 87 if(list->tail == NULL) \ 88 88 { \ ··· 97 97 \ 98 98 struct nodeType *pop_##nodeType##_list(nodeType##_list_t *list) \ 99 99 { \ 100 - struct nodeType *res = list->head; \ 101 - list->head = list->head->next##nodeType; \ 100 + struct nodeType *res = list->head; \ 101 + list->head = list->head->next##nodeType; \ 102 102 list->head->prev##nodeType = NULL; \ 103 103 list->size -= 1; \ 104 104 if(list->head == NULL) \
+11 -11
os/include/kernel/mailbox.h
··· 48 48 */ 49 49 typedef struct 50 50 { 51 - uint8_t channel : 4; /**< The channel to send the message to */ 52 - uint32_t data : 28; /**< The data to send */ 51 + uint8_t channel : 4; /**< The channel to send the message to */ 52 + uint32_t data : 28; /**< The data to send */ 53 53 } mail_message_t; 54 54 55 55 /** ··· 73 73 typedef struct 74 74 { 75 75 uint32_t reserved : 30; /**< Reserved for future use */ 76 - uint8_t empty : 1; /**< The empty flag */ 77 - uint8_t full : 1; /**< The full flag */ 76 + uint8_t empty : 1; /**< The empty flag */ 77 + uint8_t full : 1; /**< The full flag */ 78 78 } mail_status_t; /**< The status of the mailbox */ 79 79 80 80 /** ··· 105 105 */ 106 106 typedef enum 107 107 { 108 - REQUEST = 0x00000000, /**< Request code */ 108 + REQUEST = 0x00000000, /**< Request code */ 109 109 RESPONSE_SUCCESS = 0x80000000, /**< Response success code */ 110 - RESPONSE_ERROR = 0x80000001 /**< Response error code */ 110 + RESPONSE_ERROR = 0x80000001 /**< Response error code */ 111 111 } buffer_req_res_code_t; 112 112 113 113 /** ··· 119 119 */ 120 120 typedef struct 121 121 { 122 - uint32_t size; /**< Size includes the size itself */ 122 + uint32_t size; /**< Size includes the size itself */ 123 123 buffer_req_res_code_t req_res_code; /**< Request or response code */ 124 124 uint32_t tags[1]; /**< The tags start here. Will use overrun to make large 125 125 enough */ ··· 138 138 */ 139 139 typedef enum 140 140 { 141 - NULL_TAG = 0, /**< The end of the tag list */ 142 - FB_ALLOCATE_BUFFER = 0x00040001, /**< Allocate a framebuffer */ 143 - FB_RELESE_BUFFER = 0x00048001, /**< Release a framebuffer */ 141 + NULL_TAG = 0, /**< The end of the tag list */ 142 + FB_ALLOCATE_BUFFER = 0x00040001, /**< Allocate a framebuffer */ 143 + FB_RELESE_BUFFER = 0x00048001, /**< Release a framebuffer */ 144 144 FB_GET_PHYSICAL_DIMENSIONS = 0x00040003, /**< Get the physical dimensions 145 145 of the framebuffer */ 146 146 FB_SET_PHYSICAL_DIMENSIONS = 0x00048003, /**< Set the physical dimensions ··· 171 171 */ 172 172 typedef struct 173 173 { 174 - void *fb_addr; /**< The address of the framebuffer */ 174 + void *fb_addr; /**< The address of the framebuffer */ 175 175 uint32_t fb_size; /**< The size of the framebuffer */ 176 176 } fb_allocate_res_t; /**< The response value buffer for FB_ALLOCATE_BUFFER */ 177 177
+9 -9
os/include/kernel/memory.h
··· 22 22 */ 23 23 typedef struct 24 24 { 25 - uint8_t allocated : 1; /**< This page is allocated to something */ 26 - uint8_t kernel_page : 1; /**< This page is a part of the kernel */ 27 - uint8_t kernel_heap_page : 1; /**< This page is a part of the kernel */ 28 - uint32_t reserved : 29; /**< Reserved */ 29 - } page_flags_t; /**< Page flags */ 25 + uint8_t allocated : 1; /**< This page is allocated to something */ 26 + uint8_t kernel_page : 1; /**< This page is a part of the kernel */ 27 + uint8_t kernel_heap_page : 1; /**< This page is a part of the kernel */ 28 + uint32_t reserved : 29; /**< Reserved */ 29 + } page_flags_t; /**< Page flags */ 30 30 31 31 DEFINE_LIST(page); /**< List of pages */ 32 32 ··· 39 39 */ 40 40 typedef struct page 41 41 { 42 - uint32_t vaddr_mapped; /**< Virtual address mapped to this page */ 43 - page_flags_t flags; /**< Page flags */ 44 - DEFINE_LINK(page); /**< Link to the next page */ 45 - } page_t; /**< Page */ 42 + uint32_t vaddr_mapped; /**< Virtual address mapped to this page */ 43 + page_flags_t flags; /**< Page flags */ 44 + DEFINE_LINK(page); /**< Link to the next page */ 45 + } page_t; /**< Page */ 46 46 47 47 /** 48 48 * @brief Kernel heap
+9 -9
os/include/peripherals/aux.h
··· 21 21 AUX_BASE = (GPIO_BASE + 0x15000), 22 22 23 23 /* The offsets for reach register for the UART */ 24 - AUX_ENABLES = (AUX_BASE + 0x04), /**< Auxiliary Enables */ 25 - AUX_MU_IO_REG = (AUX_BASE + 0x40), /**< Mini UART I/O Data */ 26 - AUX_MU_IER_REG = (AUX_BASE + 0x44), /**< Mini UART Interrupt Enable */ 27 - AUX_MU_IIR_REG = (AUX_BASE + 0x48), /**< Mini UART Interrupt Identify */ 28 - AUX_MU_LCR_REG = (AUX_BASE + 0x4C), /**< Mini UART Line Control */ 29 - AUX_MU_MCR_REG = (AUX_BASE + 0x50), /**< Mini UART Model Control */ 30 - AUX_MU_LSR_REG = (AUX_BASE + 0x54), /**< Mini UART Line Status */ 31 - AUX_MU_MSR_REG = (AUX_BASE + 0x58), /**< Mini UART Modem Status */ 32 - AUX_MU_SCRATCH = (AUX_BASE + 0x5C), /**< Mini UART Scratch */ 24 + AUX_ENABLES = (AUX_BASE + 0x04), /**< Auxiliary Enables */ 25 + AUX_MU_IO_REG = (AUX_BASE + 0x40), /**< Mini UART I/O Data */ 26 + AUX_MU_IER_REG = (AUX_BASE + 0x44), /**< Mini UART Interrupt Enable */ 27 + AUX_MU_IIR_REG = (AUX_BASE + 0x48), /**< Mini UART Interrupt Identify */ 28 + AUX_MU_LCR_REG = (AUX_BASE + 0x4C), /**< Mini UART Line Control */ 29 + AUX_MU_MCR_REG = (AUX_BASE + 0x50), /**< Mini UART Model Control */ 30 + AUX_MU_LSR_REG = (AUX_BASE + 0x54), /**< Mini UART Line Status */ 31 + AUX_MU_MSR_REG = (AUX_BASE + 0x58), /**< Mini UART Modem Status */ 32 + AUX_MU_SCRATCH = (AUX_BASE + 0x5C), /**< Mini UART Scratch */ 33 33 AUX_MU_CNTL_REG = (AUX_BASE + 0x60), /**< Mini UART Extra Control */ 34 34 AUX_MU_STAT_REG = (AUX_BASE + 0x64), /**< Mini UART Extra Status */ 35 35 AUX_MU_BAUD_REG = (AUX_BASE + 0x68) /**< Mini UART Baudrate */
+19 -19
os/include/peripherals/gpio.h
··· 12 12 */ 13 13 typedef enum 14 14 { 15 - GF_INPUT = 0, /**< Input */ 15 + GF_INPUT = 0, /**< Input */ 16 16 GF_OUTPUT = 1, /**< Output */ 17 - GF_ALT_0 = 4, /**< Alternative Function 0 */ 18 - GF_ALT_1 = 5, /**< Alternative Function 1 */ 19 - GF_ALT_2 = 6, /**< Alternative Function 2 */ 20 - GF_ALT_3 = 7, /**< Alternative Function 3 */ 21 - GF_ALT_4 = 3, /**< Alternative Function 4 */ 22 - GF_ALT_5 = 2, /**< Alternative Function 5 */ 17 + GF_ALT_0 = 4, /**< Alternative Function 0 */ 18 + GF_ALT_1 = 5, /**< Alternative Function 1 */ 19 + GF_ALT_2 = 6, /**< Alternative Function 2 */ 20 + GF_ALT_3 = 7, /**< Alternative Function 3 */ 21 + GF_ALT_4 = 3, /**< Alternative Function 4 */ 22 + GF_ALT_5 = 2, /**< Alternative Function 5 */ 23 23 } gpio_func; 24 24 25 25 /** ··· 60 60 = (GPIO_BASE 61 61 + 0x2C), /**< The GPCLR1 register is used to clear GPIO pins 32-53 */ 62 62 63 - GPLEV0 = (GPIO_BASE + 0x34), /**< GPIO Pin Level 0 */ 64 - GPLEV1 = (GPIO_BASE + 0x38), /**< GPIO Pin Level 1 */ 65 - GPEDS0 = (GPIO_BASE + 0x40), /**< GPIO Pin Event Detect Status 0 */ 66 - GPEDS1 = (GPIO_BASE + 0x44), /**< GPIO Pin Event Detect Status 1 */ 67 - GPREN0 = (GPIO_BASE + 0x4C), /**< GPIO Pin Rising Edge Detect Enable 0 */ 68 - GPREN1 = (GPIO_BASE + 0x50), /**< GPIO Pin Rising Edge Detect Enable 1 */ 69 - GPFEN0 = (GPIO_BASE + 0x58), /**< GPIO Pin Falling Edge Detect Enable 0 */ 70 - GPFEN1 = (GPIO_BASE + 0x5C), /**< GPIO Pin Falling Edge Detect Enable 1 */ 71 - GPHEN0 = (GPIO_BASE + 0x64), /**< GPIO Pin High Detect Enable 0 */ 72 - GPHEN1 = (GPIO_BASE + 0x68), /**< GPIO Pin High Detect Enable 1 */ 73 - GPLEN0 = (GPIO_BASE + 0x70), /**< GPIO Pin Low Detect Enable 0 */ 74 - GPLEN1 = (GPIO_BASE + 0x74), /**< GPIO Pin Low Detect Enable 1 */ 63 + GPLEV0 = (GPIO_BASE + 0x34), /**< GPIO Pin Level 0 */ 64 + GPLEV1 = (GPIO_BASE + 0x38), /**< GPIO Pin Level 1 */ 65 + GPEDS0 = (GPIO_BASE + 0x40), /**< GPIO Pin Event Detect Status 0 */ 66 + GPEDS1 = (GPIO_BASE + 0x44), /**< GPIO Pin Event Detect Status 1 */ 67 + GPREN0 = (GPIO_BASE + 0x4C), /**< GPIO Pin Rising Edge Detect Enable 0 */ 68 + GPREN1 = (GPIO_BASE + 0x50), /**< GPIO Pin Rising Edge Detect Enable 1 */ 69 + GPFEN0 = (GPIO_BASE + 0x58), /**< GPIO Pin Falling Edge Detect Enable 0 */ 70 + GPFEN1 = (GPIO_BASE + 0x5C), /**< GPIO Pin Falling Edge Detect Enable 1 */ 71 + GPHEN0 = (GPIO_BASE + 0x64), /**< GPIO Pin High Detect Enable 0 */ 72 + GPHEN1 = (GPIO_BASE + 0x68), /**< GPIO Pin High Detect Enable 1 */ 73 + GPLEN0 = (GPIO_BASE + 0x70), /**< GPIO Pin Low Detect Enable 0 */ 74 + GPLEN1 = (GPIO_BASE + 0x74), /**< GPIO Pin Low Detect Enable 1 */ 75 75 GPAREN0 = (GPIO_BASE + 0x7C), /**< GPIO Pin Async. Rising Edge Detect 0 */ 76 76 GPAREN1 = (GPIO_BASE + 0x80), /**< GPIO Pin Async. Rising Edge Detect 1 */ 77 77 GPAFEN0 = (GPIO_BASE + 0x88), /**< GPIO Pin Async. Falling Edge Detect 0 */
+10 -10
os/src/common/stdlib.c
··· 7 7 { 8 8 #if MODEL_0 || MODEL_1 9 9 // Use long division, but in binary. Copied from Stack overflow... 10 - uint32_t denom = divisor; 10 + uint32_t denom = divisor; 11 11 uint32_t current = 1; 12 - uint32_t answer = 0; 12 + uint32_t answer = 0; 13 13 14 14 if(denom > dividend) 15 15 return 0; ··· 57 57 58 58 void *memcpy(void *dest, const void *src, unsigned long bytes) 59 59 { 60 - char *d = dest; 60 + char *d = dest; 61 61 const char *s = src; 62 62 while(bytes--) 63 63 { ··· 81 81 char *itoa(int num, int base) 82 82 { 83 83 static char intbuf[33]; 84 - uint32_t j = 0, isneg = 0, i; 85 - divmod_t divmod_res; 84 + uint32_t j = 0, isneg = 0, i; 85 + divmod_t divmod_res; 86 86 87 87 if(num == 0) 88 88 { ··· 94 94 if(base == 10 && num < 0) 95 95 { 96 96 isneg = 1; 97 - num = -num; 97 + num = -num; 98 98 } 99 99 else if(base == 2 && num < 0) 100 100 { ··· 107 107 108 108 while(i != 0) 109 109 { 110 - divmod_res = divmod(i, base); 110 + divmod_res = divmod(i, base); 111 111 intbuf[j++] = (divmod_res.mod) < 10 ? '0' + (divmod_res.mod) 112 112 : 'a' + (divmod_res.mod) - 10; 113 - i = divmod_res.div; 113 + i = divmod_res.div; 114 114 } 115 115 116 116 if(base == 16) ··· 136 136 i = 0; 137 137 while(i < j) 138 138 { 139 - isneg = intbuf[i]; 139 + isneg = intbuf[i]; 140 140 intbuf[i] = intbuf[j]; 141 141 intbuf[j] = isneg; 142 142 i++; ··· 148 148 149 149 int atoi(const char *nptr) 150 150 { 151 - int result = 0; 151 + int result = 0; 152 152 int position = 1; 153 153 154 154 const char *p = nptr;
+2 -2
os/src/common/string.c
··· 56 56 57 57 void strrev(char *str) 58 58 { 59 - int i, j; 59 + int i, j; 60 60 char tmp; 61 61 62 62 for(i = 0, j = strlen(str) - 1; i < j; i++, j--) 63 63 { 64 - tmp = str[i]; 64 + tmp = str[i]; 65 65 str[i] = str[j]; 66 66 str[j] = tmp; 67 67 }
+1 -1
os/src/kernel/atag.c
··· 37 37 38 38 void print_atags(uint32_t address) 39 39 { 40 - atag_t *atags = (atag_t *)address; 40 + atag_t *atags = (atag_t *)address; 41 41 unsigned int tag; 42 42 43 43 puts("Reading ATAGs\n\n");
+31 -31
os/src/kernel/framebuffer.c
··· 17 17 uint32_t depth; 18 18 uint32_t ignorex; 19 19 uint32_t ignorey; 20 - void *pointer; 20 + void *pointer; 21 21 uint32_t size; 22 22 } fb_init_t; 23 23 ··· 27 27 { 28 28 mail_message_t msg; 29 29 30 - fbinit.width = 640; 31 - fbinit.height = 480; 32 - fbinit.vwidth = fbinit.width; 30 + fbinit.width = 640; 31 + fbinit.height = 480; 32 + fbinit.vwidth = fbinit.width; 33 33 fbinit.vheight = fbinit.height; 34 - fbinit.depth = COLORDEPTH; 34 + fbinit.depth = COLORDEPTH; 35 35 36 36 msg.data = ((uint32_t)&fbinit + 0x40000000) >> 4; 37 37 ··· 41 41 if(!msg.data) 42 42 return -1; 43 43 44 - fbinfo.width = fbinit.width; 45 - fbinfo.height = fbinit.height; 46 - fbinfo.chars_width = fbinfo.width / CHAR_WIDTH; 44 + fbinfo.width = fbinit.width; 45 + fbinfo.height = fbinit.height; 46 + fbinfo.chars_width = fbinfo.width / CHAR_WIDTH; 47 47 fbinfo.chars_height = fbinfo.height / CHAR_HEIGHT; 48 - fbinfo.chars_x = 0; 49 - fbinfo.chars_y = 0; 50 - fbinfo.pitch = fbinit.bytes; 51 - fbinfo.buf = fbinit.pointer; 52 - fbinfo.buf_size = fbinit.size; 48 + fbinfo.chars_x = 0; 49 + fbinfo.chars_y = 0; 50 + fbinfo.pitch = fbinit.bytes; 51 + fbinfo.buf = fbinit.pointer; 52 + fbinfo.buf_size = fbinit.size; 53 53 54 54 return 0; 55 55 } ··· 60 60 { 61 61 property_message_tag_t tags[5]; 62 62 63 - tags[0].property_tag = FB_SET_PHYSICAL_DIMENSIONS; 64 - tags[0].value_buffer.fb_screen_size.width = 640; 63 + tags[0].property_tag = FB_SET_PHYSICAL_DIMENSIONS; 64 + tags[0].value_buffer.fb_screen_size.width = 640; 65 65 tags[0].value_buffer.fb_screen_size.height = 480; 66 - tags[1].property_tag = FB_SET_VIRTUAL_DIMENSIONS; 67 - tags[1].value_buffer.fb_screen_size.width = 640; 66 + tags[1].property_tag = FB_SET_VIRTUAL_DIMENSIONS; 67 + tags[1].value_buffer.fb_screen_size.width = 640; 68 68 tags[1].value_buffer.fb_screen_size.height = 480; 69 - tags[2].property_tag = FB_SET_BITS_PER_PIXEL; 70 - tags[2].value_buffer.fb_bits_per_pixel = COLORDEPTH; 71 - tags[3].property_tag = NULL_TAG; 69 + tags[2].property_tag = FB_SET_BITS_PER_PIXEL; 70 + tags[2].value_buffer.fb_bits_per_pixel = COLORDEPTH; 71 + tags[3].property_tag = NULL_TAG; 72 72 73 73 // Send over the initialization 74 74 if(send_messages(tags) != 0) ··· 76 76 return -1; 77 77 } 78 78 79 - fbinfo.width = tags[0].value_buffer.fb_screen_size.width; 80 - fbinfo.height = tags[0].value_buffer.fb_screen_size.height; 81 - fbinfo.chars_width = fbinfo.width / CHAR_WIDTH; 79 + fbinfo.width = tags[0].value_buffer.fb_screen_size.width; 80 + fbinfo.height = tags[0].value_buffer.fb_screen_size.height; 81 + fbinfo.chars_width = fbinfo.width / CHAR_WIDTH; 82 82 fbinfo.chars_height = fbinfo.height / CHAR_HEIGHT; 83 - fbinfo.chars_x = 0; 84 - fbinfo.chars_y = 0; 85 - fbinfo.pitch = fbinfo.width * BYTES_PER_PIXEL; 83 + fbinfo.chars_x = 0; 84 + fbinfo.chars_y = 0; 85 + fbinfo.pitch = fbinfo.width * BYTES_PER_PIXEL; 86 86 87 87 // request a framebuffer 88 - tags[0].property_tag = FB_ALLOCATE_BUFFER; 89 - tags[0].value_buffer.fb_screen_size.width = 0; 88 + tags[0].property_tag = FB_ALLOCATE_BUFFER; 89 + tags[0].value_buffer.fb_screen_size.width = 0; 90 90 tags[0].value_buffer.fb_screen_size.height = 0; 91 - tags[0].value_buffer.fb_allocate_align = 16; 92 - tags[1].property_tag = NULL_TAG; 91 + tags[0].value_buffer.fb_allocate_align = 16; 92 + tags[1].property_tag = NULL_TAG; 93 93 94 94 if(send_messages(tags) != 0) 95 95 { 96 96 return -1; 97 97 } 98 98 99 - fbinfo.buf = tags[0].value_buffer.fb_allocate_res.fb_addr; 99 + fbinfo.buf = tags[0].value_buffer.fb_allocate_res.fb_addr; 100 100 fbinfo.buf_size = tags[0].value_buffer.fb_allocate_res.fb_size; 101 101 102 102 return 0;
+8 -6
os/src/kernel/gpu.c
··· 16 16 { 17 17 static const pixel_t WHITE = {0xff, 0xff, 0xff}; 18 18 static const pixel_t BLACK = {0x00, 0x00, 0x00}; 19 - uint8_t w, h; 20 - uint8_t mask; 21 - const uint8_t *bmp = font(c); 22 - uint32_t i, num_rows = fbinfo.height / CHAR_HEIGHT; 19 + uint8_t w, h; 20 + uint8_t mask; 21 + const uint8_t *bmp = font(c); 22 + uint32_t i, num_rows = fbinfo.height / CHAR_HEIGHT; 23 23 24 24 // shift everything up one row 25 25 if(fbinfo.chars_y >= num_rows) ··· 49 49 mask = 1 << (w); 50 50 if(bmp[h] & mask) 51 51 write_pixel(fbinfo.chars_x * CHAR_WIDTH + w, 52 - fbinfo.chars_y * CHAR_HEIGHT + h, &WHITE); 52 + fbinfo.chars_y * CHAR_HEIGHT + h, 53 + &WHITE); 53 54 else 54 55 write_pixel(fbinfo.chars_x * CHAR_WIDTH + w, 55 - fbinfo.chars_y * CHAR_HEIGHT + h, &BLACK); 56 + fbinfo.chars_y * CHAR_HEIGHT + h, 57 + &BLACK); 56 58 } 57 59 } 58 60
+1 -1
os/src/kernel/kerio.c
··· 22 22 23 23 void gets(char *buf, int buflen) 24 24 { 25 - int i; 25 + int i; 26 26 char c; 27 27 // Leave a spot for null char in buffer 28 28 for(i = 0; (c = getc()) != '\r' && buflen > 1; i++, buflen--)
+5 -5
os/src/kernel/mailbox.c
··· 4 4 5 5 mail_message_t mailbox_read(int channel) 6 6 { 7 - mail_status_t stat; 7 + mail_status_t stat; 8 8 mail_message_t res; 9 9 10 10 // Make sure that the message is from the right channel ··· 58 58 int send_messages(property_message_tag_t *tags) 59 59 { 60 60 property_message_buffer_t *msg; 61 - mail_message_t mail; 62 - uint32_t bufsize = 0, i, len, bufpos; 61 + mail_message_t mail; 62 + uint32_t bufsize = 0, i, len, bufpos; 63 63 64 64 // Calculate the sizes of each tag 65 65 for(i = 0; tags[i].property_tag != NULL_TAG; i++) ··· 77 77 if(!msg) 78 78 return -1; 79 79 80 - msg->size = bufsize; 80 + msg->size = bufsize; 81 81 msg->req_res_code = REQUEST; 82 82 83 83 // Copy the messages into the buffer 84 84 for(i = 0, bufpos = 0; tags[i].property_tag != NULL_TAG; i++) 85 85 { 86 - len = get_value_buffer_len(&tags[i]); 86 + len = get_value_buffer_len(&tags[i]); 87 87 msg->tags[bufpos++] = tags[i].property_tag; 88 88 msg->tags[bufpos++] = len; 89 89 msg->tags[bufpos++] = 0;
+18 -18
os/src/kernel/memory.c
··· 29 29 static heap_segment_t 30 30 *heap_segment_list_head; /**< Head of the heap segment list */ 31 31 32 - extern uint8_t __end; /**< Defined by the linker */ 32 + extern uint8_t __end; /**< Defined by the linker */ 33 33 static uint32_t num_pages; /**< Number of pages in the system */ 34 34 35 35 IMPLEMENT_LIST(page); 36 36 37 37 static page_t *all_pages_array; /**< Array of all pages in the system */ 38 - page_list_t free_pages; /**< List of all free pages in the system */ 38 + page_list_t free_pages; /**< List of all free pages in the system */ 39 39 40 40 void mem_init(atag_t *atags) 41 41 { ··· 48 48 49 49 // Allocate space for all those pages' metadata. Start this block just 50 50 // after the kernel image is finished 51 - page_array_len = sizeof(page_t) * num_pages; 51 + page_array_len = sizeof(page_t) * num_pages; 52 52 all_pages_array = (page_t *)&__end; 53 53 bzero(all_pages_array, page_array_len); 54 54 INITIALIZE_LIST(free_pages); ··· 60 60 { 61 61 all_pages_array[i].vaddr_mapped 62 62 = i * PAGE_SIZE; // Identity map the kernel pages 63 - all_pages_array[i].flags.allocated = 1; 63 + all_pages_array[i].flags.allocated = 1; 64 64 all_pages_array[i].flags.kernel_page = 1; 65 65 } 66 66 // Reserve 1 MB for the kernel heap ··· 68 68 { 69 69 all_pages_array[i].vaddr_mapped 70 70 = i * PAGE_SIZE; // Identity map the kernel pages 71 - all_pages_array[i].flags.allocated = 1; 71 + all_pages_array[i].flags.allocated = 1; 72 72 all_pages_array[i].flags.kernel_heap_page = 1; 73 73 } 74 74 // Map the rest of the pages as unallocated, and add them to the free list ··· 86 86 void *alloc_page(void) 87 87 { 88 88 page_t *page; 89 - void *page_mem; 89 + void *page_mem; 90 90 91 91 if(size_page_list(&free_pages) == 0) 92 92 return 0; 93 93 94 94 // Get a free page 95 - page = pop_page_list(&free_pages); 95 + page = pop_page_list(&free_pages); 96 96 page->flags.kernel_page = 1; 97 - page->flags.allocated = 1; 97 + page->flags.allocated = 1; 98 98 99 99 // Get the address the physical page metadata refers to 100 100 page_mem = (void *)((page - all_pages_array) * PAGE_SIZE); ··· 126 126 127 127 void *kmalloc(uint32_t bytes) 128 128 { 129 - heap_segment_t *curr, *best = NULL; 130 - int diff, best_diff = 0x7fffffff; // Max signed int 129 + heap_segment_t *curr, *best = NULL; 130 + int diff, best_diff = 0x7fffffff; // Max signed int 131 131 132 132 // Add the header to the number of bytes we need and make the size 4 byte 133 133 // aligned ··· 140 140 diff = curr->segment_size - bytes; 141 141 if(!curr->is_allocated && diff < best_diff && diff >= 0) 142 142 { 143 - best = curr; 143 + best = curr; 144 144 best_diff = diff; 145 145 } 146 146 } ··· 156 156 if(best_diff > (int)(2 * sizeof(heap_segment_t))) 157 157 { 158 158 bzero(((void *)(best)) + bytes, sizeof(heap_segment_t)); 159 - curr = best->next; 160 - best->next = ((void *)(best)) + bytes; 161 - best->next->next = curr; 162 - best->next->prev = best; 159 + curr = best->next; 160 + best->next = ((void *)(best)) + bytes; 161 + best->next->next = curr; 162 + best->next->prev = best; 163 163 best->next->segment_size = best->segment_size - bytes; 164 - best->segment_size = bytes; 164 + best->segment_size = bytes; 165 165 } 166 166 167 167 best->is_allocated = 1; ··· 176 176 if(!ptr) 177 177 return; 178 178 179 - seg = ptr - sizeof(heap_segment_t); 179 + seg = ptr - sizeof(heap_segment_t); 180 180 seg->is_allocated = 0; 181 181 182 182 // try to coalesce segements to the left ··· 191 191 while(seg->next != NULL && !seg->next->is_allocated) 192 192 { 193 193 seg->next->next->prev = seg; 194 - seg->next = seg->next->next; 194 + seg->next = seg->next->next; 195 195 seg->segment_size += seg->next->segment_size; 196 196 } 197 197 }
+1 -1
os/src/kernel/uart.c
··· 130 130 char *uart_gets() 131 131 { 132 132 static char str[MAX_INPUT_LENGTH + 1]; 133 - int i = 0; 133 + int i = 0; 134 134 135 135 memset(&str, '\0', MAX_INPUT_LENGTH + 1); 136 136