no-OS
Loading...
Searching...
No Matches
ad9361_ext_band_ctrl.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "no_os_gpio.h"
Include dependency graph for ad9361_ext_band_ctrl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ad9361_band_setting
 
struct  ad9361_ext_band_ctl
 

Macros

#define AD9361_EXT_BAND_MAX_GPIOS   32
 
#define AD9361_EXT_BAND_MAX_SETTINGS   64
 
#define AD9361_EXT_BAND_NO_PORT_SEL   ((uint32_t)-1)
 

Enumerations

enum  ad9361_ext_band_ctl_op {
  AD9361_EXT_BAND_CTL_OP_LOW = 0 ,
  AD9361_EXT_BAND_CTL_OP_HIGH = 1 ,
  AD9361_EXT_BAND_CTL_OP_INPUT = 2 ,
  AD9361_EXT_BAND_CTL_OP_NOP = 3
}
 

Functions

struct ad9361_band_settingad9361_band_setting_alloc (const char *name, uint64_t freq_min, uint64_t freq_max, uint32_t ngpios)
 Allocate a band setting descriptor.
 
void ad9361_band_setting_free (struct ad9361_band_setting *s)
 Release a band setting and its sub-sequences.
 
int ad9361_band_setting_set_gpio (struct ad9361_band_setting *s, uint32_t gpio_idx, uint32_t op)
 Set the operation for one GPIO pin.
 
void ad9361_band_setting_set_rx_port (struct ad9361_band_setting *s, uint32_t port)
 Set the RX RF port for this band.
 
void ad9361_band_setting_set_tx_port (struct ad9361_band_setting *s, uint32_t port)
 Set the TX RF port for this band.
 
void ad9361_band_setting_set_delay (struct ad9361_band_setting *s, uint32_t delay_us)
 Set the post-step delay (microseconds).
 
struct ad9361_ext_band_ctlad9361_ext_band_ctl_alloc (void)
 Allocate an external band controller.
 
void ad9361_ext_band_ctl_free (struct ad9361_ext_band_ctl *ctl)
 Release a controller and all registered settings. GPIO descriptors are NOT freed – the caller owns them.
 
int ad9361_ext_band_ctl_add_gpio (struct ad9361_ext_band_ctl *ctl, struct no_os_gpio_desc *gpio)
 Register a GPIO with the controller. GPIOs are referenced by add order (0 = first added).
 
int ad9361_ext_band_ctl_add_rx_setting (struct ad9361_ext_band_ctl *ctl, struct ad9361_band_setting *s)
 Append an RX band setting. Settings are matched first-to-last; the first frequency match wins.
 
int ad9361_ext_band_ctl_add_tx_setting (struct ad9361_ext_band_ctl *ctl, struct ad9361_band_setting *s)
 Append a TX band setting. Settings are matched first-to-last; the first frequency match wins.
 
int32_t ad9361_register_ext_band_control (struct ad9361_rf_phy *phy, struct ad9361_ext_band_ctl *ctl)
 Attach a controller to a PHY.
 
void ad9361_unregister_ext_band_control (struct ad9361_rf_phy *phy)
 Detach the controller from a PHY. Does not free anything.
 
int32_t ad9361_adjust_rx_ext_band_settings (struct ad9361_rf_phy *phy, uint64_t freq)
 Switch RX band for a new LO frequency. Called automatically from ad9361_rfpll_set_rate() on every RX LO change. Applications may also call this directly.
 
int32_t ad9361_adjust_tx_ext_band_settings (struct ad9361_rf_phy *phy, uint64_t freq)
 Switch TX band for a new LO frequency.
 

Macro Definition Documentation

◆ AD9361_EXT_BAND_MAX_GPIOS

#define AD9361_EXT_BAND_MAX_GPIOS   32

Maximum number of GPIO lines managed by one controller instance.

◆ AD9361_EXT_BAND_MAX_SETTINGS

#define AD9361_EXT_BAND_MAX_SETTINGS   64

Maximum number of RX or TX band settings per controller.

◆ AD9361_EXT_BAND_NO_PORT_SEL

#define AD9361_EXT_BAND_NO_PORT_SEL   ((uint32_t)-1)

Sentinel value for rf_rx_input_sel / rf_tx_output_sel meaning "do not change the current port selection".

Enumeration Type Documentation

◆ ad9361_ext_band_ctl_op

Per-GPIO operation to perform when a band setting becomes active. Use these as values in ad9361_band_setting.gpio_values[].

Enumerator
AD9361_EXT_BAND_CTL_OP_LOW 

Drive the pin low (output 0).

AD9361_EXT_BAND_CTL_OP_HIGH 

Drive the pin high (output 1).

AD9361_EXT_BAND_CTL_OP_INPUT 

Switch the pin to input (high-Z).

AD9361_EXT_BAND_CTL_OP_NOP 

Leave this pin unchanged.

Function Documentation

◆ ad9361_adjust_rx_ext_band_settings()

int32_t ad9361_adjust_rx_ext_band_settings ( struct ad9361_rf_phy * phy,
uint64_t freq )

Switch RX band for a new LO frequency. Called automatically from ad9361_rfpll_set_rate() on every RX LO change. Applications may also call this directly.

