History log of /openbsd-current/sys/arch/sparc64/dev/ce4231.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.41 26-Oct-2022 kn

Make audio(9) get_props() optional, remove it from duplex drivers

The property bits of audio(9) are obsolete and ought to be removed
completely.

sys/dev/audio.c:audio_open() currently uses get_props() to bail out if
read *and* write was requested on a non-duplex driver.

Drivers that currently support playing but not recording need adjustment
before the API can be cleaned up.

Drivers that advertise themselves as full duplex, i.e. those that always
return AUDIO_PROP_FULLDUPLEX unconditionally in their get_props() currently
always succeed this check.

As this is the only property, losen audio_open()'s DIAGNOSTIC check and only
do the duplex check if the driver provides get_props().

This allows for simple removal of get_props() from full-duplex drivers
without adding any other code or without changing functionality.

This includes all audio drivers under sys/dev/pci/ (maestro(4) being the
only unfinished exception here).

Other drivers as well as the API change can then follow in smaller diffs.

This builds on amd64, arm64, i386, macppc and sparc64.
amd64 with azalia(4) still plays, records as well as plays and records
at the same time on my X230 as tested with

$ aucat -i play.wav [-o rec.wav]

alpha and hppa tests by miod
OK ratchov miod


# 1.40 19-Oct-2022 kn

Use C99 struct init for struct audio_hw_if

This audio(9) struct will lose a member, but drivers init their struct quite
inconsistently, most pre-C99 style.

Use C99 style everywhere, to get rid of all annoying differences and allow
for easy member removals/additions:
- don't change current order of members
- no explicit NULL members
- no comments or blank lines
- trailing comma in last member line

GENERIC.MP builds fine with this on arm64, amd64, i386 and sparc64.

macppc and alpha build-tested by miod
OK ratchov miod


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.39 21-Mar-2022 miod

Constify struct {audio,midi,radio,video}_hw_if. No functional change.

ok mpi@ ratchov@ "More const is good" deraadt@


# 1.38 16-Feb-2022 anton

Make room for a cookie argument passed to audio_attach_mi(). Currently
unused but intended to be used to correlate audio and wskbd devices.

ok ratchov@


# 1.37 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.36 27-Dec-2018 claudio

Move away from K&R style function definitions. clang is rather picky about
them especially if char and short arguments are used.
OK otto@ deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.35 19-Sep-2016 ratchov

Remove unused getdev() audio driver functions.


# 1.34 14-Sep-2016 ratchov

Remove drain(), query_encoding(), mappage() and get_default_params()
methods from all audio drivers and from the audio_if structure as they
are never called.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.33 11-May-2015 ratchov

Remove support for ADPCM encoding which isn't used nowadays and
not available to programs anyway.


# 1.32 11-May-2015 ratchov

Remove all audio format conversion code from the kernel (btw holding
the kernel_lock), as we already do better conversions in
user-mode. Yet, no need for every single driver to fiddle with the
conversion code as they are done transparently by common MI code. With
help from armani and miod, support from mpi

ok armani@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.31 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.30 16-May-2013 kettenis

Run audio interrupts without grabbing the kernel lock. While IPL_SERIAL is
higher than IPL_AUDIO on sparc64, and interrupt handlers running at IPL_SERIAL
still grab the kernel lock, this isn't a problem as machines with audioce(4)
are guaranteed not to have zs(4) (the only driver that uses IPL_SERIAL).


# 1.29 15-May-2013 ratchov

Introduce a global interrupt-aware mutex protecting data
structures (including sound-card registers) from concurent
access by syscall and interrupt code-paths. Since critical
sections remain the same, calls to splraise/spllower can be
safely replaced by calls to mtx_enter/mtx_leave with two
exceptions: (1) mutexes are not reentrant (the inner splraise
is thus removed), and (2) we're not allowed to sleep with a
mutex (either msleep is used or the mutex is released before
sleeping).

ok and help from kettenis, a lot of work from armani


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.28 26-Jul-2010 jakemsr

recording/full-duplex support
ok kettenis


# 1.27 26-Jul-2010 jakemsr

simplify the mixer(4) code and interface. document the interface.
ok kettenis


# 1.26 15-Jul-2010 jakemsr

add two new members to structs audio_encoding and audio_prinfo.
for both structs, the new members are 'bps' and 'msb', which
describe the number of bytes per sample and data alignment in the
sample, respectively. drivers must properly set these fields in
the 'query_encoding', 'set_parameters' and 'get_default_params'
hardware interface methods.

discussed with ratchov, deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.25 22-Feb-2010 jakemsr

- fix a few debug messages: disabled vs enabled mixup, missing \n
- remove some '//' commented code
ok ratchov, kettenis, edd


# 1.24 15-Dec-2009 edd

fix some buffer sizes.
put () around all sizeof uses.

OK ratchov@


# 1.23 01-Dec-2009 edd

Fix the mixer interface for the CE4231 sound card found in Sun machines. Still a
lot of room for improvement in the driver, but atleast it works now.

OK kettenis@, ratchov@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 21-Apr-2008 jakemsr

allow low level audio drivers to specify a default sample format,
instead of 8-bit mono mulaw @ 8kHz.

this is just the infrastructure; no drivers are specifying a default
yet.

ok ratchov@, deanna@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.21 08-Sep-2005 martin

make comments match the fact that we are on sun4u, plus minor cleanup

ok mickey@


Revision tags: OPENBSD_3_8_BASE
# 1.20 09-Jul-2005 miod

Do not #include "foo.h" and keep the whole file between #if NFOO >0 ... #endif,
config(8) will not bring us into play unless NFOO > 0 anyway.


# 1.19 16-Apr-2005 mickey

do not provide round_buffer if not needed unless explained why in comments


# 1.18 15-Apr-2005 mickey

make sure aligment does not return zero block size


Revision tags: OPENBSD_3_7_BASE
# 1.17 09-Nov-2004 miod

Always free memory on failure in c{e,s}4231_alloc(); from Patrick Lafiti.


