On 03.09.2009 07:18, Carl-Daniel Hailfinger wrote:
On 03.09.2009 01:12, Uwe Hermann wrote:
On Wed, Sep 02, 2009 at 09:01:01PM +0200, TURBO J wrote:
The peculiar flash chip mapping has a few other side effects, though:
+void drkaiser_chip_writeb(uint8_t val, chipaddr addr) +{
- mmio_writeb(val, drkaiser_bar + addr);
+}
+uint8_t drkaiser_chip_readb(const chipaddr addr) +{
- return mmio_readb(drkaiser_bar + addr);
+}
Please note that addr is _not_ relative to chip start. For any given chip, the addr of the lowest byte of the chip is 0x100000000-chipsize.
Please ignore the two sentences above. I was looking at the wrong version of the code.
This means your accessor functions have to implement bounds checking and either error out or wrap around. Example for wrapping around:
And to top it off, my wraparound and bounds checking examples were totally wrong. Sorry for that. I need to get some sleep and reread the code afterwards. Some bounds checking would still be nice, though.
Regards, Carl-Daniel