• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ qemu_chr_add_handlers函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中qemu_chr_add_handlers函数的典型用法代码示例。如果您正苦于以下问题:C++ qemu_chr_add_handlers函数的具体用法?C++ qemu_chr_add_handlers怎么用?C++ qemu_chr_add_handlers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了qemu_chr_add_handlers函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: generic_port_init

static int generic_port_init(VirtConsole *vcon, VirtIOSerialPort *port)
{
    if (vcon->chr) {
        qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
                              vcon);
        vcon->port.info->have_data = flush_buf;
    }
    return 0;
}
开发者ID:Anastasiia-Lada,项目名称:QEMU-s5l89xx-port,代码行数:9,代码来源:virtio-console.c


示例2: debugcon_init_core

static void debugcon_init_core(DebugconState *s)
{
    if (!s->chr) {
        fprintf(stderr, "Can't create debugcon device, empty char device\n");
        exit(1);
    }

    qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, s);
}
开发者ID:0bliv10n,项目名称:s2e,代码行数:9,代码来源:debugcon.c


示例3: milkymist_uart_realize

static void milkymist_uart_realize(DeviceState *dev, Error **errp)
{
    MilkymistUartState *s = MILKYMIST_UART(dev);

    s->chr = qemu_char_get_next_serial();
    if (s->chr) {
        qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
    }
}
开发者ID:Aakriti,项目名称:qemu,代码行数:9,代码来源:milkymist-uart.c


示例4: etraxfs_ser_realize

static void etraxfs_ser_realize(DeviceState *dev, Error **errp)
{
    ETRAXSerial *s = ETRAX_SERIAL(dev);

    if (s->chr) {
        qemu_chr_add_handlers(s->chr,
                              serial_can_receive, serial_receive,
                              serial_event, s);
    }
}
开发者ID:ehabkost,项目名称:qemu-hacks,代码行数:10,代码来源:etraxfs_ser.c


示例5: modem_driver_init

static void
modem_driver_init( int  base_port, ModemDriver*  dm, CharDriverState*  cs )
{
    dm->cs     = cs;
    dm->in_pos = 0;
    dm->in_sms = 0;
    dm->modem  = amodem_create( base_port, modem_driver_unsol, dm );

    qemu_chr_add_handlers( cs, modem_driver_can_read, modem_driver_read, NULL, dm );
}
开发者ID:AwaisKing,项目名称:mt6577_aosp_source,代码行数:10,代码来源:modem_driver.c


示例6: release_chr

static void release_chr(Object *obj, const char *name, void *opaque)
{
    DeviceState *dev = DEVICE(obj);
    Property *prop = opaque;
    CharDriverState **ptr = qdev_get_prop_ptr(dev, prop);

    if (*ptr) {
        qemu_chr_add_handlers(*ptr, NULL, NULL, NULL, NULL);
    }
}
开发者ID:breuerr,项目名称:qemu,代码行数:10,代码来源:qdev-properties.c


示例7: digic_uart_realize

static void digic_uart_realize(DeviceState *dev, Error **errp)
{
    DigicUartState *s = DIGIC_UART(dev);

    /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
    s->chr = qemu_char_get_next_serial();
    if (s->chr) {
        qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
    }
}
开发者ID:01org,项目名称:qemu-lite,代码行数:10,代码来源:digic-uart.c


示例8: charbuffer_update_handlers

static void
charbuffer_update_handlers( CharDriverState*  cs )
{
    CharBuffer*  cbuf = cs->opaque;

    qemu_chr_add_handlers( cbuf->endpoint,
                           cs->chr_can_read,
                           cs->chr_read,
                           cs->chr_event,
                           cs->handler_opaque );
}
开发者ID:Acidburn0zzz,项目名称:platform_external_qemu,代码行数:11,代码来源:charpipe.c


示例9: ipmi_bmc_extern_realize

static void ipmi_bmc_extern_realize(DeviceState *dev, Error **errp)
{
    IPMIBmcExtern *ibe = IPMI_BMC_EXTERN(dev);

    if (!ibe->chr) {
        error_setg(errp, "IPMI external bmc requires chardev attribute");
        return;
    }

    qemu_chr_add_handlers(ibe->chr, can_receive, receive, chr_event, ibe);
}
开发者ID:DirtYiCE,项目名称:qemu,代码行数:11,代码来源:ipmi_bmc_extern.c


示例10: test_server_create_chr

static void test_server_create_chr(TestServer *server, const gchar *opt)
{
    gchar *chr_path;

    chr_path = g_strdup_printf("unix:%s%s", server->socket_path, opt);
    server->chr = qemu_chr_new(server->chr_name, chr_path, NULL);
    g_free(chr_path);

    qemu_chr_add_handlers(server->chr, chr_can_read, chr_read,
                          chr_event, server);
}
开发者ID:heiher,项目名称:qemu,代码行数:11,代码来源:vhost-user-test.c


示例11: lm32_juart_init

static int lm32_juart_init(SysBusDevice *dev)
{
    LM32JuartState *s = FROM_SYSBUS(typeof(*s), dev);

    s->chr = qemu_char_get_next_serial();
    if (s->chr) {
        qemu_chr_add_handlers(s->chr, juart_can_rx, juart_rx, juart_event, s);
    }

    return 0;
}
开发者ID:frenchleaf,项目名称:qemu,代码行数:11,代码来源:lm32_juart.c


示例12: imx_serial_realize

