This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SPI infrastructure


Bart Veer wrote:
+cdl_package CYGPKG_IO_SPI {
+    display		"Generic SPI support"
+    requires		CYGPKG_INFRA CYGPKG_HAL
+    hardware

"hardware" not in ecos.db? Probably isn't wanted in any case.


The title is generic SPI support, but here's a poser, and something we're inconsistent with... should SPI hardware drivers have CYGPKG_IO_SPI as a parent? That way related functionality is kept together rather than distributed. in lots of top level packages.

Index: io/spi/current/doc/spi.sgml
===================================================================
RCS file: io/spi/current/doc/spi.sgml
diff -N io/spi/current/doc/spi.sgml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ io/spi/current/doc/spi.sgml	24 Aug 2004 17:26:27 -0000
@@ -0,0 +1,711 @@
+<!-- DOCTYPE part  PUBLIC "-//OASIS//DTD DocBook V3.1//EN" -->

Add to doc/sgml/doclist ?


It's interesting on reading this patch that most of it is documentation :-). Probably the right way round for DD infrastructure for a change!

--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ io/spi/current/include/spi.h	24 Aug 2004 17:26:27 -0000
[snip]
+// All devices should be in a per-bus table
+#define CYG_SPI_DEFINE_BUS_TABLE(_type_, _which_)                                       \
+    CYG_HAL_TABLE_BEGIN(cyg_spi_bus_ ## _which_ ## _devs, spibus_ ## _which_);          \
+    CYG_HAL_TABLE_END(cyg_spi_bus_ ## _which_ ## _devs_end, spibus_ ## _which_);        \
+    extern _type_ cyg_spi_bus_## _which_ ## _devs[], cyg_spi_bus_## _which_ ## _devs_end

externC? (or better: __externC)


+
+#define CYG_SPI_DEVICE_ON_BUS(_which_)  CYG_HAL_TABLE_ENTRY( spibus_ ## _which_)
+
+// Keys for use with the get_config() and set_config() operations.
+#define CYG_IO_GET_CONFIG_SPI_CLOCKRATE     0x00000800
+#define CYG_IO_SET_CONFIG_SPI_CLOCKRATE     0x00000880
+
+// The simple I/O operations.
+externC void        cyg_spi_transfer(cyg_spi_device*, cyg_bool, cyg_uint32, const cyg_uint8*, cyg_uint8*);
+externC void        cyg_spi_tick(cyg_spi_device*, cyg_bool, cyg_uint32);
+externC int         cyg_spi_get_config(cyg_spi_device*, cyg_uint32, void*, cyg_uint32*);
+externC int         cyg_spi_set_config(cyg_spi_device*, cyg_uint32, const void*, cyg_uint32*);
+
+// Support for more complicated transactions.
+externC void        cyg_spi_transaction_begin(cyg_spi_device*);

Is it not possible the underlying bus implementation may want to return an error? Ditto the others that return void.


+++ io/spi/current/src/spi.c 24 Aug 2004 17:26:27 -0000

No EOF marker ;).


Jifl
--
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]