From cc2ca82b4245bfb8eeecd7585cc7abd16d35ea8d Mon Sep 17 00:00:00 2001 From: Michal Horn Date: Thu, 16 Jul 2015 13:10:26 +0200 Subject: [PATCH] Give the HAL functions better names --- rpp/include/hal/_rm48_hdk/port_def.h | 12 ++++---- rpp/include/hal/_tms570_hdk/port_def.h | 12 ++++---- rpp/include/hal/_tms570_hydctr/port_def.h | 12 ++++---- rpp/include/hal/_tms570_rpp/port_def.h | 14 ++++----- rpp/include/hal/hal.h | 20 ++++++------ rpp/src/hal/_rm48_hdk/port_def.c | 37 +++++++++++++++++++++++ rpp/src/hal/_tms570_hdk/port_def.c | 37 +++++++++++++++++++++++ rpp/src/hal/_tms570_hydctr/port_def.c | 37 +++++++++++++++++++++++ rpp/src/hal/hal.c | 30 +++++++++--------- rpp/src/rpp/gio.c | 2 +- 10 files changed, 162 insertions(+), 51 deletions(-) diff --git a/rpp/include/hal/_rm48_hdk/port_def.h b/rpp/include/hal/_rm48_hdk/port_def.h index 5095a19..3ec8180 100644 --- a/rpp/include/hal/_rm48_hdk/port_def.h +++ b/rpp/include/hal/_rm48_hdk/port_def.h @@ -62,16 +62,16 @@ typedef struct port_def_st { #define PORT_CFG_GIOA { PIN_DSC_GIOA0, PIN_DSC_GIOA1, PIN_DSC_GIOA2, PIN_DSC_GIOA3, \ PIN_DSC_GIOA4, PIN_DSC_GIOA5, PIN_DSC_GIOA6, PIN_DSC_GIOA7 } #define PORT_NV_GIOA 8 -#define PORT_GFC_GIOA &hal_gio_port_get_val -#define PORT_SFC_GIOA &hal_gio_port_set_val +#define PORT_GFC_GIOA &hal_gpio_port_get_val +#define PORT_SFC_GIOA &hal_gpio_port_set_val #define PORT_INT_TYPE_GIOA PORT_INTERFACE_GPIO #define PORT_NAME_GIOB "GIOB" #define PORT_CFG_GIOB { PIN_DSC_GIOB0, PIN_DSC_GIOB1, PIN_DSC_GIOB2, PIN_DSC_GIOB3, \ PIN_DSC_GIOB4, PIN_DSC_GIOB5, PIN_DSC_GIOB6, PIN_DSC_GIOB7 } #define PORT_NV_GIOB 8 -#define PORT_GFC_GIOB &hal_gio_port_get_val -#define PORT_SFC_GIOB &hal_gio_port_set_val +#define PORT_GFC_GIOB &hal_gpio_port_get_val +#define PORT_SFC_GIOB &hal_gpio_port_set_val #define PORT_INT_TYPE_GIOB PORT_INTERFACE_GPIO /* Some pins are commented out, because they are muxed with SCI. */ @@ -85,8 +85,8 @@ typedef struct port_def_st { PIN_DSC_NHET1_24, PIN_DSC_NHET1_25, PIN_DSC_NHET1_26, PIN_DSC_NHET1_27, \ PIN_DSC_NHET1_28, PIN_DSC_NHET1_29, PIN_DSC_NHET1_30, PIN_DSC_NHET1_31 } #define PORT_NV_NHET1 30 -#define PORT_GFC_NHET1 &hal_gio_port_get_val -#define PORT_SFC_NHET1 &hal_gio_port_set_val +#define PORT_GFC_NHET1 &hal_gpio_port_get_val +#define PORT_SFC_NHET1 &hal_gpio_port_set_val #define PORT_INT_TYPE_NHET1 PORT_INTERFACE_GPIO #define PORT_ADC_CHANNEL_NUM 16 diff --git a/rpp/include/hal/_tms570_hdk/port_def.h b/rpp/include/hal/_tms570_hdk/port_def.h index 5095a19..3ec8180 100644 --- a/rpp/include/hal/_tms570_hdk/port_def.h +++ b/rpp/include/hal/_tms570_hdk/port_def.h @@ -62,16 +62,16 @@ typedef struct port_def_st { #define PORT_CFG_GIOA { PIN_DSC_GIOA0, PIN_DSC_GIOA1, PIN_DSC_GIOA2, PIN_DSC_GIOA3, \ PIN_DSC_GIOA4, PIN_DSC_GIOA5, PIN_DSC_GIOA6, PIN_DSC_GIOA7 } #define PORT_NV_GIOA 8 -#define PORT_GFC_GIOA &hal_gio_port_get_val -#define PORT_SFC_GIOA &hal_gio_port_set_val +#define PORT_GFC_GIOA &hal_gpio_port_get_val +#define PORT_SFC_GIOA &hal_gpio_port_set_val #define PORT_INT_TYPE_GIOA PORT_INTERFACE_GPIO #define PORT_NAME_GIOB "GIOB" #define PORT_CFG_GIOB { PIN_DSC_GIOB0, PIN_DSC_GIOB1, PIN_DSC_GIOB2, PIN_DSC_GIOB3, \ PIN_DSC_GIOB4, PIN_DSC_GIOB5, PIN_DSC_GIOB6, PIN_DSC_GIOB7 } #define PORT_NV_GIOB 8 -#define PORT_GFC_GIOB &hal_gio_port_get_val -#define PORT_SFC_GIOB &hal_gio_port_set_val +#define PORT_GFC_GIOB &hal_gpio_port_get_val +#define PORT_SFC_GIOB &hal_gpio_port_set_val #define PORT_INT_TYPE_GIOB PORT_INTERFACE_GPIO /* Some pins are commented out, because they are muxed with SCI. */ @@ -85,8 +85,8 @@ typedef struct port_def_st { PIN_DSC_NHET1_24, PIN_DSC_NHET1_25, PIN_DSC_NHET1_26, PIN_DSC_NHET1_27, \ PIN_DSC_NHET1_28, PIN_DSC_NHET1_29, PIN_DSC_NHET1_30, PIN_DSC_NHET1_31 } #define PORT_NV_NHET1 30 -#define PORT_GFC_NHET1 &hal_gio_port_get_val -#define PORT_SFC_NHET1 &hal_gio_port_set_val +#define PORT_GFC_NHET1 &hal_gpio_port_get_val +#define PORT_SFC_NHET1 &hal_gpio_port_set_val #define PORT_INT_TYPE_NHET1 PORT_INTERFACE_GPIO #define PORT_ADC_CHANNEL_NUM 16 diff --git a/rpp/include/hal/_tms570_hydctr/port_def.h b/rpp/include/hal/_tms570_hydctr/port_def.h index 5095a19..3ec8180 100644 --- a/rpp/include/hal/_tms570_hydctr/port_def.h +++ b/rpp/include/hal/_tms570_hydctr/port_def.h @@ -62,16 +62,16 @@ typedef struct port_def_st { #define PORT_CFG_GIOA { PIN_DSC_GIOA0, PIN_DSC_GIOA1, PIN_DSC_GIOA2, PIN_DSC_GIOA3, \ PIN_DSC_GIOA4, PIN_DSC_GIOA5, PIN_DSC_GIOA6, PIN_DSC_GIOA7 } #define PORT_NV_GIOA 8 -#define PORT_GFC_GIOA &hal_gio_port_get_val -#define PORT_SFC_GIOA &hal_gio_port_set_val +#define PORT_GFC_GIOA &hal_gpio_port_get_val +#define PORT_SFC_GIOA &hal_gpio_port_set_val #define PORT_INT_TYPE_GIOA PORT_INTERFACE_GPIO #define PORT_NAME_GIOB "GIOB" #define PORT_CFG_GIOB { PIN_DSC_GIOB0, PIN_DSC_GIOB1, PIN_DSC_GIOB2, PIN_DSC_GIOB3, \ PIN_DSC_GIOB4, PIN_DSC_GIOB5, PIN_DSC_GIOB6, PIN_DSC_GIOB7 } #define PORT_NV_GIOB 8 -#define PORT_GFC_GIOB &hal_gio_port_get_val -#define PORT_SFC_GIOB &hal_gio_port_set_val +#define PORT_GFC_GIOB &hal_gpio_port_get_val +#define PORT_SFC_GIOB &hal_gpio_port_set_val #define PORT_INT_TYPE_GIOB PORT_INTERFACE_GPIO /* Some pins are commented out, because they are muxed with SCI. */ @@ -85,8 +85,8 @@ typedef struct port_def_st { PIN_DSC_NHET1_24, PIN_DSC_NHET1_25, PIN_DSC_NHET1_26, PIN_DSC_NHET1_27, \ PIN_DSC_NHET1_28, PIN_DSC_NHET1_29, PIN_DSC_NHET1_30, PIN_DSC_NHET1_31 } #define PORT_NV_NHET1 30 -#define PORT_GFC_NHET1 &hal_gio_port_get_val -#define PORT_SFC_NHET1 &hal_gio_port_set_val +#define PORT_GFC_NHET1 &hal_gpio_port_get_val +#define PORT_SFC_NHET1 &hal_gpio_port_set_val #define PORT_INT_TYPE_NHET1 PORT_INTERFACE_GPIO #define PORT_ADC_CHANNEL_NUM 16 diff --git a/rpp/include/hal/_tms570_rpp/port_def.h b/rpp/include/hal/_tms570_rpp/port_def.h index d11484e..cbda7e1 100644 --- a/rpp/include/hal/_tms570_rpp/port_def.h +++ b/rpp/include/hal/_tms570_rpp/port_def.h @@ -60,7 +60,7 @@ typedef struct port_def_st { #define PORT_NAME_DINMCU "DINMCU" #define PORT_CFG_DINMCU { PIN_DSC_DIN8, PIN_DSC_DIN9, PIN_DSC_DIN10, PIN_DSC_DIN11, PIN_DSC_DIN12, PIN_DSC_DIN13, PIN_DSC_DIN14, PIN_DSC_DIN15 } #define PORT_NV_DINMCU 8 -#define PORT_GFC_DINMCU &hal_gio_port_get_val +#define PORT_GFC_DINMCU &hal_gpio_port_get_val #define PORT_SFC_DINMCU NULL #define PORT_INT_TYPE_DINMCU PORT_INTERFACE_GPIO @@ -74,15 +74,15 @@ typedef struct port_def_st { #define PORT_NAME_HOUTDIAG "HOUTDIAG" #define PORT_CFG_HOUTDIAG { PIN_DSC_HOUT1DIAG, PIN_DSC_HOUT2DIAG, PIN_DSC_HOUT3DIAG, PIN_DSC_HOUT4DIAG, PIN_DSC_HOUT5DIAG, PIN_DSC_HOUT6DIAG } #define PORT_NV_HOUTDIAG 6 -#define PORT_GFC_HOUTDIAG &hal_gio_port_get_val +#define PORT_GFC_HOUTDIAG &hal_gpio_port_get_val #define PORT_SFC_HOUTDIAG NULL #define PORT_INT_TYPE_HOUTDIAG PORT_INTERFACE_GPIO #define PORT_NAME_HOUTIN "HOUTIN" #define PORT_CFG_HOUTIN { PIN_DSC_HOUT1IN, PIN_DSC_HOUT2IN, PIN_DSC_HOUT3IN, PIN_DSC_HOUT4IN, PIN_DSC_HOUT5IN, PIN_DSC_HOUT6IN } #define PORT_NV_HOUTIN 6 -#define PORT_GFC_HOUTIN &hal_gio_port_get_val -#define PORT_SFC_HOUTIN &hal_gio_port_set_val +#define PORT_GFC_HOUTIN &hal_gpio_port_get_val +#define PORT_SFC_HOUTIN &hal_gpio_port_set_val #define PORT_INT_TYPE_HOUTIN PORT_INTERFACE_GPIO // FIXME Upper layer dependency/coupling @@ -157,15 +157,15 @@ extern uint32_t adc_get_port_val(uint32_t *config, uint32_t num_channels, uint32 #define PORT_NAME_MOUTEN "MOUTEN" #define PORT_CFG_MOUTEN { PIN_DSC_MOUT1EN, PIN_DSC_MOUT2EN, PIN_DSC_MOUT3EN, PIN_DSC_MOUT4EN, PIN_DSC_MOUT5EN, PIN_DSC_MOUT6EN } #define PORT_NV_MOUTEN 6 -#define PORT_GFC_MOUTEN &hal_gio_port_get_val +#define PORT_GFC_MOUTEN &hal_gpio_port_get_val #define PORT_SFC_MOUTEN NULL #define PORT_INT_TYPE_MOUTEN PORT_INTERFACE_GPIO #define PORT_NAME_MOUTIN "MOUTIN" #define PORT_CFG_MOUTIN { PIN_DSC_MOUT1IN, PIN_DSC_MOUT2IN, PIN_DSC_MOUT3IN, PIN_DSC_MOUT4IN, PIN_DSC_MOUT5IN, PIN_DSC_MOUT6IN } #define PORT_NV_MOUTIN 6 -#define PORT_GFC_MOUTIN &hal_gio_port_get_val -#define PORT_SFC_MOUTIN &hal_gio_port_set_val +#define PORT_GFC_MOUTIN &hal_gpio_port_get_val +#define PORT_SFC_MOUTIN &hal_gpio_port_set_val #define PORT_INT_TYPE_MOUTIN PORT_INTERFACE_GPIO #endif /* PORT_DEF_H_ */ diff --git a/rpp/include/hal/hal.h b/rpp/include/hal/hal.h index 428f824..3076035 100644 --- a/rpp/include/hal/hal.h +++ b/rpp/include/hal/hal.h @@ -85,21 +85,21 @@ void hal_gpio_pin_set_value(uint32_t pin_dsc, uint32_t value); * @param[in] pin_dsc pin descriptor * @return always 0 */ -int hal_gpio_pin_direction_input(uint32_t pin_dsc); +int hal_gpio_pin_set_dir_in(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); +int hal_gpio_pin_set_dir_out(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); +int hal_gpio_pin_get_dir(uint32_t pin_dsc); /** * Set pin as pull down or pull up and pull resistor enabled or disabled. @@ -112,7 +112,7 @@ int hal_gpio_pin_get_direction(uint32_t pin_dsc); * PORT_CONF_MODE_PDIS - pull resistor disable * @return always 0 */ -uint32_t hal_gpio_pin_conf_mode(uint32_t pin_dsc, uint32_t mode); +uint32_t hal_gpio_pin_set_mode(uint32_t pin_dsc, uint32_t mode); /** * Configure pin to be open drain or not @@ -123,7 +123,7 @@ uint32_t hal_gpio_pin_conf_mode(uint32_t pin_dsc, uint32_t mode); * * @return always 0 */ -uint32_t hal_gpio_pin_conf_od(uint32_t pin_dsc, uint32_t od); +uint32_t hal_gpio_pin_set_od(uint32_t pin_dsc, uint32_t od); /** * Configure pin @@ -149,14 +149,14 @@ uint32_t hal_gpio_pin_conf_od(uint32_t pin_dsc, uint32_t od); * * @return always 0 */ -uint32_t hal_gpio_pin_conf_set(uint32_t pin_dsc, uint32_t conf); +uint32_t hal_gpio_pin_set_config(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); +uint32_t hal_gpio_pin_configure(uint32_t pin_dsc); /** * Get values of all pins of given port. @@ -165,7 +165,7 @@ uint32_t hal_gpio_pin_conf(uint32_t pin_dsc); * @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); +uint32_t hal_gpio_port_get_val(uint32_t *config, uint32_t num_val, uint32_t *values); /** * Set values to all pins of given port. @@ -174,7 +174,7 @@ uint32_t hal_gio_port_get_val(uint32_t *config, uint32_t num_val, uint32_t *valu * @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); +uint32_t hal_gpio_port_set_val(uint32_t *config, uint32_t num_val, const uint32_t *values); /** * Get port descriptor assigned to port name. @@ -182,7 +182,7 @@ uint32_t hal_gio_port_set_val(uint32_t *config, uint32_t num_val, const uint32_t * @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(); +const port_def_t *hal_port_get_map(); port_desc_t *hal_port_get_dsc(const char *port_name, int len); diff --git a/rpp/src/hal/_rm48_hdk/port_def.c b/rpp/src/hal/_rm48_hdk/port_def.c index f43826b..14f6c54 100644 --- a/rpp/src/hal/_rm48_hdk/port_def.c +++ b/rpp/src/hal/_rm48_hdk/port_def.c @@ -71,3 +71,40 @@ port_def_t port_definition[PORT_CNT] = { {.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_map() +{ + return (const port_def_t *)port_definition; +} diff --git a/rpp/src/hal/_tms570_hdk/port_def.c b/rpp/src/hal/_tms570_hdk/port_def.c index f43826b..14f6c54 100644 --- a/rpp/src/hal/_tms570_hdk/port_def.c +++ b/rpp/src/hal/_tms570_hdk/port_def.c @@ -71,3 +71,40 @@ port_def_t port_definition[PORT_CNT] = { {.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_map() +{ + return (const port_def_t *)port_definition; +} diff --git a/rpp/src/hal/_tms570_hydctr/port_def.c b/rpp/src/hal/_tms570_hydctr/port_def.c index f43826b..14f6c54 100644 --- a/rpp/src/hal/_tms570_hydctr/port_def.c +++ b/rpp/src/hal/_tms570_hydctr/port_def.c @@ -71,3 +71,40 @@ port_def_t port_definition[PORT_CNT] = { {.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_map() +{ + return (const port_def_t *)port_definition; +} diff --git a/rpp/src/hal/hal.c b/rpp/src/hal/hal.c index cbe8913..5156226 100644 --- a/rpp/src/hal/hal.c +++ b/rpp/src/hal/hal.c @@ -79,26 +79,26 @@ void hal_gpio_pin_set_value(uint32_t pin_dsc, uint32_t value) } -int hal_gpio_pin_direction_input(uint32_t pin_dsc) +int hal_gpio_pin_set_dir_in(uint32_t pin_dsc) { hal_gpio_pin_get_port_base(pin_dsc)->DIR &= ~(1 << (pin_dsc & 0x1f)); return 0; } -int hal_gpio_pin_direction_output(uint32_t pin_dsc, uint32_t value) +int hal_gpio_pin_set_dir_out(uint32_t pin_dsc, uint32_t value) { hal_gpio_pin_set_value(pin_dsc, value); hal_gpio_pin_get_port_base(pin_dsc)->DIR |= (1 << (pin_dsc & 0x1f)); return 0; } -int hal_gpio_pin_get_direction(uint32_t pin_dsc) +int hal_gpio_pin_get_dir(uint32_t pin_dsc) { return (hal_gpio_pin_get_port_base(pin_dsc)->DIR >> (pin_dsc & 0x1f)) & 1; } -uint32_t hal_gpio_pin_conf_mode(uint32_t pin_dsc, uint32_t mode) +uint32_t hal_gpio_pin_set_mode(uint32_t pin_dsc, uint32_t mode) { gioPORT_t *gioPort = hal_gpio_pin_get_port_base(pin_dsc); @@ -114,7 +114,7 @@ uint32_t hal_gpio_pin_conf_mode(uint32_t pin_dsc, uint32_t mode) } -uint32_t hal_gpio_pin_conf_od(uint32_t pin_dsc, uint32_t od) +uint32_t hal_gpio_pin_set_od(uint32_t pin_dsc, uint32_t od) { gioPORT_t *gioPort = hal_gpio_pin_get_port_base(pin_dsc); @@ -126,28 +126,28 @@ uint32_t hal_gpio_pin_conf_od(uint32_t pin_dsc, uint32_t od) } -uint32_t hal_gpio_pin_conf_set(uint32_t pin_dsc, uint32_t conf) +uint32_t hal_gpio_pin_set_config(uint32_t pin_dsc, uint32_t conf) { pin_dsc &= ~PORT_CONF_MASK; - hal_gpio_pin_conf_mode(pin_dsc, conf & PORT_CONF_MODE_MASK); - hal_gpio_pin_conf_od(pin_dsc, conf & PORT_CONF_OD_MASK); + hal_gpio_pin_set_mode(pin_dsc, conf & PORT_CONF_MODE_MASK); + hal_gpio_pin_set_od(pin_dsc, conf & PORT_CONF_OD_MASK); if (conf & PORT_CONF_SET_DIR) { if ((conf & PORT_CONF_DIR_MASK) == (PORT_CONF_DIR_IN & PORT_CONF_DIR_MASK)) - hal_gpio_pin_direction_input(pin_dsc); + hal_gpio_pin_set_dir_in(pin_dsc); else - hal_gpio_pin_direction_output(pin_dsc, conf & PORT_CONF_INIT_HIGH); + hal_gpio_pin_set_dir_out(pin_dsc, conf & PORT_CONF_INIT_HIGH); } return 0; } -uint32_t hal_gpio_pin_conf(uint32_t pin_dsc) +uint32_t hal_gpio_pin_configure(uint32_t pin_dsc) { - return hal_gpio_pin_conf_set(pin_dsc, pin_dsc); + return hal_gpio_pin_set_config(pin_dsc, pin_dsc); } -uint32_t hal_gio_port_get_val(uint32_t *config, uint32_t num_val, uint32_t *values) +uint32_t hal_gpio_port_get_val(uint32_t *config, uint32_t num_val, uint32_t *values) { uint32_t i; @@ -157,7 +157,7 @@ uint32_t hal_gio_port_get_val(uint32_t *config, uint32_t num_val, uint32_t *valu return 0; } -uint32_t hal_gio_port_set_val(uint32_t *config, uint32_t num_val, const uint32_t *values) +uint32_t hal_gpio_port_set_val(uint32_t *config, uint32_t num_val, const uint32_t *values) { uint32_t i; @@ -167,7 +167,7 @@ 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() +const port_def_t *hal_port_get_map() { return (const port_def_t *)port_definition; } diff --git a/rpp/src/rpp/gio.c b/rpp/src/rpp/gio.c index 809d4d7..0c3b1d8 100644 --- a/rpp/src/rpp/gio.c +++ b/rpp/src/rpp/gio.c @@ -32,7 +32,7 @@ int8_t rpp_gio_init(uint32_t init_ports) int port_num = hal_gpio_pin_get_port_num(pin_map[pin].pin_desc); if ((init_ports & (1 << port_num)) && !(ports_initialized & (1 << port_num))) - hal_gpio_pin_conf(pin_map[pin].pin_desc); + hal_gpio_pin_configure(pin_map[pin].pin_desc); } ports_initialized |= init_ports; -- 2.39.2