Skip to content

Commit

Permalink
Merge branch 'alexian79-pacer' into pacer
Browse files Browse the repository at this point in the history
  • Loading branch information
mubes committed Aug 23, 2023
2 parents f4eff65 + f78a4dd commit e7585dd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions Src/itmfifos.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ static void *_runFifo( void *arg )
/* We use RDWR to allow the open to proceed without a remote end */
if ( !params->permafile )
{
opfile = open( c->fifoName, O_RDWR | O_NONBLOCK );
opfile = open( c->fifoName, O_RDWR | O_BINARY | O_NONBLOCK );
}
else
{
opfile = open( c->fifoName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH );
opfile = open( c->fifoName, O_WRONLY | O_CREAT | O_BINARY | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH );
}

do
Expand Down Expand Up @@ -212,11 +212,11 @@ static void *_runHWFifo( void *arg )
if ( !params->permafile )
{
/* We use RDWR to allow the open to proceed without a remote end */
opfile = open( c->fifoName, O_RDWR | O_NONBLOCK );
opfile = open( c->fifoName, O_RDWR | O_BINARY | O_NONBLOCK );
}
else
{
opfile = open( c->fifoName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH );
opfile = open( c->fifoName, O_WRONLY | O_CREAT | O_BINARY | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH );
}

do
Expand Down
30 changes: 15 additions & 15 deletions Src/orbuculum.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ static void *_processBlocksQueue( void *params )
{
pthread_cond_wait( &r->dataForClients, &r->dataForClients_m );

if ( r->rp != r->wp )
while( r->rp != r->wp )
{
_processBlock( r, r->rawBlock[r->rp].fillLevel, r->rawBlock[r->rp].buffer );
r->rp = ( r->rp + 1 ) % NUM_RAW_BLOCKS;
Expand Down Expand Up @@ -1261,7 +1261,7 @@ static int _serialFeeder( struct RunTime *r )
static int _fileFeeder( struct RunTime *r )

{
if ( ( r->f = open( r->options->file, O_RDONLY ) ) < 0 )
if ( ( r->f = open( r->options->file, O_RDONLY | O_BINARY) ) < 0 )
{
genericsExit( -4, "Can't open file %s" EOL, r->options->file );
}
Expand All @@ -1276,6 +1276,18 @@ static int _fileFeeder( struct RunTime *r )
struct dataBlock *rxBlock = &r->rawBlock[r->wp];
rxBlock->fillLevel = read( r->f, rxBlock->buffer, USB_TRANSFER_SIZE );

/* We can probably read from file faster than we can process.... */
_dataAvailable( r );
int nwp = ( r->wp + 1 ) % NUM_RAW_BLOCKS;

/* Spin waiting for buffer space to become available */
while ( nwp == r->rp )
{
usleep( INTERVAL_1MS );
}

r->wp = nwp;

if ( !rxBlock->fillLevel )
{
if ( r->options->fileTerminate )
Expand All @@ -1289,18 +1301,6 @@ static int _fileFeeder( struct RunTime *r )
continue;
}
}

/* We can probably read from file faster than we can process.... */
_dataAvailable( r );
int nwp = ( r->wp + 1 ) % NUM_RAW_BLOCKS;

/* Spin waiting for buffer space to become available */
while ( nwp == r->rp )
{
usleep( INTERVAL_1MS );
}

r->wp = nwp;
}

r->conn = false;
Expand Down Expand Up @@ -1434,7 +1434,7 @@ int main( int argc, char *argv[] )

if ( _r.options->outfile )
{
_r.opFileHandle = open( _r.options->outfile, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH );
_r.opFileHandle = open( _r.options->outfile, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH );

if ( _r.opFileHandle < 0 )
{
Expand Down

0 comments on commit e7585dd

Please sign in to comment.