Exemplo n.º 1
0
void ts802_state::ts802(machine_config &config)
{
	/* basic machine hardware */
	Z80(config, m_maincpu, 16_MHz_XTAL / 4);
	m_maincpu->set_addrmap(AS_PROGRAM, &ts802_state::ts802_mem);
	m_maincpu->set_addrmap(AS_IO, &ts802_state::ts802_io);
	//m_maincpu->set_daisy_config(daisy_chain_intf); // causes problems

	/* Devices */
	GENERIC_TERMINAL(config, m_terminal, 0);
	m_terminal->set_keyboard_callback(FUNC(ts802_state::kbd_put));

	z80dma_device& dma(Z80DMA(config, "dma", 16_MHz_XTAL / 4));
	dma.out_busreq_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
	dma.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
	dma.in_mreq_callback().set(FUNC(ts802_state::memory_read_byte));
	dma.out_mreq_callback().set(FUNC(ts802_state::memory_write_byte));
	dma.in_iorq_callback().set(FUNC(ts802_state::io_read_byte));
	dma.out_iorq_callback().set(FUNC(ts802_state::io_write_byte));

	z80dart_device& dart1(Z80DART(config, "dart1", 16_MHz_XTAL / 4));
	dart1.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);

	z80dart_device& dart2(Z80DART(config, "dart2", 16_MHz_XTAL / 4));
	dart2.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);

	z80ctc_device& ctc(Z80CTC(config, "ctc", 16_MHz_XTAL / 4));
	ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);

	FD1793(config, "fdc", 4'000'000 / 2);                  // unknown clock
	FLOPPY_CONNECTOR(config, "fdc:0", ts802_floppies, "525dd", floppy_image_device::default_floppy_formats).enable_sound(true);
}
Exemplo n.º 2
0
Arquivo: pia.c Projeto: jjgreen/pia
static void fit(const point_t *x, size_t cx,
		vertex_t *ix,
		int32_t fudge,
		float sclx,
		float scly,
		float mid,
		box_t B)
{
  int32_t c = cx;

  while (c--)
    {
      ix[c].ip.x =
	((int32_t)dma(x[c].x - B.min.x, sclx, -mid) & ~7)
	| fudge
	| (c & 1);

      ix[c].ip.y =
	((int32_t)dma(x[c].y - B.min.y, scly, -mid) & ~7)
	| fudge;
    }

  ix[0].ip.y += (cx & 1);
  ix[cx].ip = ix[0].ip;

  c = cx;

  while (c--)
    {
      if (ix[c].ip.x < ix[c + 1].ip.x)
	ix[c].rx = (rng_t){ix[c].ip.x, ix[c + 1].ip.x};
      else
	ix[c].rx = (rng_t){ix[c + 1].ip.x, ix[c].ip.x};

      if (ix[c].ip.y < ix[c + 1].ip.y)
	ix[c].ry = (rng_t){ix[c].ip.y, ix[c + 1].ip.y};
      else
	ix[c].ry = (rng_t){ix[c + 1].ip.y, ix[c].ip.y};

      ix[c].in = 0;
    }
}
Exemplo n.º 3
0
static void slave(void) {
  int slave_id = core_id-1;

  while (shm_slave_mpb[slave_id]->packet.cmd != CMD_START) {
    /* spin until start packet arrives */
  }
  /* respond to start packet */
  shm_slave_mpb[slave_id]->row.cmd = CMD_START;
  dma(&(shm_master_mpb->slave[slave_id].row),
      &(shm_slave_mpb[slave_id]->row),
      sizeof(struct rowbuf_t)); 

  /* loop while new packets arrive */
  for (;;) {
    while (shm_slave_mpb[slave_id]->packet.cmd <= CMD_NULL
           && shm_slave_mpb[slave_id]->packet.cmd != CMD_STOP) {
      /* spin until packet arrives */
    }
    /* terminate if stop packet arrives */
    if (shm_slave_mpb[slave_id]->packet.cmd == CMD_STOP) {
      break;
    }

    /* copy packet to local memory */
    struct packet_t p = shm_slave_mpb[slave_id]->packet;
    /* clear command */
    shm_slave_mpb[slave_id]->packet.cmd = CMD_NULL;
    /* compute pixels for one row */
    int x, idx;
    for (idx = 0, x = p.xstart; x < p.xend; idx++, x += p.xstep) {
      int val = do_iter(x, p.yval, MAX_SQUARE, MAX_ITER);
      shm_slave_mpb[slave_id]->row.data[idx] = map[val & 0x3f];
    }
    /* send row */
    shm_slave_mpb[slave_id]->row.cmd = p.cmd;
    dma(&(shm_master_mpb->slave[slave_id].row),
        &(shm_slave_mpb[slave_id]->row),
        sizeof(struct rowbuf_t));
  }
}
Exemplo n.º 4
0
int main()
{
st *p;
st *q;

p=dma();
dma1(&q);

p->i=10;
p->ch='a';
p->f=67.9;
q->i=20;
q->ch='b';
q->f=76.9;

printf("\n%d %c %f \n",p->i,p->ch,p->f);
printf("\n%d %c %f \n",q->i,q->ch,q->f);
return 0;
}
Exemplo n.º 5
0
int main() {
	auto ledStripG = GpioB[5];
	DmaStream dma(2, 3, 3);
	auto ledStripS = Spi(1, &dma);
	//auto ledStripS = Spi(1);
	LedStrip ledStrip(ledStripS);

	ledStripG
		.setPushPull()
		.setDirection(Gpio::OUTPUT)
		.setSpeed(Gpio::SPEED_100MHz);

	ledStripG = false;
	time.msleep(2);
	ledStripG = true;
	time.msleep(2);
	ledStripG = false;
	time.msleep(2);
	ledStripG = true;
	ledStripS.configGpio(ledStripG);
	time.msleep(4);

	int l = 0;
	while(1) {
		for(int i=0; i<71; ++i) {
			if(l==i)
				ledStrip.push(0, 255, 0);
			else
				ledStrip.push(6, 0, 0);
		}
		ledStrip.push(0, 0, 0);

		l++;
		l %= 72;
		ledStrip.reset();
		//time.msleep(200);
	}
}
Exemplo n.º 6
0
static void master(void) {
  unsigned i;

  write_xpm_header();

  /* clear response fields */
  for (i = 0; i < SLAVES; i++) {
    shm_master_mpb->slave[i].row.cmd = CMD_STOP;
  }
  /* send start packets */
  for (i = 0; i < SLAVES; i++) {
    shm_master_mpb->slave[i].packet.cmd = CMD_START;
    dma(&(shm_slave_mpb[i]->packet),
        &(shm_master_mpb->slave[i].packet),
        sizeof(struct packet_t));
  }
  /* wait for acknowledgement */
  for (i = 0; i < SLAVES; i++) {
    while (shm_master_mpb->slave[i].row.cmd != CMD_START) {
      /* spin until start reponse */
    }
  }
  /* clear response fields */
  for (i = 0; i < SLAVES; i++) {
    shm_master_mpb->slave[i].row.cmd = CMD_NULL;
  }

  int row[SLAVES];
  int received_row;
    
  /* send first packets to slaves */
  for (i = 0; i < SLAVES && i < ROWS; i++) {
    row[i] = i*(ROWS/SLAVES);   
    shm_master_mpb->slave[i].packet.cmd    = row[i];
    shm_master_mpb->slave[i].packet.yval   = YSTART + row[i]*YSTEP_SIZE;
    shm_master_mpb->slave[i].packet.xstart = XSTART;
    shm_master_mpb->slave[i].packet.xend   = XEND;
    shm_master_mpb->slave[i].packet.xstep  = XSTEP_SIZE;      
    dma(&(shm_slave_mpb[i]->packet),
        &(shm_master_mpb->slave[i].packet),
        sizeof(struct packet_t));

    row[i]++;
  }
  /* receive rows and send next packets */
  for (received_row = 0; received_row < ROWS; ) {
    for (i = 0; i < SLAVES; i++) {
      if (shm_master_mpb->slave[i].row.cmd != CMD_NULL) {
        received_row++;

        static char buf[10];
        itoa(buf, shm_master_mpb->slave[i].row.cmd);
        WRITE(buf, 10);

        /* write out data */
        WRITE(" 68c\n\"", 6);
        WRITE((char *)shm_master_mpb->slave[i].row.data, COLS);
        WRITE("\",\n.\nw\n", 7);

        /* clear response field */
        shm_master_mpb->slave[i].row.cmd = CMD_NULL;

        /* send next packet */
        if (row[i] < (i+1)*(ROWS/SLAVES)) {
          shm_master_mpb->slave[i].packet.cmd    = row[i];
          shm_master_mpb->slave[i].packet.yval   = YSTART + row[i]*YSTEP_SIZE;
          shm_master_mpb->slave[i].packet.xstart = XSTART;
          shm_master_mpb->slave[i].packet.xend   = XEND;
          shm_master_mpb->slave[i].packet.xstep  = XSTEP_SIZE;    
          dma(&(shm_slave_mpb[i]->packet),
              &(shm_master_mpb->slave[i].packet),
              sizeof(struct packet_t));

          row[i]++;
        }
      }
    }
  }

  /* send stop packets */
  for (i = 0; i < SLAVES; i++) {
    shm_master_mpb->slave[i].packet.cmd = CMD_STOP;
    dma(&(shm_slave_mpb[i]->packet),
        &(shm_master_mpb->slave[i].packet),
        sizeof(struct packet_t));
  }
}