1 | /*===============================================================*\ |
---|
2 | | Project: SPI driver for M25P40 like spi flash device | |
---|
3 | +-----------------------------------------------------------------+ |
---|
4 | | Copyright (c) 2007 | |
---|
5 | | Embedded Brains GmbH | |
---|
6 | | Obere Lagerstr. 30 | |
---|
7 | | D-82178 Puchheim | |
---|
8 | | Germany | |
---|
9 | | rtems@embedded-brains.de | |
---|
10 | +-----------------------------------------------------------------+ |
---|
11 | | The license and distribution terms for this file may be | |
---|
12 | | found in the file LICENSE in this distribution or at | |
---|
13 | | | |
---|
14 | | http://www.rtems.com/license/LICENSE. | |
---|
15 | | | |
---|
16 | +-----------------------------------------------------------------+ |
---|
17 | \*===============================================================*/ |
---|
18 | |
---|
19 | #include <rtems.h> |
---|
20 | #include <rtems/libi2c.h> |
---|
21 | |
---|
22 | #include <libchip/spi-flash-m25p40.h> |
---|
23 | #include <rtems/libio.h> |
---|
24 | |
---|
25 | |
---|
26 | static spi_memdrv_t spi_flash_m25p40_rw_drv_t = { |
---|
27 | {/* public fields */ |
---|
28 | .ops = &spi_memdrv_rw_ops, /* operations of general memdrv */ |
---|
29 | .size = sizeof (spi_flash_m25p40_rw_drv_t), |
---|
30 | }, |
---|
31 | { /* our private fields */ |
---|
32 | .baudrate = 2000000, |
---|
33 | .erase_before_program = true, |
---|
34 | .empty_state = 0xff, |
---|
35 | .page_size = 256, /* programming page size in bytes */ |
---|
36 | .sector_size = 0x10000, /* 64K - erase sector size in bytes */ |
---|
37 | .mem_size = 0x80000, /* 512K - total capacity in bytes */ |
---|
38 | } |
---|
39 | }; |
---|
40 | |
---|
41 | rtems_libi2c_drv_t *spi_flash_m25p40_rw_driver_descriptor = |
---|
42 | &spi_flash_m25p40_rw_drv_t.libi2c_drv_entry; |
---|
43 | |
---|
44 | static spi_memdrv_t spi_flash_m25p40_ro_drv_t = { |
---|
45 | {/* public fields */ |
---|
46 | .ops = &spi_memdrv_ro_ops, /* operations of general memdrv */ |
---|
47 | .size = sizeof (spi_flash_m25p40_ro_drv_t), |
---|
48 | }, |
---|
49 | { /* our private fields */ |
---|
50 | .baudrate = 2000000, |
---|
51 | .erase_before_program = true, |
---|
52 | .empty_state = 0xff, |
---|
53 | .page_size = 256, /* programming page size in bytes */ |
---|
54 | .sector_size = 0x10000, /* 64K erase sector size in bytes */ |
---|
55 | .mem_size = 0x80000, /* 512K total capacity in bytes */ |
---|
56 | } |
---|
57 | }; |
---|
58 | |
---|
59 | rtems_libi2c_drv_t *spi_flash_m25p40_ro_driver_descriptor = |
---|
60 | &spi_flash_m25p40_ro_drv_t.libi2c_drv_entry; |
---|