# 1.16 29-Sep-2004 miod

Ratibibugle now useless evcnt structures.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
# 1.15 24-Jun-2003 henric

Add a "where" argument to the sparc64 interrupt code. This lets us
associate a name with each interrupt handler. This is not visible
outside the kernel (yet).

ok jason@


# 1.14 02-Jun-2003 jason

nuke terms 3 & 4


Revision tags: UBC_SYNC_A
# 1.13 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE
# 1.12 17-Feb-2003 henric

Add support for the Sun Enterprise 450
Reduce the size of a GENERIC kernel by ~190k
Remove the nasty pointer/bus_space_handle_t casts
Adds debug bus_space code including the ability to trace
bus operations (it actually works now).

The following rules are now followed (and verfified by the debug
code):

1. A "bus_space_handle_t" may only be used with the
"bus_space_tag_t" that created it.
2. Only "bus_space_map()" may create "bus_space_handle_t"s.
3. A "bus_space_handle_t" may not be modified after it has
been created (other than being destroyed by "bus_space_unmap()").


Thanks to help from mcbride, marc, jason, drahn, to anyone that might
have slipped my mind at the moment.

ok jason@, deraadt@


Revision tags: OPENBSD_3_2_BASE UBC_SYNC_B
# 1.11 10-Sep-2002 jason

Remove some debugging code, KNF, and fix encoding selection.


# 1.10 16-Aug-2002 jason

remove debugging code


# 1.9 18-Jul-2002 jason

another prom name, 'audio'


Revision tags: OPENBSD_3_1_BASE
# 1.8 08-Apr-2002 jason

Credit DARPA/USAF appropriately.


# 1.7 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.6 14-Mar-2002 millert

First round of __P removal in sys


# 1.5 24-Jan-2002 jason

Save the interrupt cookies and fix the printfs for failure.


# 1.4 20-Jan-2002 ericj

move a few more arch specific drivers to use new allocm and round_buffersize.


# 1.3 11-Jan-2002 jason

enable/disable IEN in cs4231 pin control register


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 02-Oct-2001 jason

branches: 1.2.4; 1.2.6;
fix dma problems... now blaring Berlin's The Metro around the house from U30.
(like cs4231, this driver only supports playback... capture will have to
wait until post 3.0).


# 1.1 01-Oct-2001 jason

driver for cs4231 at ebus: doesn't quite sound right yet (VERY choppy and
noisy... probably dma issue). This isn't the final destination for these
files either (alot of sharing can be done with sbus version, I think).


# 1.40 19-Oct-2022 kn

Use C99 struct init for struct audio_hw_if

This audio(9) struct will lose a member, but drivers init their struct quite
inconsistently, most pre-C99 style.

Use C99 style everywhere, to get rid of all annoying differences and allow
for easy member removals/additions:
- don't change current order of members
- no explicit NULL members
- no comments or blank lines
- trailing comma in last member line

GENERIC.MP builds fine with this on arm64, amd64, i386 and sparc64.

macppc and alpha build-tested by miod
OK ratchov miod


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.39 21-Mar-2022 miod

Constify struct {audio,midi,radio,video}_hw_if. No functional change.

ok mpi@ ratchov@ "More const is good" deraadt@


# 1.38 16-Feb-2022 anton

Make room for a cookie argument passed to audio_attach_mi(). Currently
unused but intended to be used to correlate audio and wskbd devices.

ok ratchov@


# 1.37 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.36 27-Dec-2018 claudio

Move away from K&R style function definitions. clang is rather picky about
them especially if char and short arguments are used.
OK otto@ deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.35 19-Sep-2016 ratchov

Remove unused getdev() audio driver functions.


# 1.34 14-Sep-2016 ratchov

Remove drain(), query_encoding(), mappage() and get_default_params()
methods from all audio drivers and from the audio_if structure as they
are never called.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.33 11-May-2015 ratchov

Remove support for ADPCM encoding which isn't used nowadays and
not available to programs anyway.


# 1.32 11-May-2015 ratchov

Remove all audio format conversion code from the kernel (btw holding
the kernel_lock), as we already do better conversions in
user-mode. Yet, no need for every single driver to fiddle with the
conversion code as they are done transparently by common MI code. With
help from armani and miod, support from mpi

ok armani@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.31 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.30 16-May-2013 kettenis

Run audio interrupts without grabbing the kernel lock. While IPL_SERIAL is
higher than IPL_AUDIO on sparc64, and interrupt handlers running at IPL_SERIAL
still grab the kernel lock, this isn't a problem as machines with audioce(4)
are guaranteed not to have zs(4) (the only driver that uses IPL_SERIAL).


# 1.29 15-May-2013 ratchov

Introduce a global interrupt-aware mutex protecting data
structures (including sound-card registers) from concurent
access by syscall and interrupt code-paths. Since critical
sections remain the same, calls to splraise/spllower can be
safely replaced by calls to mtx_enter/mtx_leave with two
exceptions: (1) mutexes are not reentrant (the inner splraise
is thus removed), and (2) we're not allowed to sleep with a
mutex (either msleep is used or the mutex is released before
sleeping).

ok and help from kettenis, a lot of work from armani


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.28 26-Jul-2010 jakemsr

recording/full-duplex support
ok kettenis


# 1.27 26-Jul-2010 jakemsr

simplify the mixer(4) code and interface. document the interface.
ok kettenis


# 1.26 15-Jul-2010 jakemsr

add two new members to structs audio_encoding and audio_prinfo.
for both structs, the new members are 'bps' and 'msb', which
describe the number of bytes per sample and data alignment in the
sample, respectively. drivers must properly set these fields in
the 'query_encoding', 'set_parameters' and 'get_default_params'
hardware interface methods.

discussed with ratchov, deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.25 22-Feb-2010 jakemsr

- fix a few debug messages: disabled vs enabled mixup, missing \n
- remove some '//' commented code
ok ratchov, kettenis, edd


# 1.24 15-Dec-2009 edd

