linux/drivers/media/usb/hackrf/hackrf.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * HackRF driver
 *
 * Copyright (C) 2014 Antti Palosaari <[email protected]>
 */

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-vmalloc.h>

/*
 * Used Avago MGA-81563 RF amplifier could be destroyed pretty easily with too
 * strong signal or transmitting to bad antenna.
 * Set RF gain control to 'grabbed' state by default for sure.
 */
static bool hackrf_enable_rf_gain_ctrl;
module_param_named(enable_rf_gain_ctrl, hackrf_enable_rf_gain_ctrl, bool, 0644);
MODULE_PARM_DESC();

/* HackRF USB API commands (from HackRF Library) */
enum {};

/*
 *       bEndpointAddress     0x81  EP 1 IN
 *         Transfer Type            Bulk
 *       wMaxPacketSize     0x0200  1x 512 bytes
 */
#define MAX_BULK_BUFS
#define BULK_BUFFER_SIZE

static const struct v4l2_frequency_band bands_adc_dac[] =;

static const struct v4l2_frequency_band bands_rx_tx[] =;

/* stream formats */
struct hackrf_format {};

/* format descriptions for capture and preview */
static struct hackrf_format formats[] =;

static const unsigned int NUM_FORMATS =;

/* intermediate buffers with raw data from the USB device */
struct hackrf_buffer {};

struct hackrf_dev {};

#define hackrf_dbg_usb_control_msg(_dev, _r, _t, _v, _i, _b, _l)

/* execute firmware command */
static int hackrf_ctrl_msg(struct hackrf_dev *dev, u8 request, u16 value,
		u16 index, u8 *data, u16 size)
{}

static int hackrf_set_params(struct hackrf_dev *dev)
{}

/* Private functions */
static struct hackrf_buffer *hackrf_get_next_buffer(struct hackrf_dev *dev,
						    struct list_head *buffer_list)
{}

static void hackrf_copy_stream(struct hackrf_dev *dev, void *dst, void *src,
			       unsigned int src_len)
{}

/*
 * This gets called for the bulk stream pipe. This is done in interrupt
 * time, so it has to be fast, not crash, and not stall. Neat.
 */
static void hackrf_urb_complete_in(struct urb *urb)
{}

static void hackrf_urb_complete_out(struct urb *urb)
{}

static int hackrf_kill_urbs(struct hackrf_dev *dev)
{}

static int hackrf_submit_urbs(struct hackrf_dev *dev)
{}

static int hackrf_free_stream_bufs(struct hackrf_dev *dev)
{}

static int hackrf_alloc_stream_bufs(struct hackrf_dev *dev)
{}

static int hackrf_free_urbs(struct hackrf_dev *dev)
{}

static int hackrf_alloc_urbs(struct hackrf_dev *dev, bool rcv)
{}

/* The user yanked out the cable... */
static void hackrf_disconnect(struct usb_interface *intf)
{}

/* Videobuf2 operations */
static void hackrf_return_all_buffers(struct vb2_queue *vq,
				      enum vb2_buffer_state state)
{}

static int hackrf_queue_setup(struct vb2_queue *vq,
		unsigned int *nbuffers,
		unsigned int *nplanes, unsigned int sizes[], struct device *alloc_devs[])
{}

static void hackrf_buf_queue(struct vb2_buffer *vb)
{}

static int hackrf_start_streaming(struct vb2_queue *vq, unsigned int count)
{}

static void hackrf_stop_streaming(struct vb2_queue *vq)
{}

static const struct vb2_ops hackrf_vb2_ops =;

static int hackrf_querycap(struct file *file, void *fh,
		struct v4l2_capability *cap)
{}

static int hackrf_s_fmt_sdr(struct file *file, void *priv,
			    struct v4l2_format *f)
{}

static int hackrf_g_fmt_sdr(struct file *file, void *priv,
			    struct v4l2_format *f)
{}

static int hackrf_try_fmt_sdr(struct file *file, void *priv,
			      struct v4l2_format *f)
{}

static int hackrf_enum_fmt_sdr(struct file *file, void *priv,
			       struct v4l2_fmtdesc *f)
{}

static int hackrf_s_tuner(struct file *file, void *priv,
		const struct v4l2_tuner *v)
{}

static int hackrf_g_tuner(struct file *file, void *priv, struct v4l2_tuner *v)
{}

static int hackrf_s_modulator(struct file *file, void *fh,
			      const struct v4l2_modulator *a)
{}

static int hackrf_g_modulator(struct file *file, void *fh,
			      struct v4l2_modulator *a)
{}

static int hackrf_s_frequency(struct file *file, void *priv,
		const struct v4l2_frequency *f)
{}

static int hackrf_g_frequency(struct file *file, void *priv,
		struct v4l2_frequency *f)
{}

static int hackrf_enum_freq_bands(struct file *file, void *priv,
		struct v4l2_frequency_band *band)
{}

static const struct v4l2_ioctl_ops hackrf_ioctl_ops =;

static const struct v4l2_file_operations hackrf_fops =;

static const struct video_device hackrf_template =;

static void hackrf_video_release(struct v4l2_device *v)
{}

static int hackrf_s_ctrl_rx(struct v4l2_ctrl *ctrl)
{}

static int hackrf_s_ctrl_tx(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops hackrf_ctrl_ops_rx =;

static const struct v4l2_ctrl_ops hackrf_ctrl_ops_tx =;

static int hackrf_probe(struct usb_interface *intf,
		const struct usb_device_id *id)
{}

/* USB device ID list */
static const struct usb_device_id hackrf_id_table[] =;
MODULE_DEVICE_TABLE(usb, hackrf_id_table);

/* USB subsystem interface */
static struct usb_driver hackrf_driver =;

module_usb_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();