예제 #1
0
void
avr_terminate (avr_t * avr)
{
  if (avr->special_deinit)
    avr->special_deinit (avr, avr->special_data);

  if (avr->gdb)
    {
      avr_deinit_gdb (avr);
      avr->gdb = NULL;
    }

  if (avr->vcd)
    {
      avr_vcd_close (avr->vcd);
      avr->vcd = NULL;
    }

  avr_deallocate_ios (avr);

  if (avr->flash)
    free (avr->flash);
  if (avr->data)
    free (avr->data);
  avr->flash = avr->data = NULL;
}
예제 #2
0
void LedButtonsLogic::unwireHook()
{
    const int count = strlen(ports) * 8;

    for (int i = 0; i < count; i++) {
        int port = i / 8;
        int pin = i % 8;

        avr_irq_unregister_notify(avr_io_getirq(avr, AVR_IOCTL_IOPORT_GETIRQ(ports[port]), pin),
                                  LedButtonsLogic::pinChanged, callbackData[i]);
        delete callbackData[i];
    }
    callbackData.clear();
    avr_free_irq(irq, count);

    avr_vcd_close(&vcdFile);

    irq = NULL;
}
예제 #3
0
파일: lcdlogic.cpp 프로젝트: schuay/qsimavr
void LcdLogic::unwireHook()
{
    for (int i = 0; i < 4; i++) {
        avr_irq_t * iavr = avr_io_getirq(avr, AVR_IOCTL_IOPORT_GETIRQ('C'), 4 + i);
        avr_irq_t * ilcd = hd44780.irq + IRQ_HD44780_D4 + i;

        avr_unconnect_irq(iavr, ilcd);
        avr_unconnect_irq(ilcd, iavr);
    }

    avr_unconnect_irq(avr_io_getirq(avr, AVR_IOCTL_IOPORT_GETIRQ('C'), 2),
                    hd44780.irq + IRQ_HD44780_RS);
    avr_unconnect_irq(avr_io_getirq(avr, AVR_IOCTL_IOPORT_GETIRQ('C'), 3),
                    hd44780.irq + IRQ_HD44780_E);

    avr_free_irq(hd44780.irq, IRQ_HD44780_COUNT);

    avr_vcd_close(&vcdFile);
}
예제 #4
0
void avr_terminate(avr_t * avr)
{
	if (avr->custom.deinit)
		avr->custom.deinit(avr, avr->custom.data);
	if (avr->gdb) {
		avr_deinit_gdb(avr);
		avr->gdb = NULL;
	}
	if (avr->vcd) {
		avr_vcd_close(avr->vcd);
		avr->vcd = NULL;
	}
	avr_deallocate_ios(avr);

	if (avr->flash) free(avr->flash);
	if (avr->data) free(avr->data);
	if (avr->io_console_buffer.buf) {
		avr->io_console_buffer.len = 0;
		avr->io_console_buffer.size = 0;
		free(avr->io_console_buffer.buf);
		avr->io_console_buffer.buf = NULL;
	}
	avr->flash = avr->data = NULL;
}