scale_factor_listener serial_peripheral_interface_master
API Reference Manual  /  4 Model-to-Model Interfaces  / 

serial_device

Description
Interface used to connect serial devices together. It can be implemented both by devices such as UARTs and text consoles, and by links.

A character (byte) is sent with the write() function; obj is the receiving device or link, and value is either a data byte, or the out-of-band value TTY_ABORT.

The receiver will return the number of characters accepted; i.e. 1 on success and 0 if it could not handle the new byte. If the receiver returns 0, it must later call receive_ready() in the sender's serial_device interface to signal that new bytes can now be accepted. A serial device must handle the case where the receive_ready() function is called although it has no more bytes to send.

#define TTY_ABORT   0x100

SIM_INTERFACE(serial_device) {
        int (*write)(conf_object_t *obj, int value);
        void (*receive_ready)(conf_object_t *obj);
};

#define SERIAL_DEVICE_INTERFACE "serial_device"

Execution Context
Cell Context for all methods.

scale_factor_listener serial_peripheral_interface_master