aboutsummaryrefslogtreecommitdiff
path: root/documentation/content/en/books/arch-handbook/sound/_index.po
blob: dfbbf4a40aeebf3f9cf2cecbe0f68f89afdc8353 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR The FreeBSD Project
# This file is distributed under the same license as the FreeBSD Documentation package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: FreeBSD Documentation VERSION\n"
"POT-Creation-Date: 2022-02-01 09:20-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. type: YAML Front Matter: description
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:1
#, no-wrap
msgid "FreeBSD Sound Subsystem"
msgstr ""

#. type: YAML Front Matter: title
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:1
#, no-wrap
msgid "Chapter 15. Sound Subsystem"
msgstr ""

#. type: Title =
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:13
#, no-wrap
msgid "Sound Subsystem"
msgstr ""

#. type: Title ==
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:51
#, no-wrap
msgid "Introduction"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:54
msgid ""
"The FreeBSD sound subsystem cleanly separates generic sound handling issues "
"from device-specific ones. This makes it easier to add support for new "
"hardware."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:56
msgid ""
"The man:pcm[4] framework is the central piece of the sound subsystem. It "
"mainly implements the following elements:"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:58
msgid ""
"A system call interface (read, write, ioctls) to digitized sound and mixer "
"functions. The ioctl command set is compatible with the legacy _OSS_ or "
"_Voxware_ interface, allowing common multimedia applications to be ported "
"without modification."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:59
msgid ""
"Common code for processing sound data (format conversions, virtual channels)."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:60
msgid ""
"A uniform software interface to hardware-specific audio interface modules."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:61
msgid ""
"Additional support for some common hardware interfaces (ac97), or shared "
"hardware-specific code (ex: ISA DMA routines)."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:63
msgid ""
"The support for specific sound cards is implemented by hardware-specific "
"drivers, which provide channel and mixer interfaces to plug into the generic "
"[.filename]#pcm# code."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:65
msgid ""
"In this chapter, the term [.filename]#pcm# will refer to the central, common "
"part of the sound driver, as opposed to the hardware-specific modules."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:67
msgid ""
"The prospective driver writer will of course want to start from an existing "
"module and use the code as the ultimate reference. But, while the sound code "
"is nice and clean, it is also mostly devoid of comments. This document tries "
"to give an overview of the framework interface and answer some questions "
"that may arise while adapting the existing code."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:69
msgid ""
"As an alternative, or in addition to starting from a working example, you "
"can find a commented driver template at https://people.FreeBSD.org/~cg/"
"template.c[ https://people.FreeBSD.org/~cg/template.c]"
msgstr ""

#. type: Title ==
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:71
#, no-wrap
msgid "Files"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:74
msgid ""
"All the relevant code lives in [.filename]#/usr/src/sys/dev/sound/#, except "
"for the public ioctl interface definitions, found in [.filename]#/usr/src/"
"sys/sys/soundcard.h#"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:76
msgid ""
"Under [.filename]#/usr/src/sys/dev/sound/#, the [.filename]#pcm/# directory "
"holds the central code, while the [.filename]#pci/#, [.filename]#isa/# and [."
"filename]#usb/# directories have the drivers for PCI and ISA boards, and for "
"USB audio devices."
msgstr ""

#. type: Title ==
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:78
#, no-wrap
msgid "Probing, Attaching, etc."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:81
msgid ""
"Sound drivers probe and attach in almost the same way as any hardware driver "
"module. You might want to look at the crossref:isa-driver[isa-driver,ISA] or "
"crossref:pci[pci,PCI] specific sections of the handbook for more information."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:83
msgid "However, sound drivers differ in some ways:"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:85
msgid ""
"They declare themselves as [.filename]#pcm# class devices, with a `struct "
"snddev_info` device private structure:"
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:93
#, no-wrap
msgid ""
"          static driver_t xxx_driver = {\n"
"              \"pcm\",\n"
"              xxx_methods,\n"
"              sizeof(struct snddev_info)\n"
"          };\n"
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:96
#, no-wrap
msgid ""
"          DRIVER_MODULE(snd_xxxpci, pci, xxx_driver, pcm_devclass, 0, 0);\n"
"          MODULE_DEPEND(snd_xxxpci, snd_pcm, PCM_MINVER, PCM_PREFVER,PCM_MAXVER);\n"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:99
msgid ""
"Most sound drivers need to store additional private information about their "
"device. A private data structure is usually allocated in the attach routine. "
"Its address is passed to [.filename]#pcm# by the calls to `pcm_register()` "
"and `mixer_init()`. [.filename]#pcm# later passes back this address as a "
"parameter in calls to the sound driver interfaces."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:100
msgid ""
"The sound driver attach routine should declare its MIXER or AC97 interface "
"to [.filename]#pcm# by calling `mixer_init()`. For a MIXER interface, this "
"causes in turn a call to <<xxxmixer-init,`xxxmixer_init()`>>."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:101
msgid ""
"The sound driver attach routine declares its general CHANNEL configuration "
"to [.filename]#pcm# by calling `pcm_register(dev, sc, nplay, nrec)`, where "
"`sc` is the address for the device data structure, used in further calls "
"from [.filename]#pcm#, and `nplay` and `nrec` are the number of play and "
"record channels."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:102
msgid ""
"The sound driver attach routine declares each of its channel objects by "
"calls to `pcm_addchan()`. This sets up the channel glue in [.filename]#pcm# "
"and causes in turn a call to <<xxxchannel-init,`xxxchannel_init()`>>."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:103
msgid ""
"The sound driver detach routine should call `pcm_unregister()` before "
"releasing its resources."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:105
msgid "There are two possible methods to handle non-PnP devices:"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:107
msgid ""
"Use a `device_identify()` method (example: [.filename]#sound/isa/es1888.c#). "
"The `device_identify()` method probes for the hardware at known addresses "
"and, if it finds a supported device, creates a new pcm device which is then "
"passed to probe/attach."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:108
msgid ""
"Use a custom kernel configuration with appropriate hints for pcm devices "
"(example: [.filename]#sound/isa/mss.c#)."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:110
msgid ""
"[.filename]#pcm# drivers should implement `device_suspend`, `device_resume` "
"and `device_shutdown` routines, so that power management and module "
"unloading function correctly."
msgstr ""

