1.1 --- a/include/xburst_types.h Wed Jun 28 00:20:14 2017 +0200 1.2 +++ b/include/xburst_types.h Wed Jun 28 01:04:22 2017 +0200 1.3 @@ -3,6 +3,7 @@ 1.4 * 1.5 * Copyright 2009 (C) Qi Hardware Inc. 1.6 * Author: Xiangfu Liu <xiangfu@sharism.cc> 1.7 + * Copyright (C) 2017 Paul Boddie <paul@boddie.org.uk> 1.8 * 1.9 * This program is free software: you can redistribute it and/or modify 1.10 * it under the terms of the GNU General Public License as published by 1.11 @@ -21,13 +22,10 @@ 1.12 #ifndef __XBURST_TYPES_H__ 1.13 #define __XBURST_TYPES_H__ 1.14 1.15 -typedef unsigned int size_t; 1.16 -typedef unsigned char u8; 1.17 -typedef unsigned short u16; 1.18 -typedef unsigned int u32; 1.19 +#include <stdint.h> 1.20 1.21 -#define REG8(addr) *((volatile u8 *)(addr)) 1.22 -#define REG16(addr) *((volatile u16 *)(addr)) 1.23 -#define REG32(addr) *((volatile u32 *)(addr)) 1.24 +#define REG8(addr) *((volatile uint8_t *)(addr)) 1.25 +#define REG16(addr) *((volatile uint16_t *)(addr)) 1.26 +#define REG32(addr) *((volatile uint32_t *)(addr)) 1.27 1.28 #endif /* __XBURST_TYPES_H__ */
2.1 --- a/stage1/board.c Wed Jun 28 00:20:14 2017 +0200 2.2 +++ b/stage1/board.c Wed Jun 28 01:04:22 2017 +0200 2.3 @@ -5,7 +5,7 @@ 2.4 * Copyright (C) 2005-2006 Ingenic Semiconductor, <jlwei@ingenic.cn> 2.5 * Copyright (C) 2006 Stefan Roese, DENX Software Engineering, sr@denx.de. 2.6 * Copyright (C) Xiangfu Liu <xiangfu.z@gmail.com> 2.7 - * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 2.8 + * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 2.9 * 2.10 * This program is free software: you can redistribute it and/or modify 2.11 * it under the terms of the GNU General Public License as published by 2.12 @@ -36,13 +36,13 @@ 2.13 /etc/xburst-tools/usbboot.cfg. */ 2.14 2.15 struct fw_args *fw_args; 2.16 -volatile u32 FW_CPU_ID; 2.17 -volatile u8 FW_SDRAM_BW16; 2.18 -volatile u8 FW_SDRAM_BANK4; 2.19 -volatile u8 FW_SDRAM_ROW; 2.20 -volatile u8 FW_SDRAM_COL; 2.21 -volatile u8 FW_CONFIG_MOBILE_SDRAM; 2.22 -volatile u8 FW_IS_SHARE; 2.23 +volatile uint32_t FW_CPU_ID; 2.24 +volatile uint8_t FW_SDRAM_BW16; 2.25 +volatile uint8_t FW_SDRAM_BANK4; 2.26 +volatile uint8_t FW_SDRAM_ROW; 2.27 +volatile uint8_t FW_SDRAM_COL; 2.28 +volatile uint8_t FW_CONFIG_MOBILE_SDRAM; 2.29 +volatile uint8_t FW_IS_SHARE; 2.30 2.31 void load_args() 2.32 {
3.1 --- a/stage2/board-minipc.c Wed Jun 28 00:20:14 2017 +0200 3.2 +++ b/stage2/board-minipc.c Wed Jun 28 01:04:22 2017 +0200 3.3 @@ -4,7 +4,7 @@ 3.4 * Copyright (C) 2000-2009 Wolfgang Denk, DENX Software Engineering, <wd@denx.de> 3.5 * Copyright (C) 2005-2006 Ingenic Semiconductor, <jlwei@ingenic.cn> 3.6 * Copyright (C) Xiangfu Liu <xiangfu.z@gmail.com> 3.7 - * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 3.8 + * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 3.9 * 3.10 * This program is free software: you can redistribute it and/or modify 3.11 * it under the terms of the GNU General Public License as published by 3.12 @@ -116,7 +116,7 @@ 3.13 __intc_unmask_irq(GPIO_IRQ); 3.14 } 3.15 3.16 -int gpio_have_irq(u8 gpio) 3.17 +int gpio_have_irq(uint8_t gpio) 3.18 { 3.19 return (REG_GPIO_GPFR(gpio / 32) & (1 << (gpio % 32))); 3.20 }
4.1 --- a/stage2/board-nanonote.c Wed Jun 28 00:20:14 2017 +0200 4.2 +++ b/stage2/board-nanonote.c Wed Jun 28 01:04:22 2017 +0200 4.3 @@ -4,7 +4,7 @@ 4.4 * Copyright (C) 2000-2009 Wolfgang Denk, DENX Software Engineering, <wd@denx.de> 4.5 * Copyright (C) 2006 Ingenic Semiconductor, <jlwei@ingenic.cn> 4.6 * Copyright (C) Xiangfu Liu <xiangfu.z@gmail.com> 4.7 - * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 4.8 + * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 4.9 * 4.10 * This program is free software: you can redistribute it and/or modify 4.11 * it under the terms of the GNU General Public License as published by 4.12 @@ -164,7 +164,7 @@ 4.13 __intc_unmask_irq(GPIO_IRQ); 4.14 } 4.15 4.16 -int gpio_have_irq(u8 gpio) 4.17 +int gpio_have_irq(uint8_t gpio) 4.18 { 4.19 return (REG_GPIO_PXFLG(gpio / 32) & (1 << (gpio % 32))); 4.20 }
5.1 --- a/stage2/board.c Wed Jun 28 00:20:14 2017 +0200 5.2 +++ b/stage2/board.c Wed Jun 28 01:04:22 2017 +0200 5.3 @@ -3,7 +3,7 @@ 5.4 * 5.5 * Copyright (C) 2005-2006 Ingenic Semiconductor, <jlwei@ingenic.cn> 5.6 * Copyright (C) Xiangfu Liu <xiangfu.z@gmail.com> 5.7 - * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 5.8 + * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 5.9 * 5.10 * This program is free software: you can redistribute it and/or modify 5.11 * it under the terms of the GNU General Public License as published by 5.12 @@ -159,7 +159,7 @@ 5.13 5.14 /* GPIO interrupt administration. */ 5.15 5.16 -void gpio_clear(u8 gpio) 5.17 +void gpio_clear(uint8_t gpio) 5.18 { 5.19 /* Clear interrupt status. */ 5.20 5.21 @@ -171,7 +171,7 @@ 5.22 5.23 void irq_clear() 5.24 { 5.25 - u8 i; 5.26 + uint8_t i; 5.27 5.28 for (i = 0; i < 32; i++) { 5.29 if (REG_INTC_IPR & (1 << i))
6.1 --- a/stage2/cpu.c Wed Jun 28 00:20:14 2017 +0200 6.2 +++ b/stage2/cpu.c Wed Jun 28 01:04:22 2017 +0200 6.3 @@ -4,7 +4,7 @@ 6.4 * See: u-boot/arch/mips/include/asm/cacheops.h 6.5 * 6.6 * Copyright (C) 2000-2009 Wolfgang Denk, DENX Software Engineering, <wd@denx.de> 6.7 - * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 6.8 + * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 6.9 * 6.10 * This program is free software; you can redistribute it and/or 6.11 * modify it under the terms of the GNU General Public License as 6.12 @@ -30,7 +30,7 @@ 6.13 6.14 void flush_icache_all() 6.15 { 6.16 - u32 addr; 6.17 + uint32_t addr; 6.18 6.19 flush_icache_tag(); 6.20 6.21 @@ -42,7 +42,7 @@ 6.22 6.23 void flush_dcache_all() 6.24 { 6.25 - u32 addr; 6.26 + uint32_t addr; 6.27 6.28 for (addr = KSEG0; addr < KSEG0 + CONFIG_SYS_DCACHE_SIZE; addr += CONFIG_SYS_CACHELINE_SIZE) 6.29 flush_dcache_region(addr); 6.30 @@ -56,9 +56,9 @@ 6.31 flush_icache_all(); 6.32 } 6.33 6.34 -void init_registers(u32 *base, u32 got, void (*function)(), u32 args[], u8 nargs) 6.35 +void init_registers(uint32_t *base, uint32_t got, void (*function)(), uint32_t args[], uint8_t nargs) 6.36 { 6.37 - u8 i; 6.38 + uint8_t i; 6.39 6.40 /* Provide arguments to the function. */ 6.41 6.42 @@ -69,14 +69,14 @@ 6.43 6.44 /* Store essential data for the function environment. */ 6.45 6.46 - base[25] = (u32) function - 0x80000000; /* store the function address as t9 */ 6.47 + base[25] = (uint32_t) function - 0x80000000; /* store the function address as t9 */ 6.48 base[26] = got - 0x80000000; /* store the global pointer */ 6.49 - base[29] = (u32) function - 0x80000000; /* store the function address as EPC (for the handler) */ 6.50 + base[29] = (uint32_t) function - 0x80000000; /* store the function address as EPC (for the handler) */ 6.51 } 6.52 6.53 -void init_tlb(u8 first_random) 6.54 +void init_tlb(uint8_t first_random) 6.55 { 6.56 - u32 limit = configure_tlb(first_random), i; 6.57 + uint32_t limit = configure_tlb(first_random), i; 6.58 6.59 /* Reset the mappings. The total number is bits 30..25 of Config1. */ 6.60 6.61 @@ -86,10 +86,10 @@ 6.62 } 6.63 } 6.64 6.65 -void init_page_table(u32 page_table, u32 virtual, u32 physical, u32 pagesize, u8 flags, u8 asid) 6.66 +void init_page_table(uint32_t page_table, uint32_t virtual, uint32_t physical, uint32_t pagesize, uint8_t flags, uint8_t asid) 6.67 { 6.68 - u32 lower = ((physical & 0xfffff000) >> 6) | flags; 6.69 - u32 upper = (((physical + pagesize) & 0xfffff000) >> 6) | flags; 6.70 + uint32_t lower = ((physical & 0xfffff000) >> 6) | flags; 6.71 + uint32_t upper = (((physical + pagesize) & 0xfffff000) >> 6) | flags; 6.72 6.73 /* 6.74 With a complete address space mapping involving pairs of 4KB pages 6.75 @@ -121,12 +121,12 @@ 6.76 0x1000 * 8 == 0x8000 bytes 6.77 */ 6.78 6.79 - u32 base = page_table + STAGE2_PAGE_TABLE_TASK * asid; 6.80 + uint32_t base = page_table + STAGE2_PAGE_TABLE_TASK * asid; 6.81 6.82 /* Each page table entry corresponds to a pair of 4KB pages and holds two values. */ 6.83 6.84 - u32 entry = ((virtual & 0xffffe000) >> 13) * 8; 6.85 - u32 *address = (u32 *) (base + entry); 6.86 + uint32_t entry = ((virtual & 0xffffe000) >> 13) * 8; 6.87 + uint32_t *address = (uint32_t *) (base + entry); 6.88 6.89 /* The page tables should be permanently mapped to avoid hierarchical TLB miss handling. */ 6.90 6.91 @@ -134,22 +134,22 @@ 6.92 *(address + 1) = upper; 6.93 } 6.94 6.95 -void map_page(u32 virtual, u32 physical, u32 pagesize, u8 flags, u8 asid) 6.96 +void map_page(uint32_t virtual, uint32_t physical, uint32_t pagesize, uint8_t flags, uint8_t asid) 6.97 { 6.98 - u32 start = (virtual & 0xffffe000) | asid; /* VPN2 | ASID*/ 6.99 - u32 lower = ((physical & 0xfffff000) >> 6) | flags; 6.100 - u32 upper = (((physical + pagesize) & 0xfffff000) >> 6) | flags; 6.101 - u32 pagemask = ((pagesize - 1) & 0xfffff000) << 1; 6.102 + uint32_t start = (virtual & 0xffffe000) | asid; /* VPN2 | ASID*/ 6.103 + uint32_t lower = ((physical & 0xfffff000) >> 6) | flags; 6.104 + uint32_t upper = (((physical + pagesize) & 0xfffff000) >> 6) | flags; 6.105 + uint32_t pagemask = ((pagesize - 1) & 0xfffff000) << 1; 6.106 6.107 map_page_op(lower, upper, start, pagemask); 6.108 } 6.109 6.110 -void map_page_index(u32 virtual, u32 physical, u32 pagesize, u8 flags, u8 asid, u32 index) 6.111 +void map_page_index(uint32_t virtual, uint32_t physical, uint32_t pagesize, uint8_t flags, uint8_t asid, uint32_t index) 6.112 { 6.113 - u32 start = (virtual & 0xffffe000) | asid; /* VPN2 | ASID*/ 6.114 - u32 lower = ((physical & 0xfffff000) >> 6) | flags; 6.115 - u32 upper = (((physical + pagesize) & 0xfffff000) >> 6) | flags; 6.116 - u32 pagemask = ((pagesize - 1) & 0xfffff000) << 1; 6.117 + uint32_t start = (virtual & 0xffffe000) | asid; /* VPN2 | ASID*/ 6.118 + uint32_t lower = ((physical & 0xfffff000) >> 6) | flags; 6.119 + uint32_t upper = (((physical + pagesize) & 0xfffff000) >> 6) | flags; 6.120 + uint32_t pagemask = ((pagesize - 1) & 0xfffff000) << 1; 6.121 6.122 map_page_set_index(index); 6.123 map_page_index_op(lower, upper, start, pagemask);
7.1 --- a/stage2/cpu.h Wed Jun 28 00:20:14 2017 +0200 7.2 +++ b/stage2/cpu.h Wed Jun 28 01:04:22 2017 +0200 7.3 @@ -4,10 +4,10 @@ 7.4 #include "xburst_types.h" 7.5 7.6 void flush_cache_all(); 7.7 -void init_registers(u32 *, u32, void (*)(), u32[], u8); 7.8 -void init_tlb(u8); 7.9 -void init_page_table(u32, u32, u32, u32, u8, u8); 7.10 -void map_page(u32, u32, u32, u8, u8); 7.11 -void map_page_index(u32, u32, u32, u8, u8, u32); 7.12 +void init_registers(uint32_t *, uint32_t, void (*)(), uint32_t[], uint8_t); 7.13 +void init_tlb(uint8_t); 7.14 +void init_page_table(uint32_t, uint32_t, uint32_t, uint32_t, uint8_t, uint8_t); 7.15 +void map_page(uint32_t, uint32_t, uint32_t, uint8_t, uint8_t); 7.16 +void map_page_index(uint32_t, uint32_t, uint32_t, uint8_t, uint8_t, uint32_t); 7.17 7.18 #endif /* __CPU_H__ */
8.1 --- a/stage2/cpu_op.h Wed Jun 28 00:20:14 2017 +0200 8.2 +++ b/stage2/cpu_op.h Wed Jun 28 01:04:22 2017 +0200 8.3 @@ -4,16 +4,16 @@ 8.4 #include "xburst_types.h" 8.5 8.6 void flush_icache_tag(); 8.7 -void flush_icache_region(u32); 8.8 +void flush_icache_region(uint32_t); 8.9 void flush_icache_config(); 8.10 -void flush_dcache_region(u32); 8.11 +void flush_dcache_region(uint32_t); 8.12 void handle_error_level(); 8.13 void enable_interrupts(); 8.14 void init_interrupts(); 8.15 -void invoke_task(u8, u32 *, u32 *); 8.16 -u32 configure_tlb(u32); 8.17 -void map_page_set_index(u32); 8.18 -void map_page_op(u32, u32, u32, u32); 8.19 -void map_page_index_op(u32, u32, u32, u32); 8.20 +void invoke_task(uint8_t, uint32_t *, uint32_t *); 8.21 +uint32_t configure_tlb(uint32_t); 8.22 +void map_page_set_index(uint32_t); 8.23 +void map_page_op(uint32_t, uint32_t, uint32_t, uint32_t); 8.24 +void map_page_index_op(uint32_t, uint32_t, uint32_t, uint32_t); 8.25 8.26 #endif /* __CPU_OP_H__ */
9.1 --- a/stage2/init.h Wed Jun 28 00:20:14 2017 +0200 9.2 +++ b/stage2/init.h Wed Jun 28 01:04:22 2017 +0200 9.3 @@ -18,8 +18,8 @@ 9.4 /* GPIO. */ 9.5 9.6 void gpio_init_irq(); 9.7 -int gpio_have_irq(u8); 9.8 -void gpio_clear(u8); 9.9 +int gpio_have_irq(uint8_t); 9.10 +void gpio_clear(uint8_t); 9.11 9.12 /* General. */ 9.13
10.1 --- a/stage2/jzlcd.c Wed Jun 28 00:20:14 2017 +0200 10.2 +++ b/stage2/jzlcd.c Wed Jun 28 01:04:22 2017 +0200 10.3 @@ -2,7 +2,7 @@ 10.4 * JzRISC LCD controller 10.5 * 10.6 * Copyright (C) Xiangfu Liu <xiangfu@sharism.cc> 10.7 - * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 10.8 + * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 10.9 * 10.10 * This program is free software; you can redistribute it and/or 10.11 * modify it under the terms of the GNU General Public License as 10.12 @@ -32,7 +32,7 @@ 10.13 extern struct jzfb_info jzfb; 10.14 extern vidinfo_t panel_info; 10.15 10.16 -static unsigned short lcd_get_panels() 10.17 +static uint16_t lcd_get_panels() 10.18 { 10.19 return ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL) || 10.20 ((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) ? 2 : 1; 10.21 @@ -42,55 +42,55 @@ 10.22 10.23 /* Functions returning region sizes. */ 10.24 10.25 -static unsigned long lcd_get_size(vidinfo_t *vid) 10.26 +static uint32_t lcd_get_size(vidinfo_t *vid) 10.27 { 10.28 /* Lines must be aligned to a word boundary. */ 10.29 - unsigned long line_length = ALIGN((vid->vl_col * NBITS(vid->vl_bpix)) / 8, sizeof(u32)); 10.30 + uint32_t line_length = ALIGN((vid->vl_col * NBITS(vid->vl_bpix)) / 8, sizeof(uint32_t)); 10.31 return line_length * vid->vl_row; 10.32 } 10.33 10.34 -static unsigned long lcd_get_aligned_size(vidinfo_t *vid) 10.35 +static uint32_t lcd_get_aligned_size(vidinfo_t *vid) 10.36 { 10.37 /* LCD_CTRL_BST_16 requires 16-word alignment. */ 10.38 - return ALIGN(lcd_get_size(vid), 16 * sizeof(u32)); 10.39 + return ALIGN(lcd_get_size(vid), 16 * sizeof(uint32_t)); 10.40 } 10.41 10.42 -static unsigned long lcd_get_min_size(vidinfo_t *vid) 10.43 +static uint32_t lcd_get_min_size(vidinfo_t *vid) 10.44 { 10.45 /* Lines must be aligned to a word boundary. */ 10.46 - unsigned long line_length = ALIGN((vid->vl_col * 32) / 8, sizeof(u32)); 10.47 + uint32_t line_length = ALIGN((vid->vl_col * 32) / 8, sizeof(uint32_t)); 10.48 return line_length * vid->vl_row; 10.49 } 10.50 10.51 -static unsigned long lcd_get_aligned_min_size(vidinfo_t *vid) 10.52 +static uint32_t lcd_get_aligned_min_size(vidinfo_t *vid) 10.53 { 10.54 /* LCD_CTRL_BST_16 requires 16-word alignment. */ 10.55 - return ALIGN(lcd_get_min_size(vid), 16 * sizeof(u32)); 10.56 + return ALIGN(lcd_get_min_size(vid), 16 * sizeof(uint32_t)); 10.57 } 10.58 10.59 -static unsigned long lcd_get_palette_size(vidinfo_t *vid) 10.60 +static uint32_t lcd_get_palette_size(vidinfo_t *vid) 10.61 { 10.62 if (NBITS(vid->vl_bpix) < 12) 10.63 - return NCOLORS(vid->vl_bpix) * sizeof(u16); 10.64 + return NCOLORS(vid->vl_bpix) * sizeof(uint16_t); 10.65 else 10.66 return 0; 10.67 } 10.68 10.69 -static unsigned long lcd_get_aligned_palette_size(vidinfo_t *vid) 10.70 +static uint32_t lcd_get_aligned_palette_size(vidinfo_t *vid) 10.71 { 10.72 /* LCD_CTRL_BST_16 requires 16-word alignment. */ 10.73 - return ALIGN(lcd_get_palette_size(vid), 16 * sizeof(u32)); 10.74 + return ALIGN(lcd_get_palette_size(vid), 16 * sizeof(uint32_t)); 10.75 } 10.76 10.77 -static unsigned long lcd_get_descriptors_size() 10.78 +static uint32_t lcd_get_descriptors_size() 10.79 { 10.80 return 3 * sizeof(struct jz_fb_dma_descriptor); 10.81 } 10.82 10.83 -static unsigned long lcd_get_total_size(vidinfo_t *vid) 10.84 +static uint32_t lcd_get_total_size(vidinfo_t *vid) 10.85 { 10.86 - unsigned long size = lcd_get_aligned_size(vid) * lcd_get_panels(); 10.87 - unsigned long min_size = lcd_get_aligned_min_size(vid); 10.88 + uint32_t size = lcd_get_aligned_size(vid) * lcd_get_panels(); 10.89 + uint32_t min_size = lcd_get_aligned_min_size(vid); 10.90 10.91 /* Round up to nearest full page, or MMU section if defined. */ 10.92 return ALIGN((size >= min_size ? size : min_size) + lcd_get_aligned_palette_size(vid) + lcd_get_descriptors_size(), PAGE_SIZE); 10.93 @@ -100,19 +100,19 @@ 10.94 10.95 /* Functions returning addresses of each data region. */ 10.96 10.97 -static unsigned long lcd_get_palette(unsigned long addr) 10.98 +static uint32_t lcd_get_palette(uint32_t addr) 10.99 { 10.100 /* Allocate memory at the end of the region for the palette. */ 10.101 return addr - lcd_get_aligned_palette_size(&panel_info); 10.102 } 10.103 10.104 -static unsigned long lcd_get_descriptors(unsigned long addr) 10.105 +static uint32_t lcd_get_descriptors(uint32_t addr) 10.106 { 10.107 /* Allocate memory before the palette for the descriptor array. */ 10.108 return lcd_get_palette(addr) - lcd_get_descriptors_size(); 10.109 } 10.110 10.111 -static unsigned long lcd_get_framebuffer(unsigned long addr, unsigned short panel) 10.112 +static uint32_t lcd_get_framebuffer(uint32_t addr, uint16_t panel) 10.113 { 10.114 /* Allocate pages for the frame buffer and palette. */ 10.115 return addr - lcd_get_total_size(&panel_info) + (panel * lcd_get_aligned_size(&panel_info)); 10.116 @@ -172,9 +172,9 @@ 10.117 flush_cache_all(); 10.118 } 10.119 10.120 -static unsigned int jz_lcd_stn_init(unsigned int stnH) 10.121 +static uint32_t jz_lcd_stn_init(uint32_t stnH) 10.122 { 10.123 - unsigned int val = 0; 10.124 + uint32_t val = 0; 10.125 10.126 switch (jzfb.bpp) { 10.127 case 1: 10.128 @@ -236,10 +236,10 @@ 10.129 | (jzfb.vsw + jzfb.bfw + jzfb.h + jzfb.efw); 10.130 } 10.131 10.132 -static void jz_lcd_samsung_init(unsigned int pclk) 10.133 +static void jz_lcd_samsung_init(uint32_t pclk) 10.134 { 10.135 - unsigned int total, tp_s, tp_e, ckv_s, ckv_e; 10.136 - unsigned int rev_s, rev_e, inv_s, inv_e; 10.137 + uint32_t total, tp_s, tp_e, ckv_s, ckv_e; 10.138 + uint32_t rev_s, rev_e, inv_s, inv_e; 10.139 10.140 jz_lcd_tft_init(); 10.141 10.142 @@ -262,8 +262,8 @@ 10.143 10.144 static void jz_lcd_sharp_init() 10.145 { 10.146 - unsigned int total, cls_s, cls_e, ps_s, ps_e; 10.147 - unsigned int spl_s, spl_e, rev_s, rev_e; 10.148 + uint32_t total, cls_s, cls_e, ps_s, ps_e; 10.149 + uint32_t spl_s, spl_e, rev_s, rev_e; 10.150 10.151 jz_lcd_tft_init(); 10.152 10.153 @@ -283,9 +283,9 @@ 10.154 REG_LCD_REV = (rev_s << 16) | rev_e; 10.155 } 10.156 10.157 -static unsigned int jz_lcd_get_pixel_clock() 10.158 +static uint32_t jz_lcd_get_pixel_clock() 10.159 { 10.160 - unsigned int pclk; 10.161 + uint32_t pclk; 10.162 10.163 /* Derive pixel clock from frame clock. */ 10.164 10.165 @@ -315,9 +315,9 @@ 10.166 return pclk; 10.167 } 10.168 10.169 -static void jz_lcd_set_timing(unsigned int pclk) 10.170 +static void jz_lcd_set_timing(uint32_t pclk) 10.171 { 10.172 - unsigned int val; 10.173 + uint32_t val; 10.174 10.175 #ifdef CONFIG_CPU_JZ4730 10.176 val = __cpm_get_pllout() / pclk; 10.177 @@ -359,8 +359,8 @@ 10.178 static int jz_lcd_hw_init(vidinfo_t *vid) 10.179 { 10.180 struct jz_fb_info *fbi = &vid->jz_fb; 10.181 - unsigned int val = 0; 10.182 - unsigned int pclk = jz_lcd_get_pixel_clock(); 10.183 + uint32_t val = 0; 10.184 + uint32_t pclk = jz_lcd_get_pixel_clock(); 10.185 10.186 /* Setting Control register */ 10.187 switch (jzfb.bpp) { 10.188 @@ -442,18 +442,18 @@ 10.189 10.190 /* Configure DMA. */ 10.191 10.192 - REG_LCD_DA0 = (unsigned long) fbi->fdadr0; /* frame descriptor */ 10.193 + REG_LCD_DA0 = (uint32_t) fbi->fdadr0; /* frame descriptor */ 10.194 10.195 if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) || 10.196 ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL)) 10.197 - REG_LCD_DA1 = (unsigned long) fbi->fdadr1; /* frame descriptor */ 10.198 + REG_LCD_DA1 = (uint32_t) fbi->fdadr1; /* frame descriptor */ 10.199 10.200 return 0; 10.201 } 10.202 10.203 -static inline u8 LCD_CODE(u8 bpp) 10.204 +static inline uint8_t LCD_CODE(uint8_t bpp) 10.205 { 10.206 - u8 code = 0; 10.207 + uint8_t code = 0; 10.208 while (bpp && !(bpp & 1)) 10.209 { 10.210 bpp >>= 1; 10.211 @@ -464,7 +464,7 @@ 10.212 10.213 /* Public operations. */ 10.214 10.215 -void lcd_set_bpp(u8 bpp) 10.216 +void lcd_set_bpp(uint8_t bpp) 10.217 { 10.218 jzfb.bpp = bpp; 10.219 panel_info.vl_bpix = LCD_CODE(bpp); 10.220 @@ -488,21 +488,21 @@ 10.221 REG_LCD_CTRL &= ~(1<<4); /* LCDCTRL.ENA, quick disable */ 10.222 } 10.223 10.224 -static inline u16 rgb8_to_rgb16(u8 rgb) 10.225 +static inline uint16_t rgb8_to_rgb16(uint8_t rgb) 10.226 { 10.227 return ((((rgb & 0xe0) >> 5) * 4) << 11) | ((((rgb & 0x1c) >> 2) * 9) << 6) | ((rgb & 0x03) * 10); 10.228 } 10.229 10.230 -static inline u16 rgb4_to_rgb16(u8 rgb) 10.231 +static inline uint16_t rgb4_to_rgb16(uint8_t rgb) 10.232 { 10.233 return ((((rgb & 8) >> 3) * 0x1f) << 11) | ((((rgb & 6) >> 1) * 0x15) << 5) | ((rgb & 1) * 0x1f); 10.234 } 10.235 10.236 static void lcd_init_palette(vidinfo_t *vid) 10.237 { 10.238 - u16 *palette = (u16 *) lcd_get_palette(get_memory_size()); 10.239 - u16 *end = (u16 *) palette + NCOLORS(vid->vl_bpix); 10.240 - u8 value = 0; 10.241 + uint16_t *palette = (uint16_t *) lcd_get_palette(get_memory_size()); 10.242 + uint16_t *end = (uint16_t *) palette + NCOLORS(vid->vl_bpix); 10.243 + uint8_t value = 0; 10.244 10.245 while (palette < end) 10.246 { 10.247 @@ -523,7 +523,7 @@ 10.248 } 10.249 } 10.250 10.251 -unsigned long lcd_ctrl_init() 10.252 +uint32_t lcd_ctrl_init() 10.253 { 10.254 struct jz_fb_info *fbi = &panel_info.jz_fb; 10.255
11.1 --- a/stage2/jzlcd.h Wed Jun 28 00:20:14 2017 +0200 11.2 +++ b/stage2/jzlcd.h Wed Jun 28 01:04:22 2017 +0200 11.3 @@ -4,7 +4,7 @@ 11.4 * Copyright (C) 2001 Wolfgang Denk, DENX Software Engineering, wd@denx.de. 11.5 * Copyright (C) 2005-2007, Ingenic Semiconductor Inc. 11.6 * Copyright (C) Xiangfu Liu <xiangfu@sharism.cc> 11.7 - * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 11.8 + * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 11.9 * 11.10 * This program is free software; you can redistribute it and/or 11.11 * modify it under the terms of the GNU General Public License as 11.12 @@ -25,10 +25,10 @@ 11.13 #ifndef __JZLCD_H__ 11.14 #define __JZLCD_H__ 11.15 11.16 -#include "xburst_types.h" 11.17 +#include <stdint.h> 11.18 11.19 -void lcd_set_bpp(u8 bpp); 11.20 -unsigned long lcd_ctrl_init(); 11.21 +void lcd_set_bpp(uint8_t bpp); 11.22 +uint32_t lcd_ctrl_init(); 11.23 void lcd_enable(); 11.24 void lcd_disable(); 11.25 11.26 @@ -36,17 +36,17 @@ 11.27 * Framebuffer characteristics 11.28 */ 11.29 struct jzfb_info { 11.30 - unsigned int cfg; /* panel mode and pin usage etc. */ 11.31 - unsigned int w; 11.32 - unsigned int h; 11.33 - unsigned int bpp; /* bit per pixel */ 11.34 - unsigned int fclk; /* frame clk */ 11.35 - unsigned int hsw; /* hsync width, in pclk */ 11.36 - unsigned int vsw; /* vsync width, in line count */ 11.37 - unsigned int elw; /* end of line, in pclk */ 11.38 - unsigned int blw; /* begin of line, in pclk */ 11.39 - unsigned int efw; /* end of frame, in line count */ 11.40 - unsigned int bfw; /* begin of frame, in line count */ 11.41 + uint32_t cfg; /* panel mode and pin usage etc. */ 11.42 + uint32_t w; 11.43 + uint32_t h; 11.44 + uint32_t bpp; /* bit per pixel */ 11.45 + uint32_t fclk; /* frame clk */ 11.46 + uint32_t hsw; /* hsync width, in pclk */ 11.47 + uint32_t vsw; /* vsync width, in line count */ 11.48 + uint32_t elw; /* end of line, in pclk */ 11.49 + uint32_t blw; /* begin of line, in pclk */ 11.50 + uint32_t efw; /* end of frame, in line count */ 11.51 + uint32_t bfw; /* begin of frame, in line count */ 11.52 }; 11.53 11.54 /* 11.55 @@ -54,9 +54,9 @@ 11.56 */ 11.57 struct jz_fb_dma_descriptor { 11.58 struct jz_fb_dma_descriptor *fdadr; /* Frame descriptor address register */ 11.59 - unsigned long fsadr; /* Frame source address register */ 11.60 - unsigned long fidr; /* Frame ID register */ 11.61 - unsigned long ldcmd; /* Command register */ 11.62 + uint32_t fsadr; /* Frame source address register */ 11.63 + uint32_t fidr; /* Frame ID register */ 11.64 + uint32_t ldcmd; /* Command register */ 11.65 }; 11.66 11.67 /* 11.68 @@ -72,17 +72,17 @@ 11.69 struct jz_fb_dma_descriptor *dmadesc_fbhigh; 11.70 struct jz_fb_dma_descriptor *dmadesc_palette; 11.71 11.72 - unsigned long screen; /* address of frame buffer */ 11.73 - unsigned long palette; /* address of palette memory */ 11.74 + uint32_t screen; /* address of frame buffer */ 11.75 + uint32_t palette; /* address of palette memory */ 11.76 }; 11.77 11.78 /* 11.79 * Concise display characteristics with low-level structure reference 11.80 */ 11.81 typedef struct vidinfo { 11.82 - unsigned short vl_col; /* Number of columns (i.e. 640) */ 11.83 - unsigned short vl_row; /* Number of rows (i.e. 480) */ 11.84 - unsigned char vl_bpix; /* Bits per pixel, 0 = 1, 1 = 2, 2 = 4, 3 = 8 */ 11.85 + uint16_t vl_col; /* Number of columns (i.e. 640) */ 11.86 + uint16_t vl_row; /* Number of rows (i.e. 480) */ 11.87 + uint8_t vl_bpix; /* Bits per pixel, 0 = 1, 1 = 2, 2 = 4, 3 = 8 */ 11.88 11.89 struct jz_fb_info jz_fb; 11.90 } vidinfo_t;
12.1 --- a/stage2/lcd.c Wed Jun 28 00:20:14 2017 +0200 12.2 +++ b/stage2/lcd.c Wed Jun 28 01:04:22 2017 +0200 12.3 @@ -2,7 +2,7 @@ 12.4 * Ben NanoNote LCD initialisation, based on uboot-xburst and xburst-tools. 12.5 * 12.6 * Copyright (C) 2001-2002 Wolfgang Denk, DENX Software Engineering, <wd@denx.de> 12.7 - * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 12.8 + * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 12.9 * 12.10 * This program is free software: you can redistribute it and/or modify 12.11 * it under the terms of the GNU General Public License as published by 12.12 @@ -20,7 +20,6 @@ 12.13 12.14 #include "board-display.h" 12.15 12.16 -#include "xburst_types.h" 12.17 #include "jzlcd.h" 12.18 #include "sdram.h" 12.19 #include "board.h" 12.20 @@ -30,27 +29,27 @@ 12.21 12.22 static unsigned int get_line_length() 12.23 { 12.24 - return ALIGN((panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8, sizeof(u32)); 12.25 + return ALIGN((panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8, sizeof(uint32_t)); 12.26 } 12.27 12.28 -static u32 *get_pixel32(unsigned short h, unsigned short v) 12.29 +static uint32_t *get_pixel32(unsigned short h, unsigned short v) 12.30 { 12.31 - return (u32 *) (lcd_base + v * get_line_length()) + h; 12.32 + return (uint32_t *) (lcd_base + v * get_line_length()) + h; 12.33 } 12.34 12.35 -static u16 *get_pixel16(unsigned short h, unsigned short v) 12.36 +static uint16_t *get_pixel16(unsigned short h, unsigned short v) 12.37 { 12.38 - return (u16 *) (lcd_base + v * get_line_length()) + h; 12.39 + return (uint16_t *) (lcd_base + v * get_line_length()) + h; 12.40 } 12.41 12.42 -static u8 *get_pixel8(unsigned short h, unsigned short v) 12.43 +static uint8_t *get_pixel8(unsigned short h, unsigned short v) 12.44 { 12.45 - return (u8 *) (lcd_base + v * get_line_length()) + h; 12.46 + return (uint8_t *) (lcd_base + v * get_line_length()) + h; 12.47 } 12.48 12.49 -static u8 *get_pixel4(unsigned short h, unsigned short v) 12.50 +static uint8_t *get_pixel4(unsigned short h, unsigned short v) 12.51 { 12.52 - return (u8 *) (lcd_base + v * get_line_length()) + h / 2; 12.53 + return (uint8_t *) (lcd_base + v * get_line_length()) + h / 2; 12.54 } 12.55 12.56 static inline unsigned short div(unsigned short num, unsigned short denom, unsigned short scale) 12.57 @@ -58,17 +57,17 @@ 12.58 return (scale * num) / denom; 12.59 } 12.60 12.61 -static u32 pixel(u8 r, u8 g, u8 b, u8 rmax, u8 gmax, u8 bmax, u8 rshift, u8 gshift, u8 bshift) 12.62 +static uint32_t pixel(uint8_t r, uint8_t g, uint8_t b, uint8_t rmax, uint8_t gmax, uint8_t bmax, uint8_t rshift, uint8_t gshift, uint8_t bshift) 12.63 { 12.64 return (div(r, 255, rmax) << rshift) | (div(g, 255, gmax) << gshift) | (div(b, 255, bmax) << bshift); 12.65 } 12.66 12.67 -u32 get_bitmap_value(unsigned short x, u32 value) 12.68 +uint32_t get_bitmap_value(unsigned short x, uint32_t value) 12.69 { 12.70 return (value >> (((panel_info.vl_col - 1 - x) * 32) / panel_info.vl_col)) % 2 ? 0xffffffff : 0; 12.71 } 12.72 12.73 -static void get_colour(unsigned short h, unsigned short v, u8 rgb[], unsigned short pixel_type) 12.74 +static void get_colour(unsigned short h, unsigned short v, uint8_t rgb[], unsigned short pixel_type) 12.75 { 12.76 unsigned short v_max = panel_info.vl_row - 1; 12.77 unsigned short h_max = panel_info.vl_col - 1; 12.78 @@ -78,32 +77,32 @@ 12.79 rgb[(pixel_type + 1) % 3] = (rgb[0] + rgb[1]) / 2; 12.80 } 12.81 12.82 -static void set_pixel32(unsigned short h, unsigned short v, u32 value) 12.83 +static void set_pixel32(unsigned short h, unsigned short v, uint32_t value) 12.84 { 12.85 - u32 *pix = get_pixel32(h, v); 12.86 + uint32_t *pix = get_pixel32(h, v); 12.87 *pix = value; 12.88 } 12.89 12.90 -static void set_pixel16_565(unsigned short h, unsigned short v, u32 value) 12.91 +static void set_pixel16_565(unsigned short h, unsigned short v, uint32_t value) 12.92 { 12.93 - u16 *pix = get_pixel16(h, v); 12.94 - *pix = (u16) value; 12.95 + uint16_t *pix = get_pixel16(h, v); 12.96 + *pix = (uint16_t) value; 12.97 } 12.98 12.99 -static void set_pixel8(unsigned short h, unsigned short v, u32 value) 12.100 +static void set_pixel8(unsigned short h, unsigned short v, uint32_t value) 12.101 { 12.102 - u8 *pix = get_pixel8(h, v); 12.103 - *pix = (u8) value; 12.104 + uint8_t *pix = get_pixel8(h, v); 12.105 + *pix = (uint8_t) value; 12.106 } 12.107 12.108 -static void set_pixel4(unsigned short h, unsigned short v, u32 value) 12.109 +static void set_pixel4(unsigned short h, unsigned short v, uint32_t value) 12.110 { 12.111 - u8 *pix = get_pixel4(h, v); 12.112 - u8 mask = h & 1 ? 0xf0 : 0x0f; 12.113 - *pix = (*pix & mask) | ((u8) value); 12.114 + uint8_t *pix = get_pixel4(h, v); 12.115 + uint8_t mask = h & 1 ? 0xf0 : 0x0f; 12.116 + *pix = (*pix & mask) | ((uint8_t) value); 12.117 } 12.118 12.119 -void set_pixel(unsigned short h, unsigned short v, u32 value) 12.120 +void set_pixel(unsigned short h, unsigned short v, uint32_t value) 12.121 { 12.122 switch (panel_info.vl_bpix) 12.123 { 12.124 @@ -127,7 +126,7 @@ 12.125 } 12.126 static void test_pixel32(unsigned short h, unsigned short v, unsigned short pixel_type) 12.127 { 12.128 - u8 rgb[3]; 12.129 + uint8_t rgb[3]; 12.130 12.131 get_colour(h, v, rgb, pixel_type); 12.132 set_pixel32(h, v, pixel(rgb[0], rgb[1], rgb[2], 255, 255, 255, 16, 8, 0) | get_bitmap_value(h, pixel_type)); 12.133 @@ -135,7 +134,7 @@ 12.134 12.135 static void test_pixel16_565(unsigned short h, unsigned short v, unsigned short pixel_type) 12.136 { 12.137 - u8 rgb[3]; 12.138 + uint8_t rgb[3]; 12.139 12.140 get_colour(h, v, rgb, pixel_type); 12.141 set_pixel16_565(h, v, pixel(rgb[0], rgb[1], rgb[2], 31, 63, 31, 11, 5, 0) | get_bitmap_value(h, pixel_type)); 12.142 @@ -143,7 +142,7 @@ 12.143 12.144 static void test_pixel8(unsigned short h, unsigned short v, unsigned short pixel_type) 12.145 { 12.146 - u8 rgb[3]; 12.147 + uint8_t rgb[3]; 12.148 12.149 get_colour(h, v, rgb, pixel_type); 12.150 set_pixel8(h, v, pixel(rgb[0], rgb[1], rgb[2], 7, 7, 3, 5, 2, 0) | get_bitmap_value(h, pixel_type)); 12.151 @@ -151,7 +150,7 @@ 12.152 12.153 static void test_pixel4(unsigned short h, unsigned short v, unsigned short pixel_type) 12.154 { 12.155 - u8 rgb[3]; 12.156 + uint8_t rgb[3]; 12.157 12.158 get_colour(h, v, rgb, pixel_type); 12.159 set_pixel4(h, v, pixel(rgb[0], rgb[1], rgb[2], 1, 2, 1, 3, 1, 0) | get_bitmap_value(h, pixel_type)); 12.160 @@ -182,26 +181,26 @@ 12.161 12.162 void clear_pixel32(unsigned short h, unsigned short v) 12.163 { 12.164 - u32 *pix = get_pixel32(h, v); 12.165 + uint32_t *pix = get_pixel32(h, v); 12.166 *pix = 0; 12.167 } 12.168 12.169 void clear_pixel16(unsigned short h, unsigned short v) 12.170 { 12.171 - u16 *pix = get_pixel16(h, v); 12.172 + uint16_t *pix = get_pixel16(h, v); 12.173 *pix = 0; 12.174 } 12.175 12.176 void clear_pixel8(unsigned short h, unsigned short v) 12.177 { 12.178 - u8 *pix = get_pixel8(h, v); 12.179 + uint8_t *pix = get_pixel8(h, v); 12.180 *pix = 0; 12.181 } 12.182 12.183 void clear_pixel4(unsigned short h, unsigned short v) 12.184 { 12.185 - u8 *pix = get_pixel4(h, v); 12.186 - u8 mask = h & 1 ? 0xf0 : 0x0f; 12.187 + uint8_t *pix = get_pixel4(h, v); 12.188 + uint8_t mask = h & 1 ? 0xf0 : 0x0f; 12.189 *pix = *pix & mask; 12.190 } 12.191
13.1 --- a/stage2/lcd.h Wed Jun 28 00:20:14 2017 +0200 13.2 +++ b/stage2/lcd.h Wed Jun 28 01:04:22 2017 +0200 13.3 @@ -1,7 +1,7 @@ 13.4 #ifndef __LCD_H__ 13.5 #define __LCD_H__ 13.6 13.7 -#include "xburst_types.h" 13.8 +#include <stdint.h> 13.9 13.10 /* Initialisation functions. */ 13.11 13.12 @@ -9,8 +9,8 @@ 13.13 13.14 /* Output functions. */ 13.15 13.16 -u32 get_bitmap_value(unsigned short, u32); 13.17 -void set_pixel(unsigned short, unsigned short, u32); 13.18 +uint32_t get_bitmap_value(unsigned short, uint32_t); 13.19 +void set_pixel(unsigned short, unsigned short, uint32_t); 13.20 void test_pixel(unsigned short, unsigned short, unsigned short); 13.21 void clear_pixel(unsigned short, unsigned short); 13.22
14.1 --- a/stage2/nanonote_gpm940b0.h Wed Jun 28 00:20:14 2017 +0200 14.2 +++ b/stage2/nanonote_gpm940b0.h Wed Jun 28 01:04:22 2017 +0200 14.3 @@ -2,7 +2,7 @@ 14.4 * Ben NanoNote panel-specific definitions 14.5 * 14.6 * Copyright (C) Xiangfu Liu <xiangfu@sharism.cc> 14.7 - * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 14.8 + * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 14.9 * 14.10 * This program is free software; you can redistribute it and/or 14.11 * modify it under the terms of the GNU General Public License as 14.12 @@ -26,10 +26,10 @@ 14.13 #include "board.h" 14.14 #include "nanonote.h" 14.15 14.16 -static inline void __spi_write_reg1(u8 reg, u8 val) 14.17 +static inline void __spi_write_reg1(uint8_t reg, uint8_t val) 14.18 { 14.19 - u8 no, a=reg, b=val; 14.20 - u16 value; 14.21 + uint8_t no, a=reg, b=val; 14.22 + uint16_t value; 14.23 14.24 __gpio_set_pin(SPEN); 14.25 __gpio_set_pin(SPCK);
15.1 --- a/stage2/paging.c Wed Jun 28 00:20:14 2017 +0200 15.2 +++ b/stage2/paging.c Wed Jun 28 01:04:22 2017 +0200 15.3 @@ -1,7 +1,7 @@ 15.4 /* 15.5 * Paging utilities. 15.6 * 15.7 - * Copyright (C) 2016 Paul Boddie <paul@boddie.org.uk> 15.8 + * Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 15.9 * 15.10 * This program is free software: you can redistribute it and/or modify 15.11 * it under the terms of the GNU General Public License as published by 15.12 @@ -20,22 +20,22 @@ 15.13 #include "paging.h" 15.14 #include "memory.h" 15.15 15.16 -inline u32 user_address(u32 addr) 15.17 +inline uint32_t user_address(uint32_t addr) 15.18 { 15.19 return addr & USER_ADDRESS_MASK; 15.20 } 15.21 15.22 -inline u32 previous_page(u32 addr, u32 pagesize) 15.23 +inline uint32_t previous_page(uint32_t addr, uint32_t pagesize) 15.24 { 15.25 return addr - pagesize * 2; 15.26 } 15.27 15.28 -inline u32 next_page(u32 addr, u32 pagesize) 15.29 +inline uint32_t next_page(uint32_t addr, uint32_t pagesize) 15.30 { 15.31 return addr + pagesize * 2; 15.32 } 15.33 15.34 -inline u32 page_size(u32 size) 15.35 +inline uint32_t page_size(uint32_t size) 15.36 { 15.37 return size / 2; 15.38 }
16.1 --- a/stage2/paging.h Wed Jun 28 00:20:14 2017 +0200 16.2 +++ b/stage2/paging.h Wed Jun 28 01:04:22 2017 +0200 16.3 @@ -5,12 +5,12 @@ 16.4 16.5 #ifndef __ASSEMBLER__ 16.6 16.7 -#include "xburst_types.h" 16.8 +#include <stdint.h> 16.9 16.10 -u32 user_address(u32 addr); 16.11 -u32 previous_page(u32 addr, u32 pagesize); 16.12 -u32 next_page(u32 addr, u32 pagesize); 16.13 -u32 page_size(u32 size); 16.14 +uint32_t user_address(uint32_t addr); 16.15 +uint32_t previous_page(uint32_t addr, uint32_t pagesize); 16.16 +uint32_t next_page(uint32_t addr, uint32_t pagesize); 16.17 +uint32_t page_size(uint32_t size); 16.18 16.19 #endif /* __ASSEMBLER__ */ 16.20
17.1 --- a/stage2/task_gpio.c Wed Jun 28 00:20:14 2017 +0200 17.2 +++ b/stage2/task_gpio.c Wed Jun 28 01:04:22 2017 +0200 17.3 @@ -1,7 +1,7 @@ 17.4 /* 17.5 * GPIO access for tasks. 17.6 * 17.7 - * Copyright (C) 2016 Paul Boddie <paul@boddie.org.uk> 17.8 + * Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 17.9 * 17.10 * This program is free software: you can redistribute it and/or modify 17.11 * it under the terms of the GNU General Public License as published by 17.12 @@ -24,14 +24,14 @@ 17.13 #include "memory.h" 17.14 #include "task_gpio.h" 17.15 17.16 -void task_gpio_init(unsigned short task) 17.17 +void task_gpio_init(uint8_t task) 17.18 { 17.19 - u32 virtual, physical; 17.20 + uint32_t virtual, physical; 17.21 17.22 /* Map the I/O region to the task. */ 17.23 17.24 for (virtual = TASK_GPIO_BASE, physical = GPIO_BASE; 17.25 - virtual < (u32) TASK_GPIO_BASE + (u32) GPIO_REGION_SIZE; 17.26 + virtual < (uint32_t) TASK_GPIO_BASE + (uint32_t) GPIO_REGION_SIZE; 17.27 virtual += page_size(STAGE2_PAGESIZE), physical += page_size(STAGE2_PAGESIZE)) 17.28 { 17.29 init_page_table(STAGE2_PAGE_TABLE_BASE, virtual, physical, 17.30 @@ -39,27 +39,27 @@ 17.31 } 17.32 } 17.33 17.34 -void task_gpio_as_input(unsigned short pin) 17.35 +void task_gpio_as_input(uint8_t pin) 17.36 { 17.37 TASK_REG_GPIO_PXDIRC(pin / 32) = (1 << (pin % 32)); 17.38 } 17.39 17.40 -void task_gpio_as_output(unsigned short pin) 17.41 +void task_gpio_as_output(uint8_t pin) 17.42 { 17.43 TASK_REG_GPIO_PXDIRS(pin / 32) = (1 << (pin % 32)); 17.44 } 17.45 17.46 -inline void task_gpio_set_pin(unsigned short pin) 17.47 +inline void task_gpio_set_pin(uint8_t pin) 17.48 { 17.49 TASK_REG_GPIO_PXDATS(pin / 32) = (1 << (pin % 32)); 17.50 } 17.51 17.52 -inline void task_gpio_clear_pin(unsigned short pin) 17.53 +inline void task_gpio_clear_pin(uint8_t pin) 17.54 { 17.55 TASK_REG_GPIO_PXDATC(pin / 32) = (1 << (pin % 32)); 17.56 } 17.57 17.58 -inline int task_gpio_get_pin(unsigned short pin) 17.59 +inline int task_gpio_get_pin(uint8_t pin) 17.60 { 17.61 return TASK_REG_GPIO_PXPIN(pin / 32) & (1 << (pin % 32)); 17.62 }
18.1 --- a/stage2/task_gpio.h Wed Jun 28 00:20:14 2017 +0200 18.2 +++ b/stage2/task_gpio.h Wed Jun 28 01:04:22 2017 +0200 18.3 @@ -24,11 +24,11 @@ 18.4 #define TASK_REG_GPIO_PXDIRS(n) REG32(TASK_GPIO_PXDIRS((n))) 18.5 #define TASK_REG_GPIO_PXDIRC(n) REG32(TASK_GPIO_PXDIRC((n))) 18.6 18.7 -void task_gpio_init(unsigned short task); 18.8 -void task_gpio_as_input(unsigned short pin); 18.9 -void task_gpio_as_output(unsigned short pin); 18.10 -void task_gpio_set_pin(unsigned short pin); 18.11 -void task_gpio_clear_pin(unsigned short pin); 18.12 -int task_gpio_get_pin(unsigned short pin); 18.13 +void task_gpio_init(uint8_t task); 18.14 +void task_gpio_as_input(uint8_t pin); 18.15 +void task_gpio_as_output(uint8_t pin); 18.16 +void task_gpio_set_pin(uint8_t pin); 18.17 +void task_gpio_clear_pin(uint8_t pin); 18.18 +int task_gpio_get_pin(uint8_t pin); 18.19 18.20 #endif /* __TASK_GPIO_H__ */
19.1 --- a/stage2/tasks.c Wed Jun 28 00:20:14 2017 +0200 19.2 +++ b/stage2/tasks.c Wed Jun 28 01:04:22 2017 +0200 19.3 @@ -1,7 +1,7 @@ 19.4 /* 19.5 * Task handling. 19.6 * 19.7 - * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 19.8 + * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 19.9 * 19.10 * This program is free software: you can redistribute it and/or modify 19.11 * it under the terms of the GNU General Public License as published by 19.12 @@ -27,20 +27,20 @@ 19.13 19.14 /* Task tables and data. */ 19.15 19.16 -static u32 stack_pointers[max_tasks]; 19.17 -static u32 registers[max_tasks][32]; 19.18 +static uint32_t stack_pointers[max_tasks]; 19.19 +static uint32_t registers[max_tasks][32]; 19.20 19.21 -u8 current_task; 19.22 -u32 *current_stack_pointer; 19.23 -u32 *current_registers; 19.24 +uint8_t current_task; 19.25 +uint32_t *current_stack_pointer; 19.26 +uint32_t *current_registers; 19.27 19.28 /* A reference to locations for the symbol tables. */ 19.29 19.30 -extern u32 _got_start, _got_copy_start, _got_copy_end; 19.31 +extern uint32_t _got_start, _got_copy_start, _got_copy_end; 19.32 19.33 /* A reference to the start of the payload and end of memory locations. */ 19.34 19.35 -extern u32 _payload_start, _memory_end; 19.36 +extern uint32_t _payload_start, _memory_end; 19.37 19.38 /* Task management functions. */ 19.39 19.40 @@ -58,16 +58,16 @@ 19.41 19.42 void start_tasks() 19.43 { 19.44 - void (**starter)(unsigned short); 19.45 + void (**starter)(uint8_t); 19.46 int i; 19.47 19.48 for (i = 1, starter = initial_tasks; *starter; i++, starter++) 19.49 (*starter)(i); 19.50 } 19.51 19.52 -void start_task(unsigned short task, void (*function)(), u32 args[], u8 nargs) 19.53 +void start_task(uint8_t task, void (*function)(), uint32_t args[], uint8_t nargs) 19.54 { 19.55 - u32 virtual, physical, address; 19.56 + uint32_t virtual, physical, address; 19.57 19.58 /* 19.59 Each task employs a stack at a multiple of the given start address in 19.60 @@ -98,19 +98,19 @@ 19.61 return address. 19.62 */ 19.63 19.64 - init_registers(registers[task], (u32) &_got_copy_start, function, args, nargs); 19.65 + init_registers(registers[task], (uint32_t) &_got_copy_start, function, args, nargs); 19.66 19.67 /* Map the global object table for the task. */ 19.68 19.69 init_page_table(STAGE2_PAGE_TABLE_BASE, 19.70 - user_address((u32) &_got_start), 19.71 - user_address((u32) &_got_copy_start), 19.72 + user_address((uint32_t) &_got_start), 19.73 + user_address((uint32_t) &_got_copy_start), 19.74 STAGE2_PAGESIZE, TLB_READ, task); 19.75 19.76 /* Map all shared pages for the task. First, the read-only code region. */ 19.77 19.78 - for (address = (u32) &_payload_start; 19.79 - address < (u32) &_got_start; 19.80 + for (address = (uint32_t) &_payload_start; 19.81 + address < (uint32_t) &_got_start; 19.82 address = next_page(address, STAGE2_PAGESIZE)) 19.83 { 19.84 init_page_table(STAGE2_PAGE_TABLE_BASE, 19.85 @@ -121,8 +121,8 @@ 19.86 19.87 /* Make the pages after the code writable. */ 19.88 19.89 - for (address = next_page((u32) &_got_copy_end, STAGE2_PAGESIZE); 19.90 - address < (u32) &_memory_end; 19.91 + for (address = next_page((uint32_t) &_got_copy_end, STAGE2_PAGESIZE); 19.92 + address < (uint32_t) &_memory_end; 19.93 address = next_page(address, STAGE2_PAGESIZE)) 19.94 { 19.95 init_page_table(STAGE2_PAGE_TABLE_BASE,
20.1 --- a/stage2/tasks.h Wed Jun 28 00:20:14 2017 +0200 20.2 +++ b/stage2/tasks.h Wed Jun 28 01:04:22 2017 +0200 20.3 @@ -1,7 +1,7 @@ 20.4 #ifndef __TASKS_H__ 20.5 #define __TASKS_H__ 20.6 20.7 -#include "xburst_types.h" 20.8 +#include <stdint.h> 20.9 20.10 /* Provide a limit to the number of tasks (in a way that employs a constant). */ 20.11 20.12 @@ -12,7 +12,7 @@ 20.13 void init_tasks(); 20.14 void init_task(); 20.15 void start_tasks(); 20.16 -void start_task(unsigned short, void (*)(), u32[], u8); 20.17 +void start_task(uint8_t, void (*)(), uint32_t[], uint8_t); 20.18 void start_task_now(); 20.19 void switch_task(); 20.20
21.1 --- a/stage2/tasks/example.c Wed Jun 28 00:20:14 2017 +0200 21.2 +++ b/stage2/tasks/example.c Wed Jun 28 01:04:22 2017 +0200 21.3 @@ -1,7 +1,7 @@ 21.4 /* 21.5 * Example screen-updating task. 21.6 * 21.7 - * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> 21.8 + * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 21.9 * 21.10 * This program is free software: you can redistribute it and/or modify 21.11 * it under the terms of the GNU General Public License as published by 21.12 @@ -24,7 +24,7 @@ 21.13 21.14 extern vidinfo_t panel_info; 21.15 21.16 -void next_pixel(unsigned short *x, unsigned short *y) 21.17 +void next_pixel(uint16_t *x, uint16_t *y) 21.18 { 21.19 (*x)++; 21.20 if (*x >= panel_info.vl_col) { 21.21 @@ -37,7 +37,7 @@ 21.22 21.23 /* Tasks. */ 21.24 21.25 -void plot_pattern(unsigned short pixel_type, unsigned short x, unsigned short y) 21.26 +void plot_pattern(uint16_t pixel_type, uint16_t x, uint16_t y) 21.27 { 21.28 int i; 21.29 21.30 @@ -48,9 +48,9 @@ 21.31 } 21.32 } 21.33 21.34 -void start_plot_pattern(unsigned short task) 21.35 +void start_plot_pattern(uint8_t task) 21.36 { 21.37 - u32 args[] = {task, 0, (task * (panel_info.vl_row / 4)) % panel_info.vl_row}; 21.38 + uint32_t args[] = {task, 0, (task * (panel_info.vl_row / 4)) % panel_info.vl_row}; 21.39 21.40 start_task(task, (void (*)()) plot_pattern, args, 3); 21.41 }
22.1 --- a/stage2/tasks/example.h Wed Jun 28 00:20:14 2017 +0200 22.2 +++ b/stage2/tasks/example.h Wed Jun 28 01:04:22 2017 +0200 22.3 @@ -1,12 +1,12 @@ 22.4 #ifndef __EXAMPLE_H__ 22.5 #define __EXAMPLE_H__ 22.6 22.7 -#include "xburst_types.h" 22.8 +#include <stdint.h> 22.9 22.10 /* Example task functions. */ 22.11 22.12 -void plot_pattern(unsigned short, unsigned short, unsigned short); 22.13 -void plot_value(u32); 22.14 -void start_plot_pattern(unsigned short); 22.15 +void plot_pattern(uint16_t, uint16_t, uint16_t); 22.16 +void plot_value(uint32_t); 22.17 +void start_plot_pattern(uint8_t); 22.18 22.19 #endif /* __EXAMPLE_H__ */
23.1 --- a/stage2/tasks/keyscan.c Wed Jun 28 00:20:14 2017 +0200 23.2 +++ b/stage2/tasks/keyscan.c Wed Jun 28 01:04:22 2017 +0200 23.3 @@ -1,7 +1,7 @@ 23.4 /* 23.5 * Keyboard scanning task. 23.6 * 23.7 - * Copyright (C) 2016 Paul Boddie <paul@boddie.org.uk> 23.8 + * Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 23.9 * 23.10 * This program is free software: you can redistribute it and/or modify 23.11 * it under the terms of the GNU General Public License as published by 23.12 @@ -25,10 +25,10 @@ 23.13 23.14 extern vidinfo_t panel_info; 23.15 23.16 -void plot_value(unsigned short xmin, unsigned short xmax, unsigned short ymin, unsigned short ymax, u8 value) 23.17 +void plot_value(uint16_t xmin, uint16_t xmax, uint16_t ymin, uint16_t ymax, uint8_t value) 23.18 { 23.19 - unsigned short x, y; 23.20 - u32 pixel; 23.21 + uint16_t x, y; 23.22 + uint32_t pixel; 23.23 23.24 for (y = ymin; (y < panel_info.vl_row) && (y < ymax); y++) 23.25 { 23.26 @@ -53,10 +53,10 @@ 23.27 23.28 /* Tasks. */ 23.29 23.30 -void keyscan(unsigned short task) 23.31 +void keyscan(uint8_t task) 23.32 { 23.33 int column, row; 23.34 - u8 value; 23.35 + uint8_t value; 23.36 23.37 init_keyscan(); 23.38 23.39 @@ -84,9 +84,9 @@ 23.40 } 23.41 } 23.42 23.43 -void start_keyscan(unsigned short task) 23.44 +void start_keyscan(uint8_t task) 23.45 { 23.46 - u32 args[] = {task}; 23.47 + uint32_t args[] = {task}; 23.48 23.49 task_gpio_init(task); 23.50
24.1 --- a/stage2/tasks/keyscan.h Wed Jun 28 00:20:14 2017 +0200 24.2 +++ b/stage2/tasks/keyscan.h Wed Jun 28 01:04:22 2017 +0200 24.3 @@ -1,6 +1,8 @@ 24.4 #ifndef __KEYSCAN_H__ 24.5 #define __KEYSCAN_H__ 24.6 24.7 -void start_keyscan(unsigned short); 24.8 +#include <stdint.h> 24.9 + 24.10 +void start_keyscan(uint8_t); 24.11 24.12 #endif /* __KEYSCAN_H__ */
25.1 --- a/stage2/tasks/manifest.c Wed Jun 28 00:20:14 2017 +0200 25.2 +++ b/stage2/tasks/manifest.c Wed Jun 28 01:04:22 2017 +0200 25.3 @@ -1,7 +1,7 @@ 25.4 /* 25.5 * Task manifest. 25.6 * 25.7 - * Copyright (C) 2016 Paul Boddie <paul@boddie.org.uk> 25.8 + * Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 25.9 * 25.10 * This program is free software: you can redistribute it and/or modify 25.11 * it under the terms of the GNU General Public License as published by 25.12 @@ -23,7 +23,7 @@ 25.13 25.14 /* A list of task-starting functions accepting their task identifier. */ 25.15 25.16 -void (*initial_task_array[])(unsigned short) = { 25.17 +void (*initial_task_array[])(uint8_t) = { 25.18 start_plot_pattern, 25.19 start_plot_pattern, 25.20 start_keyscan, 25.21 @@ -36,4 +36,4 @@ 25.22 0 25.23 }; 25.24 25.25 -void (**initial_tasks)(unsigned short) = initial_task_array; 25.26 +void (**initial_tasks)(uint8_t) = initial_task_array;
26.1 --- a/stage2/tasks/manifest.h Wed Jun 28 00:20:14 2017 +0200 26.2 +++ b/stage2/tasks/manifest.h Wed Jun 28 01:04:22 2017 +0200 26.3 @@ -1,6 +1,8 @@ 26.4 #ifndef __TASKS_MANIFEST_H__ 26.5 #define __TASKS_MANIFEST_H__ 26.6 26.7 -void (**initial_tasks)(unsigned short); 26.8 +#include <stdint.h> 26.9 + 26.10 +void (**initial_tasks)(uint8_t); 26.11 26.12 #endif /* __TASKS_MANIFEST_H__ */