Class ArchXT_USART

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class ArchXT_USART : public Peripheral

Implementation of a USART interface for XT core series.

Limitations:

  • MSPI, MPCM or IRCOM modes are not supported

  • Auto-baud not supported

CTLREQs supported:

  • AVR_CTLREQ_GET_SIGNAL : returns in data.p the signal of the underlying USART object (see sim_uart.h)

  • AVR_CTLREQ_USART_BYTES

Public Functions

ArchXT_USART(unsigned char num, const ArchXT_USARTConfig &config)
virtual ~ArchXT_USART()
virtual bool init(Device &device) override

Virtual method called when the device is initialised. This is where the peripheral can allocate its I/O registers, interrupts or connect signals.

Returns:

boolean indicates the success of all allocations.

virtual void reset() override

Virtual method called when the device is reset. Note that resetting I/O registers is only necessary here if their reset value is not zero.

virtual bool ctlreq(ctlreq_id_t req, ctlreq_data_t *data) override

Virtual method called for a CTL request. The method must return true if the request has been processed.

virtual uint8_t ioreg_read_handler(reg_addr_t addr, uint8_t value) override

Virtual method called when the CPU is reading a I/O register allocated by this peripheral. The value has not been read yet so the module can modify it before the CPU gets it.

Parameters:
  • addr – the register address in I/O space

  • value – current cached value of the register

Returns:

actual value of the register

virtual uint8_t ioreg_peek_handler(reg_addr_t addr, uint8_t value) override

Virtual method called when a debug probe is peeking the value of a register. The value has not been read yet so the module can modify it before the CPU gets it. The difference between a peek and a read is that a peek should not modify the state of the peripheral. By default, ioreg_read_handler is called to obtain the value.

Parameters:
  • addr – the register address in I/O space

  • value – current cached value of the register

Returns:

actual value of the register

virtual void ioreg_write_handler(reg_addr_t addr, const ioreg_write_t &data) override

Virtual method called when the CPU is writing a I/O register allocated by this peripheral. The value has already been written.

Parameters:
  • addr – the register address in I/O space

  • value – the new register content

virtual void sleep(bool on, SleepMode mode) override

Virtual method called when the device enters or exits a sleep mode.

Parameters:
  • on – true when entering a sleep mode, false when exiting it.

  • mode – one of the enum SleepMode values

class _Controller : public UART::USART

Public Functions

inline _Controller(ArchXT_USART &per)

Protected Functions

inline virtual void set_line_state(Line line, bool state) override
inline virtual bool get_line_state(Line line) const override
class _PinDriver : public PinDriver

Public Functions

explicit _PinDriver(ArchXT_USART &per)
void set_open_drain_enabled(bool enabled)
void set_loopback_enabled(bool enabled)
void set_gen_enabled(bool enable)
void set_line_enabled(Line line, bool enable)
void set_line_state(Line line, bool state)
bool get_line_state(Line line) const
virtual Pin::controls_t override_gpio(pin_index_t pin_index, const Pin::controls_t &gpio_controls) override

Stub called when a state resolution is taking place on a pin that the driver is controlling. The reimplementation should make a copy of the controls structure in argument, change its members according to the override state and return the result.

Parameters:
  • pin_index – index of the pin

  • controls – pin controls as configured by the GPIO port controller

Returns:

the controls to apply to the pin

virtual void digital_state_changed(pin_index_t pin_index, bool dig_state) override

Stub called when the digital state of a pin has changed after a state resolution.

Parameters:
  • pin_index – Index of the pin

  • state – New digital state of the pin