Main Page | File List | Globals | Related Pages

ports.c File Reference

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

Go to the source code of this file.

Functions

Port * port_new (char *name, int base, int pins, PortFP_AltRd alt_rd, PortFP_AltWr alt_wr)
void port_construct (Port *p, char *name, int base, int pins, PortFP_AltRd alt_rd, PortFP_AltWr alt_wr)
void port_destroy (void *p)
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)
PortA * porta_new (int pins)
void porta_construct (PortA *p, int pins)
void porta_destroy (void *p)
PortB * portb_new (int pins)
void portb_construct (PortB *p, int pins)
void portb_destroy (void *p)
PortC * portc_new (int pins)
void portc_construct (PortC *p, int pins)
void portc_destroy (void *p)
PortD * portd_new (int pins)
void portd_construct (PortD *p, int pins)
void portd_destroy (void *p)
PortE * porte_new (int pins)
void porte_construct (PortE *p, int pins)
void porte_destroy (void *p)
PortF * portf_new (int pins)
void portf_construct (PortF *p, int pins)
void portf_destroy (void *p)

Variables

char * name_PIN [] = { "PINA", "PINB", "PINC", "PIND", "PINE", "PINF" }
char * name_DDR [] = { "DDRA", "DDRB", "DDRC", "DDRD", "DDRE", "DDRF" }
char * name_PORT [] = { "PORTA", "PORTB", "PORTC", "PORTD", "PORTE", "PORTF" }


Detailed Description

Module for accessing simulated I/O ports.

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

Definition in file ports.c.


Function Documentation

Port* port_new char *  name,
int  base,
int  pins,
PortFP_AltRd  alt_rd,
PortFP_AltWr  alt_wr
 

Allocates a new Port object.

This is a virtual method for higher level port implementations and as such should not be used directly. Definition at line 107 of file ports.c.

References avr_new, class_overload_destroy(), port_construct(), and port_destroy().

void port_construct Port *  p,
char *  name,
int  base,
int  pins,
PortFP_AltRd  alt_rd,
PortFP_AltWr  alt_wr
 

Constructor for the Port object.

This is a virtual method for higher level port implementations and as such should not be used directly. Definition at line 126 of file ports.c.

References avr_error, and vdev_construct().

Referenced by port_new(), porta_construct(), portb_construct(), portc_construct(), portd_construct(), porte_construct(), and portf_construct().

void port_destroy void *  p  ) 
 

Destructor for the Port object.

This is a virtual method for higher level port implementations and as such should not be used directly. Definition at line 164 of file ports.c.

References vdev_destroy().

Referenced by port_new(), porta_destroy(), portb_destroy(), portc_destroy(), portd_destroy(), porte_destroy(), and portf_destroy().

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 177 of file ports.c.

Referenced by mem_io_fetch().

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 187 of file ports.c.

Referenced by mem_io_fetch().

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 208 of file ports.c.

Referenced by avr_core_add_ext_rd_wr().

PortA* porta_new int  pins  ) 
 

Allocate a new PortA object.

Definition at line 354 of file ports.c.

References avr_new, class_overload_destroy(), porta_construct(), and porta_destroy().

Referenced by dev_supp_create_core().

void porta_construct PortA *  p,
int  pins
 

Constructor for the PortA object.

Port A also functions as low byte of address into external SRAM if enabled.

  • PAn <--> ADn
Definition at line 372 of file ports.c.

References avr_error, name_PORT, and port_construct().

Referenced by porta_new().

void porta_destroy void *  p  ) 
 

Destructor for the PortA object.

Definition at line 384 of file ports.c.

References port_destroy().

Referenced by porta_new().

PortB* portb_new int  pins  ) 
 

Allocate a new PortB object.

Definition at line 401 of file ports.c.

References avr_new, class_overload_destroy(), portb_construct(), and portb_destroy().

Referenced by dev_supp_create_core().

void portb_construct PortB *  p,
int  pins
 

Constructor for the PortB object.

Definition at line 415 of file ports.c.

References avr_error, name_PORT, and port_construct().

Referenced by portb_new().

void portb_destroy void *  p  ) 
 

Destructor for the PortB object.

Definition at line 427 of file ports.c.

References port_destroy().

Referenced by portb_new().

PortC* portc_new int  pins  ) 
 

Allocate a new PortC object.

Definition at line 444 of file ports.c.

References avr_new, class_overload_destroy(), portc_construct(), and portc_destroy().

Referenced by dev_supp_create_core().

void portc_construct PortC *  p,
int  pins
 

Constructor for the PortC object.

Definition at line 458 of file ports.c.

References avr_error, name_PORT, and port_construct().

Referenced by portc_new().

void portc_destroy void *  p  ) 
 

Destructor for the PortC object.

Definition at line 470 of file ports.c.

References port_destroy().

Referenced by portc_new().

PortD* portd_new int  pins  ) 
 

Allocate a new PortD object.

Definition at line 487 of file ports.c.

References avr_new, class_overload_destroy(), portd_construct(), and portd_destroy().

Referenced by dev_supp_create_core().

void portd_construct PortD *  p,
int  pins
 

Constructor for the PortD object.

Definition at line 501 of file ports.c.

References avr_error, name_PORT, and port_construct().

Referenced by portd_new().

void portd_destroy void *  p  ) 
 

Destructor for the PortD object.

Definition at line 513 of file ports.c.

References port_destroy().

Referenced by portd_new().

PortE* porte_new int  pins  ) 
 

Allocate a new PortE object.

Definition at line 530 of file ports.c.

References avr_new, class_overload_destroy(), porte_construct(), and porte_destroy().

Referenced by dev_supp_create_core().

void porte_construct PortE *  p,
int  pins
 

Constructor for the PortE object.

Definition at line 544 of file ports.c.

References avr_error, name_PORT, and port_construct().

Referenced by porte_new().

void porte_destroy void *  p  ) 
 

Destructor for the PortE object.

Definition at line 556 of file ports.c.

References port_destroy().

Referenced by porte_new().

PortF* portf_new int  pins  ) 
 

Allocate a new PortF object.

Definition at line 573 of file ports.c.

References avr_new, class_overload_destroy(), portf_construct(), and portf_destroy().

Referenced by dev_supp_create_core().

void portf_construct PortF *  p,
int  pins
 

Constructor for the PortF object.

Definition at line 587 of file ports.c.

References avr_error, name_PORT, and port_construct().

Referenced by portf_new().

void portf_destroy void *  p  ) 
 

Destructor for the PortF object.

Definition at line 599 of file ports.c.

References port_destroy().

Referenced by portf_new().


Variable Documentation

char* name_PIN[] = { "PINA", "PINB", "PINC", "PIND", "PINE", "PINF" }
 

FIXME: This should be static.

Definition at line 67 of file ports.c.

char* name_DDR[] = { "DDRA", "DDRB", "DDRC", "DDRD", "DDRE", "DDRF" }
 

FIXME: This should be static.

Definition at line 70 of file ports.c.

char* name_PORT[] = { "PORTA", "PORTB", "PORTC", "PORTD", "PORTE", "PORTF" }
 

FIXME: This should be static.

Definition at line 73 of file ports.c.

Referenced by avr_core_add_ext_rd_wr(), porta_construct(), portb_construct(), portc_construct(), portd_construct(), porte_construct(), and portf_construct().


Automatically generated by Doxygen 1.3.8 on 11 Aug 2004.