Add host functions to set operacake ports
This commit is contained in:
@ -67,6 +67,9 @@ typedef enum {
|
|||||||
HACKRF_VENDOR_REQUEST_SET_TXVGA_GAIN = 21,
|
HACKRF_VENDOR_REQUEST_SET_TXVGA_GAIN = 21,
|
||||||
HACKRF_VENDOR_REQUEST_ANTENNA_ENABLE = 23,
|
HACKRF_VENDOR_REQUEST_ANTENNA_ENABLE = 23,
|
||||||
HACKRF_VENDOR_REQUEST_SET_FREQ_EXPLICIT = 24,
|
HACKRF_VENDOR_REQUEST_SET_FREQ_EXPLICIT = 24,
|
||||||
|
HACKRF_VENDOR_REQUEST_READ_WCID = 25,
|
||||||
|
HACKRF_VENDOR_REQUEST_OPERACAKE_SET_PORTS = 26,
|
||||||
|
HACKRF_VENDOR_REQUEST_GET_OPERACAKES = 27,
|
||||||
} hackrf_vendor_request;
|
} hackrf_vendor_request;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -1695,6 +1698,40 @@ uint32_t ADDCALL hackrf_compute_baseband_filter_bw(const uint32_t bandwidth_hz)
|
|||||||
return p->bandwidth_hz;
|
return p->bandwidth_hz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set Operacake ports */
|
||||||
|
int ADDCALL hackrf_set_operacake_ports(hackrf_device* device,
|
||||||
|
const uint8_t port_a,
|
||||||
|
const uint8_t port_b)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
/* Error checking */
|
||||||
|
if((port_a > OPERACAKE_PB4) || (port_b > OPERACAKE_PB4)) {
|
||||||
|
return HACKRF_ERROR_INVALID_PARAM;
|
||||||
|
}
|
||||||
|
/* Check which side PA and PB are on */
|
||||||
|
if(((port_a <= OPERACAKE_PA4) && (port_b <= OPERACAKE_PA4))
|
||||||
|
|| ((port_a > OPERACAKE_PA4) && (port_b > OPERACAKE_PA4))) {
|
||||||
|
return HACKRF_ERROR_INVALID_PARAM;
|
||||||
|
}
|
||||||
|
result = libusb_control_transfer(
|
||||||
|
device->usb_device,
|
||||||
|
LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
|
||||||
|
HACKRF_VENDOR_REQUEST_OPERACAKE_SET_PORTS,
|
||||||
|
port_a,
|
||||||
|
port_b,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
return HACKRF_ERROR_LIBUSB;
|
||||||
|
} else {
|
||||||
|
return HACKRF_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // __cplusplus defined.
|
} // __cplusplus defined.
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,6 +83,17 @@ enum rf_path_filter {
|
|||||||
RF_PATH_FILTER_HIGH_PASS = 2,
|
RF_PATH_FILTER_HIGH_PASS = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum operacake_ports {
|
||||||
|
OPERACAKE_PA1 = 0,
|
||||||
|
OPERACAKE_PA2 = 1,
|
||||||
|
OPERACAKE_PA3 = 2,
|
||||||
|
OPERACAKE_PA4 = 3,
|
||||||
|
OPERACAKE_PB1 = 4,
|
||||||
|
OPERACAKE_PB2 = 5,
|
||||||
|
OPERACAKE_PB3 = 6,
|
||||||
|
OPERACAKE_PB4 = 7,
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct hackrf_device hackrf_device;
|
typedef struct hackrf_device hackrf_device;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Reference in New Issue
Block a user