1.1 --- a/include/minipc.h Sun Oct 02 22:34:32 2016 +0200
1.2 +++ b/include/minipc.h Sun Oct 02 22:38:07 2016 +0200
1.3 @@ -31,7 +31,12 @@
1.4 #define GPIO_POWER 97
1.5
1.6 #define GPIO_KEYIN_BASE 0 /* if jz_keypad.c is understood correctly */
1.7 +#define GPIO_KEYOUT_BASE (3 * 32 + 0)
1.8 +#define GPIO_KEYIN_COUNT 8
1.9 +#define GPIO_KEYOUT_COUNT 17
1.10
1.11 #define GPIO_IRQ IRQ_GPIO0
1.12
1.13 +#define GPIO_REGION_SIZE 0x10000
1.14 +
1.15 #endif /* __MINIPC_H__ */
2.1 --- a/include/nanonote.h Sun Oct 02 22:34:32 2016 +0200
2.2 +++ b/include/nanonote.h Sun Oct 02 22:38:07 2016 +0200
2.3 @@ -42,6 +42,9 @@
2.4 #define GPIO_KEYIN_BASE (3 * 32 + 18)
2.5 #define GPIO_KEYIN_8 (3 * 32 + 26)
2.6
2.7 +#define GPIO_KEYIN_COUNT 7
2.8 +#define GPIO_KEYOUT_COUNT 8
2.9 +
2.10 #define GPIO_POWER (3 * 32 + 29)
2.11
2.12 #define GPIO_SD_CD_N GPIO_SD_DETECT /* SD Card insert detect */
2.13 @@ -55,4 +58,6 @@
2.14
2.15 #define GPIO_IRQ IRQ_GPIO3
2.16
2.17 +#define GPIO_REGION_SIZE 0x10000
2.18 +
2.19 #endif /* __NANONOTE_H__ */
3.1 --- a/stage2/board-minipc.c Sun Oct 02 22:34:32 2016 +0200
3.2 +++ b/stage2/board-minipc.c Sun Oct 02 22:38:07 2016 +0200
3.3 @@ -27,7 +27,8 @@
3.4
3.5 void gpio_init2()
3.6 {
3.7 - /* LED enable */
3.8 + /* LED enable. */
3.9 +
3.10 __gpio_as_output(GPIO_LED_EN);
3.11 __gpio_set_pin(GPIO_LED_EN);
3.12
3.13 @@ -35,15 +36,27 @@
3.14 __gpio_as_emc();
3.15 __gpio_as_dma();
3.16
3.17 - /*
3.18 - * Initialize LCD pins
3.19 - */
3.20 + /* Initialise LCD pins. */
3.21 +
3.22 __gpio_as_lcd_master();
3.23
3.24 - /*
3.25 - * Initialize MSC pins
3.26 - */
3.27 + /* Initialise MSC pins. */
3.28 +
3.29 __gpio_as_msc();
3.30 +
3.31 + /* Initialise other pins. */
3.32 +
3.33 + unsigned short i;
3.34 +
3.35 + for (i = 0; i < GPIO_KEYIN_COUNT; i++) {
3.36 + __gpio_as_input(GPIO_KEYIN_BASE + i);
3.37 + __gpio_enable_pull(GPIO_KEYIN_BASE + i);
3.38 + }
3.39 +
3.40 + for (i = 0; i < GPIO_KEYOUT_COUNT; i++) {
3.41 + __gpio_as_output(GPIO_KEYOUT_BASE + i);
3.42 + __gpio_clear_pin(GPIO_KEYOUT_BASE + i);
3.43 + }
3.44 }
3.45
3.46 void cpm_init()
3.47 @@ -99,12 +112,6 @@
3.48
3.49 void gpio_init_irq()
3.50 {
3.51 - unsigned short i;
3.52 -
3.53 - for (i = 0; i < 7; i++) {
3.54 - __gpio_as_irq_low_level(GPIO_KEYIN_BASE + i);
3.55 - }
3.56 -
3.57 __gpio_as_irq_low_level(GPIO_POWER);
3.58 __intc_unmask_irq(GPIO_IRQ);
3.59 }
4.1 --- a/stage2/board-nanonote.c Sun Oct 02 22:34:32 2016 +0200
4.2 +++ b/stage2/board-nanonote.c Sun Oct 02 22:38:07 2016 +0200
4.3 @@ -27,31 +27,30 @@
4.4
4.5 void gpio_init2()
4.6 {
4.7 - /*
4.8 - * Initialize LCD pins
4.9 - */
4.10 + /* Initialise LCD pins. */
4.11 +
4.12 __gpio_as_slcd_8bit();
4.13
4.14 - /*
4.15 - * Initialize MSC pins
4.16 - */
4.17 + /* Initialise MSC pins. */
4.18 +
4.19 __gpio_as_msc();
4.20
4.21 - /*
4.22 - * Initialize Other pins
4.23 - */
4.24 + /* Initialise other pins. */
4.25 +
4.26 unsigned int i;
4.27 - for (i = 0; i < 7; i++){
4.28 +
4.29 + for (i = 0; i < GPIO_KEYIN_COUNT; i++){
4.30 __gpio_as_input(GPIO_KEYIN_BASE + i);
4.31 __gpio_enable_pull(GPIO_KEYIN_BASE + i);
4.32 }
4.33
4.34 - for (i = 0; i < 8; i++) {
4.35 + for (i = 0; i < GPIO_KEYOUT_COUNT; i++) {
4.36 __gpio_as_output(GPIO_KEYOUT_BASE + i);
4.37 __gpio_clear_pin(GPIO_KEYOUT_BASE + i);
4.38 }
4.39
4.40 - /* enable the TP4, TP5 as UART0 */
4.41 + /* Enable TP4, TP5 as UART0. */
4.42 +
4.43 __gpio_jtag_to_uart0();
4.44
4.45 __gpio_as_input(GPIO_KEYIN_8);
4.46 @@ -157,12 +156,6 @@
4.47
4.48 void gpio_init_irq()
4.49 {
4.50 - unsigned short i;
4.51 -
4.52 - for (i = 0; i < 7; i++) {
4.53 - __gpio_as_irq_low_level(GPIO_KEYIN_BASE + i);
4.54 - }
4.55 -
4.56 __gpio_as_irq_low_level(GPIO_POWER);
4.57 __intc_unmask_irq(GPIO_IRQ);
4.58 }
5.1 --- a/stage2/memory.h Sun Oct 02 22:34:32 2016 +0200
5.2 +++ b/stage2/memory.h Sun Oct 02 22:38:07 2016 +0200
5.3 @@ -9,10 +9,12 @@
5.4 #define STAGE2_PAGE_TABLE 0x81400000
5.5 #define STAGE2_PAGE_TABLE_TASK 0x00008000
5.6
5.7 -/* User mode addresses. */
5.8 +/* User mode and physical addresses. */
5.9
5.10 -#define STAGE2_TASK_STACK 0x01c00000
5.11 -#define STAGE2_TASK_STACK_SIZE 0x00002000
5.12 +#define TASK_GPIO_BASE 0x7fff0000
5.13 +#define TASK_STACK_TOP 0x7fff0000
5.14 +#define TASK_STACK_PHYSICAL 0x01c00000
5.15 +#define TASK_STACK_SIZE 0x00002000
5.16
5.17 /* Common configuration. */
5.18
6.1 --- a/stage2/paging.c Sun Oct 02 22:34:32 2016 +0200
6.2 +++ b/stage2/paging.c Sun Oct 02 22:38:07 2016 +0200
6.3 @@ -34,3 +34,8 @@
6.4 {
6.5 return addr + pagesize * 2;
6.6 }
6.7 +
6.8 +inline u32 page_size(u32 size)
6.9 +{
6.10 + return size / 2;
6.11 +}
7.1 --- a/stage2/paging.h Sun Oct 02 22:34:32 2016 +0200
7.2 +++ b/stage2/paging.h Sun Oct 02 22:38:07 2016 +0200
7.3 @@ -10,6 +10,7 @@
7.4 u32 user_address(u32 addr);
7.5 u32 previous_page(u32 addr, u32 pagesize);
7.6 u32 next_page(u32 addr, u32 pagesize);
7.7 +u32 page_size(u32 size);
7.8
7.9 #endif /* __ASSEMBLER__ */
7.10
8.1 --- a/stage2/tasks.c Sun Oct 02 22:34:32 2016 +0200
8.2 +++ b/stage2/tasks.c Sun Oct 02 22:38:07 2016 +0200
8.3 @@ -75,8 +75,11 @@
8.4 is never started.
8.5 */
8.6
8.7 - virtual = STAGE2_TASK_STACK;
8.8 - physical = STAGE2_TASK_STACK - STAGE2_TASK_STACK_SIZE * task;
8.9 + virtual = TASK_STACK_TOP;
8.10 +
8.11 + /* NOTE: Should allocate pages generally, not according to this simple calculation. */
8.12 +
8.13 + physical = TASK_STACK_PHYSICAL - TASK_STACK_SIZE * task;
8.14
8.15 init_page_table(STAGE2_PAGE_TABLE,
8.16 previous_page(virtual, STAGE2_PAGESIZE),
9.1 --- a/stage2/tasks.h Sun Oct 02 22:34:32 2016 +0200
9.2 +++ b/stage2/tasks.h Sun Oct 02 22:38:07 2016 +0200
9.3 @@ -3,6 +3,8 @@
9.4
9.5 #include "xburst_types.h"
9.6
9.7 +/* Provide a limit to the number of tasks (in a way that employs a constant). */
9.8 +
9.9 enum { max_tasks = 3 };
9.10
9.11 /* Task management functions. */
10.1 --- a/stage2/tasks/manifest.c Sun Oct 02 22:34:32 2016 +0200
10.2 +++ b/stage2/tasks/manifest.c Sun Oct 02 22:38:07 2016 +0200
10.3 @@ -25,6 +25,12 @@
10.4 void (*initial_task_array[])(unsigned short) = {
10.5 start_plot_pattern,
10.6 start_plot_pattern,
10.7 +
10.8 + /*
10.9 + Employ a zero terminator, and make sure that max_tasks is not exceeded
10.10 + above.
10.11 + */
10.12 +
10.13 0
10.14 };
10.15