fix some buffer sizes.
put () around all sizeof uses.

OK ratchov@


# 1.23 01-Dec-2009 edd

Fix the mixer interface for the CE4231 sound card found in Sun machines. Still a
lot of room for improvement in the driver, but atleast it works now.

OK kettenis@, ratchov@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 21-Apr-2008 jakemsr

allow low level audio drivers to specify a default sample format,
instead of 8-bit mono mulaw @ 8kHz.

this is just the infrastructure; no drivers are specifying a default
yet.

ok ratchov@, deanna@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.21 08-Sep-2005 martin

make comments match the fact that we are on sun4u, plus minor cleanup

ok mickey@


Revision tags: OPENBSD_3_8_BASE
# 1.20 09-Jul-2005 miod

Do not #include "foo.h" and keep the whole file between #if NFOO >0 ... #endif,
config(8) will not bring us into play unless NFOO > 0 anyway.


# 1.19 16-Apr-2005 mickey

do not provide round_buffer if not needed unless explained why in comments


# 1.18 15-Apr-2005 mickey

make sure aligment does not return zero block size


Revision tags: OPENBSD_3_7_BASE
# 1.17 09-Nov-2004 miod

Always free memory on failure in c{e,s}4231_alloc(); from Patrick Lafiti.


# 1.16 29-Sep-2004 miod

Ratibibugle now useless evcnt structures.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
# 1.15 24-Jun-2003 henric

Add a "where" argument to the sparc64 interrupt code. This lets us
associate a name with each interrupt handler. This is not visible
outside the kernel (yet).

ok jason@


# 1.14 02-Jun-2003 jason

nuke terms 3 & 4


Revision tags: UBC_SYNC_A
# 1.13 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE
# 1.12 17-Feb-2003 henric

Add support for the Sun Enterprise 450
Reduce the size of a GENERIC kernel by ~190k
Remove the nasty pointer/bus_space_handle_t casts
Adds debug bus_space code including the ability to trace
bus operations (it actually works now).

The following rules are now followed (and verfified by the debug
code):

1. A "bus_space_handle_t" may only be used with the
"bus_space_tag_t" that created it.
2. Only "bus_space_map()" may create "bus_space_handle_t"s.
3. A "bus_space_handle_t" may not be modified after it has
been created (other than being destroyed by "bus_space_unmap()").


Thanks to help from mcbride, marc, jason, drahn, to anyone that might
have slipped my mind at the moment.

ok jason@, deraadt@


Revision tags: OPENBSD_3_2_BASE UBC_SYNC_B
# 1.11 10-Sep-2002 jason

Remove some debugging code, KNF, and fix encoding selection.


# 1.10 16-Aug-2002 jason

remove debugging code


# 1.9 18-Jul-2002 jason

another prom name, 'audio'


Revision tags: OPENBSD_3_1_BASE
# 1.8 08-Apr-2002 jason

Credit DARPA/USAF appropriately.


# 1.7 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.6 14-Mar-2002 millert

First round of __P removal in sys


# 1.5 24-Jan-2002 jason

Save the interrupt cookies and fix the printfs for failure.


# 1.4 20-Jan-2002 ericj

move a few more arch specific drivers to use new allocm and round_buffersize.


# 1.3 11-Jan-2002 jason

enable/disable IEN in cs4231 pin control register


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 02-Oct-2001 jason

branches: 1.2.4; 1.2.6;
fix dma problems... now blaring Berlin's The Metro around the house from U30.
(like cs4231, this driver only supports playback... capture will have to
wait until post 3.0).


# 1.1 01-Oct-2001 jason

driver for cs4231 at ebus: doesn't quite sound right yet (VERY choppy and
noisy... probably dma issue). This isn't the final destination for these
files either (alot of sharing can be done with sbus version, I think).


# 1.39 21-Mar-2022 miod

Constify struct {audio,midi,radio,video}_hw_if. No functional change.

ok mpi@ ratchov@ "More const is good" deraadt@


# 1.38 16-Feb-2022 anton

Make room for a cookie argument passed to audio_attach_mi(). Currently
unused but intended to be used to correlate audio and wskbd devices.

ok ratchov@


# 1.37 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.36 27-Dec-2018 claudio

Move away from K&R style function definitions. clang is rather picky about
them especially if char and short arguments are used.
OK otto@ deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.35 19-Sep-2016 ratchov

Remove unused getdev() audio driver functions.


# 1.34 14-Sep-2016 ratchov

Remove drain(), query_encoding(), mappage() and get_default_params()
methods from all audio drivers and from the audio_if structure as they
are never called.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.33 11-May-2015 ratchov

Remove support for ADPCM encoding which isn't used nowadays and
not available to programs anyway.


# 1.32 11-May-2015 ratchov

Remove all audio format conversion code from the kernel (btw holding
the kernel_lock), as we already do better conversions in
user-mode. Yet, no need for every single driver to fiddle with the
conversion code as they are done transparently by common MI code. With
help from armani and miod, support from mpi

ok armani@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.31 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.30 16-May-2013 kettenis

Run audio interrupts without grabbing the kernel lock. While IPL_SERIAL is
higher than IPL_AUDIO on sparc64, and interrupt handlers running at IPL_SERIAL
still grab the kernel lock, this isn't a problem as machines with audioce(4)
are guaranteed not to have zs(4) (the only driver that uses IPL_SERIAL).


# 1.29 15-May-2013 ratchov

Introduce a global interrupt-aware mutex protecting data
structures (including sound-card registers) from concurent
access by syscall and interrupt code-paths. Since critical
sections remain the same, calls to splraise/spllower can be
safely replaced by calls to mtx_enter/mtx_leave with two
exceptions: (1) mutexes are not reentrant (the inner splraise
is thus removed), and (2) we're not allowed to sleep with a
mutex (either msleep is used or the mutex is released before
sleeping).

ok and help from kettenis, a lot of work from armani


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.28 26-Jul-2010 jakemsr

recording/full-duplex support
ok kettenis