#. type: Title ==
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:112
#, no-wrap
msgid "Interfaces"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:115
msgid ""
"The interface between the [.filename]#pcm# core and the sound drivers is "
"defined in terms of <<kernel-objects,kernel objects>>."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:117
msgid ""
"There are two main interfaces that a sound driver will usually provide: "
"_CHANNEL_ and either _MIXER_ or _AC97_."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:119
msgid ""
"The _AC97_ interface is a very small hardware access (register read/write) "
"interface, implemented by drivers for hardware with an AC97 codec. In this "
"case, the actual MIXER interface is provided by the shared AC97 code in [."
"filename]#pcm#."
msgstr ""

#. type: Title ===
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:120
#, no-wrap
msgid "The CHANNEL Interface"
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:122
#, no-wrap
msgid "Common Notes for Function Parameters"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:125
msgid ""
"Sound drivers usually have a private data structure to describe their "
"device, and one structure for each play and record data channel that it "
"supports."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:127
msgid ""
"For all CHANNEL interface functions, the first parameter is an opaque "
"pointer."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:129
msgid ""
"The second parameter is a pointer to the private channel data structure, "
"except for `channel_init()` which has a pointer to the private device "
"structure (and returns the channel pointer for further use by [."
"filename]#pcm#)."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:130
#, no-wrap
msgid "Overview of Data Transfer Operations"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:133
msgid ""
"For sound data transfers, the [.filename]#pcm# core and the sound drivers "
"communicate through a shared memory area, described by a `struct snd_dbuf`."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:135
msgid ""
"`struct snd_dbuf` is private to [.filename]#pcm#, and sound drivers obtain "
"values of interest by calls to accessor functions (`sndbuf_getxxx()`)."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:137
msgid ""
"The shared memory area has a size of `sndbuf_getsize()` and is divided into "
"fixed size blocks of `sndbuf_getblksz()` bytes."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:139
msgid ""
"When playing, the general transfer mechanism is as follows (reverse the idea "
"for recording):"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:141
msgid ""
"[.filename]#pcm# initially fills up the buffer, then calls the sound "
"driver's <<channel-trigger,`xxxchannel_trigger()`>> function with a "
"parameter of PCMTRIG_START."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:142
msgid ""
"The sound driver then arranges to repeatedly transfer the whole memory area "
"(`sndbuf_getbuf()`, `sndbuf_getsize()`) to the device, in blocks of "
"`sndbuf_getblksz()` bytes. It calls back the `chn_intr()`[.filename]#pcm# "
"function for each transferred block (this will typically happen at interrupt "
"time)."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:143
msgid ""
"`chn_intr()` arranges to copy new data to the area that was transferred to "
"the device (now free), and make appropriate updates to the `snd_dbuf` "
"structure."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:145
#, no-wrap
msgid "channel_init"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:148
msgid ""
"`xxxchannel_init()` is called to initialize each of the play or record "
"channels. The calls are initiated from the sound driver attach routine. (See "
"the <<pcm-probe-and-attach,probe and attach section>>)."
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:160
#, no-wrap
msgid ""
"          static void *\n"
"          xxxchannel_init(kobj_t obj, void *data,\n"
"             struct snd_dbuf *b, struct pcm_channel *c, int dir) <.>\n"
"          {\n"
"              struct xxx_info *sc = data;\n"
"              struct xxx_chinfo *ch;\n"
"               ...\n"
"              return ch; <.>\n"
"           }\n"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:163
msgid ""
"`b` is the address for the channel `struct snd_dbuf`. It should be "
"initialized in the function by calling `sndbuf_alloc()`. The buffer size to "
"use is normally a small multiple of the 'typical' unit transfer size for "
"your device.`c` is the [.filename]#pcm# channel control structure pointer. "
"This is an opaque object. The function should store it in the local channel "
"structure, to be used in later calls to [.filename]#pcm# (ie: `chn_intr(c)`)."
"`dir` indicates the channel direction (`PCMDIR_PLAY` or `PCMDIR_REC`)."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:165
msgid ""
"The function should return a pointer to the private area used to control "
"this channel. This will be passed as a parameter to other channel interface "
"calls."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:166
#, no-wrap
msgid "channel_setformat"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:169
msgid ""
"`xxxchannel_setformat()` should set up the hardware for the specified "
"channel for the specified sound format."
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:179
#, no-wrap
msgid ""
"          static int\n"
"          xxxchannel_setformat(kobj_t obj, void *data, u_int32_t format) <.>\n"
"          {\n"
"              struct xxx_chinfo *ch = data;\n"
"               ...\n"
"              return 0;\n"
"           }\n"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:182
msgid ""
"`format` is specified as an `AFMT_XXX value` ([.filename]#soundcard.h#)."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:183
#, no-wrap
msgid "channel_setspeed"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:186
msgid ""
"`xxxchannel_setspeed()` sets up the channel hardware for the specified "
"sampling speed, and returns the possibly adjusted speed."
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:196
#, no-wrap
msgid ""
"          static int\n"
"          xxxchannel_setspeed(kobj_t obj, void *data, u_int32_t speed)\n"
"          {\n"
"              struct xxx_chinfo *ch = data;\n"
"               ...\n"
"              return speed;\n"
"           }\n"
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:198
#, no-wrap
msgid "channel_setblocksize"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:201
msgid ""
"`xxxchannel_setblocksize()` sets the block size, which is the size of unit "
"transactions between [.filename]#pcm# and the sound driver, and between the "
"sound driver and the device. Typically, this would be the number of bytes "
"transferred before an interrupt occurs. During a transfer, the sound driver "
"should call [.filename]#pcm#'s `chn_intr()` every time this size has been "
"transferred."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:203
msgid ""
"Most sound drivers only take note of the block size here, to be used when an "
"actual transfer will be started."
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:213
#, no-wrap
msgid ""
"          static int\n"
"          xxxchannel_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)\n"
"          {\n"
"              struct xxx_chinfo *ch = data;\n"
"                ...\n"
"              return blocksize; <.>\n"
"           }\n"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:216
msgid ""
"The function returns the possibly adjusted block size. In case the block "
"size is indeed changed, `sndbuf_resize()` should be called to adjust the "
"buffer."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:218
#, no-wrap
msgid "channel_trigger"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:221
msgid ""
"`xxxchannel_trigger()` is called by [.filename]#pcm# to control data "
"transfer operations in the driver."
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:231
#, no-wrap
msgid ""
"          static int\n"
"          xxxchannel_trigger(kobj_t obj, void *data, int go) <.>\n"
"          {\n"
"              struct xxx_chinfo *ch = data;\n"
"               ...\n"
"              return 0;\n"
"           }\n"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:234
msgid "`go` defines the action for the current call. The possible values are:"
msgstr ""

