Class ArchXT_SPI
Defined in File arch_xt_spi.h
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public Peripheral(Class Peripheral)
Class Documentation
-
class ArchXT_SPI : public Peripheral
Implementation of a Serial Peripheral Interface controller for the XT core series.
for supported CTLREQs, see sim_spi.h
Public Functions
-
ArchXT_SPI(int num, const ArchXT_SPIConfig &config)
-
virtual ~ArchXT_SPI()
-
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
-
class _Controller : public SPI::EndPoint, public CycleTimer
Public Functions
-
explicit _Controller(ArchXT_SPI &peripheral)
-
void init(CycleManager &cycle_manager, Logger &logger)
-
void reset()
-
void set_bit_delay(cycle_count_t delay)
-
void set_mode(ControllerMode mode)
-
inline ControllerMode mode() const
-
void set_serial_mode(SerialMode mode)
-
void push_tx(uint8_t data, bool force_buffer)
-
inline bool tx_pending() const
-
uint8_t pop_rx()
-
uint8_t peek_rx() const
-
inline unsigned int rx_available() const
-
uint8_t mock_transfer(uint8_t rx_frame)
-
inline void input_clock(bool state)
-
void set_selected(bool selected)
-
inline bool selected() const
-
virtual cycle_count_t next(cycle_count_t when) override
Callback from the cycle loop.
Note
there’s no guarantee the method will be called exactly on the required ‘when’ cycle. The only guarantee is “called ‘when’ <= ‘current cycle’”, the implementations must account for this.
Note
The next ‘when’ can be in the ‘past’ (i.e. <= ‘current cycle’). In this case, the timer will be called again within the same cycle with the given next ‘when’. The only constraint is that it must be greater than the previous ‘when’. If it’s negative or zero, the timer is removed from the queue.
- Parameters:
when – current ‘when’ cycle, at which the timer was scheduled
- Returns:
the next ‘when’ the timer requires to be called at.
-
explicit _Controller(ArchXT_SPI &peripheral)
-
class _InterruptHandler : public InterruptHandler
Public Functions
-
_InterruptHandler()
-
bool init(Device &device, const reg_addr_t ®_enable, const reg_addr_t ®_flag, int_vect_t vector)
-
void reset()
-
void set_buffer_enabled(bool enabled)
-
void set_flag(uint8_t mask)
-
void clear_flag(uint8_t mask)
Clear the interrupt flag bits by AND’ing them with the mask argument.
- Returns:
true if the interrupt is canceled as a result of the flag bit changes, false if the interrupt is unchanged.
-
void clear_flag_from_ioreg(uint8_t mask)
-
void update_from_ioreg()
-
void update_from_data_access()
-
_InterruptHandler()
-
class _PinDriver : public PinDriver
Public Functions
-
_PinDriver(_Controller &ctrl, ctl_id_t id)
-
void set_mode(ControllerMode mode)
-
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 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
-
_PinDriver(_Controller &ctrl, ctl_id_t id)
-
ArchXT_SPI(int num, const ArchXT_SPIConfig &config)