This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/TM4C129ENCPDT: Use UART as a file descriptor

Part Number: TM4C129ENCPDT

Tool/software: TI-RTOS

Hi,

is it possible to use the UART as a file descriptor?

I get informations over TCP and UART and i want to use a select.

And then i want to use recv and send.

Can someone tell me if this is possible and if so how?

  • Hi,

    Krogi1305 said:

    is it possible to use the UART as a file descriptor?

     Sorry, I don't understand your question. Perhaps I don't understand what file descriptor is in the context you are trying to achieve. Can you elaborate? Hopefully someone in the community has the knowledge to help out.

    Krogi1305 said:
    I get informations over TCP and UART and i want to use a select.

    What do you mean that you want to use a select?

  • Charles Tsai said:
    What do you mean that you want to use a select?

    Unix-like and POSIX-compliant operating systems have an I/O system where an integer file descriptor is used to perform I/O to different devices, and the select() system call can wait on multiple file descriptors (I/O streams such as network sockets or UARTs) until an I/O stream is ready to read or write.

    I think Krogi1305 is asking if the equivalent functionality is supported by TI-RTOS on Tiva devices.

    The Sockets and Stream IO API section of the TI Network Developer's Kit (NDK) v2.25 API Reference Guide describes the BSD Sockets Compatibility API Layer supports using select() for network sockets.

    However, from looking at the TI-RTOS UART driver file descriptors are not supported for a UART.

  • Chester Gillon said:
    However, from looking at the TI-RTOS UART driver file descriptors are not supported for a UART.

    Poster Chester's report explains so much - yet (ENDS) in a (possible) premature manner.      Chester states that the desired (File Descriptors) "are not supported for a UART."

    Clearly - an obvious (and valuable) follow -  "Are such "File Descriptors" supported by  "ANY OTHER" ...  MCU Peripherals?

    Should (other Peripherals offer such support) then, "Review of that "Support Mechanism" - should provide guidance & insight to the requesting poster!     Such appears a key point - somehow omitted...

  • Hi Chester,
    Thank you for your explanation. I certainly learn something new today about the file descriptor.
  • cb1_mobile said:
    Clearly - an obvious (and valuable) follow -  "Are such "File Descriptors" supported by  "ANY OTHER" ...  MCU Peripherals?

    Looking at the code for tirtos_tivac_2_16_01_14, the only support for file descriptors are for network sockets (for Ethernet peripheral) and the pipes programming interface (for inter-task communication).

  • Krogi1305 said:
    I get informations over TCP and UART and i want to use a select.

    As of tirtos_tivac_2_16_01_14 the TI-RTOS UART driver doesn't support the use of file descriptors.

    To have a task which uses select() to wait for either data from a TCP socket or UART I think you need a separate task to handle the UART. The task handling the UART can interact with the task blocked in a select() on TCP sockets by either:

    a) Using a pipe to communicate with the socket task, since a pipe is read/written via a file descriptor and thus the file descriptor for a pipe can be waited for by a select().

    b) Call fdSelectAbort() from the UART task to wakeup the socket task when there is UART data to read/write. There will need to be mechanism to pass data from the UART task to the socket task.

  • Thank you Chester - "hope did exist" that "further support" may have existed - to, "Speed/Ease" poster's ambition.
    Once again - your "deep digging" proves extraordinary - poster's "ambition" (or desperation) now will be greatly taxed...
  • Thanks for your answers !!
  • That thanks should be directed toward poster "Chester."      His effort - far, "Above & Beyond."