[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Fw: Max7310: confused about the method of reading output po
From: |
Yang Ning |
Subject: |
[Qemu-devel] Fw: Max7310: confused about the method of reading output port register |
Date: |
Mon, 26 Aug 2013 09:47:06 +0800 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 |
Dear All:
Firstly,I'm writing to express my thanks to Zaborowski for the source
code of Max7310 which have helped me so much.
But I'm still confused about the method of reading output port register.
code:
case 0x01: /* Output port */
return s->level & ~s->direction;
break;
I found some instruction of output port register in the datasheet.
" Reads from the output port register reflect the value that is in the flip-flop
controlling the output selection, not the actual I/O value, which may differ if
the out-put is overloaded."
So,in my opinion,in the defination of MAX7310State,whether the property
of outputport_reg should be added?
And does the method of reading/writing output port should be modified as
follows.
[reading]
case 0x01: /* Output port */
return s->outputport_reg;
break;
[writing]
case 0x01: /* Output port */
for (diff = (data ^ s->level) & ~s->direction; diff;
diff &= ~(1 << line)) {
line = ffs(diff) - 1;
if (s->handler[line])
qemu_set_irq(s->handler[line], (data >> line) & 1);
}
s->level = (s->level & s->direction) | (data & ~s->direction);
s->outputport_reg = data;
break;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] Fw: Max7310: confused about the method of reading output port register,
Yang Ning <=