1 |
/* |
/* |
2 |
* Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2003-2006 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_scc.c,v 1.28 2005/10/26 14:37:04 debug Exp $ |
* $Id: dev_scc.c,v 1.34 2006/07/23 14:37:34 debug Exp $ |
29 |
* |
* |
30 |
* Serial controller on some DECsystems and SGI machines. (Z8530 ?) |
* Serial controller on some DECsystems and SGI machines. (Z8530 ?) |
31 |
* Most of the code in here is written for DECsystem emulation, though. |
* Most of the code in here is written for DECsystem emulation, though. |
40 |
* emulate the same lk201 behaviour as when using the dc device) |
* emulate the same lk201 behaviour as when using the dc device) |
41 |
* DMA |
* DMA |
42 |
* More correct interrupt support. |
* More correct interrupt support. |
43 |
|
* |
44 |
|
****************************************************************************** |
45 |
|
* _____ ___ ____ ___ _ |
46 |
|
* |_ _/ _ \| _ \ / _ \| | |
47 |
|
* | || | | | | | | | | | | |
48 |
|
* | || |_| | |_| | |_| |_| |
49 |
|
* |_| \___/|____/ \___/(_) |
50 |
|
* |
51 |
|
* Since this is actually a Z8530, it should be merged with dev_z8530.c! |
52 |
*/ |
*/ |
53 |
|
|
54 |
#include <stdio.h> |
#include <stdio.h> |
147 |
} |
} |
148 |
|
|
149 |
|
|
150 |
/* |
DEVICE_TICK(scc) |
|
* dev_scc_tick(): |
|
|
*/ |
|
|
void dev_scc_tick(struct cpu *cpu, void *extra) |
|
151 |
{ |
{ |
152 |
int i; |
int i; |
153 |
struct scc_data *d = (struct scc_data *) extra; |
struct scc_data *d = (struct scc_data *) extra; |
295 |
} |
} |
296 |
|
|
297 |
|
|
298 |
/* |
DEVICE_ACCESS(scc) |
|
* dev_scc_access(): |
|
|
*/ |
|
|
int dev_scc_access(struct cpu *cpu, struct memory *mem, |
|
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
299 |
{ |
{ |
300 |
struct scc_data *d = (struct scc_data *) extra; |
struct scc_data *d = (struct scc_data *) extra; |
301 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
470 |
d->scc_nr = scc_nr; |
d->scc_nr = scc_nr; |
471 |
d->use_fb = use_fb; |
d->use_fb = use_fb; |
472 |
d->addrmul = addrmul; |
d->addrmul = addrmul; |
473 |
d->console_handle = console_start_slave(machine, "SCC"); |
d->console_handle = console_start_slave(machine, "SCC", 1); |
474 |
|
|
475 |
lk201_init(&d->lk201, use_fb, dev_scc_add_to_rx_queue, |
lk201_init(&d->lk201, use_fb, dev_scc_add_to_rx_queue, |
476 |
d->console_handle, d); |
d->console_handle, d); |
477 |
|
|
478 |
memory_device_register(mem, "scc", baseaddr, DEV_SCC_LENGTH, |
memory_device_register(mem, "scc", baseaddr, DEV_SCC_LENGTH, |
479 |
dev_scc_access, d, MEM_DEFAULT, NULL); |
dev_scc_access, d, DM_DEFAULT, NULL); |
480 |
machine_add_tickfunction(machine, dev_scc_tick, d, SCC_TICK_SHIFT); |
machine_add_tickfunction(machine, dev_scc_tick, d, SCC_TICK_SHIFT, 0.0); |
481 |
|
|
482 |
return (void *) d; |
return (void *) d; |
483 |
} |
} |