kopia lustrzana https://github.com/cariboulabs/cariboulite
module changes for flush over rpizero
rodzic
61ed2057d5
commit
a13b719e52
|
@ -506,13 +506,6 @@ static long smi_stream_ioctl(struct file *file, unsigned int cmd, unsigned long
|
|||
//-------------------------------
|
||||
case SMI_STREAM_IOC_FLUSH_FIFO:
|
||||
{
|
||||
if (mutex_lock_interruptible(&inst->read_lock))
|
||||
{
|
||||
return -EINTR;
|
||||
}
|
||||
kfifo_reset_out(&inst->rx_fifo);
|
||||
mutex_unlock(&inst->read_lock);
|
||||
|
||||
break;
|
||||
}
|
||||
//-------------------------------
|
||||
|
@ -1091,17 +1084,29 @@ static int smi_stream_release(struct inode *inode, struct file *file)
|
|||
static ssize_t smi_stream_read_file_fifo(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int copied;
|
||||
size_t num_bytes = 0;
|
||||
unsigned int count_actual = count;
|
||||
unsigned int copied = 0;
|
||||
//size_t num_bytes = 0;
|
||||
//unsigned int count_actual = count;
|
||||
|
||||
if (mutex_lock_interruptible(&inst->read_lock))
|
||||
if (buf == NULL)
|
||||
{
|
||||
return -EINTR;
|
||||
}
|
||||
ret = kfifo_to_user(&inst->rx_fifo, buf, count, &copied);
|
||||
mutex_unlock(&inst->read_lock);
|
||||
|
||||
//dev_info(inst->dev, "Flushing internal rx_kfifo");
|
||||
if (mutex_lock_interruptible(&inst->read_lock))
|
||||
{
|
||||
return -EINTR;
|
||||
}
|
||||
kfifo_reset_out(&inst->rx_fifo);
|
||||
mutex_unlock(&inst->read_lock);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mutex_lock_interruptible(&inst->read_lock))
|
||||
{
|
||||
return -EINTR;
|
||||
}
|
||||
ret = kfifo_to_user(&inst->rx_fifo, buf, count, &copied);
|
||||
mutex_unlock(&inst->read_lock);
|
||||
}
|
||||
return ret < 0 ? ret : (ssize_t)copied;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ int main ()
|
|||
try
|
||||
{
|
||||
s1g->SetFrequency(900000000);
|
||||
s1g->FlushBuffers();
|
||||
//s1g->FlushBuffers();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ int main ()
|
|||
try
|
||||
{
|
||||
hif->SetFrequency(2400000000);
|
||||
hif->FlushBuffers();
|
||||
//hif->FlushBuffers();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ int main ()
|
|||
}
|
||||
hif->SetRxGain(0);
|
||||
hif->SetAgc(false);
|
||||
hif->StartReceiving(receivedSamples, 20000);
|
||||
hif->StartReceiving(receivedSamples);
|
||||
|
||||
getchar();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ static void caribou_smi_print_smi_settings(caribou_smi_st* dev, struct smi_setti
|
|||
printf(" dma enable: %c, passthru enable: %c\n", settings->dma_enable ? 'Y':'N', settings->dma_passthrough_enable ? 'Y':'N');
|
||||
printf(" dma threshold read: %d, write: %d\n", settings->dma_read_thresh, settings->dma_write_thresh);
|
||||
printf(" dma panic threshold read: %d, write: %d\n", settings->dma_panic_read_thresh, settings->dma_panic_write_thresh);
|
||||
printf(" native kernel chunk size: %ld bytes\n", dev->native_batch_len);
|
||||
printf(" native kernel chunk size: %d bytes\n", dev->native_batch_len);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
@ -765,7 +765,7 @@ int caribou_smi_flush_fifo(caribou_smi_st* dev)
|
|||
{
|
||||
if (!dev) return -1;
|
||||
if (!dev->initialized) return -1;
|
||||
int ret = ioctl(dev->filedesc, SMI_STREAM_IOC_FLUSH_FIFO, 1);
|
||||
int ret = read(dev->filedesc, NULL, 0);
|
||||
if (ret != 0)
|
||||
{
|
||||
ZF_LOGE("failed flushing driver fifos");
|
||||
|
|
Plik diff jest za duży
Load Diff
Plik binarny nie jest wyświetlany.
Ładowanie…
Reference in New Issue