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.
#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_ */
#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_ */
#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_ */
#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_ */
*/
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_ */
};
// 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;
-}
};
// 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;
-}
};
// 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;
-}
};
// 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},
{.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;
-}
#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;
}
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;
+}