uint16_t SCI_getDataBlocking(SCI_Handle sciHandle) { SCI_Obj *sci = (SCI_Obj *)sciHandle; while(SCI_isRxDataReady(sciHandle) != true){ } return (sci->SCIRXBUF); } // end of SCI_getDataBlocking() function
uint16_t SCI_getDataNonBlocking(SCI_Handle sciHandle, uint16_t * success) { SCI_Obj *sci = (SCI_Obj *)sciHandle; if(SCI_isRxDataReady(sciHandle)){ *success = true; return (sci->SCIRXBUF); } *success = false; return (NULL); } // end of SCI_getDataNonBlocking() function
int SCI_read(int dev_fd, char * buf, unsigned count) { uint16_t readCount = 0; uint16_t * bufPtr = (uint16_t *) buf; if(count == 0) { return (0); } while((readCount < count) && SCI_isRxDataReady(ioSci)){ *bufPtr = SCI_getData(ioSci); readCount++; bufPtr++; } return (readCount); }