# 1.27 26-Jul-2010 jakemsr

simplify the mixer(4) code and interface. document the interface.
ok kettenis


# 1.26 15-Jul-2010 jakemsr

add two new members to structs audio_encoding and audio_prinfo.
for both structs, the new members are 'bps' and 'msb', which
describe the number of bytes per sample and data alignment in the
sample, respectively. drivers must properly set these fields in
the 'query_encoding', 'set_parameters' and 'get_default_params'
hardware interface methods.

discussed with ratchov, deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.25 22-Feb-2010 jakemsr

- fix a few debug messages: disabled vs enabled mixup, missing \n
- remove some '//' commented code
ok ratchov, kettenis, edd


# 1.24 15-Dec-2009 edd

fix some buffer sizes.
put () around all sizeof uses.

OK ratchov@


# 1.23 01-Dec-2009 edd

Fix the mixer interface for the CE4231 sound card found in Sun machines. Still a
lot of room for improvement in the driver, but atleast it works now.

OK kettenis@, ratchov@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 21-Apr-2008 jakemsr

allow low level audio drivers to specify a default sample format,
instead of 8-bit mono mulaw @ 8kHz.

this is just the infrastructure; no drivers are specifying a default
yet.

ok ratchov@, deanna@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.21 08-Sep-2005 martin

make comments match the fact that we are on sun4u, plus minor cleanup

ok mickey@


Revision tags: OPENBSD_3_8_BASE
# 1.20 09-Jul-2005 miod

Do not #include "foo.h" and keep the whole file between #if NFOO >0 ... #endif,
config(8) will not bring us into play unless NFOO > 0 anyway.


# 1.19 16-Apr-2005 mickey

do not provide round_buffer if not needed unless explained why in comments


# 1.18 15-Apr-2005 mickey

make sure aligment does not return zero block size


Revision tags: OPENBSD_3_7_BASE
# 1.17 09-Nov-2004 miod

Always free memory on failure in c{e,s}4231_alloc(); from Patrick Lafiti.


# 1.16 29-Sep-2004 miod

Ratibibugle now useless evcnt structures.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
# 1.15 24-Jun-2003 henric

Add a "where" argument to the sparc64 interrupt code. This lets us
associate a name with each interrupt handler. This is not visible
outside the kernel (yet).

ok jason@


# 1.14 02-Jun-2003 jason

nuke terms 3 & 4


Revision tags: UBC_SYNC_A
# 1.13 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE
# 1.12 17-Feb-2003 henric

Add support for the Sun Enterprise 450
Reduce the size of a GENERIC kernel by ~190k
Remove the nasty pointer/bus_space_handle_t casts
Adds debug bus_space code including the ability to trace
bus operations (it actually works now).

The following rules are now followed (and verfified by the debug
code):

1. A "bus_space_handle_t" may only be used with the
"bus_space_tag_t" that created it.
2. Only "bus_space_map()" may create "bus_space_handle_t"s.
3. A "bus_space_handle_t" may not be modified after it has
been created (other than being destroyed by "bus_space_unmap()").


Thanks to help from mcbride, marc, jason, drahn, to anyone that might
have slipped my mind at the moment.

ok jason@, deraadt@


Revision tags: OPENBSD_3_2_BASE UBC_SYNC_B
# 1.11 10-Sep-2002 jason

Remove some debugging code, KNF, and fix encoding selection.


# 1.10 16-Aug-2002 jason

remove debugging code


# 1.9 18-Jul-2002 jason

another prom name, 'audio'


Revision tags: OPENBSD_3_1_BASE
# 1.8 08-Apr-2002 jason

Credit DARPA/USAF appropriately.


# 1.7 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.6 14-Mar-2002 millert

First round of __P removal in sys


# 1.5 24-Jan-2002 jason

Save the interrupt cookies and fix the printfs for failure.


# 1.4 20-Jan-2002 ericj

move a few more arch specific drivers to use new allocm and round_buffersize.


# 1.3 11-Jan-2002 jason

enable/disable IEN in cs4231 pin control register


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 02-Oct-2001 jason

branches: 1.2.4; 1.2.6;
fix dma problems... now blaring Berlin's The Metro around the house from U30.
(like cs4231, this driver only supports playback... capture will have to
wait until post 3.0).


# 1.1 01-Oct-2001 jason

driver for cs4231 at ebus: doesn't quite sound right yet (VERY choppy and
noisy... probably dma issue). This isn't the final destination for these
files either (alot of sharing can be done with sbus version, I think).


# 1.38 16-Feb-2022 anton

Make room for a cookie argument passed to audio_attach_mi(). Currently
unused but intended to be used to correlate audio and wskbd devices.

ok ratchov@


# 1.37 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.36 27-Dec-2018 claudio

Move away from K&R style function definitions. clang is rather picky about
them especially if char and short arguments are used.
OK otto@ deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.35 19-Sep-2016 ratchov

Remove unused getdev() audio driver functions.


# 1.34 14-Sep-2016 ratchov

Remove drain(), query_encoding(), mappage() and get_default_params()
methods from all audio drivers and from the audio_if structure as they
are never called.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.33 11-May-2015 ratchov

Remove support for ADPCM encoding which isn't used nowadays and
not available to programs anyway.


# 1.32 11-May-2015 ratchov

Remove all audio format conversion code from the kernel (btw holding
the kernel_lock), as we already do better conversions in
user-mode. Yet, no need for every single driver to fiddle with the
conversion code as they are done transparently by common MI code. With
help from armani and miod, support from mpi

ok armani@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.31 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.30 16-May-2013 kettenis

Run audio interrupts without grabbing the kernel lock. While IPL_SERIAL is
higher than IPL_AUDIO on sparc64, and interrupt handlers running at IPL_SERIAL
still grab the kernel lock, this isn't a problem as machines with audioce(4)
are guaranteed not to have zs(4) (the only driver that uses IPL_SERIAL).


# 1.29 15-May-2013 ratchov

