Vous êtes sur la page 1sur 12

Real-Time Audio Mixer

ECE532H1S
Digital System Design
Group Report
Peter Mi!aels
"e#in $ui
Table of Contents:
1% &#er#ie'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%3
2% &utome%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%(
)ota*le Pro*lems Enountered%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%(
Audio Code%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%(
+art ,nterru-ts%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
3% Desri-tion o. t!e /lo0s%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
a1 Existing Com-onents%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
AC23 Audio Code%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
AC23 Controller%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
E!o Core4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
6ast Sim-lex $in0 76S$1 /us%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
Miro/la8e Proessor 7#% 5%991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
*1 Modi.ied Com-onents%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%3
AC23 Dri#er4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%3
1 Custom Com-onents%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%:
Audio Mixer%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%:
+ser ,nter.ae4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2
(% Desri-tion o. Design Tree4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%11
To- $e#el4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%11
Dri#ers4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%11
So.t'are Modules4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%11
Hard'are Modules4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%11
1. Overview
T!e goal o. t!is -ro;et 'as to design an audio mixer t!at mixed t'o audio in-uts
and allo'ed .or t!e ontrol o. t!e mixing in real-time% ,n addition to mixing t!e signals<
t!e user 'ould *e a*le to reord and -lay*a0 mixed sound and a--ly di..erent audio
e..ets to t!e mixed sound4 e!o< re#er*eration< time-stret!ing< and .iltering% 6inally< to
-re#ent -ro*lems aused *y sound #ariation in t!e soure in-uts< t!e design 'ould !a#e
used an 66T t!at 'ould e=uali8e t!e magnitudes% T!e entire system and all real-time
.untions 'ould *e ontrolled *y an easily na#igated user inter.ae%
Xilinx Virtex II FPGA
Development Board
AC97 Audio Codec
Miro-!one $ine-,n S-ea0er
Terminal
External Memory
AC97 Controller Mixer Module
7Custom1 MicroBlaze
7>ilinx ,P1
!er Inter"ace
7Custom S?@1
#c$o Module
%PB Inter"ace
Xart&ite
7>ilinx ,P1
RS232 Serial ,?&
#xternal Memor'
Controller
AC97 Driver
%PB Interrupt
Controller
T!e a*o#e .igure is a model o. our .inal design% As a result o. a team mem*er
lea#ing t!e grou- 'e saled *a0 our initial design and eliminated t!e 66T module and
some o. t!e e..ets%
@e reused om-onents .rom -re#ious -ro;ets< mainly t!e AC23 ontroller -lus
dri#er and t!e e!o *lo0% As ex-eted 'e made use o. ,P su--lied *y >ilinx as -art o.
t!e de#elo-ment en#ironment% @e ontri*uted t!e Mixer !ard'are module< modi.ied t!e
AC23 dri#er to suit our needs and reated t!e +, and all ode assoiated 'it! t!e
im-lemented .eatures%
2. Outcome
&#erall< many o. t!e -ro;ets originally -ro-osed om-onents 'ere im-lemented
suess.ully% Many use.ul .untions su! as reording and -lay*a0< memory aesses
.or reording and -lay*a0< and t!e user inter.ae 'ere t!e most suess.ul -arts o. t!is
-ro;et< !a#ing no -ro*lems in t!eir exeution%
+n.ortunately< t!e namesa0e o. t!e -ro;et 'as one o. t!e .e' -iees t!at 'ere
not suess.ully om-leted in time% T!e !ard'are logi .or t!e digital audio mixer 'as
reated< simulated and synt!esi8ed< *ut did not 'or0 orretly '!en integrated into t!e
rest o. t!e system% To o..set t!is tem-orarily< a so.t'are im-lementation o. t!e mixer 'as
attem-ted< *ut t!at yielded noisy out-ut due to t!e inreased delays aused *y t!e
so.t'are im-lementation%
T!e sound e..ets *lo0s su! as e!o and time stret!ing 'ere im-lemented and
'or0ing< *ut did not -rodue o*#ious -erei#a*le results% T!is ould !a#e *een easily
remedied *y inreasing t!e delay .or t!e e!o< and inreasing t!e time stret!ing e..et%
Notable Problems Encountered
Audio Codec
&ne o. t!e audio ode !i-As a-a*ilities is t!at it allo's on-!i- mixing o. audio
signals oming into t!e !i-% Ho'e#er< 'e diso#ered t!at i. t!e on-!i- mixers are used<
t!e mixed signal is not sent to t!e reording registers< '!i! 'ould gat!er data to *e sent
to t!e Miro/la8e% ,nstead< t!e mixer out-uts are sent diretly to t!e !i- out-uts< '!i!
dri#e t!e line-out onnetion on t!e *oard%
@e originally 'anted to -er.orm on-!i- mixing o. t!e stereo signal to generate a
mono signal< '!i! ould t!en *e mixed 'it! t!e miro-!one 'it!out any loss o. signal
data% Ho'e#er< 'e diso#ered t!at t!is ould not *e done in t!e 'ay 'e 'anted% As a
result< 'e !ad to disa*le mixing 'it!in t!e !i-% @!at t!is meant is t!at t!e reording
registers ould only *e on.igured to reord eit!er t!e le.t or rig!t !annel o. t!e stereo
in-ut and t!e miro-!one in-ut% &ne o. t!e !annels .rom t!e stereo in-ut 'ould *e lost%
@!ile t!is 'as not a se#ere t!reat to t!e -ro;et< it did redue t!e =uality o. our sound
out-ut%
Uart Interrupts
@!ile im-lementing our interru-t *ased +,< it 'as diso#ered t!at *ot! t!e
reei#e and t!e send !andling routines must *e instantiated% ,nitially< 'e ;ust instantiated
t!e reei#e !andler sine 'e 'ere only interested in user in-ut triggering and interru-t<
*ut it 'as =ui0ly diso#ered t!at t!e xilB-rint.71 alls outside t!e main t!read i%e% in t!e
routine !andler 'ere ne#er exeuted% 6urt!er testing onluded t!at t!e send !andler
must also *e instantiated e#en i. it is an em-ty stu*%
3. Description of te !loc"s
a) Existing Components
AC#$ Audio Codec
T!e audio system .or t!e >ilinx >+P Cirtex ,, Pro De#elo-ment /oard is
im-lemented on t!e $M(559 AC23 ode !i- .rom )ational Semiondutor% T!e Cirtex
,, Pro de#elo-ment *oard only allo's t'o di..erent inoming signals< miro-!one in-ut
7mono1 and line-in 7stereo1% T!e ode on#erts analog audio data to PCM data and #ie
#ersa% ,ts datas!eet an *e .ound !ere4 '''%national%om?o-.?$M?$M(559%!tml ,t is also
inluded in t!e soure tree as a re.erene%
A .e' t!ings s!ould *e noted a*out t!e ode< t!e t'o mixers are al'ays on< so i.
any signals are sent to t!em< t!e signals 'ill *e om*ined% 6urt!er< i. t!e mixers are used<
t!e result 'ill *e out-ut< 'it!out !a#ing a !ane to *e -roessed .urt!er% To onnet t!e
audio ode to t!e 6PDA< 'e .ollo'ed t!e guidelines outlined in t!e >+P +ser Duide
doumentation t!at ame 'it! t!e >PS suite and t!e *oard s!ematis%
T!e 0ey to ati#ating t!e ode is to ma- t!e A+D,&BRESETBE signal to one o. t!e D,P
s'it!es on t!e *oard and -ull it !ig! .or t!e ode to ati#ate% T!e ode resets i. t!e
signal is lo' .or a .e' lo0 yles and t!en it is -ulled !ig!%
Doument4 '''%xilinx%om?uni#?>+PC2P?Doumentation?>+PC2PB+serBDuide%-d.
S!ematis4 '''%xilinx%om?uni#?>+PC2P?Doumentation?E>TER)A$BRECBCBSCHEMAT,CS%-d.
AC#$ Controller
T!e ontroller .or t!e AC23 audio ode 'as ta0en .rom t!e 2995 -ro;et FReal-
Time Audio ProessingG% T!e exat ore used 'as Fo-*Ba23BontrollerB#(B99BaG% T!is
ontroller -ro#ided t!e a*ility to ommuniate 'it! t!e audio ode de#ie and inluded
t!e a*ility to use 6S$ lin0s to ommuniate 'it! t!e Miro/la8e%
&riginal doumentation .rom t!e 2995 -ro;et4
'''%eeg%toronto%edu?H-?ourses?(32?2995?-ro;ets?realtimeaudio%-d.
6urt!er in.ormation regarding t!is ore 'as soured .rom t!e 299( -ro;et FAC23
Sound Controller 'it! De#ie Dri#erG% More in.ormation a*out t!is module an *e .ound
in t!e original doumentation .ound !ere4
'''%eeg%toronto%edu?H-?ourses?(32?299(?-ro;ets?a23ontroller%do
%co Core:
T!e e!o ore< #ersion 1%99a< 'as ta0en unmodi.ied .rom t!e >Pod -ro;et .rom
2995% ,t 'as onneted in t!e +, using t!e 6S$% A sam-le o. audio is 'ritten to t!e 6S$
and a sam-le is read *a0 *e.ore it is -roessed .urt!er or out-ut to t!e AC23 ore%
Port Connections4
Cl0 I sysBl0Bs
Reset I netBgnd
T!e e!o ore is oded in CHD$ and onsists o. a 6S$ inter.ae .or reading and
'riting< an instantiation o. a 6,6& *u..er '!ose de-t! is -rogramma*le% T!e audio
sam-le oming t!roug! t!e 6S$ is stored in t!e 6,6& t!en data .rom t!e 6,6& is
om*ined 'it! t!e audio sam-le and returned on t!e 6S$%
$in0 to do4 '''%eeg%toronto%edu?H-?ourses?(32?2995?-ro;ets?x-od%-d.
&ast 'imple( )in" *&')+ !us
T!e 6S$ is a *us onnetion -ro#ided *y >ilinx .or !ig! s-eed data trans.ers
*et'een t!e Miro/la8e and ot!er !ard'are *lo0s% Ea! instane o. an 6S$ is
re-resented *y t'o uni-diretional lin0s< '!i! -ro#ide a-a*ility .or *i-diretional data
trans.er '!en used toget!er% Ea! lin0 is im-lemented as an asyn!ronous 6,6& '!i!
allo's di..erent lo0 domains on ea! end o. t!e lin0% T!e main use .or t!e 6S$ lin0s
are '!en s-eed or *and'idt! are im-ortant< sine t!ese are dediated lines and donAt
su..er .rom ongestion -ro*lems li0e t!e &P/ *us does%
,m-ortant note4 @!ile ea! instantiation o. t!e 6S$ on t!e Miro/la8e -ro#ides
t'o onnetions 7master and sla#e1< ea! instantiation o. t!e atual *us lin0 is only a
single onnetion% @!en re.erening an 6S$ ,D .or use 'it! t!e getfsl() and putfsl()
7*lo0ing1 .untions< t!e ,D is t!e 6S$ instane num*er on t!e Miro/la8e< not t!e *us
instane num*er% ie% ,. a *lo0 onnets to M6S$9 and S6S$9 on t!e Miro/la8e using
*us lin0s .slB#29B9 and .slB#29B1< t!e 6S$ ,D .or data in *ot! diretions is 9%
,icro!la-e .rocessor *v. /.00c+
T!e Miro/la8e is an ,P ore im-lemented *y >ilinx '!i! -ro#ides a -roessor
im-lemented on t!e 6PDA% T!e means t!at t!e -roessor an *e readily reon.igured to
suit '!ate#er needs t!e designer !as% &n t!e ot!er !and< t!is also means t!at it is
onsidera*ly slo'er t!an a standard -roessor im-lemented in AS,Cs%
$i0e any -roessor< t!e Miro/la8e is designed to -roess instrutions -assed into
it% T!e -rogram used .or our system 'as 'ritten in C and om-iled to run on t!e
Miro/la8e% Sine t!ere 'as no o-erating system installed on our system< lo' le#el
!ard'are aesses !ad to *e im-lemented using t!e a#aila*le !ard'are dri#ers diretly%
More in.ormation a*out t!e Miro/la8e an *e .ound !ere4
'''%xilinx%om?xlnx?xe*i8?designResoures?i-B-rodutBdetails%;s-J0eyKmiroB*la8e
b) Modified Components
AC#$ Driver:
T!e AC23 Dri#er< #ersion 1%99a< 'as ta0en .rom t!e FReal-Time Audio
ProessingG -ro;et .rom 2995% T!e dri#er is used 'it! t!e AC23 Core< #ersion (<
desri*ed in t!e a*o#e setion FExisting Com-onentsG%
T!e dri#er 'as modi.ied to so t!at t'o sam-les are reordedL t!e ta*le *elo' desri*es
t!e register settings .urt!er%
T!e settings 'ere made in t!e void init_sound(int sample_rate) .untion in xa23% .ile o.
t!e dri#er%
Re( )ame Value Function
92! Master Colume 9x9999 Controls t!e AMP &ut-ut #olume< itAs *een set
to 9d/ gain% Too mu! gain results in noise%
9(! $ine $e#el Colume 9x9999 Controls t!e Stereo &ut-ut #olume< itAs *een
set to 9d/ gain%
95! Mono Colume 9x:999 Controls t!e Mono &ut-ut #olume< itAs *een set
to Mute% Mono &ut-ut !as not *een
im-lemented on t!e *oard< so t!e register is
Muted to redue noise%
9A! PCB/ee-BColume 9x:999 Controls t!e PCB/ee- .untion< '!i! an mix
a standard noise into t!e out-ut< itAs *een set to
Mute%
9C! P!oneBColume 9x:999 Controls t!e P!one ,n-ut< it !asnAt *een
im-lemented on t!e de# *oard% T!e register is
set to Mute to redue noise%
9E! Mi Colume 9x:99: Controls t!e Colume o. *ot! Mi ,n-uts< only
one is im-lemented on t!e de# *oard% T!e
register is set to Mute t!e signal so it doesnAt
go into M,>1 and set to 9d/ gain *e.ore it
enters t!e reord selet%
19! $ine ,n Colume 9x:999 Controls t!e Stereo $ine ,n-ut to t!e M,>1< itAs
*een set to Mute sine on-ode signal mixing
'as not re=uired%
12! CD Colume 9x:999 Controls t!e CD ,n-ut to t!e M,>1< t!at in-ut
is not im-lemented on t!e de# *oard% T!e
register is set to Mute to redue noise%
1(! Cideo Colume 9x:999 Controls t!e Cideo ,n-ut to t!e M,>1< t!at
in-ut is not im-lemented on t!e de# *oard% T!e
register is set to Mute to redue noise%
15! Aux Colume 9x:999 Controls t!e Auxiliary ,n-ut to t!e M,>1< t!at
in-ut is not im-lemented on t!e de# *oard% T!e
register is set to Mute to redue noise%
1:! PCM &ut Colume 9x9:9: Controls t!e #olume .rom t!e DAC to t!e
out-ut% /ot! t!e rig!t and le.t !annels !a#e
*een set to 9d/ gain to redue noise%
1A! Reord Selet 9x9(99 Controls t!e Reord Selet Mux< itAs *een set to
ae-t $ine ,n as le.t !annel and Mi as t!e
rig!t !annel%
1C! Reord Dain 9x9999 Controls t!e gain?attenuation a--lied to audio
*e.ore it is sam-led at t!e ADC% ,tAs *een set to
9d/ to eliminate t!e addition o. noise%
29! Deneral Pur-ose 9x:999 Controls #arious mux ontrols% T!e P&P
ontrol o. t!e mux '!i! deides '!i! mixer
t!e sound 'ill enter .rom t!e DAC !as *een
set< so M,>1 is *y-assed%
2A! Extended Audio
Control?Status
9x9991 Setting t!e least signi.iant *it< ati#ates CRA<
'!i! allo's .or t!e -rogramming t!e
sam-ling rate%
2C! PCM DAC Rate ((199 Sets t!e sam-ling rate o. t!e DAC%
32! PCM ADC Rate ((199 Sets t!e sam-ling rate o. t!e ADC%
More in.ormation on t!ese registers and a *lo0 diagram o. t!e AC23 Code 7om-onent
M $M(5591 an *e .ound on t!e datas!eet< it is lin0ed in Setion 3< a1< AC23 Audio
Code%
c) Custom Components
Audio ,i(er
Implementation4
T!e audio mixer 'as designed to *e a !ard'are module '!i! allo'ed .or
sala*le mixing o. t'o mono audio signals% T!e sala*ility meant t!at during run-time<
t!e ratios in '!i! t!e t'o audio signals 'ere mixed ould *e !anged at any time<
allo'ing t!e user to !oose !o' dominant ea! sound 'ould *e in t!e out-ut% Audio
mixing meant om*ining t!e t'o signals su! t!at *ot! ould *e !eard at one%
To sale t!e sound in-uts< to a..et t!eir mixing ratio< t!e in-uts are .irst ad;usted
*y t!e .ollo'ing .ator *e.ore *eing mixed toget!er%
Input1 = input1 * <input1 mixing percentage> / 50
Input2 = input2 * <input2 mixing percentage> / 50
T!is means t!at i. 'e 'anted t!e out-ut to onsist o. 39N in-ut1 and 39N in-ut2<
t!e am-litudes o. ea! o. t!ese signals 'ould *e saled to t!e a--ro-riate .ator *e.ore
t!ey get mixed toget!er% ,n t!is ase< t!e am-litude o. in-ut1 'ould *e redued< '!ile t!e
am-litude o. in-ut2 'ould *e inreased%
T!e audio mixer im-lements t!e .ollo'ing .ormula in !ard'are4
Output = input1 + input2 ( input1 * input2 / <maximum signal amplitude> )
T!is .ormula 'or0s in t!e time domain and om-utes t!is .or ea! sam-le o. t!e
sound in-uts% T!e addition o. t!e t'o sounds means om*ining t!eir am-litudes so t!at
*ot! an *e !eard% T!e su*tration term is a saling .ator '!i! -re#ents t!e sound
out-ut .rom *eing louder t!an t!e t'o indi#idual sound in-uts% T!is means t!at t!e
resulting #olume 'ill *e t!e larger o. in-ut1 or in-ut2 and not louder%
6or t!is system< 15 *it #alues .or t!e sound sam-les 'ere used sine t!at 'as t!e si8e o.
data '!i! t!e AC23 ontroller 'as designed .or% T!is resulted in t!e signal am-litude
ranging .rom 9 I 55535 '!ere 9 re-resents silene< and 55535 is t!e loudest%
Connection4
T!e audio mixer ore 'as onneted to t!e rest o. t!e system using 6ast Sim-lex
$in0 76S$1 onnetions to t!e Miro/la8e so.t -roessor% T!e -roessor< t!roug!
exeution o. our -rogram< olleted sam-les .rom t!e AC23 audio ode and -assed t!em
into t!e mixer t!roug! t!e 6S$% T!e -roessed out-ut .rom t!e mixer 'as sent t!roug!
anot!er 6S$ lin0 *a0 to t!e -roessor '!ere it 'as sent *a0 to t!e AC23 ode .or
-lay*a0%
I!!ue!4
As .ar as 'e 0no'< t!e issue around t!e audio mixer ore 'as a result o. t!e
module not 'riting its out-uts to t!e 6S$% T!e reason .or t!is 'as un0no'n at t!e time o.
demonstration%
T!e ModelSim simulation s!o's !o' t!e mixer 'as reading data .rom t!e 6S$<
generating t!e orret out-ut #alues< and s!ould t!eoretially !a#e 'ritten to t!e 6S$%
User Interface:
T'o +, designs !a#e *een om-letedL one uses a non-*lo0ing read on t!e +art to
!e0 .or user in-ut and t!e ot!er registers an interru-t routine 'it! t!e +art% /ot! 'or0<
alt!oug! t!e -olling ode is more relia*le< t!e interru-t *ased ode !as *een inluded as
an exam-le%
T!e *elo' ta*les lists t!e ommands a#aila*le to t!e user4
1 Mix Signals
2 Play 6ile 6rom Memory
3 Reord 6ile ,n Memory
( A--ly E!o
5 A--ly E..et M2
5 Sto-
&-tions ( and 5 are only a#aila*le one o-tion 1 !as *een seleted% To sto- eit!er e..et<
t!e user must selet it a seond time% T!e -olling #ersion< allo's seleting t!e alternate
e..et to sto- t!e urrent one I t!e s'it! !a--ens automatially%
T!e ode starts *y setting u- t!e AC23 ode< t!e +art ,nterru-ts and ati#ating
t!e interru-ts on t!e miro*la8e -roessor< t!e latter a--lies to t!e interru-t *ased ode
only%
Pollin( I
A.ter suess.ul set-u- t!e ode enters an in.inite loo- '!i! onsist o. a +art
non-*lo0ing read o-eration Xart&ite*Recv+,artController - ,c$ar - int .'te!/0
to !e0 i. t!e user entered a ommand and t!en *ased on t!at ommand ma0es a
deision '!i! o. t!e atomi mixing .untions to exeute% T!e onditional !e0s are
set-u- so t!at t!e urrent .untion *eing exeuted *y t!e digital mixer is 0no'n and
only ommands t!at are ae-ta*le are .ollo'ed t!roug!% ,. no ommand is entered
t!e loo- goes t!roug! and ontinues to all t!e atomi mixing .untions< '!i! 'as
set *y t!e last user entered ommand% T!e atomi .untions !a#e one roleL to read
t'o sam-les .rom t!e a23 ode< a--ly mixing and any sound e..ets< and t!en -ut
t!e result *a0 on to t!e a23 .or out-ut%
T!is ty-e o. !e0ing< allo's .or lean and straig!t.or'ard ontrol *y t!e user%
Ho'e#er< t!e numerous onditional !e0s in t!e in.inite loo- at to slo' do'n t!e
-roess and i. too many ations are -er.ormed inside t!e atomi mixing .untions<
t!e out-ut mig!t ontain noise .rom too many missed sam-les%
Interrupt Ba!ed I
A.ter suess.ul set-u- o. t!e a23 and t!e +art interru-ts< t!e ode enters an
in.inite loo-% T!is in.inite loo- !as onditional !e0s on t!e .untion signals '!i!
designate t!e urrent ation% T!e .untional signals are set in t!e +art interru-t
!andler< '!i! is triggered ea! time t!e user enters a ommand% T!e interru-t
!andler determines i. t!e ommand is ae-ta*le and t!en sets t!e a--ro-riate signals
.or mixing< mixing O e!o< reord or -lay*a0< et% &ne exeution returns to t!e
main loo-< t!e onditional !e0s trigger a sel.-ontained mixing .untion% T!e
mixing .untions are om-osed o. t!e atomi sound -roessing inside a '!ile loo-
'!i! exits t!e moment t!e .untional signals are set to 6A$SE% T!us< to end t!e
sound -roessing t!e user must trigger an e#ent t!roug! t!e +art !andler< so t!at t!e
.untional signals an *e reset%
T!is design introdues om-liations .or t!e ontrol o. t!e +,< one must *e
are.ul to antii-ate all -ossi*le user in-uts and reset t!e signals '!en a--ro-riate%
1. Description of Desi2n Tree:
Top )evel:
system%m!s I to- le#el !ard'are desri-tions
system%mss I to- le#el so.t'are desri-tions
data?
system%u. I user onstraints .ile and -in s-ei.iations
Drivers:
driver!?
a23B#1B99Ba I dri#er .or on.iguring AC23 audio ode
'oftware ,odules:
code?
audioMixer% I so.t'are ontaining t!e main -rogram and user inter.ae%
T!is -rogram ommuniates 'it! !ard'are using 6S$s
audioMixer2% I interru-t *ased #ersion o. t!e main -rogram% T!e ot!er
#ersion uses -olling%
3ardware ,odules:
pcore!?
audioBmixerB#1B99Ba I Cerilog im-lementation o. audio mixer ore
e!oB#1B99Ba I CHD$ im-lementation o. e!o ore
o-*Ba23BontrollerB#(B99Ba I CHD$ im-lementation o. AC23 ontroller
'!i! allo's 6S$s to *e used
Appendi( A
Hints for using the AC97 audio codec with the irtex !! Pro
6ull doumentation .or t!e ode !i- an *e .ound !ere4
'''%national%om?o-.?$M?$M(559%!tml
11 T!ere is a signal on t!e ode alled A+D,&BRESETBE% T!e signal M+ST *e
-ulled !ig! *y t!e 6PDA *e.ore t!e ode 'ill 'or0% &t!er'ise< t!e ode 'ill
al'ays *e stu0 in reset mode% To do t!is< .ollo' t!ese ste-s4
a% Add t!e .ollo'ing t'o lines into t!e system.ucf .ile4
!" #$%IO&'!(!"&) *O+ = !,-
!" #$%IO&'!(!"&) IO("#%#'% = *.""*-
*% ,n t!e Ports #ie'< add a ne' external -in% )ame t!e -in
FA+D,&BRESETBEG and assign t!e net to netB#% ,. t!is doesnAt 'or0<
anot!er solution 'ould *e to assign it to one o. t!e D,P s'it!es on t!e
*oard% ,. t!is is done< -us!ing t!e s'it! do'n 'ill -ull t!e ode out o.
reset%
21 C!anges to t!e ode on.iguration an *e made in
drivers/ac97_v1_00_a/src/xac97.c% T!e on.iguration is done in t!e .untion
init&s/und()%
T!e .ollo'ing !olds true .or 6S$ onnetions% T!ese !a#e not *een tested using &P/
onnetions%
31 ,. t!e on-!i- mixers are ena*led< an internal yle in t!e !i- 'ill ause sound to
ome out o. t!e mixer diretly onto t!e out-uts< *y-assing inter.ae onnetions
to your -rogram% To get aess to t!e data< disa*le t!e on-!i- mixers and selet
t!e a--ro-riate #alues .or t!e reording register%
(1 Data oming .rom t!e ode is transmitted in t'o se-arate -a0ets% &ne -a0et
enodes data .rom t!e le.t !annel< and t!e seond -a0et ontains data
re-resenting t!e rig!t !annel% @!en reading .rom t!e ode !i-< you need to
-er.orm t'o reads to get all t!e signal data% T!e soures .or t!e le.t and rig!t
!annels an *e ontrolled using t!e reording register% See t!e datas!eet .or
details%
51 @riting sound out to t!e ode is also done 'it! t'o -a0ets< ea! ontaining
eit!er t!e le.t or rig!t !annel% ,. you are sending out a mono signal< send t!e
same data t'ie< as t!is seems to redue noise at t!e out-ut%

Vous aimerez peut-être aussi