Subject: Re: Few Jornada 690 questions
To: None <port-hpcsh@netbsd.org>
From: Adam Wysocki via ArcaBit <gophi@arcabit.pl>
List: port-hpcsh
Date: 08/21/2006 21:23:04
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--8323328-634236372-1156171275=:1058
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.LNX.4.64.0608211641471.1058@localhost.localdomain>
17.08.06 uwe@ptc.spbu.ru wrote:
> There's no sound *card* in sh3 jornadas. There's an on-chip 8-bit DAC
> and one of its channels is hooked to the speaker. You need to feed
> the DAC directly from the CPU. This means that you need to have 8K
> interrupts per second to play even crappy lo-fi 8KHz 8bit audio.
I tried to do it in userspace (I'm new to NetBSD so writing a custom
driver could be kind of challenge for now) and even managed to output
some sound (and learned the hard way that securelevel greater than 0
prevents readwrite /dev/mem accesses), but it seems that there's no
easy way to get the userspace code executed at 8000 Hz. NetBSD doesn't
seem to have a realtime scheduler (seems strange, so maybe I'm wrong)
and setitimer() and usleep() on this CPU just doesn't work at this
frequency even when reniced to -20. Maximum archieved frequency,
both using setitimer() and usleep(), was 32 Hz.
[gophi@hpcsh ~/src]$ make test && sudo nice -n -20 ./test
cc -O -o test test.c
us=3122254 (should be 1000000), freq=32 (should be 100)
[gophi@hpcsh ~/src]$ make test2 && sudo nice -n -20 ./test2
cc -O -o test2 test2.c
us=3119995 (should be 1000000), freq=32 (should be 100)
(test.c and test2.c attached)
> There is on-chip DMAC that can do timed transfers using internal
> counter-timer, but attempts to use it wedge the machine ~immediately.
Seems promising. Have you tried it with a lower frequency than 8 kHz?
Maybe it just didn't worked because of too high frequency. Do you have
some details on this controller?
--
[ Adam Wysocki, www.chmurka.net, GSM: +48 514 710 213 ]
[ Software Development Department, ArcaBit Sp. z o.o. ]
[ Ul. Fortuny 9 :: 01-339 Warszawa :: www.arcabit.com ]
--8323328-634236372-1156171275=:1058
Content-Type: TEXT/X-CSRC; CHARSET=US-ASCII; NAME=test.c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SAqIDEwMDAwMDBMICsgKHR2
WzFdLnR2X3VzZWMgLSB0dlswXS50dl91c2VjKTsNCg0KCXByaW50ZigidXM9
JWx1IChzaG91bGQgYmUgJWx1KSwgZnJlcT0lbHUgKHNob3VsZCBiZSAlbHUp
XG4iLCANCgkJdXMsIE5VTSAqIDEwMDAwMDBMIC8gRlJFUSwgMTAwMDAwMEwg
KiBOVU0gLyB1cywgRlJFUSk7DQp9DQo=
--8323328-634236372-1156171275=:1058
Content-Type: TEXT/X-CSRC; CHARSET=US-ASCII; NAME=test2.c
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.64.0608211641151.1058@localhost.localdomain>
Content-Description:
Content-Disposition: ATTACHMENT; FILENAME=test2.c
I2luY2x1ZGUgPHVuaXN0ZC5oPg0KI2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5j
bHVkZSA8c3lzL3RpbWUuaD4NCg0KI2RlZmluZSBGUkVRCTEwMA0KI2RlZmlu
ZSBOVU0JRlJFUQ0KDQptYWluKCkNCnsNCglzdHJ1Y3QgdGltZXZhbCB0dlsy
XTsNCglpbnQgaSA9IDA7DQoJdW5zaWduZWQgbG9uZyB1czsNCg0KCWdldHRp
bWVvZmRheSgmdHZbMF0sIE5VTEwpOw0KDQoJd2hpbGUoaSsrIDwgTlVNKQ0K
CQl1c2xlZXAoMTAwMDAwMEwgLyAoRlJFUSAqIE5VTSkpOw0KDQoJZ2V0dGlt
ZW9mZGF5KCZ0dlsxXSwgTlVMTCk7DQoNCgl1cyA9ICh0dlsxXS50dl9zZWMg
LSB0dlswXS50dl9zZWMpICogMTAwMDAwMEwgKyAodHZbMV0udHZfdXNlYyAt
IHR2WzBdLnR2X3VzZWMpOw0KDQoJcHJpbnRmKCJ1cz0lbHUgKHNob3VsZCBi
ZSAlbHUpLCBmcmVxPSVsdSAoc2hvdWxkIGJlICVsdSlcbiIsIA0KCQl1cywg
TlVNICogMTAwMDAwMEwgLyBGUkVRLCAxMDAwMDAwTCAqIE5VTSAvIHVzLCBG
UkVRKTsNCn0NCg==
--8323328-634236372-1156171275=:1058--