2023-09-24 04:19 AM
Hi, I'm reading up on stm mp1, in particular the Linux side, my intent was to use the M4 to read data from sensors and transfer them to the A7 on the Linux side. Now I've read the function in C code that reads the messages from the manual:
int readTtyRpmsg(int FdRpmsg, int len, char* pData) { int byte_rd, byte_avail; int result = 0; if (FdRpmsg < 0) { printf("CA7 : Error reading ttyRPMSG, fileDescriptor is not set\n"); return FdRpmsg; } ioctl(FdRpmsg, FIONREAD, &byte_avail); if (byte_avail > 0) { if (byte_avail >= len) { byte_rd = read(FdRpmsg, pData, len); } else { byte_rd = read(FdRpmsg, pData, byte_avail); } result = byte_rd; } else { result = 0; } return result; }
my question if there is a way to read data with interrupt or every time I have to query this function, how do I know if the data to read in msg is available without querying the function Thank you