cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32 mp1 Dev/tty/msg

SDall
Associate II

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:

 

  • read:
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

0 REPLIES 0