Introduce a global interrupt-aware mutex protecting data
structures (including sound-card registers) from concurent
access by syscall and interrupt code-paths. Since critical
sections remain the same, calls to splraise/spllower can be
safely replaced by calls to mtx_enter/mtx_leave with two
exceptions: (1) mutexes are not reentrant (the inner splraise
is thus removed), and (2) we're not allowed to sleep with a
mutex (either msleep is used or the mutex is released before
sleeping).

ok and help from kettenis, a lot of work from armani


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.28 26-Jul-2010 jakemsr

recording/full-duplex support
ok kettenis


# 1.27 26-Jul-2010 jakemsr

simplify the mixer(4) code and interface. document the interface.
ok kettenis


# 1.26 15-Jul-2010 jakemsr

add two new members to structs audio_encoding and audio_prinfo.
for both structs, the new members are 'bps' and 'msb', which
describe the number of bytes per sample and data alignment in the
sample, respectively. drivers must properly set these fields in
the 'query_encoding', 'set_parameters' and 'get_default_params'
hardware interface methods.

discussed with ratchov, deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.25 22-Feb-2010 jakemsr

- fix a few debug messages: disabled vs enabled mixup, missing \n
- remove some '//' commented code
ok ratchov, kettenis, edd


# 1.24 15-Dec-2009 edd

fix some buffer sizes.
put () around all sizeof uses.

OK ratchov@


# 1.23 01-Dec-2009 edd

Fix the mixer interface for the CE4231 sound card found in Sun machines. Still a
lot of room for improvement in the driver, but atleast it works now.

OK kettenis@, ratchov@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 21-Apr-2008 jakemsr

allow low level audio drivers to specify a default sample format,
instead of 8-bit mono mulaw @ 8kHz.

this is just the infrastructure; no drivers are specifying a default
yet.

ok ratchov@, deanna@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.21 08-Sep-2005 martin

make comments match the fact that we are on sun4u, plus minor cleanup

ok mickey@


Revision tags: OPENBSD_3_8_BASE
# 1.20 09-Jul-2005 miod

Do not #include "foo.h" and keep the whole file between #if NFOO >0 ... #endif,
config(8) will not bring us into play unless NFOO > 0 anyway.


# 1.19 16-Apr-2005 mickey

do not provide round_buffer if not needed unless explained why in comments


# 1.18 15-Apr-2005 mickey

make sure aligment does not return zero block size


Revision tags: OPENBSD_3_7_BASE
# 1.17 09-Nov-2004 miod

Always free memory on failure in c{e,s}4231_alloc(); from Patrick Lafiti.


# 1.16 29-Sep-2004 miod

Ratibibugle now useless evcnt structures.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
# 1.15 24-Jun-2003 henric

Add a "where" argument to the sparc64 interrupt code. This lets us
associate a name with each interrupt handler. This is not visible
outside the kernel (yet).

ok jason@


# 1.14 02-Jun-2003 jason

nuke terms 3 & 4


Revision tags: UBC_SYNC_A
# 1.13 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE
# 1.12 17-Feb-2003 henric

Add support for the Sun Enterprise 450
Reduce the size of a GENERIC kernel by ~190k
Remove the nasty pointer/bus_space_handle_t casts
Adds debug bus_space code including the ability to trace
bus operations (it actually works now).

The following rules are now followed (and verfified by the debug
code):

1. A "bus_space_handle_t" may only be used with the
"bus_space_tag_t" that created it.
2. Only "bus_space_map()" may create "bus_space_handle_t"s.
3. A "bus_space_handle_t" may not be modified after it has
been created (other than being destroyed by "bus_space_unmap()").


Thanks to help from mcbride, marc, jason, drahn, to anyone that might
have slipped my mind at the moment.

ok jason@, deraadt@


Revision tags: OPENBSD_3_2_BASE UBC_SYNC_B
# 1.11 10-Sep-2002 jason

Remove some debugging code, KNF, and fix encoding selection.


# 1.10 16-Aug-2002 jason

remove debugging code


# 1.9 18-Jul-2002 jason

another prom name, 'audio'


Revision tags: OPENBSD_3_1_BASE
# 1.8 08-Apr-2002 jason

Credit DARPA/USAF appropriately.


# 1.7 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.6 14-Mar-2002 millert

First round of __P removal in sys


# 1.5 24-Jan-2002 jason

Save the interrupt cookies and fix the printfs for failure.


# 1.4 20-Jan-2002 ericj

move a few more arch specific drivers to use new allocm and round_buffersize.


# 1.3 11-Jan-2002 jason

enable/disable IEN in cs4231 pin control register


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 02-Oct-2001 jason

branches: 1.2.4; 1.2.6;
fix dma problems... now blaring Berlin's The Metro around the house from U30.
(like cs4231, this driver only supports playback... capture will have to
wait until post 3.0).


# 1.1 01-Oct-2001 jason

driver for cs4231 at ebus: doesn't quite sound right yet (VERY choppy and
noisy... probably dma issue). This isn't the final destination for these
files either (alot of sharing can be done with sbus version, I think).


# 1.37 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.36 27-Dec-2018 claudio

Move away from K&R style function definitions. clang is rather picky about
them especially if char and short arguments are used.
OK otto@ deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.35 19-Sep-2016 ratchov

Remove unused getdev() audio driver functions.


# 1.34 14-Sep-2016 ratchov

Remove drain(), query_encoding(), mappage() and get_default_params()
methods from all audio drivers and from the audio_if structure as they
are never called.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.33 11-May-2015 ratchov

Remove support for ADPCM encoding which isn't used nowadays and
not available to programs anyway.


# 1.32 11-May-2015 ratchov

Remove all audio format conversion code from the kernel (btw holding
the kernel_lock), as we already do better conversions in
user-mode. Yet, no need for every single driver to fiddle with the
conversion code as they are done transparently by common MI code. With
help from armani and miod, support from mpi

ok armani@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.31 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.30 16-May-2013 kettenis

