This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Using the Flash V2 API on top of a Dataflash
- From: "Tom Deconinck" <t dot deconinck at gmail dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Fri, 23 Nov 2007 09:17:49 +0100
- Subject: [ECOS] Using the Flash V2 API on top of a Dataflash
Hi,
I'm trying to use an Atmel SPI Dataflash through the eCos Flash API,
but I don't seem to get it working. I'm using the Flash_v2 branch for
all flash related stuff.
I'm using a AT91SAM7SE512 with the AT91 SPI driver and the Atmel
Dataflash driver on top of that.
I've created a cdl package that exports the spi device
(CYGPKG_DEVS_SPI_ARM_AT91SAM7SEEK) and a cdl package that hooks up the
dataflash to the Flash API (CYGPKG_DEVS_DATAFLASH_AT91_SPI).
However, the Dataflash doesn't end up in the Flash API.
Am I missing something?
Or is there some example I could have a look at? So far I haven't found any...
** CYGPKG_DEVS_SPI_ARM_AT91SAM7SEEK package details:
cdl_package CYGPKG_DEVS_SPI_ARM_AT91SAM7SEEK {
parent CYGPKG_IO_SPI
active_if CYGPKG_IO_SPI
active_if CYGPKG_DEVS_SPI_ARM_AT91
display "Atmel AT91SAM7SEEK SPI devices"
hardware
include_dir cyg/io
compile spi_at91sam7seek.c
define_proc {
puts $::cdl_system_header "/***** SPI exported devices begin *****/"
puts $::cdl_system_header "#include <cyg/io/spi_at91sam7seek.h>"
puts $::cdl_system_header "/***** SPI exported devices end *****/"
}
}
It has a header file that just exports the device: spi_at91samseek.h
#define HAL_SPI_EXPORTED_DEVICES \
externC cyg_spi_device *cyg_spi_dataflash_dev0;
And a source file defining the device on a particular SPI bus:
spi_at91sam7seek.c
cyg_spi_at91_device_t spi_dataflash_dev0 CYG_SPI_DEVICE_ON_BUS(0) =
{
.spi_device.spi_bus = &cyg_spi_at91_bus.spi_bus,
.dev_num = 0, // Device number
.cl_pol = 0, // Clock polarity (0 or 1)
.cl_pha = 1, // Clock phase (0 or 1)
.cl_brate = 6000000, // Clock baud rate
.cs_up_udly = 1, // Delay in usec between CS up and transfer start
.cs_dw_udly = 1,//0 // Delay in usec between transfer end and CS down
.tr_bt_udly = 1 // Delay in usec between two transfers
};
cyg_spi_device *cyg_spi_dataflash_dev0 = &spi_dataflash_dev0.spi_device;
cyg_spi_at91_device_t *cyg_spi_at91_dataflash = &spi_dataflash_dev0;
** CYGPKG_DEVS_DATAFLASH_AT91_SPI package details:
cdl_package CYGPKG_DEVS_DATAFLASH_AT91_SPI {
display "Atmel AT91SAM7SE SPI dataflash support"
description "SPI DATAFLASH memory device support for Atmel
AT91SAM7SE board"
parent CYGPKG_IO_FLASH
active_if CYGPKG_IO_FLASH
active_if CYGPKG_IO_SPI
requires CYGPKG_HAL_ARM_AT91
requires CYGPKG_DEVS_FLASH_ATMEL_DATAFLASH
compile at91_spi_dataflash.c
# Arguably this should do in the generic package
# but then there is a logic loop so you can never enable it.
cdl_interface CYGINT_DEVS_FLASH_ATMEL_DATAFLASH_FLASH_DEV {
display "Support for Atmel Dataflash required"
}
implements CYGPKG_DEVS_FLASH_ATMEL_DATAFLASH_FLASH_DEV
}
It has a source file (at91_spi_dataflash.c) :
__externC cyg_spi_at91_device_t spi_dataflash_dev0;
CYG_DATAFLASH_FLASH_DRIVER( dataflash0,
&(spi_dataflash_dev0.spi_device),
0x400000, /* misuse of reserved memory */
0,
6 );
Thanks,
Tom
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss