dev_ns16550.cc Source File
Back to the index.
Go to the documentation of this file.
51 #define DEV_NS16550_LENGTH 8
110 uint64_t idata = 0, odata=0;
120 fatal(
"[ ns16550 (%s): len=%i, idata=0x%16llx! ]\n",
121 d->
name, len, (
long long)idata);
141 fatal(
"[ ns16550 (%s): outside register space? relative_addr="
142 "0x%llx. bad addrmult? bad device length? ]\n", d->
name,
143 (
long long)relative_addr);
147 switch (relative_addr) {
169 odata = x < 0? 0 : x;
171 dev_ns16550_tick(
cpu, d);
180 debug(
"[ ns16550 (%s): speed set to %i bps ]\n",
191 debug(
"[ ns16550 (%s): write to ier: 0x%02x ]"
192 "\n", d->
name, (
int)idata);
200 dev_ns16550_tick(
cpu, d);
207 debug(
"[ ns16550 (%s): write to fifo control: 0x%02x ]"
208 "\n", d->
name, (
int)idata);
214 debug(
"[ ns16550 (%s): read from iir: 0x%02x ]\n",
215 d->
name, (
int)odata);
216 dev_ns16550_tick(
cpu, d);
222 debug(
"[ ns16550 (%s): write to lsr: 0x%02x ]\n",
223 d->
name, (
int)idata);
234 debug(
"[ ns16550 (%s): write to msr: 0x%02x ]\n",
235 d->
name, (
int)idata);
239 debug(
"[ ns16550 (%s): read from msr: 0x%02x ]\n",
240 d->
name, (
int)odata);
247 switch (idata & 0x7) {
257 switch ((idata & 0x38) / 0x8) {
258 case 0: d->
parity =
'N';
break;
259 case 1: d->
parity =
'O';
break;
260 case 2: d->
parity =
'?';
break;
261 case 3: d->
parity =
'E';
break;
262 case 4: d->
parity =
'?';
break;
263 case 5: d->
parity =
'Z';
break;
264 case 6: d->
parity =
'?';
break;
265 case 7: d->
parity =
'o';
break;
268 d->
dlab = idata & 0x80? 1 : 0;
270 debug(
"[ ns16550 (%s): write to lctl: 0x%02x (%s%s"
271 "setting mode %i%c%s) ]\n", d->
name, (
int)idata,
272 d->
dlab?
"Divisor Latch access, " :
"",
273 idata&0x40?
"sending BREAK, " :
"",
277 debug(
"[ ns16550 (%s): read from lctl: 0x%02x ]\n",
278 d->
name, (
int)odata);
285 debug(
"[ ns16550 (%s): write to mcr: 0x%02x ]\n",
286 d->
name, (
int)idata);
290 dev_ns16550_tick(
cpu, d);
293 debug(
"[ ns16550 (%s): read from mcr: 0x%02x ]\n",
294 d->
name, (
int)odata);
300 debug(
"[ ns16550 (%s): read from reg %i ]\n",
301 d->
name, (
int)relative_addr);
302 odata = d->
reg[relative_addr];
304 debug(
"[ ns16550 (%s): write to reg %i:",
305 d->
name, (
int)relative_addr);
306 for (i=0; i<len; i++)
309 d->
reg[relative_addr] = idata;
327 memset(d, 0,
sizeof(
struct ns_data));
void console_putchar(int handle, int ch)
#define INTERRUPT_CONNECT(name, istruct)
#define INTERRUPT_ASSERT(istruct)
void console_makeavail(int handle, char ch)
addr & if(addr >=0x24 &&page !=NULL)
void memory_device_register(struct memory *mem, const char *, uint64_t baseaddr, uint64_t len, int(*f)(struct cpu *, struct memory *, uint64_t, unsigned char *, size_t, int, void *), void *extra, int flags, unsigned char *dyntrans_data)
int console_charavail(int handle)
#define DEV_NS16550_LENGTH
void machine_add_tickfunction(struct machine *machine, void(*func)(struct cpu *, void *), void *extra, int clockshift)
void COMBINE() strlen(struct cpu *cpu, struct arm_instr_call *ic, int low_addr)
void fatal(const char *fmt,...)
uint64_t memory_readmax64(struct cpu *cpu, unsigned char *buf, int len)
int console_readchar(int handle)
unsigned char reg[DEV_NS16550_LENGTH]
int console_start_slave(struct machine *machine, const char *consolename, int use_for_input)
#define INTERRUPT_DEASSERT(istruct)
void memory_writemax64(struct cpu *cpu, unsigned char *buf, int len, uint64_t data)
#define CHECK_ALLOCATION(ptr)
Generated on Tue Aug 25 2020 19:25:06 for GXemul by
1.8.18