mirror of
https://github.com/steve-m/hsdaoh.git
synced 2025-12-10 07:44:41 +01:00
remove some stale code
This commit is contained in:
parent
0ad2ea5b97
commit
ccd8727801
6 changed files with 6 additions and 116 deletions
|
|
@ -87,25 +87,6 @@ HSDAOH_API int hsdaoh_close(hsdaoh_dev_t *dev);
|
|||
HSDAOH_API int hsdaoh_get_usb_strings(hsdaoh_dev_t *dev, char *manufact,
|
||||
char *product, char *serial);
|
||||
|
||||
/*!
|
||||
* Set the sample rate for the device
|
||||
*
|
||||
* \param dev the device handle given by hsdaoh_open()
|
||||
* \param samp_rate the sample rate to be set
|
||||
* \param ext_clock if true, use the IFCLK input insteafd of internal clock source
|
||||
* if a Si5351 is connected, it will be configured
|
||||
* \return 0 on success, -EINVAL on invalid rate
|
||||
*/
|
||||
HSDAOH_API int hsdaoh_set_sample_rate(hsdaoh_dev_t *dev, uint32_t rate, bool ext_clock);
|
||||
|
||||
/*!
|
||||
* Get actual sample rate the device is configured to.
|
||||
*
|
||||
* \param dev the device handle given by hsdaoh_open()
|
||||
* \return 0 on error, sample rate in Hz otherwise
|
||||
*/
|
||||
HSDAOH_API uint32_t hsdaoh_get_sample_rate(hsdaoh_dev_t *dev);
|
||||
|
||||
/* streaming functions */
|
||||
|
||||
typedef void(*hsdaoh_read_cb_t)(unsigned char *buf, uint32_t len, void *ctx);
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef __I2C_H
|
||||
#define __I2C_H
|
||||
|
||||
int hsdaoh_i2c_write_fn(void *dev, uint8_t i2c_addr, uint8_t *buffer, uint16_t len);
|
||||
int hsdaoh_i2c_read_fn(void *dev, uint8_t i2c_addr, uint8_t *buffer, uint16_t len);
|
||||
|
||||
#endif
|
||||
|
|
@ -37,8 +37,6 @@
|
|||
|
||||
#include "hsdaoh.h"
|
||||
|
||||
#define DEFAULT_SAMPLE_RATE 30000000
|
||||
|
||||
static int do_exit = 0;
|
||||
static uint32_t bytes_to_read = 0;
|
||||
static hsdaoh_dev_t *dev = NULL;
|
||||
|
|
@ -48,7 +46,6 @@ void usage(void)
|
|||
fprintf(stderr,
|
||||
"hsdaoh_file, HDMI data acquisition tool\n\n"
|
||||
"Usage:\n"
|
||||
"\t[-s samplerate (default: 30 MHz)]\n"
|
||||
"\t[-d device_index (default: 0)]\n"
|
||||
"\t[-p ppm_error (default: 0)]\n"
|
||||
"\t[-n number of samples to read (default: 0, infinite)]\n"
|
||||
|
|
@ -119,16 +116,12 @@ int main(int argc, char **argv)
|
|||
int ppm_error = 0;
|
||||
FILE *file;
|
||||
int dev_index = 0;
|
||||
uint32_t samp_rate = DEFAULT_SAMPLE_RATE;
|
||||
|
||||
while ((opt = getopt(argc, argv, "d:s:n:p:d:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "d:n:p:d:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
dev_index = (uint32_t)atoi(optarg);
|
||||
break;
|
||||
case 's':
|
||||
samp_rate = (uint32_t)atof(optarg);
|
||||
break;
|
||||
case 'p':
|
||||
ppm_error = atoi(optarg);
|
||||
break;
|
||||
|
|
@ -168,11 +161,6 @@ int main(int argc, char **argv)
|
|||
SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE );
|
||||
#endif
|
||||
|
||||
/* Set the sample rate */
|
||||
r = hsdaoh_set_sample_rate(dev, samp_rate, 0);
|
||||
if (r < 0)
|
||||
fprintf(stderr, "WARNING: Failed to set sample rate.\n");
|
||||
|
||||
if (strcmp(filename, "-") == 0) { /* Write samples to stdout */
|
||||
file = stdout;
|
||||
#ifdef _WIN32
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ typedef int socklen_t;
|
|||
#endif
|
||||
|
||||
#define DEFAULT_PORT_STR "1234"
|
||||
#define DEFAULT_SAMPLE_RATE_HZ 30000000
|
||||
#define DEFAULT_MAX_NUM_BUFFERS 500
|
||||
|
||||
static SOCKET s;
|
||||
|
|
@ -102,7 +101,6 @@ void usage(void)
|
|||
fprintf(stderr, "\t[-b number of buffers (default: 15, set by library)]\n");
|
||||
fprintf(stderr, "\t[-n max number of linked list buffers to keep (default: %d)]\n", DEFAULT_MAX_NUM_BUFFERS);
|
||||
fprintf(stderr, "\t[-d device index (default: 0)]\n");
|
||||
fprintf(stderr, "\t[-P ppm_error (default: 0)]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -291,25 +289,6 @@ static void *command_worker(void *arg)
|
|||
pthread_exit(NULL);
|
||||
}
|
||||
}
|
||||
switch(cmd.cmd) {
|
||||
case 0x01:
|
||||
break;
|
||||
case 0x02:
|
||||
fprintf(stderr, "set sample rate %d\n", ntohl(cmd.param));
|
||||
hsdaoh_set_sample_rate(dev, ntohl(cmd.param), false);
|
||||
break;
|
||||
case 0x03:
|
||||
fprintf(stderr, "set gain mode %d\n", ntohl(cmd.param));
|
||||
//hsdaoh_set_tuner_gain_mode(dev, ntohl(cmd.param));
|
||||
break;
|
||||
case 0x04:
|
||||
fprintf(stderr, "set gain %d\n", ntohl(cmd.param));
|
||||
// hsdaoh_set_tuner_gain(dev, ntohl(cmd.param));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cmd.cmd = 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -318,7 +297,6 @@ int main(int argc, char **argv)
|
|||
int r, opt, i;
|
||||
char *addr = "127.0.0.1";
|
||||
const char *port = DEFAULT_PORT_STR;
|
||||
uint32_t frequency = 100000000, samp_rate = DEFAULT_SAMPLE_RATE_HZ;
|
||||
struct sockaddr_storage local, remote;
|
||||
struct addrinfo *ai;
|
||||
struct addrinfo *aiHead;
|
||||
|
|
@ -330,7 +308,6 @@ int main(int argc, char **argv)
|
|||
int aiErr;
|
||||
uint32_t buf_num = 0;
|
||||
int dev_index = 0;
|
||||
int ppm_error = 0;
|
||||
struct llist *curelem,*prev;
|
||||
pthread_attr_t attr;
|
||||
void *status;
|
||||
|
|
@ -349,14 +326,11 @@ int main(int argc, char **argv)
|
|||
struct sigaction sigact, sigign;
|
||||
#endif
|
||||
|
||||
while ((opt = getopt(argc, argv, "a:p:s:v:b:n:d:e")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "a:p:b:n:d")) != -1) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
dev_index = (uint32_t)atoi(optarg);
|
||||
break;
|
||||
case 's':
|
||||
samp_rate = (uint32_t)atof(optarg);
|
||||
break;
|
||||
case 'a':
|
||||
addr = strdup(optarg);
|
||||
break;
|
||||
|
|
@ -401,11 +375,6 @@ int main(int argc, char **argv)
|
|||
SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE );
|
||||
#endif
|
||||
|
||||
/* Set the sample rate */
|
||||
r = hsdaoh_set_sample_rate(dev, samp_rate, false);
|
||||
if (r < 0)
|
||||
fprintf(stderr, "WARNING: Failed to set sample rate.\n");
|
||||
|
||||
pthread_mutex_init(&exit_cond_lock, NULL);
|
||||
pthread_mutex_init(&ll_mutex, NULL);
|
||||
pthread_mutex_init(&exit_cond_lock, NULL);
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ void usage(void)
|
|||
"hsdaoh_test, a test tool for hsdaoh\n\n"
|
||||
"Usage:\n"
|
||||
"\t[-d device_index (default: 0)]\n"
|
||||
"\t[-s expected samplerate (default: 30 MHz)]\n"
|
||||
"\t[-p[seconds] enable PPM error measurement (default: 10 seconds)]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -244,7 +245,7 @@ int main(int argc, char **argv)
|
|||
int n_read, r, opt, i;
|
||||
int dev_index = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "d:s:p:he")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "d:s:p:h")) != -1) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
dev_index = (uint32_t)atoi(optarg);
|
||||
|
|
@ -263,9 +264,8 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (dev_index < 0) {
|
||||
if (dev_index < 0)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
r = hsdaoh_open(&dev, (uint32_t)dev_index);
|
||||
if (r < 0) {
|
||||
|
|
@ -289,10 +289,8 @@ int main(int argc, char **argv)
|
|||
|
||||
r = hsdaoh_start_stream(dev, hsdaoh_callback, NULL);
|
||||
|
||||
|
||||
while (!do_exit) {
|
||||
while (!do_exit)
|
||||
usleep(50000);
|
||||
}
|
||||
|
||||
if (do_exit)
|
||||
fprintf(stderr, "\nUser cancel, exiting...\n");
|
||||
|
|
|
|||
|
|
@ -42,20 +42,9 @@
|
|||
#include <inttypes.h>
|
||||
#include <libusb.h>
|
||||
#include <libuvc/libuvc.h>
|
||||
#include <hsdaoh_i2c.h>
|
||||
#include <hsdaoh.h>
|
||||
#include <crc.h>
|
||||
|
||||
/*
|
||||
* All libusb callback functions should be marked with the LIBUSB_CALL macro
|
||||
* to ensure that they are compiled with the same calling convention as libusb.
|
||||
*
|
||||
* If the macro isn't available in older libusb versions, we simply define it.
|
||||
*/
|
||||
#ifndef LIBUSB_CALL
|
||||
#define LIBUSB_CALL
|
||||
#endif
|
||||
|
||||
enum hsdaoh_async_status {
|
||||
HSDAOH_INACTIVE = 0,
|
||||
HSDAOH_CANCELING,
|
||||
|
|
@ -77,8 +66,6 @@ struct hsdaoh_dev {
|
|||
uvc_device_t *uvc_dev;
|
||||
uvc_device_handle_t *uvc_devh;
|
||||
|
||||
uint32_t rate; /* Hz */
|
||||
|
||||
int hid_interface;
|
||||
|
||||
uint8_t edid_seq_cnt;
|
||||
|
|
@ -245,18 +232,6 @@ void hsdaoh_ms_enable_transparent_mode(hsdaoh_dev_t *dev)
|
|||
hsdaoh_ms_write_register(dev, 0xf600, 0x80);
|
||||
}
|
||||
|
||||
int hsdaoh_i2c_write_fn(void *dev, uint8_t addr, uint8_t *buf, uint16_t len)
|
||||
{
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int hsdaoh_i2c_read_fn(void *dev, uint8_t addr, uint8_t *buf, uint16_t len)
|
||||
{
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int hsdaoh_get_usb_strings(hsdaoh_dev_t *dev, char *manufact, char *product,
|
||||
char *serial)
|
||||
{
|
||||
|
|
@ -298,19 +273,6 @@ int hsdaoh_get_usb_strings(hsdaoh_dev_t *dev, char *manufact, char *product,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int hsdaoh_set_sample_rate(hsdaoh_dev_t *dev, uint32_t samp_rate, bool ext_clock)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t hsdaoh_get_sample_rate(hsdaoh_dev_t *dev)
|
||||
{
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
||||
return dev->rate;
|
||||
}
|
||||
|
||||
static hsdaoh_adapter_t *find_known_device(uint16_t vid, uint16_t pid)
|
||||
{
|
||||
unsigned int i;
|
||||
|
|
@ -550,7 +512,6 @@ int hsdaoh_open(hsdaoh_dev_t **out_dev, uint32_t index)
|
|||
if (hsdaoh_clear_endpoint_halt(dev) < 0)
|
||||
goto err;
|
||||
|
||||
//dev->rate = DEFAULT_SAMPLERATE;
|
||||
dev->dev_lost = 0;
|
||||
|
||||
found:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue