sim_peripheral.h File Reference

yasimavr: sim_peripheral.h File Reference
yasimavr
Loading...
Searching...
No Matches
sim_peripheral.h File Reference
#include "sim_ioreg.h"
#include "sim_signal.h"
#include "sim_logger.h"

Go to the source code of this file.

Classes

struct  NVM_request_t
 Structure used for AVR_CTLREQ_NVM_REQUEST requests. More...
 
struct  ctlreq_data_t
 
struct  base_reg_config_t
 
class  Peripheral
 Abstract class defining a framework for MCU peripherals. More...
 
class  DummyController
 Generic dummy peripheral. More...
 
struct  DummyController::dummy_register_t
 

Functions

Register field lookup

The structure base_reg_config_t and the functions find_reg_config() are useful for configuration that maps a register field value to a set of parameters. (see the timer classes for examples)

template<typename T >
int find_reg_config (const std::vector< T > &v, uint64_t reg_value)
 
template<typename T >
const T * find_reg_config_p (const std::vector< T > &v, uint64_t reg_value)
 

Controller requests definition

Definition of common and builtin CTLREQs

See also
Device::ctlreq
ctlreq_data_t
#define AVR_CTLREQ_BASE   0x100
 
#define AVR_CTLREQ_GET_SIGNAL   0
 
#define AVR_CTLREQ_CORE_BREAK   (AVR_CTLREQ_BASE + 1)
 
#define AVR_CTLREQ_CORE_SLEEP   (AVR_CTLREQ_BASE + 2)
 
#define AVR_CTLREQ_CORE_WAKEUP   (AVR_CTLREQ_BASE + 3)
 
#define AVR_CTLREQ_CORE_SHORTING   (AVR_CTLREQ_BASE + 4)
 
#define AVR_CTLREQ_CORE_CRASH   (AVR_CTLREQ_BASE + 5)
 
#define AVR_CTLREQ_CORE_RESET   (AVR_CTLREQ_BASE + 6)
 
#define AVR_CTLREQ_CORE_RESET_FLAG   (AVR_CTLREQ_BASE + 7)
 
#define AVR_CTLREQ_CORE_NVM   (AVR_CTLREQ_BASE + 8)
 
#define AVR_CTLREQ_CORE_HALT   (AVR_CTLREQ_BASE + 9)
 
#define AVR_CTLREQ_CORE_SECTIONS   (AVR_CTLREQ_BASE + 10)
 
#define AVR_CTLREQ_WATCHDOG_RESET   (AVR_CTLREQ_BASE + 1)
 
#define AVR_CTLREQ_NVM_REQUEST   (AVR_CTLREQ_BASE + 1)
 
#define AVR_CTLREQ_SLEEP_CALL   (AVR_CTLREQ_BASE + 1)
 
#define AVR_CTLREQ_SLEEP_PSEUDO   (AVR_CTLREQ_BASE + 2)
 
typedef int ctlreq_id_t
 

Peripheral identifier definition

All peripherals are uniquely identified by a 32-bits integer which is actually composed of 4 characters. This section defines the identifiers for the usual peripherals.

See also
Peripheral
constexpr sim_id_t AVR_IOCTL_CORE = "CORE"
 
constexpr sim_id_t AVR_IOCTL_WDT = "WDT"
 
constexpr sim_id_t AVR_IOCTL_INTR = "CPUINT"
 
constexpr sim_id_t AVR_IOCTL_SLEEP = "SLPCTRL"
 
constexpr sim_id_t AVR_IOCTL_CLOCK = "CLKCTRL"
 
constexpr sim_id_t AVR_IOCTL_PORTMUX = "PORTMUX"
 
constexpr sim_id_t AVR_IOCTL_EEPROM = "EEPROM"
 
constexpr sim_id_t AVR_IOCTL_NVM = "NVMCTRL"
 
constexpr sim_id_t AVR_IOCTL_VREF = "VREF"
 
constexpr sim_id_t AVR_IOCTL_EXTINT = "EXTINT"
 
constexpr sim_id_t AVR_IOCTL_RST = "RSTCTRL"
 
constexpr sim_id_t AVR_IOCTL_RTC = "RTC"
 
constexpr sim_id_t AVR_IOCTL_PORT (char c)
 
constexpr sim_id_t AVR_IOCTL_ADC (char c)
 
constexpr sim_id_t AVR_IOCTL_ACP (char c)
 
constexpr sim_id_t AVR_IOCTL_TIMER (char t, char c)
 
constexpr sim_id_t AVR_IOCTL_UART (char c)
 
constexpr sim_id_t AVR_IOCTL_SPI (char c)
 
constexpr sim_id_t AVR_IOCTL_TWI (char c)