From: Erik M. <er...@us...> - 2002-02-04 19:39:43
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv20909/src/blob Modified Files: Makefile.am main.c Added Files: accelent_sa.c Log Message: Accelent IDP support by Holger Schurig Also clean up some Makefiles (alphabetic order, etc) --- NEW FILE: accelent_sa.c --- /* * accelent_sa.c: Accelent IDP specific stuff * * Copyright (C) 2001 Erik Mouw (J.A...@it...) * Copyright (C) 2001 Stefan Eletzhofer * (ste...@ww...) * Copyright (C) 2002 Holger Schurig <h.s...@mn...> * * 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 * */ #ident "$Id: accelent_sa.c,v 1.1 2002/02/04 18:02:42 erikm Exp $" /********************************************************************** * includes */ #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/serial.h> #include <blob/flash.h> #include <blob/init.h> #include <blob/command.h> #include <blob/uucodec.h> #include <blob/serial.h> extern blob_status_t blob_status; /* flash descriptor for Accelent IDP flash. */ /* Accelent IDP uses 2xINTEL e28F640 Chips */ static flash_descriptor_t accelent_sa_flash_descriptors[] = { { size: 2 * 128 * 1024, num: 64, lockable: 1 }, { /* NULL block */ }, }; static int accelent_sa_flash_enable_vpp(void) { //TODO //set GPIO17 return 0; } static int accelent_sa_flash_disable_vpp(void) { //TODO //reset GPIO17 return 0; } static void init_accelent_sa_flash_driver(void) { flash_descriptors = accelent_sa_flash_descriptors; flash_driver = &intel32_flash_driver; flash_driver->enable_vpp = accelent_sa_flash_enable_vpp; flash_driver->disable_vpp = accelent_sa_flash_disable_vpp; } __initlist(init_accelent_sa_flash_driver, INIT_LEVEL_DRIVER_SELECTION); static void accelent_sa_init_hardware(void) { /* select serial driver */ serial_driver = &sa11x0_serial_driver; } __initlist(accelent_sa_init_hardware, INIT_LEVEL_DRIVER_SELECTION); /********************************************************************* * cmd_download_file * * AUTOR: SELETZ * REVISED: * * Download a file to arbitary memory location * */ int cmd_download_file( int argc, char *argv[] ) { int ret = 0; u32 dest = 0L; u32 len = 0L; if ( argc < 3 ) return -EINVAL; ret = strtou32( argv[1], &dest ); if ( ret < 0 ) return -EINVAL; ret = strtou32( argv[2], &len ); if ( ret < 0 ) return -EINVAL; if (blob_status.terminalSpeed != blob_status.downloadSpeed) { SerialOutputString("Switching to download speed\n"); SerialOutputString("You have 60 seconds to switch your terminal emulator to the same speed and\n"); SerialOutputString("start downloading. After that " PACKAGE " will switch back to term speed.\n"); serial_init(blob_status.downloadSpeed); } else { SerialOutputString("You have 60 seconds to start downloading.\n"); } ret = UUDecode((char *)dest, len); if ( ret == len ) { SerialOutputString("Received "); SerialOutputDec(ret); SerialOutputString(" (0x"); SerialOutputHex(ret); SerialOutputString(") bytes.\n"); ret = 0; } else { SerialOutputString("error during uudecode\n"); } if (blob_status.terminalSpeed != blob_status.downloadSpeed) { SerialOutputString("\n(Please switch your terminal emulator back to terminal speed\n"); serial_init(blob_status.terminalSpeed); } return ret; } static char downloadhelp[] = "dlfile destadr filelength\n" "download file to memory\n"; __commandlist( cmd_download_file, "dlfile", downloadhelp ); /********************************************************************* * cmd_flash_write * * AUTOR: SELETZ * REVISED: * * Command wrapper for low-level flash write access * */ static int cmd_flash_write( int argc, char *argv[] ) { int ret = 0; u32 src = 0L; u32 dest = 0L; u32 len = 0L; if ( argc < 4 ) return -EINVAL; ret = strtou32( argv[1], &src ); if ( ret < 0 ) return -EINVAL; ret = strtou32( argv[2], &dest ); if ( ret < 0 ) return -EINVAL; ret = strtou32( argv[3], &len ); if ( ret < 0 ) return -EINVAL; if ( len & (0x3) ) { len = (len>>2) + 1; } else { len = len>>2; } _DBGU32( src ); _DBGU32( dest ); _DBGU32( len ); ret = flash_write_region( (u32 *)dest, (u32*)src, len ); return ret; } static char flashwritehelp[] = "fwrite srcadr destadr size(bytes)\n" "flash a memory region\n"; __commandlist( cmd_flash_write, "fwrite", flashwritehelp ); /********************************************************************* * cmd_flash_erase * * AUTOR: SELETZ * REVISED: * * Command wrapper for low-level flash erasing * */ static int cmd_flash_erase( int argc, char *argv[] ) { int ret = 0; u32 dest = 0L; u32 len = 0L; if ( argc < 3 ) return -EINVAL; ret = strtou32( argv[1], &dest ); if ( ret < 0 ) return -EINVAL; ret = strtou32( argv[2], &len ); if ( ret < 0 ) return -EINVAL; if ( len & (0x3) ) { len = (len>>2) + 1; } else { len = len>>2; } ret = flash_erase_region( (u32 *)dest, len ); return ret; } static char flasherasehelp[] = "ferase adr size(bytes)\n" "erase a flash region\n"; __commandlist( cmd_flash_erase, "ferase", flasherasehelp ); Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/src/blob/Makefile.am,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- Makefile.am 2002/02/01 14:38:55 1.20 +++ Makefile.am 2002/02/04 18:02:42 1.21 @@ -149,10 +149,12 @@ intel16.c \ intel32.c \ nullflash.c \ + accelent_sa.c \ assabet.c \ brutus.c \ badge4.c \ clart.c \ + frodo.c \ h3600.c \ idr.c \ jornada720.c \ @@ -160,8 +162,7 @@ nesa.c \ pleb.c \ shannon.c \ - system3.c \ - frodo.c + system3.c blob_rest_elf32_DEPENDENCIES = \ Index: main.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/main.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- main.c 2002/02/04 12:14:16 1.28 +++ main.c 2002/02/04 18:02:42 1.29 @@ -96,7 +96,7 @@ /* call serial_init() because the default 9k6 speed might not be what the user requested */ -#if defined(H3600) || defined(SHANNON) || defined(IDR) || defined(BADGE4) || defined(JORNADA720) +#if defined(H3600) || defined(SHANNON) || defined(IDR) || defined(BADGE4) || defined(JORNADA720) || defined(ACCELENT_SA) blob_status.terminalSpeed = baud_115200; /* DEBUG */ #endif #if defined(PT_SYSTEM3) |