changeset 3160:35ac6793793f

* cdl/flash_sst25xx_freescale_dspi.cdl * src/sst25_freescale_dspi.c: New package -- Disk driver fot Freescale DSPI [Bugzilla 1001450]
author vae
date Wed, 22 Feb 2012 21:15:44 +0000
parents 97d27161b0f7
children 12eba26a707e
files packages/devs/flash/freescale/dspi/sst25xx/current/ChangeLog packages/devs/flash/freescale/dspi/sst25xx/current/cdl/flash_sst25xx_freescale_dspi.cdl packages/devs/flash/freescale/dspi/sst25xx/current/src/sst25xx_freescale_dspi.c
diffstat 3 files changed, 228 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/freescale/dspi/sst25xx/current/ChangeLog
@@ -0,0 +1,29 @@
+2012-01-06  Ilija Kocho  <ilijak@siva.com.mk>
+
+	* cdl/flash_sst25xx_freescale_dspi.cdl
+	* src/sst25_freescale_dspi.c:
+	New package -- Disk driver fot Freescale DSPI [Bugzilla 1001450]
+
+//===========================================================================
+// ####GPLCOPYRIGHTBEGIN####                                                
+// -------------------------------------------                              
+// This file is part of eCos, the Embedded Configurable Operating System.   
+// Copyright (C) 2012 Free Software Foundation, Inc.                        
+//
+// 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 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., 51 Franklin Street,                      
+// Fifth Floor, Boston, MA  02110-1301, USA.                                
+// -------------------------------------------                              
+// ####GPLCOPYRIGHTEND####                                                  
+//===========================================================================
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/freescale/dspi/sst25xx/current/cdl/flash_sst25xx_freescale_dspi.cdl
@@ -0,0 +1,100 @@
+##==========================================================================
+##
+##      flash_sst25xx_freescale_dspi.cdl
+##
+##      SST25XX FLASH instatntiation for Freescale DSPI
+##
+##==========================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####                                            
+## -------------------------------------------                              
+## This file is part of eCos, the Embedded Configurable Operating System.   
+## Copyright (C) 2011 Free Software Foundation, 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.                                                                 
+##
+## eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,    
+## 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
+##
+## As a special exception, if other files instantiate templates or use      
+## macros or inline functions from this file, or you compile this file      
+## and link it with other works to produce a work based on this file,       
+## this file does not by itself cause the resulting work to be covered by   
+## the GNU General Public License. However the source code for this file    
+## must still be made available in accordance with section (3) of the GNU   
+## General Public License v2.                                               
+##
+## This exception does not invalidate any other reasons why a work based    
+## on this file might be covered by the GNU General Public License.         
+## -------------------------------------------                              
+## ####ECOSGPLCOPYRIGHTEND####                                              
+##==========================================================================
+#######DESCRIPTIONBEGIN####
+##
+## Author(s):    Ilija Kocho <ilijak@siva.com.mk>
+## Date:         2011-12-27
+##
+######DESCRIPTIONEND####
+##
+##==========================================================================
+
+cdl_package CYGPKG_DEVS_FLASH_SST25XX_FREESCALE_DSPI {
+    display "Driver for SST25XX flash over Freescale DSPI"
+    parent CYGPKG_DEVS_FLASH_SPI_SST25XX
+    
+    cdl_component CYGHWR_DEVS_FLASH_SPI_SST25XX_DEV0 {
+        display "Use SST25XX flash device 0"
+        flavor bool
+        default_value 0
+        no_define
+        
+        requires CYGPKG_DEVS_FLASH_SPI_SST25XX
+        requires CYGPKG_DEVS_SPI_FREESCALE_DSPI
+        implements CYGHWR_DEVS_FLASH_SPI_SST25XX_DEVICE
+        
+        requires CYGHWR_DEVS_FLASH_SST25XX_DEV0_SPI_BUS
+        requires CYGHWR_DEVS_FLASH_SST25XX_DEV0_SPI_CS
+        requires CYGNUM_DEVS_FLASH_SPI_SST25XX_DEV0_MAP_ADDR
+        
+        compile -library=libextras.a sst25xx_freescale_dspi.c
+        
+        cdl_component CYGHWR_DEVS_FLASH_SST25XX_DEV0_SPEED {
+            display "Nominal clock speed Hz"
+            flavor data
+            default_value 25000000
+            
+            cdl_option CYGHWR_DEVS_FLASH_SST25XX_DEV0_SPI_USE_DBR {
+                display "Use double baud rate"
+                flavor bool
+                default_value 0
+                description "
+                    Double baud rate is a feature of Freescale DSPI
+                    that may provide higher baud rates but duty the cycle may be
+                    different than 50/50 depdent on scaler/prescaler setting
+                    for achieved baud rate."
+            }
+        }
+        
+        cdl_option CYGHWR_DEVS_FLASH_SST25XX_DEV0_CS_DLY {
+            display "Nominal chip select delays (units)"
+            flavor data
+            legal_values { 1 10 }
+            default_value 1
+        }
+        
+        cdl_option CYGHWR_DEVS_FLASH_SST25XX_DEV0_CS_DLY_UN {
+            display "Chip select delay unit (ns)"
+            flavor data
+            default_value 100
+            legal_values { 100 1000 }
+        }
+    }
+}
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/freescale/dspi/sst25xx/current/src/sst25xx_freescale_dspi.c
@@ -0,0 +1,99 @@
+//==========================================================================
+//
+//      sst25xx_freescale_dspi.c
+//
+//      SST25XX FLASH device over Freescale DSPI
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2008 Free Software Foundation, 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.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):      ilijak
+// Contributor(s):
+// Date:           2011-12-14
+// Description:
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+#include <pkgconf/system.h>
+#if defined(CYGPKG_IO_SPI) && defined(CYGPKG_DEVS_FLASH_SPI_SST25XX)
+// ------------------------------------------------------------------------
+// There is an SST25XX serial flash on the SPI bus
+//#include <cyg/infra/cyg_type.h>
+#include <cyg/io/spi.h>
+#include <cyg/io/sst25xx.h>
+#include <cyg/io/spi_freescale_dspi.h>
+#include <pkgconf/devs_flash_sst25xx_freescale_dspi.h>
+
+// SPI bus device configuration
+#define SST25XX_SPI_FRAME_SIZE      8
+#define SST25XX_SPI_CLOCK_POL       0
+#define SST25XX_SPI_CLOCK_PHASE     0
+
+#ifdef CYGHWR_DEVS_SST25XX_DEV0_SPI_USE_DBR
+# define SST25XX_SPI_DBR_DEV0 1
+#else
+# define SST25XX_SPI_DBR_DEV0 0
+#endif
+
+// Underlaying Freescale DSPI device
+CYG_DEVS_SPI_FREESCALE_DSPI_DEVICE(
+    sst25xx_spi_dev0,                         // Device name
+    CYGHWR_DEVS_FLASH_SST25XX_DEV0_SPI_BUS,  // SPI bus
+    CYGHWR_DEVS_FLASH_SST25XX_DEV0_SPI_CS,   // Dev num (CS)
+    SST25XX_SPI_FRAME_SIZE,                  // Frame size
+    SST25XX_SPI_CLOCK_POL,                   // Clock pol
+    SST25XX_SPI_CLOCK_PHASE,                 // Clock phase
+    CYGHWR_DEVS_FLASH_SST25XX_DEV0_SPEED,    // Clock speed (Hz)
+    CYGHWR_DEVS_FLASH_SST25XX_DEV0_CS_DLY,   // CS assert delay
+    CYGHWR_DEVS_FLASH_SST25XX_DEV0_CS_DLY,   // CS negate delay
+    CYGHWR_DEVS_FLASH_SST25XX_DEV0_CS_DLY,   // Delay between transfers
+    CYGHWR_DEVS_FLASH_SST25XX_DEV0_CS_DLY_UN,// Delay unit (100 or 1000 ns)
+    SST25XX_SPI_DBR_DEV0                     // Use double baud rate
+);
+
+//-----------------------------------------------------------------------------
+// Instantiate the SST25xx device driver.
+
+CYG_DEVS_FLASH_SPI_SST25XX_DRIVER(sst25xx_flash_dev0,
+                                  CYGNUM_DEVS_FLASH_SPI_SST25XX_DEV0_MAP_ADDR,
+                                  &sst25xx_spi_dev0);
+
+#endif // defined(CYGPKG_IO_SPI) && defined(CYGPKG_DEVS_FLASH_SPI_SST25XX)
+
+//==========================================================================
+// EOF sst25xx_freescale_dspi.c