2023-08-26 12:36:10 +08:00
|
|
|
#ifndef _GPIO_DRV_H_
|
|
|
|
#define _GPIO_DRV_H_
|
|
|
|
|
|
|
|
#include "dw_apb_gpio.h"
|
|
|
|
#include "typedef.h"
|
|
|
|
|
2023-11-16 14:23:38 +08:00
|
|
|
#define JESD_RF_CH_NUM 4
|
|
|
|
|
|
|
|
#define JESD_GPIOGROUP_NUM 9
|
2023-08-26 12:36:10 +08:00
|
|
|
|
|
|
|
typedef enum _tagGpioLValid
|
|
|
|
{
|
|
|
|
LOW_AS_VALID = 0,
|
|
|
|
HIGH_AS_VALID
|
|
|
|
}gpioLValid;
|
|
|
|
|
|
|
|
typedef enum _tagJesdGpioTRCH
|
|
|
|
{
|
2023-11-16 14:23:38 +08:00
|
|
|
JESD_TRANS_TX = 0,
|
|
|
|
JESD_RF_TX = 1,
|
|
|
|
JESD_ANT_TX = 2,
|
|
|
|
JESD_TRANS_RX = 3,
|
|
|
|
JESD_RF_RX = 4,
|
|
|
|
JESD_ANT_RX = 5,
|
|
|
|
JESD_TRANS_ORX = 6,
|
|
|
|
JESD_RF_ORX = 7,
|
|
|
|
JESD_ANT_ORX = 8,
|
|
|
|
JESD_TRCH_MAXNUM = 9
|
2023-08-26 12:36:10 +08:00
|
|
|
}jesdGpioTRch;
|
|
|
|
|
2023-09-15 14:59:25 +08:00
|
|
|
typedef enum _tagGpioState
|
2023-08-26 12:36:10 +08:00
|
|
|
{
|
2023-09-15 14:59:25 +08:00
|
|
|
GPIO_OFF = 0,
|
|
|
|
GPIO_ON = 1
|
2023-08-26 12:36:10 +08:00
|
|
|
}jesdGpioState;
|
|
|
|
|
|
|
|
typedef struct _tagGpioInfo
|
|
|
|
{
|
|
|
|
uint8_t pinId; // 0~31
|
|
|
|
uint8_t vaFlag; // 0: low as valid; 1: high as valid
|
|
|
|
}stGpioInfo;
|
|
|
|
|
2024-04-20 17:09:54 +08:00
|
|
|
typedef struct _tagRfGpioInfo
|
|
|
|
{
|
|
|
|
uint32_t pinInfo; // 1 bit 1 pin
|
|
|
|
uint32_t validInfo; // 0: low as valid; 1: high as valid
|
|
|
|
}stRfGpioInfo;
|
|
|
|
|
2023-08-26 12:36:10 +08:00
|
|
|
typedef struct _tagGpioJesd
|
|
|
|
{
|
2024-04-20 17:09:54 +08:00
|
|
|
stRfGpioInfo txRfGpioInfo[JESD_RF_CH_NUM];
|
|
|
|
stRfGpioInfo rxRfGpioInfo[JESD_RF_CH_NUM];
|
|
|
|
stRfGpioInfo orxRfGpioInfo[JESD_RF_CH_NUM];
|
|
|
|
|
2023-11-16 14:23:38 +08:00
|
|
|
stGpioInfo txTransGpioInfo[JESD_RF_CH_NUM];
|
2023-08-26 12:36:10 +08:00
|
|
|
stGpioInfo txGpioInfo[JESD_RF_CH_NUM];
|
2023-11-16 14:23:38 +08:00
|
|
|
stGpioInfo txAntGpioInfo[JESD_RF_CH_NUM];
|
|
|
|
stGpioInfo rxTransGpioInfo[JESD_RF_CH_NUM];
|
2023-08-26 12:36:10 +08:00
|
|
|
stGpioInfo rxGpioInfo[JESD_RF_CH_NUM];
|
2023-11-16 14:23:38 +08:00
|
|
|
stGpioInfo rxAntGpioInfo[JESD_RF_CH_NUM];
|
|
|
|
stGpioInfo orxTransGpioInfo[JESD_RF_CH_NUM];
|
2023-08-26 12:36:10 +08:00
|
|
|
stGpioInfo orxGpioInfo[JESD_RF_CH_NUM];
|
2023-11-16 14:23:38 +08:00
|
|
|
stGpioInfo orxAntGpioInfo[JESD_RF_CH_NUM];
|
2023-08-26 12:36:10 +08:00
|
|
|
}stGpioJesd;
|
|
|
|
|
|
|
|
typedef struct _tagGpioOnBoard
|
|
|
|
{
|
|
|
|
stGpioJesd jesdGpioInfo;
|
|
|
|
stGpioInfo triggerGpioInfo;
|
|
|
|
}stGpioOnBoard;
|
|
|
|
|
|
|
|
int32_t hw_gpio_init();
|
|
|
|
|
|
|
|
int32_t set_jesd_rf_state(uint8_t nTRCh, uint8_t nState);
|
|
|
|
|
2024-04-20 17:09:54 +08:00
|
|
|
int32_t set_jesd_all_rf_state(uint8_t nTRCh, uint8_t nState); // tx, rx, orx
|
|
|
|
|
2023-08-26 12:36:10 +08:00
|
|
|
int32_t set_trigger_state(uint8_t nState);
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
int32_t set_tx_on();
|
|
|
|
|
|
|
|
int32_t set_tx_off();
|
|
|
|
|
|
|
|
int32_t set_rx_on();
|
|
|
|
|
|
|
|
int32_t set_rx_off();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|