Proposed addition to libi2c transfer mode structure for SPI chip select generation

Thomas Dörfler Thomas.Doerfler at embedded-brains.de
Sun Sep 21 09:09:44 UTC 2008


Robert,

the addition you propose may be useful for several devices, although it
requires additional logic in SPI driver that do not support this option
by hardware, beacuse they need to remember which address they are
currently working with (it is not stored in hardware).

I see no harm in adding this field, but I would like to invert the logic
of the option:

bool spi_sel_per_word  /* TRUE: activate SEL only while a word is
transferred */

If we invert it, it will be false for "old" drivers and therefore will
have the same behaviour with or without this field.

RTEMS-4.9.0 is scheduled to be cut next Wednesday and its features are
frozen, so IMHO it is too late to add a new driver. And therefore I
would not want to add this field to the 4.9.0 branch, but adding it to
4.10 is ok.

wkr,
Thomas.


Robert S. Grimes wrote:
> Hi all,
> 
> The Xilinx Virtex-4 and Virtex II-Pro SPI peripherals support 
> automatically generating per-byte chip selects (CS) for communicating 
> over the SPI bus.  This mode is in addition to a manual mode, in which 
> software must manually set CS.  The automatic mode is very cool for 
> those devices that use CS to frame each byte (or in a custom version of 
> the SPI peripheral I have, each 16-bit word).  However, other devices, 
> such as Ramtron FRAM, expect the CS to be used as a "transaction" frame, 
> which is where the manual mode comes in.
> 
> When I implemented my SPI driver, I needed to support both modes (as I 
> have examples of each device type), but I couldn't find where to capture 
> this option.  It seems to logically fit into the rtems_libi2c_tfr_mode_t 
> structure, as it is related to those attributes, so that is what I did 
> in my 4.8 installation.  I would like to see this incorporated into 
> RTEMS (hopefully 4.9), so the Virtex SPI driver will work.  Here is the 
> single change, in /cpukit/libi2c/libi2c.h:
> 
>   typedef struct {
>     uint32_t baudrate;       /* maximum bits per second               */
>                              /* only valid for SPI drivers:           */
>     uint8_t  bits_per_char;  /* how many bits per byte/word/longword? */
>     bool     lsb_first;      /* true: send LSB first                  */
>     bool     clock_inv;      /* true: inverted clock (high active)    */
>     bool     clock_phs;      /* true: clock starts toggling at start of 
> data tfr */
>     uint32_t  idle_char;     /* This character will be continuously 
> transmitted in read only functions */
> +   bool     spi_sel_mode;   /* SPI only - true = SS set per 
> transaction; false = SS set per SPI word */
>   } rtems_libi2c_tfr_mode_t;
> 
> Any comments?
> 
> I also can submit my SPI driver, though it is currently polled mode 
> only; that was sufficient for my needs, and I couldn't get the 
> interrupts to work correctly.  Perhaps by submitting it someone else 
> could help?  Regardless, it does work fine as is, with that caveat.
> 
> Thanks,
> -Bob
> 
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users


-- 
--------------------------------------------
embedded brains GmbH
Thomas Doerfler           Obere Lagerstr. 30
D-82178 Puchheim          Germany
Tel. : +49-89-18 90 80 79-2
Fax  : +49-89-18 90 80 79-9
email: Thomas.Doerfler at embedded-brains.de
PGP public key available on request

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list