[Oberon] Hardware driver construction 'capacity building' [3D Acc.]

Thomas Frey frey at inf.ethz.ch
Wed Jan 22 10:13:01 CET 2003


> Well yes, it's uncomfortable translating C code;
> but I'm still waiting to hear if it's only me who has pain in
> translating between:
>
> Clear Bits 0,1 of s
> s -> Port(61H)
>
>    and this monster:
>
> s := s - {0, 1};
The bit clearing part is easy in Oberon compared to s &= 0xfffffffc;

> SYSTEM.PORTOUT (61H, SYSTEM.VAL(CHAR, s))
>
> This is terribly unintuitive !
>
> Also,
> SYSTEM.PORTIN (61H, SYSTEM.VAL(CHAR, s));
> seems absurd, since by conventional (and also n-o) syntax,
>   SYSTEM.VAL(CHAR, s) must execute before:
> SYSTEM.PORTIN (61H, <byte>).
>
> I.e. the 'value' must be converted to 'CHAR type',
> *before* it is obtained/available ?!
>
> Is there a gentle tutorial to introduce this strange syntax.
>
> A colaborative project to 'write hardware drivers in general'
> rather than just 3D Acc. is needed.

Modern HW usually allows memory mapped I/O (not using the
IA32 specific PORT hack)
For mmio there are some new SYSTEM methods that remove this
VAL problem:
SYSTEM.PUT8(adr, val : LONGINT);
SYSTEM.PUT16(adr, val : LONGINT);
SYSTEM.PUT32(adr, val : LONGINT);
SYSTEM.GET8(adr : LONGINT) : LONGINT;
SYSTEM.GET6(adr : LONGINT) : LONGINT;
SYSTEM.GET32(adr : LONGINT): LONGINT;

Of course you still need VAL to convert LONGINT to SET and vice versa.
The syntax is clear since the return value is the result of a function
procedure.

--Thomas





More information about the Oberon mailing list