Subject: =?iso-8859-1?Q?FreeBSD=B4s_ioperm=28=29_vs=2E_NetBSD=B4s_i386=5Fset=5Fi?=
To: tech-kern (E-Mail) <tech-kern@netbsd.org>
From: Nicolas Saurbier <Nicolas.Saurbier@biodata.de>
List: tech-kern
Date: 07/17/2003 12:35:30
This is a multi-part message in MIME format.

------_=_NextPart_001_01C34C4F.2513CB8C
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

I=B4m trying to modify a piece of code, that allows controlling 8 LEDs, =
connected directly to DATA 1-8 of LPT0. The software ist working under =
Linux and FreeBSD. My problem is to implement, what under Linux/FreeBSD =
is just done by:

ioperm(0x378, 1, 1)

I tried to copy some stuff from /drivers/port.h, but the compiler says:

Host1>make
g++ -O1 -o meskalin meskalin.cpp
/tmp/ccwqSvfh.o: In function `meskalin::startio(void)':
/tmp/ccwqSvfh.o(.text+0x15b): undefined reference to `i386_get_ioperm'
/tmp/ccwqSvfh.o(.text+0x16d): undefined reference to `i386_set_ioperm'
collect2: ld returned 1 exit status
*** Error code 1

Stop.
Host1>

From googling the web, I found several Threads dealing with =
i386_set_ioperm(), but this stuff seems to extrem to me ;-). Can any1 =
please tell me, how to get this working on NetBSD???

Thanx=20

P.S.: Please find attached the c-code and the hpp.
P.P.S: I=B4m not sure if this is the right mailing-list... ;-)

Nic

------_=_NextPart_001_01C34C4F.2513CB8C
Content-Type: application/octet-stream;
	name="mescalin.hpp"
Content-Transfer-Encoding: base64
Content-Description: mescalin.hpp
Content-Disposition: attachment;
	filename="mescalin.hpp"

b3N0MT5tb3JlIG1lc2thbGluLmhwcA0KDQojaW5jbHVkZSAgICAgICAgPHN0ZGlvLmg+DQojaW5j
bHVkZSAgICAgICAgPHN0ZGxpYi5oPg0KI2luY2x1ZGUgICAgICAgIDx1bmlzdGQuaD4NCiNpbmNs
dWRlICAgICAgICA8c3RyaW5nLmg+DQojaWZkZWYgX19GcmVlQlNEX18NCiAgICAgICAgI2luY2x1
ZGU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IHZvaWQgICAgb3V0aW8oaW50IHZhbHVlKTsN
Cg0KfTsNCg0KbWVza2FsaW4gbWVza2FsaW47DQoNCkhvc3QxPg==

------_=_NextPart_001_01C34C4F.2513CB8C
Content-Type: application/octet-stream;
	name="mescalin.cpp"
Content-Transfer-Encoding: base64
Content-Description: mescalin.cpp
Content-Disposition: attachment;
	filename="mescalin.cpp"

SG9zdDE+bW9yZSBtZXNrYWxpbi5jcHANCg0KI2luY2x1ZGUgICAgICAgICJtZXNrYWxpbi5ocHAi
DQoNCg0KaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKmFyZ3ZbXSkNCnsNCmludCBmcmVxdWVuY3kg
PSAxMDsNCmNoYXIgKnBhdHRlcm47DQpjaGFyICpzcGVjaWFsOw0KY2hhciAqcGF0dGVybl9vcHQ7
DQpjaGFyICpzcGVjaWFsX29wdDsNCmNoYXIgcGF0dGVybl9vcHRfZGVmYXVsdFtdID0gIm5vbmUi
Ow0KY2hhciBzcGVjaWFsX29wdF9kZWZhdWx0W10gPSAibm9uZSI7DQoNCiAgICAgICAgZm9yKGlu
dCBpPTE7IGFyZ2M+aTsgaSsrKQ0KICAgICAgICB7DQogICAgICAgIC8vcHJpbnRmKCJhcmd1bWVu
dDogJXNcbiIsIGFyZ3ZbaV0pOyAvL2RidWcNCiAgICAgICAgICAgICAgICBpZihhcmd2W2ldWzBd
PT0nLScpDQogICAgICAgICAgICAgICAgew0KICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNo
KGFyZ3ZbaV1bMV0pDQogICAgICAgICAgICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgIGNhc2UgJ2gnOg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVza2FsaW4udXNh
Z2UoYXJndlswXSk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJl
YWs7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICBjYXNlICdzJzoNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWwgPSBh
cmd2W2krMV07DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICBpZiAoKGFyZ2MtaSk8Mikgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgbWVza2FsaW4udXNhZ2UoYXJndlswXSk7DQogICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGFyZ2MtaSk+Mikgew0KICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lhbF9vcHQgPSBhcmd2W2krMl07
DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Ug
ew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lh
bF9vcHQgPSBzcGVjaWFsX29wdF9kZWZhdWwNCnQ7DQogICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgYnJlYWs7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCg0KICAg
ICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgLy9wcmludGYo
InN3aXRjaGVkIHRvOiAlY1xuIiwgYXJndltpXVsxXSk7DQogICAgICAgICAgICAgICAgfQ0KICAg
ICAgICB9DQoNCiAgICAgICAgLy9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