Parameters
phy- AD9361 PHY state.
freq- New RX LO frequency in Hz.
Returns
0 on success (including no matching setting), or negative errno.
Here is the caller graph for this function:

◆ ad9361_adjust_tx_ext_band_settings()

int32_t ad9361_adjust_tx_ext_band_settings ( struct ad9361_rf_phy * phy,
uint64_t freq )

Switch TX band for a new LO frequency.

Parameters
phy- AD9361 PHY state.
freq- New TX LO frequency in Hz.
Returns
0 on success, or negative errno on hardware failure.
Here is the caller graph for this function:

◆ ad9361_band_setting_alloc()

struct ad9361_band_setting * ad9361_band_setting_alloc ( const char * name,
uint64_t freq_min,
uint64_t freq_max,
uint32_t ngpios )

Allocate a band setting descriptor.

Parameters
name- Human-readable name (copied; may be NULL).
freq_min- Inclusive lower bound of the frequency range (Hz).
freq_max- Exclusive upper bound of the frequency range (Hz).
ngpios- Number of GPIO lines this setting may drive (0 is valid).
Returns
Pointer to the new setting, or NULL on allocation failure.

◆ ad9361_band_setting_free()

void ad9361_band_setting_free ( struct ad9361_band_setting * s)

Release a band setting and its sub-sequences.

Parameters
s- Band setting to free (may be NULL).
Here is the caller graph for this function:

◆ ad9361_band_setting_set_delay()

void ad9361_band_setting_set_delay ( struct ad9361_band_setting * s,
uint32_t delay_us )

Set the post-step delay (microseconds).

Parameters
s- The band setting.
delay_us- Delay in microseconds (0 = no delay).

◆ ad9361_band_setting_set_gpio()

int ad9361_band_setting_set_gpio ( struct ad9361_band_setting * s,
uint32_t gpio_idx,
uint32_t op )

Set the operation for one GPIO pin.

Parameters
s- The band setting.
gpio_idx- Index in the controller's gpios[] array (0-based).
op- AD9361_EXT_BAND_CTL_OP_LOW/HIGH/INPUT/NOP.
Returns
0 on success, -EINVAL if gpio_idx is out of range.

◆ ad9361_band_setting_set_rx_port()

void ad9361_band_setting_set_rx_port ( struct ad9361_band_setting * s,
uint32_t port )

Set the RX RF port for this band.

Parameters
s- The band setting.
port- RX RF input port index.

◆ ad9361_band_setting_set_tx_port()

void ad9361_band_setting_set_tx_port ( struct ad9361_band_setting * s,
uint32_t port )

Set the TX RF port for this band.

Parameters
s- The band setting.
port- TX RF output port index.

◆ ad9361_ext_band_ctl_add_gpio()

int ad9361_ext_band_ctl_add_gpio ( struct ad9361_ext_band_ctl * ctl,
struct no_os_gpio_desc * gpio )

Register a GPIO with the controller. GPIOs are referenced by add order (0 = first added).

Parameters
ctl- The controller.
gpio- A configured GPIO descriptor.
Returns
0 on success, -EINVAL or -ENOMEM on error.

◆ ad9361_ext_band_ctl_add_rx_setting()

int ad9361_ext_band_ctl_add_rx_setting ( struct ad9361_ext_band_ctl * ctl,
struct ad9361_band_setting * s )

Append an RX band setting. Settings are matched first-to-last; the first frequency match wins.

Parameters
ctl- The controller.
s- Band setting to add.
Returns
0 on success, -EINVAL or -ENOMEM on error.

◆ ad9361_ext_band_ctl_add_tx_setting()

int ad9361_ext_band_ctl_add_tx_setting ( struct ad9361_ext_band_ctl * ctl,
struct ad9361_band_setting * s )

Append a TX band setting. Settings are matched first-to-last; the first frequency match wins.

Parameters
ctl- The controller.
s- Band setting to add.
Returns
0 on success, -EINVAL or -ENOMEM on error.

◆ ad9361_ext_band_ctl_alloc()

struct ad9361_ext_band_ctl * ad9361_ext_band_ctl_alloc ( void )

Allocate an external band controller.

Returns
Pointer to the zeroed controller, or NULL on failure.

◆ ad9361_ext_band_ctl_free()

void ad9361_ext_band_ctl_free ( struct ad9361_ext_band_ctl * ctl)

Release a controller and all registered settings. GPIO descriptors are NOT freed – the caller owns them.

Parameters
ctl- Controller to free (may be NULL).

◆ ad9361_register_ext_band_control()

int32_t ad9361_register_ext_band_control ( struct ad9361_rf_phy * phy,
struct ad9361_ext_band_ctl * ctl )

Attach a controller to a PHY.

Parameters
phy- AD9361 PHY state.
ctl- External band controller to register.
Returns
0 on success, -EINVAL if either argument is NULL.

◆ ad9361_unregister_ext_band_control()

void ad9361_unregister_ext_band_control ( struct ad9361_rf_phy * phy)

Detach the controller from a PHY. Does not free anything.

Parameters
phy- AD9361 PHY state.