SimAVR
AVR Simulator
IO Port

Data Structures

struct  avr_ioport_getirq_t
 this ioctl takes a avr_regbit_t, compares the register address to PORT/PIN/DDR and return the corresponding IRQ(s) if it matches More...
 
struct  avr_ioport_state_t
 ioctl used to get a port state. More...
 
struct  avr_ioport_external_t
 ioctl used to set default port state when set as input. More...
 
struct  avr_iopin_t
 pin structure More...
 
struct  avr_ioport_t
 Definition for an IO port. More...
 

Macros

#define AVR_IOPORT_OUTPUT   0x100
 
#define AVR_IOCTL_IOPORT_GETIRQ(_name)   AVR_IOCTL_DEF('i','o','g',(_name))
 add port name (uppercase) to get the real IRQ More...
 
#define AVR_IOCTL_IOPORT_GETIRQ_REGBIT   AVR_IOCTL_DEF('i','o','g','r')
 
#define AVR_IOCTL_IOPORT_GETSTATE(_name)   AVR_IOCTL_DEF('i','o','s',(_name))
 add port name (uppercase) to get the port state More...
 
#define AVR_IOCTL_IOPORT_SET_EXTERNAL(_name)   AVR_IOCTL_DEF('i','o','p',(_name))
 add port name (uppercase) to set default input pin IRQ values More...
 
#define AVR_IOPIN(_port, _pin)   { .port = _port, .pin = _pin }
 
#define AVR_IOPORT_DECLARE(_lname, _cname, _uname)
 

Typedefs

typedef struct avr_ioport_getirq_t avr_ioport_getirq_t
 this ioctl takes a avr_regbit_t, compares the register address to PORT/PIN/DDR and return the corresponding IRQ(s) if it matches More...
 
typedef struct avr_ioport_state_t avr_ioport_state_t
 ioctl used to get a port state. More...
 
typedef struct avr_ioport_external_t avr_ioport_external_t
 ioctl used to set default port state when set as input. More...
 
typedef struct avr_iopin_t avr_iopin_t
 pin structure More...
 
typedef struct avr_ioport_t avr_ioport_t
 Definition for an IO port. More...
 

Enumerations

enum  {
  IOPORT_IRQ_PIN0 = 0, IOPORT_IRQ_PIN1, IOPORT_IRQ_PIN2, IOPORT_IRQ_PIN3,
  IOPORT_IRQ_PIN4, IOPORT_IRQ_PIN5, IOPORT_IRQ_PIN6, IOPORT_IRQ_PIN7,
  IOPORT_IRQ_PIN_ALL, IOPORT_IRQ_DIRECTION_ALL, IOPORT_IRQ_REG_PORT, IOPORT_IRQ_REG_PIN,
  IOPORT_IRQ_COUNT
}
 

Functions

void avr_ioport_init (avr_t *avr, avr_ioport_t *port)
 

Detailed Description

Macro Definition Documentation

#define AVR_IOCTL_IOPORT_GETIRQ (   _name)    AVR_IOCTL_DEF('i','o','g',(_name))

add port name (uppercase) to get the real IRQ

#define AVR_IOCTL_IOPORT_GETIRQ_REGBIT   AVR_IOCTL_DEF('i','o','g','r')
#define AVR_IOCTL_IOPORT_GETSTATE (   _name)    AVR_IOCTL_DEF('i','o','s',(_name))

add port name (uppercase) to get the port state

#define AVR_IOCTL_IOPORT_SET_EXTERNAL (   _name)    AVR_IOCTL_DEF('i','o','p',(_name))

add port name (uppercase) to set default input pin IRQ values

#define AVR_IOPIN (   _port,
  _pin 
)    { .port = _port, .pin = _pin }
#define AVR_IOPORT_DECLARE (   _lname,
  _cname,
  _uname 
)
Value:
.port ## _lname = { \
.name = _cname, .r_port = PORT ## _uname, .r_ddr = DDR ## _uname, .r_pin = PIN ## _uname, \
}
#define AVR_IOPORT_OUTPUT   0x100

Typedef Documentation

typedef struct avr_iopin_t avr_iopin_t

pin structure

ioctl used to set default port state when set as input.

this ioctl takes a avr_regbit_t, compares the register address to PORT/PIN/DDR and return the corresponding IRQ(s) if it matches

ioctl used to get a port state.

for (int i = 'A'; i <= 'F'; i++) { avr_ioport_state_t state; if (avr_ioctl(AVR_IOCTL_IOPORT_GETSTATE(i), &state) == 0) printf("PORT%c %02x DDR %02x PIN %02x\n", state.name, state.port, state.ddr, state.pin); }

typedef struct avr_ioport_t avr_ioport_t

Definition for an IO port.

Enumeration Type Documentation

anonymous enum
Enumerator
IOPORT_IRQ_PIN0 
IOPORT_IRQ_PIN1 
IOPORT_IRQ_PIN2 
IOPORT_IRQ_PIN3 
IOPORT_IRQ_PIN4 
IOPORT_IRQ_PIN5 
IOPORT_IRQ_PIN6 
IOPORT_IRQ_PIN7 
IOPORT_IRQ_PIN_ALL 
IOPORT_IRQ_DIRECTION_ALL 
IOPORT_IRQ_REG_PORT 
IOPORT_IRQ_REG_PIN 
IOPORT_IRQ_COUNT 

Function Documentation

void avr_ioport_init ( avr_t avr,
avr_ioport_t port 
)

Here is the call graph for this function:

Here is the caller graph for this function: