]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - rpp/src/drv/spi.c
Move SPI driver from HAL layer to DRV layer
[pes-rpp/rpp-lib.git] / rpp / src / drv / spi.c
index cf19d9f990c6dc9ed580c0b31f0c1e55b15a4afc..d4ed1bf0f50b9b4ba31958aaa236be5119af8ab3 100644 (file)
@@ -1,7 +1,18 @@
-//#include "sys_common.h"
-#include "ul_list.h"
-#include "drv_spi.h"
-#include "cpu_def.h"
+/* Copyright (C) 2012-2013, 2015 Czech Technical University in Prague
+ *
+ * This document contains proprietary information belonging to Czech
+ * Technical University in Prague. Passing on and copying of this
+ * document, and communication of its contents is not permitted
+ * without prior written authorization.
+ *
+ * File : spi.c
+ */
+
+//#include "ul/ul_list.h"
+//#include "drv/spi.h"
+//#include "cpu_def.h"
+//#include "ul/ul_list.h"
+#include "drv/spi.h"
 
 int spi_msg_rq_ins(spi_drv_t *ifc, spi_msg_head_t *msg)
 {
@@ -22,9 +33,8 @@ int spi_msg_rq_ins(spi_drv_t *ifc, spi_msg_head_t *msg)
 
 int spi_transfer_callback(struct spi_drv *ifc, int code, struct spi_msg_head *msg)
 {
-       if (msg->private) {
+       if (msg->private)
                msg->private = 0;
-       }
        return 0;
 }
 
@@ -46,9 +56,8 @@ int spi_transfer(spi_drv_t *ifc, int addr, int rq_len, const void *tx_buf, void
                return -1;
 
        /* Wait for the request completion */
-       while (msg.private) {
+       while (msg.private)
                __memory_barrier();
-       }
 
 
        if (msg.flags & (SPI_MSG_FAIL | SPI_MSG_ABORT))
@@ -56,4 +65,3 @@ int spi_transfer(spi_drv_t *ifc, int addr, int rq_len, const void *tx_buf, void
 
        return msg.rq_len;
 }
-