赞
踩
qdev_init_gpio_in_named
qdev_get_gpio_in_named
/**
* qdev_init_gpio_in_named() - create an array of input GPIO lines
* @dev: device to add array to
* @handler: a &typedef qemu_irq_handler function to call when GPIO is set
* @name: Name of the GPIO input (must be unique for this device)
* @n: Number of GPIO lines in this input set
*
* Like qdev_init_gpio_in_named_with_opaque(), but the opaque pointer
* passed to the handler is @dev (which is the most commonly desired behaviour).
*/
static inline void qdev_init_gpio_in_named(DeviceState *dev,
qemu_irq_handler handler,
const char *name, int n)
qdev_init_gpio_in_named(DEVICE(obj), FUNCTION_PROCESS_GPIO_PIN_IN(3,11), "gpio_pin_in_3_11", 1);
DEVICE(obj):
FUNCTION_PROCESS_GPIO_PIN_IN(3,11):handler函数
"gpio_pin_in_3_11":引脚名称
1:此引脚线个数
进入到monitor模式 telnet 127.0.0.1 12345
查看设备信息 info qtree
dev: dev01, id ""
gpio-in "gpio_pin_in_4_25" 1
gpio-in "gpio_pin_in_4_24" 1
gpio-in "gpio_pin_in_3_20" 1
gpio-in "gpio_pin_in_3_11" 1
mmio 0000000025040000/0000000000010000
typedef struct {
SysBusDevice parent_obj;
MemoryRegion iomem;
qemu_irq irq_out[32];
} ;
sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq_out[i]);
/**
* qdev_init_gpio_out_named: create an array of named output GPIO lines
* @dev: Device to create output GPIOs for
* @pins: Pointer to qemu_irq or qemu_irq array for the GPIO lines
* @name: Name to give this array of GPIO lines
* @n: Number of GPIO lines to create
*
* Like qdev_init_gpio_out(), but creates an array of GPIO output lines
* with a name. Code using the device can then connect these GPIO lines
* using qdev_connect_gpio_out_named().
*/
void qdev_init_gpio_out_named(DeviceState *dev, qemu_irq *pins,
const char *name, int n);
qdev_init_gpio_out_named(dev, &s->irq_out[11], "gpio_pinout_3_11", 1);
/**
* qdev_connect_gpio_out_named: Connect one of a device's named output
* GPIO lines
* @dev: Device whose GPIO to connect
* @name: Name of the output GPIO array
* @n: Number of the anonymous output GPIO line (which must be in range)
* @input_pin: qemu_irq to connect the output line to
*
* For anonymous output GPIO lines, use qdev_connect_gpio_out().
*/
void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
qemu_irq input_pin);
qdev_connect_gpio_out_named(gpio_out_dev, "gpio_pinout_3_11", 0,
qdev_get_gpio_in_named(gpio_in_dev, "gpio_pin_in_3_11", 0));
gpio_out_dev:gpio线输出的设备,对接irq
"gpio_pinout_3_11":gpio线输出线的名字
0:gpio线输出线的index
gpio_in_dev:gpio线输入的设备,对接handler函数
"gpio_pin_in_3_11":gpio线输入线的名字
0:gpio线输入线的index
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。