#. type: delimited block = 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:238
msgid ""
"If the driver uses ISA DMA, `sndbuf_isadma()` should be called before "
"performing actions on the device, and will take care of the DMA chip side of "
"things."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:240
#, no-wrap
msgid "channel_getptr"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:243
msgid ""
"`xxxchannel_getptr()` returns the current offset in the transfer buffer. "
"This will typically be called by `chn_intr()`, and this is how [."
"filename]#pcm# knows where it can transfer new data."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:244
#, no-wrap
msgid "channel_free"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:247
msgid ""
"`xxxchannel_free()` is called to free up channel resources, for example when "
"the driver is unloaded, and should be implemented if the channel data "
"structures are dynamically allocated or if `sndbuf_alloc()` was not used for "
"buffer allocation."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:248
#, no-wrap
msgid "channel_getcaps"
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:257
#, no-wrap
msgid ""
"          struct pcmchan_caps *\n"
"          xxxchannel_getcaps(kobj_t obj, void *data)\n"
"          {\n"
"              return &xxx_caps; <.>\n"
"           }\n"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:260
msgid ""
"The routine returns a pointer to a (usually statically-defined) "
"`pcmchan_caps` structure (defined in [.filename]#sound/pcm/channel.h#. The "
"structure holds the minimum and maximum sampling frequencies, and the "
"accepted sound formats. Look at any sound driver for an example."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:261
#, no-wrap
msgid "More Functions"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:264
msgid ""
"`channel_reset()`, `channel_resetdone()`, and `channel_notify()` are for "
"special purposes and should not be implemented in a driver without "
"discussing it on the {freebsd-multimedia}."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:266
msgid "`channel_setdir()` is deprecated."
msgstr ""

