]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/commitdiff
Merge all GPIO and Digital IO functions into the hal.c and hal.h file
authorMichal Horn <michal@apartman.cz>
Thu, 16 Jul 2015 10:53:32 +0000 (12:53 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 2 Aug 2015 18:12:37 +0000 (20:12 +0200)
Makefile.var
rpp/include/hal/gpio.h [deleted file]
rpp/include/hal/hal.h
rpp/include/hal/port_gpio.h [deleted file]
rpp/include/hal/port_spi.h [deleted file]
rpp/src/hal/_tms570_rpp/port_def.c
rpp/src/hal/hal.c [moved from rpp/src/hal/gpio.c with 63% similarity]
rpp/src/hal/port_gpio.c [deleted file]
rpp/src/hal/port_spi.c [deleted file]

index 54aaaed9e40aa8e3aab882f43d3c7f208ef9493d..899602d6b5408fdd574a0fc04fccdc2e2b1dbddb 100644 (file)
@@ -39,10 +39,9 @@ rpp_lib_SOURCES +=                                                           \
        rpp/src/rpp/sci.c                                               \
        rpp/src/drv/_$(TARGET)/adc.c                            \
        rpp/src/drv/sci.c                                               \
-       rpp/src/hal/gpio.c                                              \
+       rpp/src/hal/hal.c                                               \
        rpp/src/hal/_$(TARGET)/gpio_def.c               \
        rpp/src/hal/_$(TARGET)/port_def.c               \
-       rpp/src/hal/port_gpio.c                                 \
        rpp/src/sys/asm/dabort.asm                              \
        rpp/src/sys/asm/sys_core.asm                            \
        rpp/src/sys/asm/sys_intvecs.asm                 \
@@ -158,7 +157,6 @@ rpp_lib_SOURCES_tms570_rpp =                                        \
        rpp/src/hal/pom_vect_remap.c                            \
        rpp/src/drv/spi.c                                               \
        rpp/src/drv/spi_tms570.c                                        \
-       rpp/src/hal/port_spi.c                                  \
        rpp/src/hal/spi_resp_transl.c                   \
        rpp/src/rpp/dac.c                                               \
        rpp/src/rpp/din.c                                               \
diff --git a/rpp/include/hal/gpio.h b/rpp/include/hal/gpio.h
deleted file mode 100644 (file)
index 0f5540d..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright (C) 2013-2014 Czech Technical University in Prague
- * Authors:
- *     - Michal Horn <hornmich@fel.cvut.cz>
- *
- * 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.
- *
- * Abstract:
- *     The file contains GPIO pins read, write and configure inline functions.
- */
-
-/**
- * @file
- *
- *  This file contains gpio pin inline functions.
- *  - Get pin descriptor from name function
- *  - Get port base (pointer to registers) from port number
- *  - Get port number from pin descriptor
- *  - Get port base (pointer to registers) from pin descriptor
- *  - Get/Set pin value
- *  - Get/Set pin direction
- *  - Set pin configuration (can be used for initial configuration after MCU reset
- *
- *  Each pin is defined by its descriptor defined in hal_gpio_platform_def. The descriptor can be obtained
- *  by hal_gpio_get_pin_dsc by giving a pin name as an argument.
- */
-
-#ifndef _HAL_GPIO_H
-#define _HAL_GPIO_H_
-
-#include "hal/hal.h"
-
-uint8_t hal_gpio_get_pin_cnt();
-
-pin_map_element_t* hal_gpio_get_pin_map();
-
-/**
- * Get port base assigned to port number
- * @param[in]   port_num    Port number <0;4>
- * @return Pointer to port registers
- */
-gioPORT_t *hal_gpio_get_port_base(uint32_t port_num);
-
-/**
- * Get port number assigned to pin in its descriptor
- * @param[in]   pin descriptor
- * @return  Index of port
- */
-uint32_t hal_gpio_pin_get_port_num(uint32_t pin_dsc);
-
-/**
- * Get port base from pin descriptor
- * Combines two upper defined functions
- * @param[in]   pin_dcs Pin descriptor
- * @return      Pointer to port registers
- */
-gioPORT_t *hal_gpio_pin_get_port_base(uint32_t pin_dsc);
-
-/**
- *  Get pin descriptor assigned to pin name.
- *  @param[in]  pin_name    Pointer to string - the name of the pin.
- *  @param[in]  len         Length of the name, if terminated by '/0', then len=-1
- *  @return Pin descriptor or NULL if not found
- */
-uint32_t *hal_gpio_pin_get_dsc(const char *pin_name, int len);
-
-/**
- * Get value from GPIO pin
- * @param[in]   pin_dsc pin descriptor
- * @return  value read from specified gpio pin
- */
-uint32_t hal_gpio_pin_get_value(uint32_t pin_dsc);
-
-/**
- * Set value to gpio pin
- * @param[in]   pin_dsc pin descriptor
- * @param[in]   value   value to be assigned to the pin
- */
-void hal_gpio_pin_set_value(uint32_t pin_dsc, uint32_t value);
-
-/**
- * Set pin direction to input
- * @param[in] pin_dsc pin descriptor
- * @return always 0
- */
-int hal_gpio_pin_direction_input(uint32_t pin_dsc);
-
-/**
- * Set pin direction to output
- * @param[in] pin_dsc pin descriptor
- * @return always 0
- */
-int hal_gpio_pin_direction_output(uint32_t pin_dsc, uint32_t value);
-
-/**
- * Get pin direction
- * @param[in] pin_dsc pin descriptor
- * @return 1 - output, 0 - input
- */
-int hal_gpio_pin_get_direction(uint32_t pin_dsc);
-
-/**
- * Set pin as pull down or pull up and pull resistor enabled or disabled.
- * @param[in] pin_dsc Descriptor of the pin
- * @param[in] Mode on which pin will be configured to.
- *              PORT_CONF_MODE_PU - pull up
- *              PORT_CONF_MODE_PD - pull down
- *              must be | with
- *              PORT_CONF_MODE_PEN - pull resistor enable
- *              PORT_CONF_MODE_PDIS - pull resistor disable
- * @return always 0
- */
-uint32_t hal_gpio_pin_conf_mode(uint32_t pin_dsc, uint32_t mode);
-
-/**
- * Configure pin to be open drain or not
- * @param[in] pin_dsc Descriptor of the pin
- * @param[in] Mode on which pin will be configured to.
- *              PORT_CONF_OD_OFF - open-drain disabled
- *              PORT_CONF_OD_ON - open drain enabled
- *
- * @return always 0
- */
-uint32_t hal_gpio_pin_conf_od(uint32_t pin_dsc, uint32_t od);
-
-/**
- * Configure pin
- * @param[in] pin_dsc Descriptor of the pin
- * @param[in] Mode on which pin will be configured to.
- *              PORT_CONF_OD_OFF - open-drain disabled
- *              PORT_CONF_OD_ON - open drain enabled
- *
- *              PORT_CONF_MODE_PU - pull up
- *              PORT_CONF_MODE_PD - pull down
- *
- *              PORT_CONF_MODE_PEN - pull resistor enable
- *              PORT_CONF_MODE_PDIS - pull resistor disable
- *
- *              PORT_CONF_DIR_IN - direction input
- *              PORT_CONF_DIR_OUT - direction output
- *
- *              PORT_CONF_INIT_LOW - init value 0
- *              PORT_CONF_INIT_HIGH - init value 1
- *
- *              PORT_CONF_FNC_GPIO - port function GPIO
- *              PORT_CONF_FNC_FNCX - port alternate function X
- *
- * @return always 0
- */
-uint32_t hal_gpio_pin_conf_set(uint32_t pin_dsc, uint32_t conf);
-
-/**
- * Do the initial pin configuration according values in pin descriptor
- * @param[in]   pin_dsc pin descriptor
- * @return always 0;
- */
-uint32_t hal_gpio_pin_conf(uint32_t pin_dsc);
-
-
-#endif //_HAL_GPIO_H_
index 3a0ee571e69e53fd67f380b950f5163da6edbae6..428f824f748885015a2b2897b372e85bf63ab00b 100644 (file)
 #error No supported target specified!
 #endif
 
-#include "hal/gpio.h"
-#include "hal/port_gpio.h"
+uint8_t hal_gpio_get_pin_cnt();
+
+pin_map_element_t* hal_gpio_get_pin_map();
+
+/**
+ * Get port base assigned to port number
+ * @param[in]   port_num    Port number <0;4>
+ * @return Pointer to port registers
+ */
+gioPORT_t *hal_gpio_get_port_base(uint32_t port_num);
+
+/**
+ * Get port number assigned to pin in its descriptor
+ * @param[in]   pin descriptor
+ * @return  Index of port
+ */
+uint32_t hal_gpio_pin_get_port_num(uint32_t pin_dsc);
+
+/**
+ * Get port base from pin descriptor
+ * Combines two upper defined functions
+ * @param[in]   pin_dcs Pin descriptor
+ * @return      Pointer to port registers
+ */
+gioPORT_t *hal_gpio_pin_get_port_base(uint32_t pin_dsc);
+
+/**
+ *  Get pin descriptor assigned to pin name.
+ *  @param[in]  pin_name    Pointer to string - the name of the pin.
+ *  @param[in]  len         Length of the name, if terminated by '/0', then len=-1
+ *  @return Pin descriptor or NULL if not found
+ */
+uint32_t *hal_gpio_pin_get_dsc(const char *pin_name, int len);
+
+/**
+ * Get value from GPIO pin
+ * @param[in]   pin_dsc pin descriptor
+ * @return  value read from specified gpio pin
+ */
+uint32_t hal_gpio_pin_get_value(uint32_t pin_dsc);
+
+/**
+ * Set value to gpio pin
+ * @param[in]   pin_dsc pin descriptor
+ * @param[in]   value   value to be assigned to the pin
+ */
+void hal_gpio_pin_set_value(uint32_t pin_dsc, uint32_t value);
+
+/**
+ * Set pin direction to input
+ * @param[in] pin_dsc pin descriptor
+ * @return always 0
+ */
+int hal_gpio_pin_direction_input(uint32_t pin_dsc);
+
+/**
+ * Set pin direction to output
+ * @param[in] pin_dsc pin descriptor
+ * @return always 0
+ */
+int hal_gpio_pin_direction_output(uint32_t pin_dsc, uint32_t value);
+
+/**
+ * Get pin direction
+ * @param[in] pin_dsc pin descriptor
+ * @return 1 - output, 0 - input
+ */
+int hal_gpio_pin_get_direction(uint32_t pin_dsc);
+
+/**
+ * Set pin as pull down or pull up and pull resistor enabled or disabled.
+ * @param[in] pin_dsc Descriptor of the pin
+ * @param[in] Mode on which pin will be configured to.
+ *              PORT_CONF_MODE_PU - pull up
+ *              PORT_CONF_MODE_PD - pull down
+ *              must be | with
+ *              PORT_CONF_MODE_PEN - pull resistor enable
+ *              PORT_CONF_MODE_PDIS - pull resistor disable
+ * @return always 0
+ */
+uint32_t hal_gpio_pin_conf_mode(uint32_t pin_dsc, uint32_t mode);
+
+/**
+ * Configure pin to be open drain or not
+ * @param[in] pin_dsc Descriptor of the pin
+ * @param[in] Mode on which pin will be configured to.
+ *              PORT_CONF_OD_OFF - open-drain disabled
+ *              PORT_CONF_OD_ON - open drain enabled
+ *
+ * @return always 0
+ */
+uint32_t hal_gpio_pin_conf_od(uint32_t pin_dsc, uint32_t od);
+
+/**
+ * Configure pin
+ * @param[in] pin_dsc Descriptor of the pin
+ * @param[in] Mode on which pin will be configured to.
+ *              PORT_CONF_OD_OFF - open-drain disabled
+ *              PORT_CONF_OD_ON - open drain enabled
+ *
+ *              PORT_CONF_MODE_PU - pull up
+ *              PORT_CONF_MODE_PD - pull down
+ *
+ *              PORT_CONF_MODE_PEN - pull resistor enable
+ *              PORT_CONF_MODE_PDIS - pull resistor disable
+ *
+ *              PORT_CONF_DIR_IN - direction input
+ *              PORT_CONF_DIR_OUT - direction output
+ *
+ *              PORT_CONF_INIT_LOW - init value 0
+ *              PORT_CONF_INIT_HIGH - init value 1
+ *
+ *              PORT_CONF_FNC_GPIO - port function GPIO
+ *              PORT_CONF_FNC_FNCX - port alternate function X
+ *
+ * @return always 0
+ */
+uint32_t hal_gpio_pin_conf_set(uint32_t pin_dsc, uint32_t conf);
+
+/**
+ * Do the initial pin configuration according values in pin descriptor
+ * @param[in]   pin_dsc pin descriptor
+ * @return always 0;
+ */
+uint32_t hal_gpio_pin_conf(uint32_t pin_dsc);
+
+/**
+ * Get values of all pins of given port.
+ * @param[in] config    Pointer to array of pin descriptors
+ * @param[in] num_val   Number of pins assigned to the port
+ * @param[out] values   Stored values of all pins of the port. 1st bit -> pin0, 2nd bit -> pin1...
+ * @return always 0
+ */
+uint32_t hal_gio_port_get_val(uint32_t *config, uint32_t num_val, uint32_t *values);
+
+/**
+ * Set values to all pins of given port.
+ * @param[in] config    Pointer to array of pin descriptors
+ * @param[in] num_val   Number of pins assigned to the port
+ * @param[in] values    Stored values of all pins of the port. 1st bit -> pin0, 2nd bit -> pin1...
+ * @return always 0
+ */
+uint32_t hal_gio_port_set_val(uint32_t *config, uint32_t num_val, const uint32_t *values);
+
+/**
+ *  Get port descriptor assigned to port name.
+ *  @param[in]  port_name   Pointer to string - the name of the port.
+ *  @param[in]  len         Length of the name, if terminated by '/0', then len=-1
+ *  @return Port descriptor or NULL if not found
+ */
+const port_def_t *hal_port_get_definitions();
+
+port_desc_t *hal_port_get_dsc(const char *port_name, int len);
+
+/**
+ *  Get port descriptor assigned to port name.
+ *  @param[in]  port_name   Pointer to string - the name of the port.
+ *  @param[in]  len         Length of the name, if terminated by '/0', then len=-1
+ *  @return Port descriptor or NULL if not found
+ */
+port_desc_t *hal_port_get_dsc(const char *port_name, int len);
+
+/**
+ * Transfer command through the spi
+ * @param[in] config    Address of the SPI
+ * @param[in] num_bytes Number of bytes to be trasfered
+ * @param[in] commands  SPI command to be sent
+ * @return spi response
+ */
+uint32_t hal_spi_port_transfer_command(uint32_t *config, uint32_t num_bytes, const uint32_t *commands);
+
 
 #endif /* __HAL_H */
diff --git a/rpp/include/hal/port_gpio.h b/rpp/include/hal/port_gpio.h
deleted file mode 100644 (file)
index f7b0b3e..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 2013-2014 Czech Technical University in Prague
- * Authors:
- *     - Michal Horn <hornmich@fel.cvut.cz>
- *
- * 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.
- */
-
-#ifndef PORT_GPIO_H_
-#define PORT_GPIO_H_
-
-//#include "sys_common.h"
-#include "hal/hal.h"
-
-/**
- * Get values of all pins of given port.
- * @param[in] config    Pointer to array of pin descriptors
- * @param[in] num_val   Number of pins assigned to the port
- * @param[out] values   Stored values of all pins of the port. 1st bit -> pin0, 2nd bit -> pin1...
- * @return always 0
- */
-uint32_t hal_gio_port_get_val(uint32_t *config, uint32_t num_val, uint32_t *values);
-
-/**
- * Set values to all pins of given port.
- * @param[in] config    Pointer to array of pin descriptors
- * @param[in] num_val   Number of pins assigned to the port
- * @param[in] values    Stored values of all pins of the port. 1st bit -> pin0, 2nd bit -> pin1...
- * @return always 0
- */
-uint32_t hal_gio_port_set_val(uint32_t *config, uint32_t num_val, const uint32_t *values);
-
-/**
- *  Get port descriptor assigned to port name.
- *  @param[in]  port_name   Pointer to string - the name of the port.
- *  @param[in]  len         Length of the name, if terminated by '/0', then len=-1
- *  @return Port descriptor or NULL if not found
- */
-const port_def_t *hal_port_get_definitions();
-
-port_desc_t *hal_port_get_dsc(const char *port_name, int len);
-
-/**
- *  Get port descriptor assigned to port name.
- *  @param[in]  port_name   Pointer to string - the name of the port.
- *  @param[in]  len         Length of the name, if terminated by '/0', then len=-1
- *  @return Port descriptor or NULL if not found
- */
-port_desc_t *hal_port_get_dsc(const char *port_name, int len);
-
-#endif /* PORT_GPIO_H_ */
diff --git a/rpp/include/hal/port_spi.h b/rpp/include/hal/port_spi.h
deleted file mode 100644 (file)
index f08c4e1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- *
- * @file port_spi.h
- *
- * @copyright Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * @author Michal Horn <hornmich@fel.cvut.cz>
- */
-
-#ifndef PORT_SPI_H_
-#define PORT_SPI_H_
-
-//#include "sys_common.h"
-#include "hal/hal.h"
-
-/**
- * Transfer command through the spi
- * @param[in] config    Address of the SPI
- * @param[in] num_bytes Number of bytes to be trasfered
- * @param[in] commands  SPI command to be sent
- * @return spi response
- */
-uint32_t hal_spi_port_transfer_command(uint32_t *config, uint32_t num_bytes, const uint32_t *commands);
-
-
-#endif /* PORT_SPI_H_ */
index 62add29548632910b956e007ab44902c6420613c..1f211314cedf67ca6c87599af20ae499b41cb54c 100644 (file)
@@ -24,8 +24,6 @@
  */
 
 #include "hal/hal.h"
-
-#include "hal/port_spi.h"
 #include "drv/spi.h"
 
 // Lists of pins assigned to the ports
similarity index 63%
rename from rpp/src/hal/gpio.c
rename to rpp/src/hal/hal.c
index 4633ff13e8e679c84c3f959d55f2fc13b69e9703..cbe891366f680b907650805e998399843f28f9da 100644 (file)
@@ -1,28 +1,22 @@
-/* Copyright (C) 2012-2013 Czech Technical University in Prague
+/*
+ * hal.c
  *
- * Authors:
- *     - Michal Horn <hornmich@fel.cvut.cz>
- *
- * 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 : gpio.c
- *
- * Abstract:
- *         This file contains gpio pin configuration functions.
- *      Some additional function for setting and getting pin values, getting
- *      descriptors etc. are defined in header file as inline functions.
- *
- *      Each pin is defined by its descriptor defined in hal_gpio_platform_def. The descriptor can be obtained
- *      by hal_gpio_get_pin_dsc by giving a pin name as an argument.
+ *  Created on: 16.7.2015
+ *      Author: michal
  */
 
 #include "hal/hal.h"
+#include "drv/spi.h"
 
 extern gioPORT_t *port_id_map[MAX_PORT_CNT];
 extern pin_map_element_t pin_map[MAX_PIN_CNT];
+extern port_def_t port_definition[PORT_CNT];
+
+#define SPI_PORT_BUF_LEN 4
+/** Buffer for spi command to be sent */
+uint8_t spi_port_buf_tx[SPI_PORT_BUF_LEN];
+/** Buffer for spi response */
+uint8_t spi_port_buf_rx[SPI_PORT_BUF_LEN];
 
 uint8_t hal_gpio_get_pin_cnt() {
        return MAX_PIN_CNT;
@@ -151,3 +145,72 @@ uint32_t hal_gpio_pin_conf(uint32_t pin_dsc)
 {
        return hal_gpio_pin_conf_set(pin_dsc, pin_dsc);
 }
+
+
+uint32_t hal_gio_port_get_val(uint32_t *config, uint32_t num_val, uint32_t *values)
+{
+       uint32_t i;
+
+       for (i = 0; i < num_val; i++) {
+               values[i] = hal_gpio_pin_get_value(config[i]);
+       }
+       return 0;
+}
+
+uint32_t hal_gio_port_set_val(uint32_t *config, uint32_t num_val, const uint32_t *values)
+{
+       uint32_t i;
+
+       for (i = 0; i < num_val; i++) {
+               hal_gpio_pin_set_value(config[i], (values[i/8] >> i%8) & 0x1);
+       }
+       return 0;
+}
+
+const port_def_t *hal_port_get_definitions()
+{
+       return (const port_def_t *)port_definition;
+}
+
+port_desc_t *hal_port_get_dsc(const char *port_name, int len)
+{
+       uint32_t i;
+       const char *port_name_ptr;
+       char port_name_term[32];
+
+       if (len != -1) {    // port name not terminated by '\0'
+               strncpy(port_name_term, port_name, len);
+               port_name_term[len] = '\0';
+               port_name_ptr = port_name_term;
+       }
+       else port_name_ptr = port_name;
+
+       for (i = 0; i < PORT_CNT; i++) {
+               if (strcmp(port_name_ptr, port_definition[i].name) == 0)
+                       return port_definition[i].desc;
+       }
+       return NULL;
+}
+
+uint32_t hal_spi_port_transfer_command(uint32_t *config, uint32_t num_bytes, const uint32_t *commands)
+{
+       spi_drv_t *ifc;
+       int i;
+       uint32_t ret;
+
+       for (i = 0; i < num_bytes; i++)
+               spi_port_buf_tx[i] = commands[i];
+
+       ifc = spi_find_drv(NULL, config[0]);
+       if (ifc == NULL)
+               return 0;
+
+       if (!(ifc->flags & SPI_IFC_ON))
+               return 0;
+
+       spi_transfer(ifc, config[1], num_bytes, spi_port_buf_tx, spi_port_buf_rx);
+       ret = 0;
+       for (i = 0; i < num_bytes; i++)
+               ret |= spi_port_buf_rx[i] << i*8;
+       return ret;
+}
diff --git a/rpp/src/hal/port_gpio.c b/rpp/src/hal/port_gpio.c
deleted file mode 100644 (file)
index 099e839..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (C) 2012-2013 Czech Technical University in Prague
- *
- * Authors:
- *     - Michal Horn <hornmich@fel.cvut.cz>
- *
- * 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 : port_gpio.c
- *
- * Abstract:
- *         This file contains getter and setter functions for GPIO port type.
- */
-
-#include "hal/hal.h"
-
-extern port_def_t port_definition[PORT_CNT];
-
-uint32_t hal_gio_port_get_val(uint32_t *config, uint32_t num_val, uint32_t *values)
-{
-       uint32_t i;
-
-       for (i = 0; i < num_val; i++) {
-               values[i] = hal_gpio_pin_get_value(config[i]);
-       }
-       return 0;
-}
-
-uint32_t hal_gio_port_set_val(uint32_t *config, uint32_t num_val, const uint32_t *values)
-{
-       uint32_t i;
-
-       for (i = 0; i < num_val; i++) {
-               hal_gpio_pin_set_value(config[i], (values[i/8] >> i%8) & 0x1);
-       }
-       return 0;
-}
-
-const port_def_t *hal_port_get_definitions()
-{
-       return (const port_def_t *)port_definition;
-}
-
-port_desc_t *hal_port_get_dsc(const char *port_name, int len)
-{
-       uint32_t i;
-       const char *port_name_ptr;
-       char port_name_term[32];
-
-       if (len != -1) {    // port name not terminated by '\0'
-               strncpy(port_name_term, port_name, len);
-               port_name_term[len] = '\0';
-               port_name_ptr = port_name_term;
-       }
-       else port_name_ptr = port_name;
-
-       for (i = 0; i < PORT_CNT; i++) {
-               if (strcmp(port_name_ptr, port_definition[i].name) == 0)
-                       return port_definition[i].desc;
-       }
-       return NULL;
-}
diff --git a/rpp/src/hal/port_spi.c b/rpp/src/hal/port_spi.c
deleted file mode 100644 (file)
index 8c26537..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 2012-2013, 2015 Czech Technical University in Prague
- *
- * Authors:
- *     - Michal Horn <hornmich@fel.cvut.cz>
- *
- * 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 : port_spi.c
- *
- * Abstract:
- *         This file contains getter and setter functions for SPI port type.
- */
-
-#include "drv/spi.h"
-
-#define PORT_BUF 4
-/** Buffer for spi command to be sent */
-uint8_t spi_port_buf_tx[PORT_BUF];
-/** Buffer for spi response */
-uint8_t spi_port_buf_rx[PORT_BUF];
-
-uint32_t hal_spi_port_transfer_command(uint32_t *config, uint32_t num_bytes, const uint32_t *commands)
-{
-       spi_drv_t *ifc;
-       int i;
-       uint32_t ret;
-
-       for (i = 0; i < num_bytes; i++)
-               spi_port_buf_tx[i] = commands[i];
-
-       ifc = spi_find_drv(NULL, config[0]);
-       if (ifc == NULL)
-               return 0;
-
-       if (!(ifc->flags & SPI_IFC_ON))
-               return 0;
-
-       spi_transfer(ifc, config[1], num_bytes, spi_port_buf_tx, spi_port_buf_rx);
-       ret = 0;
-       for (i = 0; i < num_bytes; i++)
-               ret |= spi_port_buf_rx[i] << i*8;
-       return ret;
-}