Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 32 lines (26 sloc) 0.826 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
#include "qdev.h"
#include "qdev-addr.h"
#include "targphys.h"

/* --- target physical address --- */

static int parse_taddr(DeviceState *dev, Property *prop, const char *str)
{
    target_phys_addr_t *ptr = qdev_get_prop_ptr(dev, prop);

    *ptr = strtoull(str, NULL, 16);
    return 0;
}

static int print_taddr(DeviceState *dev, Property *prop, char *dest, size_t len)
{
    target_phys_addr_t *ptr = qdev_get_prop_ptr(dev, prop);
    return snprintf(dest, len, "0x" TARGET_FMT_plx, *ptr);
}

PropertyInfo qdev_prop_taddr = {
    .name = "taddr",
    .type = PROP_TYPE_TADDR,
    .size = sizeof(target_phys_addr_t),
    .parse = parse_taddr,
    .print = print_taddr,
};

void qdev_prop_set_taddr(DeviceState *dev, const char *name, target_phys_addr_t value)
{
    qdev_prop_set(dev, name, &value, PROP_TYPE_TADDR);
}
Something went wrong with that request. Please try again.