diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-03 07:20:11 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-04 10:13:28 +0200 |
commit | 27de4e1fb8bcdbdd8cb882fc0d7a2c152b4e027a (patch) | |
tree | def0664dcddc53fd5d599b455c64f76ca2293606 /bsps/shared/dev/i2c/spi-flash-m25p40.c | |
parent | bsps: Move config macros to RTEMS_BSP_CONFIGURE (diff) | |
download | rtems-27de4e1fb8bcdbdd8cb882fc0d7a2c152b4e027a.tar.bz2 |
bsps: Move libchip to bsps
This patch is a part of the BSP source reorganization.
Update #3285.
Diffstat (limited to 'bsps/shared/dev/i2c/spi-flash-m25p40.c')
-rw-r--r-- | bsps/shared/dev/i2c/spi-flash-m25p40.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/bsps/shared/dev/i2c/spi-flash-m25p40.c b/bsps/shared/dev/i2c/spi-flash-m25p40.c new file mode 100644 index 0000000000..075a4510b9 --- /dev/null +++ b/bsps/shared/dev/i2c/spi-flash-m25p40.c @@ -0,0 +1,60 @@ +/*===============================================================*\ +| Project: SPI driver for M25P40 like spi flash device | ++-----------------------------------------------------------------+ +| Copyright (c) 2007 | +| Embedded Brains GmbH | +| Obere Lagerstr. 30 | +| D-82178 Puchheim | +| Germany | +| rtems@embedded-brains.de | ++-----------------------------------------------------------------+ +| The license and distribution terms for this file may be | +| found in the file LICENSE in this distribution or at | +| | +| http://www.rtems.org/license/LICENSE. | +| | ++-----------------------------------------------------------------+ +\*===============================================================*/ + +#include <rtems.h> +#include <rtems/libi2c.h> + +#include <libchip/spi-flash-m25p40.h> +#include <rtems/libio.h> + + +static spi_memdrv_t spi_flash_m25p40_rw_drv_t = { + {/* public fields */ + .ops = &spi_memdrv_rw_ops, /* operations of general memdrv */ + .size = sizeof (spi_flash_m25p40_rw_drv_t), + }, + { /* our private fields */ + .baudrate = 2000000, + .erase_before_program = true, + .empty_state = 0xff, + .page_size = 256, /* programming page size in bytes */ + .sector_size = 0x10000, /* 64K - erase sector size in bytes */ + .mem_size = 0x80000, /* 512K - total capacity in bytes */ + } +}; + +rtems_libi2c_drv_t *spi_flash_m25p40_rw_driver_descriptor = +&spi_flash_m25p40_rw_drv_t.libi2c_drv_entry; + +static spi_memdrv_t spi_flash_m25p40_ro_drv_t = { + {/* public fields */ + .ops = &spi_memdrv_ro_ops, /* operations of general memdrv */ + .size = sizeof (spi_flash_m25p40_ro_drv_t), + }, + { /* our private fields */ + .baudrate = 2000000, + .erase_before_program = true, + .empty_state = 0xff, + .page_size = 256, /* programming page size in bytes */ + .sector_size = 0x10000, /* 64K erase sector size in bytes */ + .mem_size = 0x80000, /* 512K total capacity in bytes */ + } +}; + +rtems_libi2c_drv_t *spi_flash_m25p40_ro_driver_descriptor = +&spi_flash_m25p40_ro_drv_t.libi2c_drv_entry; |