]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/commitdiff
Separate target independent code
authorMichal Horn <michal@apartman.cz>
Thu, 16 Jul 2015 08:59:02 +0000 (10:59 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 2 Aug 2015 18:12:37 +0000 (20:12 +0200)
The target dependent code (pin and port definitions) is in the target specific files in
rpp/hal/_target directory.

The target independent code 9structures and code) has been moved to files in rpp/hal directory.

rpp/include/hal/_rm48_hdk/port_def.h
rpp/include/hal/_tms570_hdk/port_def.h
rpp/include/hal/_tms570_hydctr/port_def.h
rpp/include/hal/_tms570_rpp/port_def.h
rpp/include/hal/port_gpio.h
rpp/src/hal/_rm48_hdk/port_def.c
rpp/src/hal/_tms570_hdk/port_def.c
rpp/src/hal/_tms570_hydctr/port_def.c
rpp/src/hal/_tms570_rpp/port_def.c
rpp/src/hal/port_gpio.c

index 2994f39efbb400efe5175075a9888e3aeee50a25..5095a1997aa798112a61669980aef9f60202f934 100644 (file)
@@ -97,8 +97,4 @@ typedef struct port_def_st {
 #define PORT_SFC_ADC            NULL
 #define PORT_INT_TYPE_ADC       PORT_INTERFACE_ADC
 
-port_desc_t *hal_port_get_dsc(const char *port_name, int len);
-const port_def_t *hal_port_get_definitions();
-
-
 #endif /* PORT_DEF_H_ */
index 2994f39efbb400efe5175075a9888e3aeee50a25..5095a1997aa798112a61669980aef9f60202f934 100644 (file)
@@ -97,8 +97,4 @@ typedef struct port_def_st {
 #define PORT_SFC_ADC            NULL
 #define PORT_INT_TYPE_ADC       PORT_INTERFACE_ADC
 
-port_desc_t *hal_port_get_dsc(const char *port_name, int len);
-const port_def_t *hal_port_get_definitions();
-
-
 #endif /* PORT_DEF_H_ */
index 2994f39efbb400efe5175075a9888e3aeee50a25..5095a1997aa798112a61669980aef9f60202f934 100644 (file)
@@ -97,8 +97,4 @@ typedef struct port_def_st {
 #define PORT_SFC_ADC            NULL
 #define PORT_INT_TYPE_ADC       PORT_INTERFACE_ADC
 
-port_desc_t *hal_port_get_dsc(const char *port_name, int len);
-const port_def_t *hal_port_get_definitions();
-
-
 #endif /* PORT_DEF_H_ */
index 9c09f646db4b81b73507d494f2e93fd472d3c291..d11484eb6bb55019c347d8e1fb4901640e19cdee 100644 (file)
@@ -168,8 +168,4 @@ extern uint32_t adc_get_port_val(uint32_t *config, uint32_t num_channels, uint32
 #define PORT_SFC_MOUTIN         &hal_gio_port_set_val
 #define PORT_INT_TYPE_MOUTIN    PORT_INTERFACE_GPIO
 
-port_desc_t *hal_port_get_dsc(const char *port_name, int len);
-const port_def_t *hal_port_get_definitions();
-
-
 #endif /* PORT_DEF_H_ */
index a3d527716457776746e189d0afaba343dbc02c8e..f7b0b3e95e051609201f831fecbe1b3b150cc073 100644 (file)
@@ -32,4 +32,22 @@ uint32_t hal_gio_port_get_val(uint32_t *config, uint32_t num_val, uint32_t *valu
  */
 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_ */
index 2da9a431839413b6f6dbaed996c4182820845013..f43826b3bd5d123d19ac462c8699e8a0709b1ccf 100644 (file)
@@ -65,46 +65,9 @@ static port_desc_t port_desc_adc = {
 };
 
 // Maps of port names to port descriptors
-static port_def_t port_definition[PORT_CNT] = {
+port_def_t port_definition[PORT_CNT] = {
        {.name = PORT_NAME_GIOA,      .desc = &port_desc_gioa},
        {.name = PORT_NAME_GIOB,      .desc = &port_desc_giob},
        {.name = PORT_NAME_NHET1,    .desc = &port_desc_nhet1},
        {.name = PORT_NAME_ADC,      .desc = &port_desc_adc}
 };
-
-/**
- *  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)
-{
-       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;
-}
-
-/**
- *  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()
-{
-       return (const port_def_t *)port_definition;
-}
index 2da9a431839413b6f6dbaed996c4182820845013..f43826b3bd5d123d19ac462c8699e8a0709b1ccf 100644 (file)
@@ -65,46 +65,9 @@ static port_desc_t port_desc_adc = {
 };
 
 // Maps of port names to port descriptors
-static port_def_t port_definition[PORT_CNT] = {
+port_def_t port_definition[PORT_CNT] = {
        {.name = PORT_NAME_GIOA,      .desc = &port_desc_gioa},
        {.name = PORT_NAME_GIOB,      .desc = &port_desc_giob},
        {.name = PORT_NAME_NHET1,    .desc = &port_desc_nhet1},
        {.name = PORT_NAME_ADC,      .desc = &port_desc_adc}
 };
-
-/**
- *  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)
-{
-       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;
-}
-
-/**
- *  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()
-{
-       return (const port_def_t *)port_definition;
-}
index 2da9a431839413b6f6dbaed996c4182820845013..f43826b3bd5d123d19ac462c8699e8a0709b1ccf 100644 (file)
@@ -65,46 +65,9 @@ static port_desc_t port_desc_adc = {
 };
 
 // Maps of port names to port descriptors
-static port_def_t port_definition[PORT_CNT] = {
+port_def_t port_definition[PORT_CNT] = {
        {.name = PORT_NAME_GIOA,      .desc = &port_desc_gioa},
        {.name = PORT_NAME_GIOB,      .desc = &port_desc_giob},
        {.name = PORT_NAME_NHET1,    .desc = &port_desc_nhet1},
        {.name = PORT_NAME_ADC,      .desc = &port_desc_adc}
 };
-
-/**
- *  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)
-{
-       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;
-}
-
-/**
- *  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()
-{
-       return (const port_def_t *)port_definition;
-}
index 37c4ad0b367f4f0902201eddd20177f65545fcc0..62add29548632910b956e007ab44902c6420613c 100644 (file)
@@ -167,7 +167,7 @@ static port_desc_t port_desc_moutin = {
 };
 
 // Maps of port names to port descriptors
-static port_def_t port_definition[PORT_CNT] = {
+port_def_t port_definition[PORT_CNT] = {
        {.name = PORT_NAME_DINMCU,      .desc = &port_desc_dinmcu},
        {.name = PORT_NAME_DINSPI,      .desc = &port_desc_dinspi},
        {.name = PORT_NAME_HOUTDIAG,    .desc = &port_desc_houtdiag},
@@ -185,39 +185,3 @@ static port_def_t port_definition[PORT_CNT] = {
        {.name = PORT_NAME_MOUTIN,      .desc = &port_desc_moutin}
 };
 
-/**
- *  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)
-{
-       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;
-}
-
-/**
- *  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()
-{
-       return (const port_def_t *)port_definition;
-}
index 71efad2b8110bae711f802670cd636111467f6ef..099e839f5bbc53a43eb3c91eefcfa6e1859b4c4b 100644 (file)
@@ -16,6 +16,8 @@
 
 #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;
@@ -35,3 +37,28 @@ uint32_t hal_gio_port_set_val(uint32_t *config, uint32_t num_val, const uint32_t
        }
        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;
+}