paul@6 | 1 | /* |
paul@6 | 2 | * Ben NanoNote stage 2 payload test. |
paul@6 | 3 | * |
paul@33 | 4 | * Copyright (C) Wolfgang Spraul <wolfgang@sharism.cc> |
paul@118 | 5 | * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk> |
paul@6 | 6 | * |
paul@63 | 7 | * This program is free software: you can redistribute it and/or modify |
paul@63 | 8 | * it under the terms of the GNU General Public License as published by |
paul@63 | 9 | * the Free Software Foundation, either version 3 of the License, or |
paul@63 | 10 | * (at your option) any later version. |
paul@6 | 11 | * |
paul@63 | 12 | * This program is distributed in the hope that it will be useful, |
paul@63 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@63 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@63 | 15 | * GNU General Public License for more details. |
paul@6 | 16 | * |
paul@63 | 17 | * You should have received a copy of the GNU General Public License |
paul@63 | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
paul@6 | 19 | */ |
paul@6 | 20 | |
paul@154 | 21 | #include "init.h" |
paul@68 | 22 | #include "irq.h" |
paul@15 | 23 | #include "lcd.h" |
paul@68 | 24 | #include "cpu.h" |
paul@156 | 25 | #include "tasks.h" |
paul@156 | 26 | #include "example.h" |
paul@6 | 27 | |
paul@6 | 28 | void c_main(void) |
paul@6 | 29 | { |
paul@54 | 30 | volatile int started; |
paul@18 | 31 | |
paul@73 | 32 | init_tlb(); |
paul@68 | 33 | flush_cache_all(); |
paul@68 | 34 | |
paul@18 | 35 | /* The actual work. */ |
paul@18 | 36 | |
paul@54 | 37 | started = is_started(); |
paul@118 | 38 | |
paul@118 | 39 | if (!started) |
paul@118 | 40 | { |
paul@54 | 41 | gpio_init2(); |
paul@54 | 42 | cpm_init(); |
paul@54 | 43 | rtc_init(); |
paul@54 | 44 | timer_init(); |
paul@54 | 45 | } |
paul@118 | 46 | |
paul@15 | 47 | lcd_init(); |
paul@136 | 48 | irq_init(); |
paul@133 | 49 | |
paul@133 | 50 | /* Start the tasks. */ |
paul@118 | 51 | |
paul@145 | 52 | init_tasks(); |
paul@156 | 53 | start_plot_pattern(1); |
paul@156 | 54 | start_plot_pattern(2); |
paul@133 | 55 | |
paul@133 | 56 | /* Now, wait for the tasks to be selected as interrupts occur. */ |
paul@133 | 57 | |
paul@136 | 58 | enable_interrupts(); |
paul@165 | 59 | start_task_now(); |
paul@6 | 60 | } |