*/
#include "hal/hal.h"
+#include "drv/spi.h"
+#include "drv/_tms570_hdk/adc.h"
// Lists of pins assigned to the ports
-static uint32_t port_cfg_gioa[] = PORT_CFG_GIOA;
-static uint32_t port_cfg_giob[] = PORT_CFG_GIOB;
-static uint32_t port_cfg_nhet1[] = PORT_CFG_NHET1;
-static uint32_t port_cfg_adc[] = PORT_CFG_ADC;
+static uint32_t 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
+};
+static uint32_t 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
+};
+static uint32_t port_cfg_nhet1[] = {
+ PIN_DSC_NHET1_0, PIN_DSC_NHET1_1, PIN_DSC_NHET1_2,
+ PIN_DSC_NHET1_3, PIN_DSC_NHET1_4, PIN_DSC_NHET1_5,
+ PIN_DSC_NHET1_7, PIN_DSC_NHET1_8, PIN_DSC_NHET1_9,
+ PIN_DSC_NHET1_10, PIN_DSC_NHET1_11, PIN_DSC_NHET1_12,
+ PIN_DSC_NHET1_14, PIN_DSC_NHET1_15, PIN_DSC_NHET1_16,
+ PIN_DSC_NHET1_17, PIN_DSC_NHET1_18, PIN_DSC_NHET1_19,
+ PIN_DSC_NHET1_20, PIN_DSC_NHET1_21, PIN_DSC_NHET1_22,
+ PIN_DSC_NHET1_23, 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
+};
+static uint32_t port_cfg_adc[] = { (uint32_t)adcREG1, adcGROUP1, 1 };
// Port descriptors
static port_desc_t port_desc_gioa = {
- .config = port_cfg_gioa,
- .numValues = PORT_NV_GIOA,
- .interfaceType = PORT_INT_TYPE_GIOA,
- .port_getfnc_ptr = PORT_GFC_GIOA,
- .port_setfnc_ptr = PORT_SFC_GIOA,
+ .config = port_cfg_gioa,
+ .numValues = 8,
+ .interfaceType = GPIO,
+ .port_getfnc_ptr = &hal_gpio_port_get_val,
+ .port_setfnc_ptr = &hal_gpio_port_set_val,
};
-
static port_desc_t port_desc_giob = {
- .config = port_cfg_giob,
- .numValues = PORT_NV_GIOB,
- .interfaceType = PORT_INT_TYPE_GIOB,
- .port_getfnc_ptr = PORT_GFC_GIOB,
- .port_setfnc_ptr = PORT_SFC_GIOB,
+ .config = port_cfg_giob,
+ .numValues = 8,
+ .interfaceType = GPIO,
+ .port_getfnc_ptr = &hal_gpio_port_get_val,
+ .port_setfnc_ptr = &hal_gpio_port_set_val,
};
-
static port_desc_t port_desc_nhet1 = {
- .config = port_cfg_nhet1,
- .numValues = PORT_NV_NHET1,
- .interfaceType = PORT_INT_TYPE_NHET1,
- .port_getfnc_ptr = PORT_GFC_NHET1,
- .port_setfnc_ptr = PORT_SFC_NHET1,
+ .config = port_cfg_nhet1,
+ .numValues = 30,
+ .interfaceType = GPIO,
+ .port_getfnc_ptr = &hal_gpio_port_get_val,
+ .port_setfnc_ptr = &hal_gpio_port_set_val,
};
-
static port_desc_t port_desc_adc = {
- .config = port_cfg_adc,
- .numValues = PORT_NV_ADC,
- .interfaceType = PORT_INT_TYPE_ADC,
- .port_getfnc_ptr = PORT_GFC_ADC,
- .port_setfnc_ptr = PORT_SFC_ADC,
+ .config = port_cfg_adc,
+ .numValues = 16,
+ .interfaceType = ADC,
+ .port_getfnc_ptr = &adc_get_port_val,
+ .port_setfnc_ptr = ((void *)0),
};
+
// 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},
* @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()
{
return (const port_def_t *)port_definition;
}