Fix detection of EOF

pull/13/head
Brandon Skari 2016-01-31 15:38:22 +07:00
rodzic 53e63a3536
commit 96ecd96724
2 zmienionych plików z 25 dodań i 12 usunięć

Wyświetl plik

@ -119,7 +119,7 @@ udelay(int us)
}
static void
terminate(int dummy)
stop_dma(void)
{
#ifdef WITH_MEMORY_BUFFER
//pthread_cancel(th1);
@ -163,7 +163,12 @@ terminate(int dummy)
mem_free(mbox.handle, mbox.mem_ref);
//printf("Unmapfree Done\n");
}
}
static void
terminate(int dummy)
{
stop_dma();
//munmap(virtbase,NUM_PAGES * PAGE_SIZE);
printf("END OF PiTx\n");
exit(1);
@ -1364,8 +1369,10 @@ for (;;)
reset();
NbRead=readWrapper(IQArray,DmaSampleBurstSize*2*2);
}
else
terminate(0);
else {
stop_dma();
return 0;
}
}
@ -1439,8 +1446,10 @@ for (;;)
printf("Looping FileIn\n");
reset();
}
else if (!useStdin)
terminate(0);
else if (!useStdin) {
stop_dma();
return 0;
}
}
@ -1515,8 +1524,8 @@ for (;;)
}
else if (!useStdin)
{
sleep(1);
terminate(0);
stop_dma();
return 0;
}
}
@ -1615,7 +1624,7 @@ for (;;)
terminate(0);
stop_dma();
return(0);
}

Wyświetl plik

@ -62,8 +62,12 @@ typedef struct {
*/
static ssize_t formatRfWrapper(void* const outBuffer, const size_t count) {
static float wavBuffer[1024];
static int wavOffset = 0;
static int wavFilled = 0;
static int wavOffset = -1;
static int wavFilled = -1;
if (wavFilled == 0) {
return 0;
}
const int excursion = 6000;
int numBytesWritten = 0;
@ -160,7 +164,7 @@ PyMODINIT_FUNC
init_rpitx(void) {
PyObject* const module = Py_InitModule("_rpitx", _rpitx_methods);
if (module == NULL) {
return NULL;
return;
}
rpitxError = PyErr_NewException("_rpitx.error", NULL, NULL);
Py_INCREF(rpitxError);