You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I´m trying to create asynchronous read data from rtl-sdr. I use sample rate 2Mhz, but this case what I push doesn´t work (Throw Exception), I would like to read data without lost samples.
I whould like to ask for some help or write example with comments. I saw at rtl_adbc.c where I wound this type of solution.
while (!end) {
//pthread_mutex_lock(&mem1Lock);
pthread_cond_wait(&ready, &ready_m);
for (int i = 0; i < 100000; i += 2)
fprintf(output, "%d\n%d\n", mem1[i], mem1[i+1]);
/*pthread_mutex_unlock(&mem1Lock);
pthread_mutex_lock(&mem2Lock);
for (int i = 0; i < 50000; i += 2)
fprintf(output, "%d\n%d\n", mem2[i], mem2[i + 1]);
pthread_mutex_unlock(&mem2Lock);*/
}
fclose(output);
return NULL;
Hello,
I´m trying to create asynchronous read data from rtl-sdr. I use sample rate 2Mhz, but this case what I push doesn´t work (Throw Exception), I would like to read data without lost samples.
I whould like to ask for some help or write example with comments. I saw at rtl_adbc.c where I wound this type of solution.
`static pthread_cond_t ready;
static pthread_mutex_t ready_m;
//Shared Global Memory
uint8_t mem1[100000], mem2[50000];
//Lock for read and write
pthread_mutex_t mem1Lock = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mem2Lock = PTHREAD_MUTEX_INITIALIZER;
BOOL end;
static void* saveData()
{
FILE *output;
output = fopen("D:\black\zkouska.dat", "w");
}
void* readData(rtlsdr_dev_t *dev)
{
int read;
}
static void getData(unsigned char *buf, uint32_t len, void *ctx)
{
//pthread_mutex_lock(&mem1Lock);
memcpy(mem1, buf, len);
pthread_cond_signal(&ready);
/*pthread_mutex_unlock(&mem1Lock);
}
void test(rtlsdr_dev_t *dev, double time)
{
pthread_t threadRead, threadWrite;
int rc; end = FALSE;
pthread_cond_init(&ready, NULL);
pthread_mutex_init(&ready_m, NULL);
}
`
Thanks for any help
The text was updated successfully, but these errors were encountered: