![]() |
Altera HWLIB
16.0
The Altera HW Manager API Reference Manual
|
This functional group presents a perspective of the General-Purpose IO signals as individual GPIO and GPI bits spread across a number of signals across several GPIO ports. This allows the programmer the freedom to generally ignore the underlying port and signal structure of the GPIO hardware if desired.
Data Structures | |
struct | ALT_GPIO_CONFIG_RECORD_s |
struct | ALT_GPIO_PIN_RECORD_s |
Typedefs | |
typedef enum ALT_GPIO_1BIT_e | ALT_GPIO_1BIT_t |
typedef struct ALT_GPIO_CONFIG_RECORD_s | ALT_GPIO_CONFIG_RECORD_t |
typedef struct ALT_GPIO_PIN_RECORD_s | ALT_GPIO_PIN_RECORD_t |
Functions | |
ALT_STATUS_CODE | alt_gpio_bit_config (ALT_GPIO_1BIT_t signal_num, ALT_GPIO_PIN_DIR_t dir, ALT_GPIO_PIN_TYPE_t type, ALT_GPIO_PIN_POL_t pol, ALT_GPIO_PIN_DEBOUNCE_t debounce, ALT_GPIO_PIN_DATA_t data) |
ALT_STATUS_CODE | alt_gpio_bitconfig_get (ALT_GPIO_1BIT_t signal_num, ALT_GPIO_CONFIG_RECORD_t *config) |
ALT_STATUS_CODE | alt_gpio_group_config (ALT_GPIO_CONFIG_RECORD_t *config_array, uint32_t len) |
ALT_STATUS_CODE | alt_gpio_group_config_get (ALT_GPIO_CONFIG_RECORD_t *config_array, uint32_t len) |
ALT_STATUS_CODE | alt_gpio_group_config_get2 (ALT_GPIO_1BIT_t *pinid_array, ALT_GPIO_CONFIG_RECORD_t *config_array, uint32_t len) |
struct ALT_GPIO_CONFIG_RECORD_s |
This configuration record definition is used for configuring bits and groups of bits of the GPIO interface.
Data Fields | ||
---|---|---|
ALT_GPIO_1BIT_t | signal_number | The index number of the signal to configure. |
ALT_GPIO_PIN_DIR_t | direction | The data direction of the signal. |
ALT_GPIO_PIN_TYPE_t | type | Edge-triggered or level triggered interrupts. |
ALT_GPIO_PIN_POL_t | polarity | Active-high or active-low trigger for the interrupt. |
ALT_GPIO_PIN_DEBOUNCE_t | debounce | Enable or disable GPIO debounce capability. |
ALT_GPIO_PIN_DATA_t | data | If the signal is an output, the data value to be output. |
struct ALT_GPIO_PIN_RECORD_s |
This pin record type definition is comprised of the signal index and associated input or output data.
Data Fields | ||
---|---|---|
ALT_GPIO_1BIT_t | signal_number | The index number of the signal. |
ALT_GPIO_PIN_DATA_t | val | Data - zero or one. |
typedef enum ALT_GPIO_1BIT_e ALT_GPIO_1BIT_t |
This type definition enumerates the individual bits as one flat array spread across the multiple GPIO ports handled by the GPIO manager. The bit-ordering must match the hardware bit-ordering.
typedef struct ALT_GPIO_CONFIG_RECORD_s ALT_GPIO_CONFIG_RECORD_t |
This configuration record definition is used for configuring bits and groups of bits of the GPIO interface.
typedef struct ALT_GPIO_PIN_RECORD_s ALT_GPIO_PIN_RECORD_t |
This pin record type definition is comprised of the signal index and associated input or output data.
enum ALT_GPIO_1BIT_e |
This type definition enumerates the individual bits as one flat array spread across the multiple GPIO ports handled by the GPIO manager. The bit-ordering must match the hardware bit-ordering.
ALT_STATUS_CODE alt_gpio_bit_config | ( | ALT_GPIO_1BIT_t | signal_num, |
ALT_GPIO_PIN_DIR_t | dir, | ||
ALT_GPIO_PIN_TYPE_t | type, | ||
ALT_GPIO_PIN_POL_t | pol, | ||
ALT_GPIO_PIN_DEBOUNCE_t | debounce, | ||
ALT_GPIO_PIN_DATA_t | data | ||
) |
Configures all parameters for one bit (signal) of the GPIO ports.
signal_num | The GPIO port signal index. |
dir | The data direction for this signal. |
type | Edge-triggered or Level-triggered interrupt for this signal. |
pol | Active-high or active-low interrupt polarity for this signal. |
debounce | Enable the debounce flip-flops for this signal or not. |
data | If the GPIO signal is set to be an output, set it to this value |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_E_BAD_ARG | Invalid input argument. |
ALT_STATUS_CODE alt_gpio_bitconfig_get | ( | ALT_GPIO_1BIT_t | signal_num, |
ALT_GPIO_CONFIG_RECORD_t * | config | ||
) |
Returns the configuration parameters of a given GPIO bit.
signal_num | The GPIO port signal index. |
config | Pointer to a single GPIO_CONFIG_RECORD_s configuration record. The fields of this configuration record are filled in by the function. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_E_BAD_ARG | Invalid input argument. |
ALT_STATUS_CODE alt_gpio_group_config | ( | ALT_GPIO_CONFIG_RECORD_t * | config_array, |
uint32_t | len | ||
) |
Configures a list of GPIO bits. The GPIO bits do not have to be configured the same, as was the case for the mask version of this function, alt_gpio_port_config(). Each bit may be configured differently and bits may be listed in any order.
config_array | Pointer to an array of GPIO_CONFIG_RECORD_s configuration records. These definitions contain all the parameters needed to set up the listed pins. All or any subset of the GPIO signals can be configured. Signals do not have to be listed in numerical order or be unique. If a signal number is listed multiple times, the last configuration listed is used. Configuration terminates either when len signals have been configured or if the next signal number index in the array is equal to ALT_END_OF_GPIO_SIGNALS (-1). |
len | Length of array to configure. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_E_BAD_ARG | Invalid input argument. |
ALT_STATUS_CODE alt_gpio_group_config_get | ( | ALT_GPIO_CONFIG_RECORD_t * | config_array, |
uint32_t | len | ||
) |
Returns a list of the pin signal indices and the associated configuration settings (data direction, interrupt type, polarity, and debounce) of that list of signals.
config_array | Pointer to an array of ALT_GPIO_CONFIG_RECORD_t configuration records. Only the signal indices in the first field of each configuration record need be filled in. This function will fill in all the other fields of the configuration record, returning all configuration parameters in the array. Signals do not have to be listed in numerical order or be unique. If a signal number is listed multiple times, the configuration record will contain multiple entries for that signal. Configuration reading terminates either when len signal configurations have been read or if the next signal number index in the array is equal to ALT_END_OF_GPIO_SIGNALS (-1). |
len | Length of configuration array to read and return. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_E_BAD_ARG | Invalid input argument. |
ALT_STATUS_CODE alt_gpio_group_config_get2 | ( | ALT_GPIO_1BIT_t * | pinid_array, |
ALT_GPIO_CONFIG_RECORD_t * | config_array, | ||
uint32_t | len | ||
) |
Returns a list of the pin signal indices and the associated configuration settings (data direction, interrupt type, polarity, and debounce) of that list of signals. The difference between this version and alt_gpio_group_config_get() is this version follows a separate list of signal indices instead of having the signal list provided in the first field of the configuration records in the array.
pinid_array | Pointer to a list of signal index numbers. These indices are copied to the first field of each configuration record in the returned array. |
config_array | Pointer to an array of ALT_GPIO_CONFIG_RECORD_t configuration records. This function will fill in the fields of the configuration record, returning all configuration parameters in the array. Signals do not have to be listed in numerical order or be unique. If a signal number is listed multiple times, the configuration record array will contain multiple identical entries for that signal. Configuration reading terminates either when len signal configurations have been read or if the next signal number index in the array is equal to ALT_END_OF_GPIO_SIGNALS (-1). |
len | Length of configuration array to read. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_E_BAD_ARG | Invalid input argument. |