From fe83cef6831e46410c6095033fe53c2750340099 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 11 Jan 2010 16:14:47 +0000 Subject: 2010-01-11 Allan Hessenflow * serial/spi.c, serial/spi.h: Fill in skeleton with functional SPI master code. * include/spiRegs.h: Correct spi shadow register declaration. --- c/src/lib/libcpu/bfin/serial/spi.h | 43 ++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'c/src/lib/libcpu/bfin/serial/spi.h') diff --git a/c/src/lib/libcpu/bfin/serial/spi.h b/c/src/lib/libcpu/bfin/serial/spi.h index a656f44c29..63609a3ccb 100644 --- a/c/src/lib/libcpu/bfin/serial/spi.h +++ b/c/src/lib/libcpu/bfin/serial/spi.h @@ -1,9 +1,7 @@ -/* placeholder (just a shell) */ - /* * RTEMS driver for Blackfin SPI * - * COPYRIGHT (c) 2008 Kallisti Labs, Los Gatos, CA, USA + * COPYRIGHT (c) 2010 Kallisti Labs, Los Gatos, CA, USA * written by Allan Hessenflow * * The license and distribution terms for this file may be @@ -13,40 +11,45 @@ * $Id$ */ - -#ifndef _spi_h_ -#define _spi_h_ - +#ifndef _spi_h +#define _spi_h #ifdef __cplusplus extern "C" { #endif - typedef struct { - /* parameters provided by bsp */ - uint32_t freq; - void *base; - bool fast; - /* internal use */ - rtems_id irq_sema_id; -} bfin_spi_softc_t; + void *base; + /* remaining entries are for internal use */ + rtems_id sem; + int bytes_per_word; + uint16_t idle_pattern; + uint8_t *rd_ptr; + const uint8_t *wr_ptr; + int len; +} bfin_spi_state_t; typedef struct { rtems_libi2c_bus_t bus; - bfin_spi_softc_t softc; -} bfin_spi_desc_t; + bfin_spi_state_t p; +} bfin_spi_bus_t; + + +void bfin_spi_isr(int v); +rtems_status_code bfin_spi_init(rtems_libi2c_bus_t *bus); -extern rtems_libi2c_bus_ops_t bfin_spi_libi2c_bus_ops; +rtems_status_code bfin_spi_send_start(rtems_libi2c_bus_t *bus); +int bfin_spi_read_bytes(rtems_libi2c_bus_t *bus, unsigned char *buf, int len); -void bfin_spi_isr(int source); +int bfin_spi_write_bytes(rtems_libi2c_bus_t *bus, unsigned char *buf, int len); +int bfin_spi_ioctl(rtems_libi2c_bus_t *bus, int cmd, void *arg); #ifdef __cplusplus } #endif -#endif /* _spi_h_ */ +#endif /* _spi_h */ -- cgit v1.2.3