Run audio interrupts without grabbing the kernel lock. While IPL_SERIAL is
higher than IPL_AUDIO on sparc64, and interrupt handlers running at IPL_SERIAL
still grab the kernel lock, this isn't a problem as machines with audioce(4)
are guaranteed not to have zs(4) (the only driver that uses IPL_SERIAL).


# 1.29 15-May-2013 ratchov

Introduce a global interrupt-aware mutex protecting data
structures (including sound-card registers) from concurent
access by syscall and interrupt code-paths. Since critical
sections remain the same, calls to splraise/spllower can be
safely replaced by calls to mtx_enter/mtx_leave with two
exceptions: (1) mutexes are not reentrant (the inner splraise
is thus removed), and (2) we're not allowed to sleep with a
mutex (either msleep is used or the mutex is released before
sleeping).

ok and help from kettenis, a lot of work from armani


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.28 26-Jul-2010 jakemsr

recording/full-duplex support
ok kettenis


# 1.27 26-Jul-2010 jakemsr

simplify the mixer(4) code and interface. document the interface.
ok kettenis


# 1.26 15-Jul-2010 jakemsr

add two new members to structs audio_encoding and audio_prinfo.
for both structs, the new members are 'bps' and 'msb', which
describe the number of bytes per sample and data alignment in the
sample, respectively. drivers must properly set these fields in
the 'query_encoding', 'set_parameters' and 'get_default_params'
hardware interface methods.

discussed with ratchov, deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.25 22-Feb-2010 jakemsr

- fix a few debug messages: disabled vs enabled mixup, missing \n
- remove some '//' commented code
ok ratchov, kettenis, edd


# 1.24 15-Dec-2009 edd

fix some buffer sizes.
put () around all sizeof uses.

OK ratchov@


# 1.23 01-Dec-2009 edd

Fix the mixer interface for the CE4231 sound card found in Sun machines. Still a
lot of room for improvement in the driver, but atleast it works now.

OK kettenis@, ratchov@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 21-Apr-2008 jakemsr

allow low level audio drivers to specify a default sample format,
instead of 8-bit mono mulaw @ 8kHz.

this is just the infrastructure; no drivers are specifying a default
yet.

ok ratchov@, deanna@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.21 08-Sep-2005 martin

make comments match the fact that we are on sun4u, plus minor cleanup

ok mickey@


Revision tags: OPENBSD_3_8_BASE
# 1.20 09-Jul-2005 miod

Do not #include "foo.h" and keep the whole file between #if NFOO >0 ... #endif,
config(8) will not bring us into play unless NFOO > 0 anyway.


# 1.19 16-Apr-2005 mickey

do not provide round_buffer if not needed unless explained why in comments


# 1.18 15-Apr-2005 mickey

make sure aligment does not return zero block size


Revision tags: OPENBSD_3_7_BASE
# 1.17 09-Nov-2004 miod

Always free memory on failure in c{e,s}4231_alloc(); from Patrick Lafiti.


# 1.16 29-Sep-2004 miod

Ratibibugle now useless evcnt structures.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
# 1.15 24-Jun-2003 henric

Add a "where" argument to the sparc64 interrupt code. This lets us
associate a name with each interrupt handler. This is not visible
outside the kernel (yet).

ok jason@


# 1.14 02-Jun-2003 jason

nuke terms 3 & 4


Revision tags: UBC_SYNC_A
# 1.13 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE
# 1.12 17-Feb-2003 henric

Add support for the Sun Enterprise 450
Reduce the size of a GENERIC kernel by ~190k
Remove the nasty pointer/bus_space_handle_t casts
Adds debug bus_space code including the ability to trace
bus operations (it actually works now).

The following rules are now followed (and verfified by the debug
code):

1. A "bus_space_handle_t" may only be used with the
"bus_space_tag_t" that created it.
2. Only "bus_space_map()" may create "bus_space_handle_t"s.
3. A "bus_space_handle_t" may not be modified after it has
been created (other than being destroyed by "bus_space_unmap()").


Thanks to help from mcbride, marc, jason, drahn, to anyone that might
have slipped my mind at the moment.

ok jason@, deraadt@


Revision tags: OPENBSD_3_2_BASE UBC_SYNC_B
# 1.11 10-Sep-2002 jason

Remove some debugging code, KNF, and fix encoding selection.


# 1.10 16-Aug-2002 jason

remove debugging code


# 1.9 18-Jul-2002 jason

another prom name, 'audio'


Revision tags: OPENBSD_3_1_BASE
# 1.8 08-Apr-2002 jason

Credit DARPA/USAF appropriately.


# 1.7 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.6 14-Mar-2002 millert

First round of __P removal in sys


# 1.5 24-Jan-2002 jason

Save the interrupt cookies and fix the printfs for failure.


# 1.4 20-Jan-2002 ericj

move a few more arch specific drivers to use new allocm and round_buffersize.


# 1.3 11-Jan-2002 jason

enable/disable IEN in cs4231 pin control register


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 02-Oct-2001 jason

branches: 1.2.4; 1.2.6;
fix dma problems... now blaring Berlin's The Metro around the house from U30.
(like cs4231, this driver only supports playback... capture will have to
wait until post 3.0).


# 1.1 01-Oct-2001 jason

driver for cs4231 at ebus: doesn't quite sound right yet (VERY choppy and
noisy... probably dma issue). This isn't the final destination for these
files either (alot of sharing can be done with sbus version, I think).


# 1.36 27-Dec-2018 claudio

Move away from K&R style function definitions. clang is rather picky about
them especially if char and short arguments are used.
OK otto@ deraadt@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.35 19-Sep-2016 ratchov

Remove unused getdev() audio driver functions.


# 1.34 14-Sep-2016 ratchov

Remove drain(), query_encoding(), mappage() and get_default_params()
methods from all audio drivers and from the audio_if structure as they
are never called.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.33 11-May-2015 ratchov

Remove support for ADPCM encoding which isn't used nowadays and
not available to programs anyway.


# 1.32 11-May-2015 ratchov

