This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
strataflash platform hooks
- From: Mark Salter <msalter at redhat dot com>
- To: ecos-patches at sources dot redhat dot com
- Date: Thu, 2 Sep 2004 11:14:20 -0400 (EDT)
- Subject: strataflash platform hooks
This was needed for a platform with an "interesting" flash bus
configuration.
--Mark
Index: devs/flash/intel/strata/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/intel/strata/current/ChangeLog,v
retrieving revision 1.21
diff -u -p -5 -r1.21 ChangeLog
--- devs/flash/intel/strata/current/ChangeLog 21 Aug 2004 08:37:47 -0000 1.21
+++ devs/flash/intel/strata/current/ChangeLog 2 Sep 2004 15:03:52 -0000
@@ -1,5 +1,12 @@
+2004-09-02 Mark Salter <msalter@redhat.com>
+
+ * src/flash_query.c (CYGHWR_FLASH_READ_QUERY): Add platform hook
+ to handle access to query info.
+ * src/flash_program_buf.c (CYGHWR_FLASH_WRITE_BUF): Add platform
+ hook handle access to write buffer.
+
2004-08-21 Andrew Lunn <andrew.lunn@ascom.ch>
* src/flash_unlock_block.c (flash_unlock_block):
* cdl/flash_strata.cdl: CDL to control the maximum number of
blocks the driver supports. Some of the newer strata device has more
Index: devs/flash/intel/strata/current/src/flash_program_buf.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/intel/strata/current/src/flash_program_buf.c,v
retrieving revision 1.9
diff -u -p -5 -r1.9 flash_program_buf.c
--- devs/flash/intel/strata/current/src/flash_program_buf.c 11 Sep 2003 13:21:39 -0000 1.9
+++ devs/flash/intel/strata/current/src/flash_program_buf.c 2 Sep 2004 15:03:52 -0000
@@ -6,11 +6,11 @@
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc.
//
// eCos 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 or (at your option) any later version.
//
@@ -53,10 +53,15 @@
#include "strata.h"
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
+// Platforms may define this for special handling when accessing the write buffer.
+#ifndef CYGHWR_FLASH_WRITE_BUF
+#define CYGHWR_FLASH_WRITE_BUF(a,b) (*(a) = *(b))
+#endif
+
int
flash_program_buf(volatile flash_t *addr, flash_t *data, int len,
unsigned long block_mask, int buffer_size)
__attribute__ ((section (".2ram.flash_program_buf")));
int
@@ -97,11 +102,11 @@ flash_program_buf(volatile flash_t *addr
*BA = FLASHWORD(wc-1); // Count is 0..N-1
for (i = 0; i < wc; i++) {
#ifdef CYGHWR_FLASH_WRITE_ELEM
CYGHWR_FLASH_WRITE_ELEM(addr+i, data+i);
#else
- *(addr+i) = *(data+i);
+ CYGHWR_FLASH_WRITE_BUF(addr+i, data+i);
#endif
}
*BA = FLASH_Confirm;
ROM[0] = FLASH_Read_Status;
Index: devs/flash/intel/strata/current/src/flash_query.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/intel/strata/current/src/flash_query.c,v
retrieving revision 1.6
diff -u -p -5 -r1.6 flash_query.c
--- devs/flash/intel/strata/current/src/flash_query.c 10 Sep 2003 20:52:53 -0000 1.6
+++ devs/flash/intel/strata/current/src/flash_query.c 2 Sep 2004 15:03:52 -0000
@@ -6,11 +6,11 @@
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc.
//
// eCos 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 or (at your option) any later version.
//
@@ -54,10 +54,14 @@
#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>
#include CYGHWR_MEMORY_LAYOUT_H
+// Platforms may define this for special handling when accessing the query data.
+#ifndef CYGHWR_FLASH_READ_QUERY
+#define CYGHWR_FLASH_READ_QUERY(a) (*(a))
+#endif
#define CNT 20*1000*10 // Approx 20ms
int
flash_query(unsigned char *data) __attribute__ ((section (".2ram.flash_query")));
@@ -79,14 +83,14 @@ flash_query(unsigned char *data)
ROM[0] = FLASH_Read_Query;
i = sizeof(struct FLASH_query);
#endif // Not CYGOPT_FLASH_IS_BOOTBLOCK
for (cnt = CNT; cnt > 0; cnt--) ;
- for ( /* i */; i > 0; i-- ) {
+ for ( /* i */; i > 0; i--, ++ROM) {
// It is very deliberate that data is chars NOT flash_t:
// The info comes out in bytes regardless of device.
- *data++ = (unsigned char) (*ROM++);
+ *data++ = (unsigned char) CYGHWR_FLASH_READ_QUERY(ROM);
#ifndef CYGOPT_FLASH_IS_BOOTBLOCK
# if 8 == CYGNUM_FLASH_WIDTH
// strata flash with 'byte-enable' contains the configuration data
// at even addresses
++ROM;