#. type: Title ===
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:267
#, no-wrap
msgid "The MIXER Interface"
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:270
#, no-wrap
msgid "mixer_init"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:273
msgid ""
"`xxxmixer_init()` initializes the hardware and tells [.filename]#pcm# what "
"mixer devices are available for playing and recording"
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:281
#, no-wrap
msgid ""
"          static int\n"
"          xxxmixer_init(struct snd_mixer *m)\n"
"          {\n"
"              struct xxx_info   *sc = mix_getdevinfo(m);\n"
"              u_int32_t v;\n"
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:283
#, no-wrap
msgid "              [Initialize hardware]\n"
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:288
#, no-wrap
msgid ""
"              [Set appropriate bits in v for play mixers] <.>\n"
"              mix_setdevs(m, v);\n"
"              [Set appropriate bits in v for record mixers]\n"
"              mix_setrecdevs(m, v)\n"
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:291
#, no-wrap
msgid ""
"              return 0;\n"
"          }\n"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:294
msgid ""
"Set bits in an integer value and call `mix_setdevs()` and `mix_setrecdevs()` "
"to tell [.filename]#pcm# what devices exist."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:296
msgid ""
"Mixer bits definitions can be found in [.filename]#soundcard.h# "
"(`SOUND_MASK_XXX` values and `SOUND_MIXER_XXX` bit shifts)."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:297
#, no-wrap
msgid "mixer_set"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:300
msgid "`xxxmixer_set()` sets the volume level for one mixer device."
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:311
#, no-wrap
msgid ""
"          static int\n"
"          xxxmixer_set(struct snd_mixer *m, unsigned dev,\n"
"                           unsigned left, unsigned right) <.>\n"
"          {\n"
"              struct sc_info *sc = mix_getdevinfo(m);\n"
"              [set volume level]\n"
"              return left | (right << 8); <.>\n"
"          }\n"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:314
msgid ""
"The device is specified as a `SOUND_MIXER_XXX` value. The volume values are "
"specified in range [0-100]. A value of zero should mute the device."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:315
msgid ""
"As the hardware levels probably will not match the input scale, and some "
"rounding will occur, the routine returns the actual level values (in range "
"0-100) as shown."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:316
#, no-wrap
msgid "mixer_setrecsrc"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:319
msgid "`xxxmixer_setrecsrc()` sets the recording source device."
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:326
#, no-wrap
msgid ""
"          static int\n"
"          xxxmixer_setrecsrc(struct snd_mixer *m, u_int32_t src) <.>\n"
"          {\n"
"              struct xxx_info *sc = mix_getdevinfo(m);\n"
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:328
#, no-wrap
msgid "              [look for non zero bit(s) in src, set up hardware]\n"
msgstr ""

#. type: delimited block . 4
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:332
#, no-wrap
msgid ""
"              [update src to reflect actual action]\n"
"              return src; <.>\n"
"           }\n"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:335
msgid "The desired recording devices are specified as a bit field"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:336
msgid ""
"The actual devices set for recording are returned. Some drivers can only set "
"one device for recording. The function should return -1 if an error occurs."
msgstr ""

#. type: Title ====
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:337
#, no-wrap
msgid "mixer_uninit, mixer_reinit"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:340
msgid ""
"`xxxmixer_uninit()` should ensure that all sound is muted and if possible "
"mixer hardware should be powered down."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:342
msgid ""
"`xxxmixer_reinit()` should ensure that the mixer hardware is powered up and "
"any settings not controlled by `mixer_set()` or `mixer_setrecsrc()` are "
"restored."
msgstr ""

#. type: Title ===
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:343
#, no-wrap
msgid "The AC97 Interface"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:346
msgid ""
"The _AC97_ interface is implemented by drivers with an AC97 codec. It only "
"has three methods:"
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:348
msgid "`xxxac97_init()` returns the number of ac97 codecs found."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:349
msgid "`ac97_read()` and `ac97_write()` read or write a specified register."
msgstr ""

#. type: Plain text
#: documentation/content/en/books/arch-handbook/sound/_index.adoc:350
msgid ""
"The _AC97_ interface is used by the AC97 code in [.filename]#pcm# to perform "
"higher level operations. Look at [.filename]#sound/pci/maestro3.c# or many "
"others under [.filename]#sound/pci/# for an example."
msgstr ""