Remove all audio format conversion code from the kernel (btw holding
the kernel_lock), as we already do better conversions in
user-mode. Yet, no need for every single driver to fiddle with the
conversion code as they are done transparently by common MI code. With
help from armani and miod, support from mpi

ok armani@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.31 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.30 16-May-2013 kettenis

Run audio interrupts without grabbing the kernel lock. While IPL_SERIAL is
higher than IPL_AUDIO on sparc64, and interrupt handlers running at IPL_SERIAL
still grab the kernel lock, this isn't a problem as machines with audioce(4)
are guaranteed not to have zs(4) (the only driver that uses IPL_SERIAL).


# 1.29 15-May-2013 ratchov

Introduce a global interrupt-aware mutex protecting data
structures (including sound-card registers) from concurent
access by syscall and interrupt code-paths. Since critical
sections remain the same, calls to splraise/spllower can be
safely replaced by calls to mtx_enter/mtx_leave with two
exceptions: (1) mutexes are not reentrant (the inner splraise
is thus removed), and (2) we're not allowed to sleep with a
mutex (either msleep is used or the mutex is released before
sleeping).

ok and help from kettenis, a lot of work from armani


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.28 26-Jul-2010 jakemsr

recording/full-duplex support
ok kettenis


# 1.27 26-Jul-2010 jakemsr

simplify the mixer(4) code and interface. document the interface.
ok kettenis


# 1.26 15-Jul-2010 jakemsr

add two new members to structs audio_encoding and audio_prinfo.
for both structs, the new members are 'bps' and 'msb', which
describe the number of bytes per sample and data alignment in the
sample, respectively. drivers must properly set these fields in
the 'query_encoding', 'set_parameters' and 'get_default_params'
hardware interface methods.

discussed with ratchov, deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.25 22-Feb-2010 jakemsr

- fix a few debug messages: disabled vs enabled mixup, missing \n
- remove some '//' commented code
ok ratchov, kettenis, edd


# 1.24 15-Dec-2009 edd

fix some buffer sizes.
put () around all sizeof uses.

OK ratchov@


# 1.23 01-Dec-2009 edd

Fix the mixer interface for the CE4231 sound card found in Sun machines. Still a
lot of room for improvement in the driver, but atleast it works now.

OK kettenis@, ratchov@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 21-Apr-2008 jakemsr

allow low level audio drivers to specify a default sample format,
instead of 8-bit mono mulaw @ 8kHz.

this is just the infrastructure; no drivers are specifying a default
yet.

ok ratchov@, deanna@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.21 08-Sep-2005 martin

make comments match the fact that we are on sun4u, plus minor cleanup

ok mickey@


Revision tags: OPENBSD_3_8_BASE
# 1.20 09-Jul-2005 miod

Do not #include "foo.h" and keep the whole file between #if NFOO >0 ... #endif,
config(8) will not bring us into play unless NFOO > 0 anyway.


# 1.19 16-Apr-2005 mickey

do not provide round_buffer if not needed unless explained why in comments


# 1.18 15-Apr-2005 mickey

make sure aligment does not return zero block size


Revision tags: OPENBSD_3_7_BASE
# 1.17 09-Nov-2004 miod

Always free memory on failure in c{e,s}4231_alloc(); from Patrick Lafiti.


# 1.16 29-Sep-2004 miod

Ratibibugle now useless evcnt structures.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
# 1.15 24-Jun-2003 henric

Add a "where" argument to the sparc64 interrupt code. This lets us
associate a name with each interrupt handler. This is not visible
outside the kernel (yet).

ok jason@


# 1.14 02-Jun-2003 jason

nuke terms 3 & 4


Revision tags: UBC_SYNC_A
# 1.13 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE
# 1.12 17-Feb-2003 henric

Add support for the Sun Enterprise 450
Reduce the size of a GENERIC kernel by ~190k
Remove the nasty pointer/bus_space_handle_t casts
Adds debug bus_space code including the ability to trace
bus operations (it actually works now).

The following rules are now followed (and verfified by the debug
code):

1. A "bus_space_handle_t" may only be used with the
"bus_space_tag_t" that created it.
2. Only "bus_space_map()" may create "bus_space_handle_t"s.
3. A "bus_space_handle_t" may not be modified after it has
been created (other than being destroyed by "bus_space_unmap()").


Thanks to help from mcbride, marc, jason, drahn, to anyone that might
have slipped my mind at the moment.

ok jason@, deraadt@


Revision tags: OPENBSD_3_2_BASE UBC_SYNC_B
# 1.11 10-Sep-2002 jason

Remove some debugging code, KNF, and fix encoding selection.


# 1.10 16-Aug-2002 jason

remove debugging code


# 1.9 18-Jul-2002 jason

another prom name, 'audio'


Revision tags: OPENBSD_3_1_BASE
# 1.8 08-Apr-2002 jason

Credit DARPA/USAF appropriately.


# 1.7 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.6 14-Mar-2002 millert

First round of __P removal in sys


# 1.5 24-Jan-2002 jason

Save the interrupt cookies and fix the printfs for failure.


# 1.4 20-Jan-2002 ericj

move a few more arch specific drivers to use new allocm and round_buffersize.


# 1.3 11-Jan-2002 jason

enable/disable IEN in cs4231 pin control register


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 02-Oct-2001 jason

branches: 1.2.4; 1.2.6;
fix dma problems... now blaring Berlin's The Metro around the house from U30.
(like cs4231, this driver only supports playback... capture will have to
wait until post 3.0).


# 1.1 01-Oct-2001 jason

driver for cs4231 at ebus: doesn't quite sound right yet (VERY choppy and
noisy... probably dma issue). This isn't the final destination for these
files either (alot of sharing can be done with sbus version, I think).


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.35 19-Sep-2016 ratchov

Remove unused getdev() audio driver functions.


# 1.34 14-Sep-2016 ratchov

Remove drain(), query_encoding(), mappage() and get_default_params()
methods from all audio drivers and from the audio_if structure as they
are never called.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.33 11-May-2015 ratchov

