Quantcast
Channel: Embedded Software (Read Only)
Viewing all articles
Browse latest Browse all 25965

Forum Post: RE: writing to a PIP object

$
0
0

After allowing CCS to do its update it will now compile. I did have to add a c++ mem.h lib and use memcpy to get it to work.

volatile unsigned int *McASP_RBUF0 = (unsigned int *)0x44000280;   while(PIP_getReaderNumFrames(&inputpipe) > 0)  {   if(SEM_pendBinary(&sampleDataReady, 0) == true) //used to protect against dual "get" calls from HWI and this Task   {    PIP_get(&inputpipe);    addr = PIP_getReaderAddr(&inputpipe);    size = PIP_getReaderSize(&inputpipe);    if(size < 16){LOG_printf(&trace, "ERROR: frame size < 16bits \n");}     memcpy(tempBuff, addr, 2);    PIP_free(&inputpipe);


void

readNextSample()  //make a HWI function call

{

Uns size;     //check read buffer     if(SEM_pendBinary(&sampleDataReady, 0) == true) //use counter to avoid missing samples  {  if (PIP_getWriterNumFrames(&inputpipe) > 0)     //how many frames are available  {  PIP_alloc(&inputpipe);                    // allocate an empty frame to write in     Ptr addr = PIP_getWriterAddr(&inputpipe);  //get address of empty frame  size = PIP_getWriterSize(&inputpipe);      //find size of empty frame     if(size > 0x10){PIP_setWriterSize(&inputpipe, 0x10);} //set frame to 2 word size 32bits     unsigned int tempBuff[1];  tempBuff[0] = *McASP_RBUF0;  memcpy(addr, tempBuff, 2);  PIP_put(&inputpipe); //release frame to pipe  }  else //exit function with ERROR  {  LOG_printf(&trace, "ERROR: new sample function: no empty frames  \n");     SEM_postBinary(&sampleDataReady);     return;  }  }  //end if     SEM_postBinary(&sampleDataReady);  //release semaphore at end of function  }  //end of read next sample    


Viewing all articles
Browse latest Browse all 25965

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>