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.32 2006/01/01 13:17:17 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> |
301 |
/* |
/* |
302 |
* dev_scc_access(): |
* dev_scc_access(): |
303 |
*/ |
*/ |
304 |
int dev_scc_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(scc) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
305 |
{ |
{ |
306 |
struct scc_data *d = (struct scc_data *) extra; |
struct scc_data *d = (struct scc_data *) extra; |
307 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
476 |
d->scc_nr = scc_nr; |
d->scc_nr = scc_nr; |
477 |
d->use_fb = use_fb; |
d->use_fb = use_fb; |
478 |
d->addrmul = addrmul; |
d->addrmul = addrmul; |
479 |
d->console_handle = console_start_slave(machine, "SCC"); |
d->console_handle = console_start_slave(machine, "SCC", 1); |
480 |
|
|
481 |
lk201_init(&d->lk201, use_fb, dev_scc_add_to_rx_queue, |
lk201_init(&d->lk201, use_fb, dev_scc_add_to_rx_queue, |
482 |
d->console_handle, d); |
d->console_handle, d); |
483 |
|
|
484 |
memory_device_register(mem, "scc", baseaddr, DEV_SCC_LENGTH, |
memory_device_register(mem, "scc", baseaddr, DEV_SCC_LENGTH, |
485 |
dev_scc_access, d, MEM_DEFAULT, NULL); |
dev_scc_access, d, DM_DEFAULT, NULL); |
486 |
machine_add_tickfunction(machine, dev_scc_tick, d, SCC_TICK_SHIFT); |
machine_add_tickfunction(machine, dev_scc_tick, d, SCC_TICK_SHIFT); |
487 |
|
|
488 |
return (void *) d; |
return (void *) d; |