mirror of
git://projects.qi-hardware.com/iris.git
synced 2024-12-29 02:59:53 +02:00
70 lines
2.2 KiB
COBOL
70 lines
2.2 KiB
COBOL
#pypp 0
|
|
// Iris: micro-kernel for a capability-based operating system.
|
|
// mips/trendtac/board.ccp: trendtac-specific functions.
|
|
// Copyright 2009 Bas Wijnen <wijnen@debian.org>
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#define ARCH
|
|
#define INIT
|
|
#include "kernel.hh"
|
|
|
|
void board_init ():
|
|
// Disable all gpio interrupts and alternate functions initially.
|
|
for unsigned i = 0; i < 4; ++i:
|
|
GPIO_GPIER (i) = 0
|
|
GPIO_GPALR (i) = 0
|
|
GPIO_GPAUR (i) = 0
|
|
// Set up the rest of the hardware (copied from Linux).
|
|
cpm_idle_mode ()
|
|
cpm_enable_cko1 ()
|
|
cpm_start_all ()
|
|
harb_set_priority (0x08)
|
|
dmac_enable_all_channels ()
|
|
harb_usb0_uhc ()
|
|
gpio_as_emc ()
|
|
gpio_as_uart0 ()
|
|
gpio_as_dma ()
|
|
gpio_as_eth ()
|
|
gpio_as_usb ()
|
|
gpio_as_lcd_master ()
|
|
gpio_as_ssi()
|
|
gpio_as_msc ()
|
|
|
|
gpio_as_gpio (GPIO_CAPS_PORT, GPIO_CAPS)
|
|
gpio_as_gpio (GPIO_SCROLL_PORT, GPIO_SCROLL)
|
|
gpio_as_gpio (GPIO_NUM_PORT, GPIO_NUM)
|
|
gpio_as_gpio (GPIO_TP_LEFT_PORT, GPIO_TP_LEFT)
|
|
gpio_as_gpio (GPIO_TP_RIGHT_PORT, GPIO_TP_RIGHT)
|
|
|
|
// Start the operating system timer, and set it to give an interrupt immediately.
|
|
// This is better, because the kernel starts with jumping into the idle task and
|
|
// waiting for the first interrupt.
|
|
unsigned latch = (JZ_EXTAL + (HZ >> 1)) / HZ
|
|
ost_disable_all ()
|
|
ost_set_mode (0, OST_TCSR_UIE | OST_TCSR_CKS_EXTAL)
|
|
ost_set_reload (0, latch)
|
|
ost_set_count (0, 1)
|
|
ost_set_mode (0, OST_TCSR_UIE | OST_TCSR_CKS_EXTAL)
|
|
ost_enable_channel (0)
|
|
|
|
void arch_reboot ():
|
|
// Wait for serial port to be done.
|
|
while !(UART0_LSR & UARTLSR_TEMT):
|
|
// Reboot.
|
|
wdt_set_count (~0)
|
|
wdt_start ()
|
|
// Wait for wdt to trigger reboot.
|
|
while true:
|