1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2025-04-21 12:27:27 +03:00

start gpio driver

This commit is contained in:
Bas Wijnen
2009-07-20 02:09:12 +02:00
parent bee84d53ec
commit dbeaddc0ca
6 changed files with 218 additions and 80 deletions

View File

@@ -28,7 +28,7 @@ arch_kernel_sources = mips/interrupts.cc mips/test.cc mips/arch.cc
boot_sources = mips/init.cc
BUILT_SOURCES = $(kernel_sources) $(boot_sources)
arch_headers = mips/arch.hh mips/jz4730.hh
boot_threads = keyboard lcd
boot_threads = gpio lcd
uimage:

View File

@@ -236,5 +236,5 @@ thread0:
.incbin "lcd"
.balign 0x1000
thread1:
.incbin "keyboard"
.incbin "gpio"
thread2:

View File

@@ -238,6 +238,13 @@ void init (unsigned mem):
// Set up initial threads.
init_threads ()
// Disable all gpio pins initially.
for unsigned i = 0; i < 4; ++i:
GPIO_GPIER (i) = 0
GPIO_GPDIR (i) = 0
GPIO_GPPUR (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 ()
@@ -253,10 +260,6 @@ void init (unsigned mem):
gpio_as_lcd_master ()
gpio_as_ssi()
gpio_as_msc ()
GPIO_GPDIR (GPIO_PWM0_PORT) |= 1 << GPIO_PWM0
GPIO_GPDR (GPIO_PWM0_PORT) |= 1 << GPIO_PWM0
GPIO_GPDIR (GPIO_USB_CLK_EN_PORT) |= 1 << GPIO_USB_CLK_EN
GPIO_GPDR (GPIO_USB_CLK_EN_PORT) |= 1 << GPIO_USB_CLK_EN
// 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