# ports.c File Reference

Module for accessing simulated I/O ports. More...

Go to the source code of this file.

## Functions
VDevice * | port_create (int addr, char *name, int rel_addr, void *data)
void | port_ext_disable (Port *p)
void | port_ext_enable (Port *p)
void | port_add_ext_rd_wr (Port *p, PortFP_ExtRd ext_rd, PortFP_ExtWr ext_wr)

## Detailed Description

Module for accessing simulated I/O ports.

Defines an abstract Port class as well as subclasses for each individual port.

Todo:
  Remove the pins argument and the mask field. That's handled at a higher level so is obsolete here now.

Definition in file ports.c.

## Function Documentation

VDevice* port_create | ( | int | addr,
|  | char * | name,
|  | int | rel_addr,
|  | void * | data |
| ) |  |  |

Create a new Port instance.

This should only be used in DevSuppDefn initializers.

Definition at line 100 of file ports.c.

void port_ext_disable | ( | Port * | p | ) |

Disable external port functionality.

This is only used when dumping memory to core file. See mem_io_fetch().

Definition at line 200 of file ports.c.

void port_ext_enable | ( | Port * | p | ) |

Enable external port functionality.

This is only used when dumping memory to core file. See mem_io_fetch().

Definition at line 210 of file ports.c.

void port_add_ext_rd_wr | ( | Port * | p,
|  | PortFP_ExtRd | ext_rd,
|  | PortFP_ExtWr | ext_wr |
| ) |  |  |

Attaches read and write functions to a particular port.

I think I may have this backwards. Having the virtual hardware supply functions for the core to call on every io read/write, might cause missed events (like edge triggered). I'm really not too sure how to handle this.

In the future, it might be better to have the core supply a function for the virtual hardware to call when data is written to the device. The device supplied function could then check if an interrupt should be generated or just simply write to the port data register.

For now, leave it as is since it's easier to test if you can block when the device is reading from the virtual hardware.

Definition at line 231 of file ports.c.

Referenced by avr_core_add_ext_rd_wr().

Automatically generated by Doxygen 1.5.5 on 7 Nov 2008.