Date: Tue, 18 Jun 2013 12:59:33 +0200 From: Robert Millan <rmh@freebsd.org> To: Niclas Zeising <zeising@freebsd.org>, Bruce Evans <brde@optusnet.com.au> Cc: arch@freebsd.org Subject: Re: Bus space routines Message-ID: <CAOfDtXP=nM8jEgMWyqnAdyipL7ZcYBpXyuPiuKQ7CuAx5WFBpg@mail.gmail.com> In-Reply-To: <CAOfDtXNWMO-D1D9UAcvG_nhv4uqMQmrpEvsPd-PAEB1-FdoXtA@mail.gmail.com> References: <51C0345E.4000309@freebsd.org> <CAOfDtXNWMO-D1D9UAcvG_nhv4uqMQmrpEvsPd-PAEB1-FdoXtA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
2013/6/18 Robert Millan <rmh@freebsd.org>:
> static __inline void
> bus_space_write_1(bus_space_tag_t tag, bus_space_handle_t bsh,
> bus_size_t offset, u_int8_t value)
> {
>
> if (tag == X86_BUS_SPACE_IO)
> outb(bsh + offset, value);
> else
> *(volatile u_int8_t *)(bsh + offset) = value;
> }
>
> So why not just use those? It seems very natural to me that if you
> have something which is unambigous and reliable, you use this instead
> of something else which is prone to nasty errors.
(Yes, I'm aware that GNU systems in general don't have this, and that
using bus_space_* would introduce a portability nuissance, but IMHO
this is much better than encouraging them to use the non-portable
<sys/io.h> from Glibc right away. At least this forces them to think
about what they're doing)
--
Robert Millan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOfDtXP=nM8jEgMWyqnAdyipL7ZcYBpXyuPiuKQ7CuAx5WFBpg>
