Main Page

Functions

# device.c File Reference

VDevice methods. More...

Go to the source code of this file.

## Functions
VDevice * | vdev_new (char *name, VDevFP_Read rd, VDevFP_Write wr, VDevFP_Reset reset, VDevFP_AddAddr add_addr)
void | vdev_def_AddAddr (VDevice *dev, int addr, char *name, int related_addr, void *data)
void | vdev_construct (VDevice *dev, VDevFP_Read rd, VDevFP_Write wr, VDevFP_Reset reset, VDevFP_AddAddr add_addr)
void | vdev_destroy (void *dev)
uint8_t | vdev_read (VDevice *dev, int addr)
void | vdev_write (VDevice *dev, int addr, uint8_t val)
void | vdev_reset (VDevice *dev)
void | vdev_set_core (VDevice *dev, AvrClass *core)
AvrClass * | vdev_get_core (VDevice *dev)
void | vdev_add_addr (VDevice *dev, int addr, char *name, int rel_addr, void *data)

## Detailed Description

VDevice methods.

These functions are the base for all other devices mapped into the device space.

Definition in file device.c.

## Function Documentation

VDevice* vdev_new | ( | char * | name,
|  | VDevFP_Read | rd,
|  | VDevFP_Write | wr,
|  | VDevFP_Reset | reset,
|  | VDevFP_AddAddr | add_addr
| ) |  |

Create a new VDevice.

Definition at line 62 of file device.c.

References avr_new0, class_overload_destroy(), vdev_construct(), and vdev_destroy().

void vdev_def_AddAddr | ( | VDevice * | dev,
|  | int | addr,
|  | char * | name,
|  | int | related_addr,
|  | void * | data
| ) |  |

Default AddAddr method.

This generate a warning that the should let the developer know that the vdev needs to be updated.

Definition at line 80 of file device.c.

References avr_warning.

void vdev_construct | ( | VDevice * | dev,
|  | VDevFP_Read | rd,
|  | VDevFP_Write | wr,
|  | VDevFP_Reset | reset,
|  | VDevFP_AddAddr | add_addr
| ) |  |

Constructor for a VDevice.

Definition at line 89 of file device.c.

References avr_error, and class_construct().

Referenced by adc_construct(), adc_intr_construct(), ocreg16_construct(), spi_construct(), spi_intr_construct(), timer0_construct(), timer16_construct(), timer_intr_construct(), uart_construct(), uart_intr_construct(), usb_construct(), usb_intr_construct(), and vdev_new().

void vdev_destroy | ( | void * | dev ) |

Destructor for a VDevice.

Definition at line 105 of file device.c.

References class_destroy().

Referenced by adc_destroy(), adc_intr_destroy(), spi_destroy(), spi_intr_destroy(), timer0_destroy(), timer_intr_destroy(), uart_destroy(), uart_intr_destroy(), usb_destroy(), usb_intr_destroy(), and vdev_new().

uint8_t vdev_read | ( | VDevice * | dev,
|  | int | addr
| ) |  |

Reads the device's value in the register at addr.

Definition at line 161 of file device.c.

Referenced by mem_io_fetch(), and mem_read().

void vdev_write | ( | VDevice * | dev,
|  | int | addr,
|  | uint8_t | val
| ) |  |

Writes an value to the register at addr.

Definition at line 168 of file device.c.

Referenced by mem_write().

void vdev_reset | ( | VDevice * | dev ) |

Resets a device.

Definition at line 175 of file device.c.

Referenced by mem_reset().

void vdev_set_core | ( | VDevice * | dev,
|  | AvrClass * | core
| ) |  |

Set the core field.

Definition at line 182 of file device.c.

AvrClass* vdev_get_core | ( | VDevice * | dev ) |

Get the core field.

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

Inform the vdevice that it needs to handle another address.

This is primarily used when creating the core in dev_supp_create_core().

Definition at line 195 of file device.c.

References avr_warning.

Automatically generated by Doxygen 1.7.2 on Wed Feb 22 2012.