Remove support for ADPCM encoding which isn't used nowadays and
not available to programs anyway.


# 1.32 11-May-2015 ratchov

Remove all audio format conversion code from the kernel (btw holding
the kernel_lock), as we already do better conversions in
user-mode. Yet, no need for every single driver to fiddle with the
conversion code as they are done transparently by common MI code. With
help from armani and miod, support from mpi

ok armani@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.31 12-Jul-2014 tedu

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.30 16-May-2013 kettenis

Run audio interrupts without grabbing the kernel lock. While IPL_SERIAL is
higher than IPL_AUDIO on sparc64, and interrupt handlers running at IPL_SERIAL
still grab the kernel lock, this isn't a problem as machines with audioce(4)
are guaranteed not to have zs(4) (the only driver that uses IPL_SERIAL).


# 1.29 15-May-2013 ratchov

Introduce a global interrupt-aware mutex protecting data
structures (including sound-card registers) from concurent
access by syscall and interrupt code-paths. Since critical
sections remain the same, calls to splraise/spllower can be
safely replaced by calls to mtx_enter/mtx_leave with two
exceptions: (1) mutexes are not reentrant (the inner splraise
is thus removed), and (2) we're not allowed to sleep with a
mutex (either msleep is used or the mutex is released before
sleeping).

ok and help from kettenis, a lot of work from armani


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.28 26-Jul-2010 jakemsr

recording/full-duplex support
ok kettenis


# 1.27 26-Jul-2010 jakemsr

simplify the mixer(4) code and interface. document the interface.
ok kettenis


# 1.26 15-Jul-2010 jakemsr

add two new members to structs audio_encoding and audio_prinfo.
for both structs, the new members are 'bps' and 'msb', which
describe the number of bytes per sample and data alignment in the
sample, respectively. drivers must properly set these fields in
the 'query_encoding', 'set_parameters' and 'get_default_params'
hardware interface methods.

discussed with ratchov, deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.25 22-Feb-2010 jakemsr

- fix a few debug messages: disabled vs enabled mixup, missing \n
- remove some '//' commented code
ok ratchov, kettenis, edd


# 1.24 15-Dec-2009 edd

fix some buffer sizes.
put () around all sizeof uses.

OK ratchov@


# 1.23 01-Dec-2009 edd

Fix the mixer interface for the CE4231 sound card found in Sun machines. Still a
lot of room for improvement in the driver, but atleast it works now.

OK kettenis@, ratchov@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.22 21-Apr-2008 jakemsr

allow low level audio drivers to specify a default sample format,
instead of 8-bit mono mulaw @ 8kHz.

this is just the infrastructure; no drivers are specifying a default
yet.

ok ratchov@, deanna@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.21 08-Sep-2005 martin

make comments match the fact that we are on sun4u, plus minor cleanup

ok mickey@


Revision tags: OPENBSD_3_8_BASE
# 1.20 09-Jul-2005 miod

Do not #include "foo.h" and keep the whole file between #if NFOO >0 ... #endif,
config(8) will not bring us into play unless NFOO > 0 anyway.


# 1.19 16-Apr-2005 mickey

do not provide round_buffer if not needed unless explained why in comments


# 1.18 15-Apr-2005 mickey

make sure aligment does not return zero block size


Revision tags: OPENBSD_3_7_BASE
# 1.17 09-Nov-2004 miod

Always free memory on failure in c{e,s}4231_alloc(); from Patrick Lafiti.


# 1.16 29-Sep-2004 miod

Ratibibugle now useless evcnt structures.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
# 1.15 24-Jun-2003 henric

Add a "where" argument to the sparc64 interrupt code. This lets us
associate a name with each interrupt handler. This is not visible
outside the kernel (yet).

ok jason@


# 1.14 02-Jun-2003 jason

nuke terms 3 & 4


Revision tags: UBC_SYNC_A
# 1.13 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE
# 1.12 17-Feb-2003 henric

Add support for the Sun Enterprise 450
Reduce the size of a GENERIC kernel by ~190k
Remove the nasty pointer/bus_space_handle_t casts
Adds debug bus_space code including the ability to trace
bus operations (it actually works now).

The following rules are now followed (and verfified by the debug
code):

1. A "bus_space_handle_t" may only be used with the
"bus_space_tag_t" that created it.
2. Only "bus_space_map()" may create "bus_space_handle_t"s.
3. A "bus_space_handle_t" may not be modified after it has
been created (other than being destroyed by "bus_space_unmap()").


Thanks to help from mcbride, marc, jason, drahn, to anyone that might
have slipped my mind at the moment.

ok jason@, deraadt@


Revision tags: OPENBSD_3_2_BASE UBC_SYNC_B
# 1.11 10-Sep-2002 jason

Remove some debugging code, KNF, and fix encoding selection.


# 1.10 16-Aug-2002 jason

remove debugging code


# 1.9 18-Jul-2002 jason

another prom name, 'audio'


Revision tags: OPENBSD_3_1_BASE
# 1.8 08-Apr-2002 jason

Credit DARPA/USAF appropriately.


# 1.7 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.6 14-Mar-2002 millert

First round of __P removal in sys


# 1.5 24-Jan-2002 jason

Save the interrupt cookies and fix the printfs for failure.


# 1.4 20-Jan-2002 ericj

move a few more arch specific drivers to use new allocm and round_buffersize.


# 1.3 11-Jan-2002 jason

enable/disable IEN in cs4231 pin control register


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 02-Oct-2001 jason

branches: 1.2.4; 1.2.6;
fix dma problems... now blaring Berlin's The Metro around the house from U30.
(like cs4231, this driver only supports playback... capture will have to
wait until post 3.0).


# 1.1 01-Oct-2001 jason

driver for cs4231 at ebus: doesn't quite sound right yet (VERY choppy and
noisy... probably dma issue). This isn't the final destination for these
files either (alot of sharing can be done with sbus version, I think).