arch_avr_port.h Source File

yasimavr: arch_avr_port.h Source File
yasimavr
Loading...
Searching...
No Matches
arch_avr_port.h
Go to the documentation of this file.
1/*
2 * arch_avr_port.h
3 *
4 * Copyright 2021-2026 Clement Savergne <csavergne@yahoo.com>
5
6 This file is part of yasim-avr.
7
8 yasim-avr is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 yasim-avr is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with yasim-avr. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22//=======================================================================================
23
24#ifndef __YASIMAVR_AVR_PORT_H__
25#define __YASIMAVR_AVR_PORT_H__
26
27#include "arch_avr_globals.h"
29
31
32
33//=======================================================================================
45
50
51public:
52
53 explicit ArchAVR_Port(const ArchAVR_PortConfig& config);
54
55 virtual bool init(Device& device) override;
56 virtual void reset(int flags) override;
57 virtual void ioreg_write_handler(reg_addr_t addr, const ioreg_write_t& data) override;
58
59protected:
60
61 virtual void pin_state_changed(uint8_t num, Wire::StateEnum state) override;
62
63private:
64
65 const ArchAVR_PortConfig& m_config;
66 uint8_t m_portr_value;
67 uint8_t m_ddr_value;
68
69 void update_pin_states(uint8_t new_portr, uint8_t new_ddr);
70
71};
72
73
75
76#endif //__YASIMAVR_AVR_PORT_H__
#define AVR_ARCHAVR_PUBLIC_API
Definition arch_avr_globals.h:46
Implementation of a GPIO port controller for AVR series.
Definition arch_avr_port.h:49
Basic AVR device model.
Definition sim_device.h:61
virtual void ioreg_write_handler(reg_addr_t addr, const ioreg_write_t &data) override
Definition sim_peripheral.cpp:117
Generic model for a GPIO port controller.
Definition sim_port.h:52
virtual bool init(Device &device) override
Definition sim_port.cpp:46
virtual void reset(int flags) override
Definition sim_port.cpp:68
virtual void pin_state_changed(uint8_t num, Wire::StateEnum state)
Definition sim_port.cpp:133
StateEnum
Definition sim_wire.h:63
Representation of a I/O register address, with validity state.
Definition sim_types.h:60
#define YASIMAVR_BEGIN_NAMESPACE
Definition sim_globals.h:58
#define YASIMAVR_END_NAMESPACE
Definition sim_globals.h:59
Configuration structure for ArchAVR_Port.
Definition arch_avr_port.h:37
reg_addr_t reg_dir
Definition arch_avr_port.h:42
reg_addr_t reg_port
Definition arch_avr_port.h:40
char name
Definition arch_avr_port.h:39
reg_addr_t reg_pin
Definition arch_avr_port.h:41
Definition sim_ioreg.h:39