static void imx_serial_realize(DeviceState *dev, Error **errp)
{
    IMXSerialState *s = IMX_SERIAL(dev);

    if (s->chr) {
        qemu_chr_add_handlers(s->chr, imx_can_receive, imx_receive,
                              imx_event, s);
    } else {
        DPRINTF("No char dev for uart\n");
    }
}
开发者ID:32bitmicro,项目名称:riscv-qemu,代码行数:11,代码来源:imx_serial.c


示例13: serial_init_core

static void serial_init_core(SerialState *s)
{
    if (!s->chr) {
        fprintf(stderr, "Can't create radio device, empty char device\n");
    	exit(1);
    }

    qemu_register_reset(radio_reset, s);

    qemu_chr_add_handlers(s->chr, serial_can_receive1, serial_receive1,
                          serial_event, s);
}
开发者ID:Anastasiia-Lada,项目名称:QEMU-s5l89xx-port,代码行数:12,代码来源:iphone2g_radio.c


示例14: generic_port_init

static int generic_port_init(VirtConsole *vcon, VirtIOSerialDevice *dev)
{
    vcon->port.info = dev->info;

    if (vcon->chr) {
        qemu_chr_add_handlers(vcon->chr, &chr_handlers, vcon);
        vcon->port.info->have_data = flush_buf;
        vcon->port.info->guest_open = guest_open;
        vcon->port.info->guest_close = guest_close;
    }
    return 0;
}
开发者ID:jitesh1337,项目名称:csc574-net-sec,代码行数:12,代码来源:virtio-console.c


示例15: bcm2835_aux_realize

static void bcm2835_aux_realize(DeviceState *dev, Error **errp)
{
    BCM2835AuxState *s = BCM2835_AUX(dev);

    /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
    s->chr = qemu_char_get_next_serial();

    if (s->chr) {
        qemu_chr_add_handlers(s->chr, bcm2835_aux_can_receive,
                              bcm2835_aux_receive, bcm2835_aux_event, s);
    }
}
开发者ID:fanwenyi0529,项目名称:qemu-fvm,代码行数:12,代码来源:bcm2835_aux.c


示例16: main

int main(int argc, char **argv)
{
    QTestState *s = NULL;
    CharDriverState *chr = NULL;
    const char *hugefs = 0;
    char *socket_path = 0;
    char *qemu_cmd = 0;
    char *chr_path = 0;
    int ret;

    g_test_init(&argc, &argv, NULL);

    module_call_init(MODULE_INIT_QOM);

    hugefs = init_hugepagefs();
    if (!hugefs) {
        return 0;
    }

    socket_path = g_strdup_printf("/tmp/vhost-%d.sock", getpid());

    /* create char dev and add read handlers */
    qemu_add_opts(&qemu_chardev_opts);
    chr_path = g_strdup_printf("unix:%s,server,nowait", socket_path);
    chr = qemu_chr_new("chr0", chr_path, NULL);
    g_free(chr_path);
    qemu_chr_add_handlers(chr, chr_can_read, chr_read, NULL, chr);

    /* run the main loop thread so the chardev may operate */
    data_mutex = _mutex_new();
    data_cond = _cond_new();
    _thread_new(NULL, thread_function, NULL);

    qemu_cmd = g_strdup_printf(QEMU_CMD, hugefs, socket_path);
    s = qtest_start(qemu_cmd);
    g_free(qemu_cmd);

    qtest_add_func("/vhost-user/read-guest-mem", read_guest_mem);

    ret = g_test_run();

    if (s) {
        qtest_quit(s);
    }

    /* cleanup */
    unlink(socket_path);
    g_free(socket_path);
    _cond_free(data_cond);
    _mutex_free(data_mutex);

    return ret;
}
开发者ID:anshulmakkar,项目名称:qemu,代码行数:53,代码来源:vhost-user-test.c


示例17: lm32_juart_init

static int lm32_juart_init(SysBusDevice *dev)
{
    LM32JuartState *s = LM32_JUART(dev);

    /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
    s->chr = qemu_char_get_next_serial();
    if (s->chr) {
        qemu_chr_add_handlers(s->chr, juart_can_rx, juart_rx, juart_event, s);
    }

    return 0;
}
开发者ID:01org,项目名称:qemu-lite,代码行数:12,代码来源:lm32_juart.c


示例18: rng_egd_finalize

static void rng_egd_finalize(Object *obj)
{
    RngEgd *s = RNG_EGD(obj);

    if (s->chr) {
        qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, NULL);
        qemu_chr_fe_release(s->chr);
    }

    g_free(s->chr_name);

    rng_egd_free_requests(s);
}
开发者ID:sibiaoluo,项目名称:qemu,代码行数:13,代码来源:rng-egd.c


示例19: virtserialport_initfn

/* Generic Virtio Serial Ports */
static int virtserialport_initfn(VirtIOSerialDevice *dev)
{
    VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
    VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);

    port->info = dev->info;

    if (vcon->chr) {
        qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
                              vcon);
        port->info->have_data = flush_buf;
    }
    return 0;
}
开发者ID:iggy,项目名称:qemu,代码行数:15,代码来源:virtio-console.c


示例20: virtconsole_exitfn

static int virtconsole_exitfn(VirtIOSerialPort *port)
{
    VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);

    if (vcon->chr) {
	/*
	 * Instead of closing the chardev, free it so it can be used
	 * for other purposes.
	 */
	qemu_chr_add_handlers(vcon->chr, NULL, NULL, NULL, NULL);
    }

    return 0;
}
开发者ID:Anastasiia-Lada,项目名称:QEMU-s5l89xx-port,代码行数:14,代码来源:virtio-console.c



注:本文中的qemu_chr_add_handlers函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ qemu_chr_fe_write函数代码示例发布时间:2022-05-30
下一篇:
C++ qemu_blockalign函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap