Motorola DSP56300 Assembler Version 6.2.0 99-03-18 13:59:02 exfilter.asm Page 1 1 ;**************************************************************************** 2 ;EXFILTER : LOW PASS FILTERING DEMO FOR THE DSP56303EVM 3 ;WILL PASS AUDIO STRAIGHT THROUGH FOR APPROXIMATELY 10 SECONDS, THEN WILL 4 ;PASS IT THROUGH A FILTER FOR APPROXIMATELY 10 SECONDS, THEN STRAIGHT 5 ;THROUGH ETC..ETC..ETC 6 ;*************************************************************************** 1071 1072 00FFFF LINEAR EQU $FFFF 1073 ;****************************************************************************** 1074 1075 ;---Buffer for talking to the CS4218 1076 1077 X:000000 org x:0 1078 RX_BUFF_BASE 1079 000000 equ * 1080 RX_data_1_2 1081 X:000000 ds 1 ;data time slot 1/2 for RX ISR 1082 RX_data_3_4 1083 X:000001 ds 1 ;data time slot 3/4 for RX ISR 1084 RX_data_5_6 1085 X:000002 ds 1 ;data time slot 5/6 for RX ISR 1086 RX_data_7_8 1087 X:000003 ds 1 ;data time slot 7/8 for RX ISR 1088 1089 TX_BUFF_BASE 1090 000004 equ * 1091 TX_data_1_2 1092 X:000004 ds 1 ;data time slot 1/2 for TX ISR 1093 TX_data_3_4 1094 X:000005 ds 1 ;data time slot 3/4 for TX ISR 1095 TX_data_5_6 1096 X:000006 ds 1 ;data time slot 5/6 for TX ISR 1097 TX_data_7_8 1098 X:000007 ds 1 ;data time slot 7/8 for TX ISR 1099 1100 X:000008 RX_PTR ds 1 ; Pointer for rx buffer 1101 X:000009 TX_PTR ds 1 ; Pointer for tx buffer 1102 1103 1104 1105 X:000010 org x:$10 1106 X:000010 coefs dc 0.00370753 ;b10 1107 X:000011 dc 0.5 ;scaling factor 1108 X:000012 dc 0.00741518 ;b11 1109 X:000013 dc 0.83384359 ;a11 1110 X:000014 dc 0.00370753 ;b12 1111 X:000015 dc -0.34867418 ;a22 1112 1113 1114 X:000016 dc 0.00485158 ;b20 1115 X:000017 dc 0.5 ;scaling factor 1116 X:000018 dc 0.00970316 ;b21 1117 X:000019 dc 0.86615109 ;a21 1118 X:00001A dc 0.00485158 ;b22 1119 X:00001B dc -0.38555753 ;a22 1120 Motorola DSP56300 Assembler Version 6.2.0 99-03-18 13:59:02 exfilter.asm Page 2 1121 Y:000010 org y:$10 1122 Y:000010 000000 rtdelay bsc 4,$0 ;used to store information for filter 1123 Y:000014 000000 ltdelay bsc 4,$0 1124 tempstore 1125 Y:000018 ds 1 1126 1127 ;TONE_OUTPUT EQU HEADPHONE_EN+LINEOUT_EN+(4*LEFT_ATTN)+(4*RIGHT_ATTN) 1128 ;TONE_INPUT EQU MIC_IN_SELECT+(15*MONITOR_ATTN) 1129 ;CTRL_WD_12 equ NO_PREAMP+HI_PASS_FILT+SAMP_RATE_48+STEREO+DATA_16 ;CLB=0 1130 ;CTRL_WD_34 equ IMMED_3STATE+XTAL1_SELECT+BITS_64+CODEC_MASTER 1131 ;CTRL_WD_56 equ $000000 1132 ;CTRL_WD_78 equ $000000 1133 1134 000300 CTRL_WD_12 equ MIN_LEFT_ATTN+MIN_RIGHT_ATTN+LIN2+RIN2 1135 000000 CTRL_WD_34 equ MIN_LEFT_GAIN+MIN_RIGHT_GAIN 1136 1137 1138 1139 1140 P:000100 org p:$100 1141 START 1142 P:000100 08F4BD main movep #$040003,x:M_PCTL ; set PLL for MF of 4 040003 1143 P:000102 08F4BB movep #012421,x:M_BCR ; 003085 1144 P:000104 0003F8 ori #3,mr ;mask interrupts 1145 P:000105 0500BB movec #0,sp ;clear hardware stack pointer 1146 P:000106 0500BA move #0,omr ;operating mode 0 1147 P:000107 364000 move #$40,r6 ; initialise stack pointer 1148 P:000108 05F426 move #-1,m6 ; linear addressing FFFFFF 1149 P:00010A 0BF080 jsr ada_init ; intialize codec 000150 1150 1151 1152 1153 loop_1 1154 1155 P:00010C 066080 do #$60,wait2 ;do for approximately 10 seconds 00011D 1156 P:00010E 06FF8F do #$fff,wait2inner 00011C 1157 1158 P:000110 01B7A2 jset #2,x:M_SSISR0,* ;wait for frame sync to pass 000110 1159 P:000112 01B782 jclr #2,x:M_SSISR0,* ;wait for frame sync 000112 1160 1161 P:000114 568000 move x:RX_BUFF_BASE,a ;receive left 1162 P:000115 578100 move x:RX_BUFF_BASE+1,b ;receive right 1163 1164 P:000116 560400 move a,x:TX_BUFF_BASE ;transmit left 1165 P:000117 570500 move b,x:TX_BUFF_BASE+1 ;transmit right 1166 1167 P:000118 46F400 move #CTRL_WD_12,y0 ;set up control words 000300 Motorola DSP56300 Assembler Version 6.2.0 99-03-18 13:59:02 exfilter.asm Page 3 1168 P:00011A 460600 move y0,x:TX_BUFF_BASE+2 1169 P:00011B 260000 move #CTRL_WD_34,y0 1170 P:00011C 460700 move y0,x:TX_BUFF_BASE+3 1171 wait2inner 1172 P:00011D 000000 nop 1173 wait2 1174 1175 P:00011E 066080 do #$60,wait ;do for approximately 10s 000131 1176 P:000120 06FF8F do #$fff,waitinner 000130 1177 1178 P:000122 01B7A2 jset #2,x:M_SSISR0,* ;wait for frame sync. to pass 000122 1179 P:000124 01B782 jclr #2,x:M_SSISR0,* ;wait for frame sync 000124 1180 1181 P:000126 568000 move x:RX_BUFF_BASE,a ;receive left 1182 P:000127 578100 move x:RX_BUFF_BASE+1,b ;receive right 1183 1184 P:000128 0BF080 jsr process_stereo 000133 1185 1186 P:00012A 560400 move a,x:TX_BUFF_BASE ;transmit left 1187 P:00012B 570500 move b,x:TX_BUFF_BASE+1 ;transmit right 1188 P:00012C 46F400 move #CTRL_WD_12,y0 000300 1189 P:00012E 460600 move y0,x:TX_BUFF_BASE+2 1190 P:00012F 260000 move #CTRL_WD_34,y0 1191 P:000130 460700 move y0,x:TX_BUFF_BASE+3 1192 waitinner 1193 P:000131 000000 nop 1194 wait 1195 1196 P:000132 0C010C jmp loop_1 ;go back to the beginning 1197 1198 1199 process_stereo 1200 P:000133 301400 move #ltdelay,r0 ;set up pointer 1201 P:000134 0BF080 jsr filter ;filter the left sample 00013E 1202 P:000136 5E1800 move a,y:tempstore ;save filtered left sample 1203 P:000137 21EE00 move b,a ;move right sample 1204 P:000138 301000 move #rtdelay,r0 ;set up pointer 1205 P:000139 0BF080 jsr filter ;filter the right sample 00013E 1206 P:00013B 21CF00 move a,b ;filtered right into b 1207 P:00013C 5E9800 move y:tempstore,a ;filtered left into a 1208 P:00013D 00000C rts 1209 1210 1211 filter 1212 P:00013E 05F420 move #LINEAR,m0 ;linear addressing 00FFFF 1213 P:000140 0464A0 move m0,m4 1214 P:000141 0008F8 ori #$08,mr ;set scaling mode Motorola DSP56300 Assembler Version 6.2.0 99-03-18 13:59:02 exfilter.asm Page 4 1215 1216 P:000142 060280 do #2,endloop ;do for both stages 00014D 1217 P:000144 341022 asr a #coefs,r4 ;r4=pointer to coefficients **** 1218 [exfilter.asm 150]: WARNING --- Pipeline stall reading register written in previous instruction (X data move field) 1218 P:000145 12D800 move a,x0 y:(r0)+,a **** 1219 [exfilter.asm 151]: WARNING --- Pipeline stall reading register written in instruction at address: P:000144 (X data move f ield) 1219 P:000146 45DC22 asr a x:(r4)+,x1 1220 P:000147 E49CA3 macr x1,x0,a x:(r4)+,x1 y:(r0)-,y0 **** 1221 [exfilter.asm 153]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1221 P:000148 159CE0 mpy y0,x1,a a,y1 x:(r4)+,x1 1222 P:000149 45DCA2 mac x0,x1,a x:(r4)+,x1 1223 P:00014A 45DCF3 macr y1,x1,a x:(r4)+,x1 **** 1224 [exfilter.asm 156]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1224 P:00014B B69CA0 mpy x1,x0,a x:(r4)+,x1 a,y:(r0)+ 1225 P:00014C 2000F3 macr y1,x1,a **** 1226 [exfilter.asm 158]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1226 P:00014D B29C71 tfr y1,a x:(r4)+,x0 a,y:(r0)+ 1227 endloop 1228 P:00014E 00F3B8 andi #$f3,mr 1229 P:00014F 00000C rts 1230 1231 1232 1233 1234 include 'ada_init.asm' 1235 page 132,60 1236 ;************************************************************************** 1237 ; ADA_INIT.ASM Ver 1.2 1238 ; Example program to initialize the CS4218 1239 ; 1240 ; Copyright (c) MOTOROLA 1995, 1996, 1997, 1998 1241 ; Semiconductor Products Sector 1242 ; Wireless Signal Processing Division 1243 ; 1244 ; History: 1245 ; 14 June 1996: RLR/LJD - ver 1.0 1246 ; 21 July 1997: BEA - ver 1.1 1247 ; 23 Sept 1998: TTL - ver 1.2 1248 ;************************************************************************** 1249 X:00001C org x: 1250 1251 ; Codec control constants 1252 X:00001C CTRL_WD_HI ds 1 1253 X:00001D CTRL_WD_LO ds 1 1254 1255 1256 ; GPIO pin constants 1257 1258 ; ESSI0 - audio data GPIO mode 1259 ; DSP CODEC 1260 ; --------------------------- 1261 CODEC_RESET 1262 000000 equ 0 ; bit0 SC00 ---> CODEC_RESET~ 1263 Motorola DSP56300 Assembler Version 6.2.0 99-03-18 13:59:02 ada_init.asm Page 5 1264 ; ESSI1 - control data GPIO Mode 1265 ; DSP CODEC 1266 ;---------------------------- 1267 000000 CCS equ 0 ; bit0 SC10 ---> CCS~ 1268 000001 CCLK equ 1 ; bit1 SC11 ---> CCLK 1269 000002 CDIN equ 2 ; bit2 SC12 ---> CDIN 1270 1271 ;************************************************************************** 1272 ; Initialize the CS4218 codec 1273 ; --------------------------- 1274 ; Serial Mode 4 (SM4), DSP Slave/Codec Master, 32-bits per frame 1275 ; 1276 ; After a reset, the control port must be written once to initialize it 1277 ; if the port will be accessed to read or write control bits. The initial 1278 ; write is a "dummy" write since the data is ignored by the codec. A second 1279 ; write is needed to configure the codec as desired. Then, the control port 1280 ; only needs to be written to when a change is desired, or to obtain status 1281 ; information. 1282 ; 1283 ; Although only 23 bits contain useful data in CDIN, a minimum of 31 bits 1284 ; must be written. 1285 ; 1286 ; CDIN 1287 ;------------------------------------------------ 1288 ; bit 31 0 1289 ;------------------------------------------------ 1290 ; bit 30 mask interrupt 1291 ; 0=no mask on MF5:\INT pin 1292 ; 1=mask on MF5:\INT pin 1293 ;------------------------------------------------ 1294 ; bit 29 DO1 1295 ;------------------------------------------------ 1296 ; bits 28-24 left output D/A sttenuation (1.5dB steps) 1297 ; 00000=No attenuation 0dB 1298 ; 11111=Max attenuation -46.5dB 1299 ;------------------------------------------------ 1300 ; bits 23-19 right output D/A attenuation (1.5dB steps) 1301 ; 00000=No attenuation 0dB 1302 ; 11111=Max attenuation -46.5dB 1303 ;------------------------------------------------ 1304 ; bit 18 mute D/A outputs 1305 ; 0=outputs ON 1306 ; 1=outputs MUTED 1307 ;------------------------------------------------ 1308 ; bit 17 input mux, left select 1309 ; 0=RIN1 1310 ; 1=RIN2 (used on EVM) 1311 ;------------------------------------------------ 1312 ; bit 16 input mux, right select 1313 ; 0=LIN1 1314 ; 1=LIN2 (used on EVM) 1315 ;------------------------------------------------ 1316 ; bits 15-12 left input A/D gain (1.5dB steps) 1317 ; 0000=No gain 0dB 1318 ; 1111=Max gain +22.5dB 1319 ;------------------------------------------------ Motorola DSP56300 Assembler Version 6.2.0 99-03-18 13:59:02 ada_init.asm Page 6 1320 ; bits 11-8 right input A/D gain (1.5dB steps) 1321 ; 0000=No gain 0dB 1322 ; 1111=Max gain +22.5dB 1323 ;------------------------------------------------ 1324 ; bits 7-0 00000000 1325 ;------------------------------------------------ 1326 ;************************************************************************** 1327 1328 1329 P:000150 org p: 1330 ada_init 1331 1332 ; reset ESSI ports 1333 P:000150 07F43F movep #$0000,x:M_PCRC ; reset ESSI0 port 000000 1334 P:000152 07F42F movep #$0000,x:M_PCRD ; reset ESSI1 port 000000 1335 1336 ; Set Control Register A and B 1337 P:000154 07F435 movep #$101807,x:M_CRA0 ; 12.288MHz/16 = 768KHz SCLK 101807 1338 ; prescale modulus = 8 1339 ; frame rate divider = 2 1340 ; 16-bits per word 1341 ; 32-bits per frame 1342 ; 16-bit data aligned to bit 23 1343 1344 P:000156 07F436 movep #$ff330c,x:M_CRB0 ; Enable REIE,TEIE,RLIE,TLIE, FF330C 1345 ; RIE,TIE,RE,TE0 1346 ; network mode, synchronous, 1347 ; out on rising/in on falling 1348 ; shift MSB first 1349 ; external clock source drives SCK 1350 ; (codec is master) 1351 ; RX frame sync pulses active for 1352 ; 1 bit clock immediately before 1353 ; transfer period 1354 ; positive frame sync polarity 1355 ; frame sync length is 1-bit 1356 1357 ; Configure GPIO pins -- (functionality and direction ) 1358 P:000158 07F43F movep #$0000,x:M_PCRC ; Enable GPIO pin 0 SC00=CODEC_RESET 000000 1359 P:00015A 07F42F movep #$0000,x:M_PCRD ; Enable GPIO CSS (pin 0),CCLK (pin 1), CDIN (pin 2) 000000 1360 1361 P:00015C 07F43E movep #$0001,x:M_PRRC ; set PC0=CODEC_RESET~ as output 000001 1362 P:00015E 07F42E movep #$0007,x:M_PRRD ; set PD0=CCS~ as output 000007 1363 ; set PD1=CCLK as output 1364 ; set PD2=CDIN as output 1365 1366 ; Codec Reset Motorola DSP56300 Assembler Version 6.2.0 99-03-18 13:59:02 ada_init.asm Page 7 1367 P:000160 013D00 bclr #CODEC_RESET,x:M_PDRC ; assert CODEC_RESET~ 1368 P:000161 012D00 bclr #CCS,x:M_PDRD ; assert CCS~ -- allows control register to be writte n to 1369 1370 ; Delay to allow Codec to reset 1371 P:000162 06E883 do #1000,_delay_loop 000165 1372 P:000164 06E8A3 rep #1000 ; minimum 50 ms delay 1373 P:000165 000000 nop 1374 _delay_loop 1375 1376 1377 ; Setting up to send Codec control information 1378 P:000166 013D20 bset #CODEC_RESET,x:M_PDRC ; deassert CODEC_RESET~ 1379 1380 1381 ; Sending control words 1382 set_control 1383 P:000167 44F400 move #CTRL_WD_12,x0 ; transfer control value to control variable 000300 1384 P:000169 441C00 move x0,x:CTRL_WD_HI 1385 P:00016A 240000 move #CTRL_WD_34,x0 1386 P:00016B 441D00 move x0,x:CTRL_WD_LO 1387 P:00016C 0BF080 jsr codec_control ; send in dummy control information 000176 1388 P:00016E 0BF080 jsr codec_control ; send in correct control information 000176 1389 1390 1391 ; Set and enable interrupts 1392 P:000170 08F4BE movep #$000c,x:M_IPRP ; set interrupt priority level for ESSI0 to 3 00000C 1393 P:000172 00FCB8 andi #$fc,mr ; enable interrupts 1394 1395 ; Set ESSI functionality 1396 P:000173 07F43F movep #$003e,x:M_PCRC ; enable ESSI0 except SC00=CODEC_RESET 00003E 1397 1398 P:000175 00000C rts 1399 1400 1401 ;------------------------------------------------------------- 1402 ; codec_control routine 1403 ; Input: CTRL_WD_LO and CTRL_WD_HI 1404 ; Output: CDIN 1405 ; Description: Used to send control information to CODEC 1406 ; NOTE: does not preserve the 'a' register. 1407 ;------------------------------------------------------------- 1408 codec_control 1409 P:000176 200013 clr a 1410 P:000177 012D00 bclr #CCS,x:M_PDRD ; assert CCS 1411 P:000178 549C00 move x:CTRL_WD_HI,a1 ; upper 16 bits of control data 1412 P:000179 0BF080 jsr send_codec ; shift out upper control word 000180 1413 P:00017B 549D00 move x:CTRL_WD_LO,a1 ; lower 16 bits of control data 1414 P:00017C 0BF080 jsr send_codec ; shift out lower control word Motorola DSP56300 Assembler Version 6.2.0 99-03-18 13:59:02 ada_init.asm Page 8 000180 1415 P:00017E 012D20 bset #CCS,x:M_PDRD ; deassert CCS 1416 P:00017F 00000C rts 1417 1418 1419 ;--------------------------------------------------------------- 1420 ; send_codec routine 1421 ; Input: a1 containing control information 1422 ; Output: sends bits to CDIN 1423 ; Description: Determines bits to send to CDIN 1424 ;--------------------------------------------------------------- 1425 1426 send_codec 1427 P:000180 061080 do #16,end_send_codec ; 16 bits per word 00018C 1428 P:000182 012D21 bset #CCLK,x:M_PDRD ; toggle CCLK clock high 1429 P:000183 0ACC17 jclr #23,a1,bit_low ; test msb 000188 1430 P:000185 012D22 bset #CDIN,x:M_PDRD ; send high into CDIN 1431 P:000186 0AF080 jmp continue 000189 1432 bit_low 1433 P:000188 012D02 bclr #CDIN,x:M_PDRD ; send low into CDIN 1434 continue 1435 P:000189 0602A0 rep #2 ; delay 1436 P:00018A 000000 nop 1437 P:00018B 012D01 bclr #CCLK,x:M_PDRD ; restart cycle 1438 P:00018C 200033 lsl a ; shift control word to 1 bit 1439 ; to left 1440 end_send_codec 1441 P:00018D 00000C rts 1442 1443 1444 1445 1446 ;**************************************************************************** 1447 ; SSI0_ISR.ASM Ver.2.0 1448 ; Example program to handle interrupts through 1449 ; the 56307 SSI0 to move audio through the CS4218 1450 ; 1451 ; Copyright (c) MOTOROLA 1995, 1996, 1997, 1998 1452 ; Semiconductor Products Sector 1453 ; Digital Signal Processing Division 1454 ; 1455 ; 1456 ; History: 1457 ; 14 June 1996: RLR/LJD - ver 1.0 1458 ; 23 July 1997: BEA - ver 1.1 1459 ;****************************************************************************** 1460 1461 1462 ;----the actual interrupt service routines (ISRs) follow: 1463 1464 ;************************ SSI TRANSMIT ISR ********************************* 1465 ssi_txe_isr 1466 P:00018E 013704 bclr #4,x:M_SSISR0 ; Read SSISR to clear exception flag Motorola DSP56300 Assembler Version 6.2.0 99-03-18 13:59:02 ada_init.asm Page 9 1467 ; explicitly clears underrun flag 1468 ssi_tx_isr 1469 P:00018F 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1470 P:000190 055F20 move m0,x:(r7)+ ; Save m0 to the stack. 1471 P:000191 0501A0 move #1,m0 ; Modulus 2 buffer. 1472 P:000192 608900 move x:TX_PTR,r0 ; Load the pointer to the tx buffer. 1473 P:000193 000000 nop 1474 P:000194 000000 nop 1475 P:000195 000000 nop 1476 P:000196 07D83C movep x:(r0)+,x:M_TX00 ; SSI transfer data register. 1477 P:000197 600900 move r0,x:TX_PTR ; Update tx buffer pointer. 1478 P:000198 05FF20 move x:-(r7),m0 ; Restore m0. 1479 P:000199 60FF00 move x:-(r7),r0 ; Restore r0. 1480 P:00019A 000004 rti 1481 1482 ;********************* SSI TRANSMIT LAST SLOT ISR ************************** 1483 ssi_txls_isr 1484 P:00019B 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1485 P:00019C 300400 move #TX_BUFF_BASE,r0 ; Reset pointer. 1486 P:00019D 000000 nop 1487 P:00019E 600900 move r0,x:TX_PTR ; Reset tx buffer pointer just in 1488 P:00019F 000000 nop ; case it was corrupted. 1489 P:0001A0 60FF00 move x:-(r7),r0 ; Restore r0. 1490 P:0001A1 000004 rti 1491 1492 ;************************** SSI receive ISR ******************************** 1493 ssi_rxe_isr 1494 P:0001A2 013705 bclr #5,x:M_SSISR0 ; Read SSISR to clear exception flag 1495 ; explicitly clears overrun flag 1496 ssi_rx_isr 1497 P:0001A3 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1498 P:0001A4 055F20 move m0,x:(r7)+ ; Save m0 to the stack. 1499 P:0001A5 0501A0 move #1,m0 ; Modulus 2 buffer. 1500 P:0001A6 608800 move x:RX_PTR,r0 ; Load the pointer to the rx buffer. 1501 P:0001A7 000000 nop 1502 P:0001A8 000000 nop 1503 P:0001A9 000000 nop 1504 P:0001AA 075838 movep x:M_RX0,x:(r0)+ ; Read out received data to buffer. 1505 P:0001AB 600800 move r0,x:RX_PTR ; Update rx buffer pointer. 1506 P:0001AC 05FF20 move x:-(r7),m0 ; Restore m0. 1507 P:0001AD 60FF00 move x:-(r7),r0 ; Restore r0. 1508 P:0001AE 000004 rti 1509 1510 ;********************** SSI receive last slot ISR ************************** 1511 ssi_rxls_isr 1512 P:0001AF 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1513 P:0001B0 300000 move #RX_BUFF_BASE,r0 ; Reset rx buffer pointer just in 1514 ; case it was corrupted. 1515 P:0001B1 600800 move r0,x:RX_PTR ; Update rx buffer pointer. 1516 P:0001B2 60FF00 move x:-(r7),r0 ; Restore r0. 1517 P:0001B3 000004 rti 1518 1519 echo 1520 end 0 Errors Motorola DSP56300 Assembler Version 6.2.0 99-03-18 13:59:02 exfilter.asm Page 10 5 Warnings