From: Abraham vd M. <ab...@us...> - 2003-08-06 23:00:55
|
Update of /cvsroot/blob/blob/src/blob In directory sc8-pr-cvs1:/tmp/cvs-serv9035/src/blob Added Files: csir_ims.c gpio-pxa.S Log Message: Added new files, removed old stale files --- NEW FILE: csir_ims.c --- /* * -*- eval: c_set_style("linux") -*- * * csir_ims.c: CSIR Incident Management System specific stuff * * Copyright (C) 2003 Abraham van der Merwe <ab...@4d...> * * 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 2 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include <blob/config.h> #endif #include <blob/main.h> #include <blob/arch.h> #include <blob/errno.h> #include <blob/error.h> #include <blob/util.h> #include <blob/reboot.h> #include <blob/serial.h> #include <blob/flash.h> #include <blob/init.h> #include <blob/command.h> #include <blob/uucodec.h> #include <blob/led.h> #define GPIO25_LED GPIO_bit(25) static int led_state; static int led_locked; static void csir_ims_led_on (void) { if (!led_locked) { GPSR0 = GPIO25_LED; led_state = 1; } } static void csir_ims_led_off (void) { if (!led_locked) { GPCR0 = GPIO25_LED; led_state = 0; } } static void csir_ims_led_toggle (void) { if (led_state) csir_ims_led_off (); else csir_ims_led_on (); } static void csir_ims_led_lock (void) { led_locked = 1; } static void csir_ims_led_unlock (void) { led_locked = 0; } static led_driver_t csir_ims_led_driver = { .led_on = csir_ims_led_on, .led_off = csir_ims_led_off, .led_toggle = csir_ims_led_toggle, .led_lock = csir_ims_led_lock, .led_unlock = csir_ims_led_unlock }; static void csir_ims_init_driver (void) { static const flash_descriptor_t flash[] = { { .size = 128 * 1024, .num = 64, .lockable = 1 }, { /* NULL block */ } }; GPDR0 |= GPIO25_LED; flash_descriptors = flash; reboot_driver = &pxa_reboot_driver; serial_driver = &pxa_serial_driver; flash_driver = &intel16_flash_driver; led_driver = &csir_ims_led_driver; } __initlist (csir_ims_init_driver,INIT_LEVEL_DRIVER_SELECTION); --- NEW FILE: gpio-pxa.S --- /* * gpio-pxa.S - Part of the AVO Architecture Boot Loader * * Written by Abraham van der Merwe <ab...@bl...> * Copyright (c) 2002, 2003 Blio Corporation (Pty) Ltd. * All Rights Reserved. */ #ifdef HAVE_CONFIG_H #include <blob/config.h> #endif #include <blob/arch.h> .text REG_BASE: .word GPDR0, GPDR1, GPDR2 .word GPSR0, GPSR1, GPSR2 .word GPCR0, GPCR1, GPCR2 .word GAFR0_L, GAFR1_L, GAFR2_L .word GAFR0_U, GAFR1_U, GAFR2_U VALUE_BASE: .word GPDR0_VALUE, GPDR1_VALUE, GPDR2_VALUE .word GPSR0_VALUE, GPSR1_VALUE, GPSR2_VALUE .word GPCR0_VALUE, GPCR1_VALUE, GPCR2_VALUE .word GAFR0_L_VALUE, GAFR1_L_VALUE, GAFR2_L_VALUE .word GAFR0_U_VALUE, GAFR1_U_VALUE, GAFR2_U_VALUE .globl gpiosetup .type gpiosetup, #function gpiosetup: ldr r1, REG_BASE ldr r0, VALUE_BASE mov r2, r0 0: ldr r3, [r0], #4 str r3, [r1], #4 cmp r1, r2 blo 0b ldr r1, =PSSR mov r0, #(PSSR_RDH | PSSR_PH) str r0, [r1] mov pc, lr |