]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - rpp/include/drv/spi.h
Make the RPP layer thread safe
[pes-rpp/rpp-lib.git] / rpp / include / drv / spi.h
index 81b533e6fbaf6b0a6fcc42406b1cc78e94f5eaac..ba4fb43a22bcc5781fa3351e8d59ad2d3135b011 100644 (file)
@@ -1,59 +1,21 @@
+/**
+ *
+ * @file spi.h
+ *
+ * @copyright Copyright (C) 2012-2013, 2015 Czech Technical University in Prague
+ *
+ */
+
 #ifndef _SPI_DRV_H_
 #define _SPI_DRV_H_
 
-#include "sys_common.h"
-#include "ul_list.h"
-#include "string.h"
-#include "cpu_def.h"
-
-#define SPI_MSG_FINISHED 0x040
-#define SPI_MSG_ABORT    0x020
-#define SPI_MSG_FAIL     0x010
-
-struct spi_drv;
-
-typedef struct spi_msg_head {
-       uint16_t flags;         /* message flags */
-       uint16_t addr;          /* message destination address -- used as
-                                       index into the "address translation table"*/
-
-       //uint16_t size_mode;   /* message frame len and mode */
-       uint16_t rq_len;        /* requested transfer length */
-       const uint8_t *tx_buf;  /* pointer to TX data */
-       uint8_t *rx_buf;        /* pointer to RX data */
-
-       ul_list_node_t node;
-       //struct spi_drv *ifc;  /* */
-       int (*callback) (struct spi_drv * ifc, int code, struct spi_msg_head * msg); /* Called when whole transfer is finished */
-       long private;           /* If set -- msg is processed by HW */
-} spi_msg_head_t;
-
-
-
-#define SPI_CTRL_WAKE_RQ 1
-typedef int (spi_ctrl_fnc_t) (struct spi_drv * ifc, int ctrl, void *p);
-
-#define SPI_IFC_ON 1
-typedef struct spi_drv {
-       uint16_t flags;                 /* Flags */
-       //uint16_t self_addr;
-       ul_list_head_t rq_queue;        /* Queue containing MSG requests to process */
-       spi_msg_head_t *msg_act;        /* MSG being actually processed */
-       spi_ctrl_fnc_t *ctrl_fnc;       /* Device dependent function responsible for sending data */
-       //long private;
-} spi_drv_t;
+#include "drv/spi_tms570.h"
+#include "drv/port.h"
 
 UL_LIST_CUST_DEC(spi_rq_queue, spi_drv_t, spi_msg_head_t, rq_queue, node)
 
-/* ------------------------------------------------------------------------- */
-
-typedef unsigned long spi_isr_lock_level_t;
-#define spi_isr_lock   save_and_cli
-#define         spi_isr_unlock restore_flags
-
-/* ------------------------------------------------------------------------- */
 int spi_transfer(spi_drv_t *ifc, int addr, int rq_len, const void *tx_buf, void *rx_buf);
-spi_drv_t *spi_find_drv(char *name, int number);
 int spi_msg_rq_ins(spi_drv_t *ifc, spi_msg_head_t *msg);
+int8_t port_spi_set(const struct port_desc *port, void *values, size_t size);
 
 #endif /* _SPI_DRV_H_ */