1 |
/* |
/* |
2 |
* Copyright (C) 2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-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_lpt.c,v 1.5 2005/11/13 00:14:09 debug Exp $ |
* $Id: dev_lpt.c,v 1.8 2006/02/09 20:02:59 debug Exp $ |
29 |
* |
* |
30 |
* LPT (parallel printer) controller. |
* LPT (parallel printer) controller. |
31 |
*/ |
*/ |
50 |
#define DEV_LPT_LENGTH 3 |
#define DEV_LPT_LENGTH 3 |
51 |
|
|
52 |
struct lpt_data { |
struct lpt_data { |
|
int in_use; |
|
53 |
int irqnr; |
int irqnr; |
54 |
char *name; |
char *name; |
55 |
int console_handle; |
int console_handle; |
73 |
/* |
/* |
74 |
* dev_lpt_access(): |
* dev_lpt_access(): |
75 |
*/ |
*/ |
76 |
int dev_lpt_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(lpt) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
77 |
{ |
{ |
78 |
uint64_t idata = 0, odata=0; |
uint64_t idata = 0, odata=0; |
79 |
struct lpt_data *d = extra; |
struct lpt_data *d = extra; |
115 |
} |
} |
116 |
|
|
117 |
|
|
118 |
/* |
DEVINIT(lpt) |
|
* devinit_lpt(): |
|
|
*/ |
|
|
int devinit_lpt(struct devinit *devinit) |
|
119 |
{ |
{ |
120 |
struct lpt_data *d = malloc(sizeof(struct lpt_data)); |
struct lpt_data *d = malloc(sizeof(struct lpt_data)); |
121 |
size_t nlen; |
size_t nlen; |
127 |
} |
} |
128 |
memset(d, 0, sizeof(struct lpt_data)); |
memset(d, 0, sizeof(struct lpt_data)); |
129 |
d->irqnr = devinit->irq_nr; |
d->irqnr = devinit->irq_nr; |
|
d->in_use = devinit->in_use; |
|
130 |
d->name = devinit->name2 != NULL? devinit->name2 : ""; |
d->name = devinit->name2 != NULL? devinit->name2 : ""; |
131 |
d->console_handle = |
d->console_handle = console_start_slave(devinit->machine, devinit->name, |
132 |
console_start_slave(devinit->machine, devinit->name); |
CONSOLE_OUTPUT_ONLY); |
133 |
|
|
134 |
nlen = strlen(devinit->name) + 10; |
nlen = strlen(devinit->name) + 10; |
135 |
if (devinit->name2 != NULL) |
if (devinit->name2 != NULL) |