Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 pass_c~1.asm Page 1 1 ;*************************************************************************** 2 ;QS_ST.ASM : WILL PASS AUDIO STRAIGHT THROUGH 3 ;*************************************************************************** 1067 1068 ;****************************************************************************** 1069 1070 ;---Buffer for talking to the CS4215 1071 1072 X:000000 org x:0 1073 RX_BUFF_BASE 1074 000000 equ * 1075 RX_data_1_2 1076 X:000000 ds 1 ;data time slot 1/2 for RX ISR 1077 RX_data_3_4 1078 X:000001 ds 1 ;data time slot 3/4 for RX ISR 1079 RX_data_5_6 1080 X:000002 ds 1 ;data time slot 5/6 for RX ISR 1081 RX_data_7_8 1082 X:000003 ds 1 ;data time slot 7/8 for RX ISR 1083 1084 TX_BUFF_BASE 1085 000004 equ * 1086 TX_data_1_2 1087 X:000004 ds 1 ;data time slot 1/2 for TX ISR 1088 TX_data_3_4 1089 X:000005 ds 1 ;data time slot 3/4 for TX ISR 1090 TX_data_5_6 1091 X:000006 ds 1 ;data time slot 5/6 for TX ISR 1092 TX_data_7_8 1093 X:000007 ds 1 ;data time slot 7/8 for TX ISR 1094 1095 X:000008 RX_PTR ds 1 ; Pointer for rx buffer 1096 X:000009 TX_PTR ds 1 ; Pointer for tx buffer 1097 1098 ;TONE_OUTPUT EQU HEADPHONE_EN+LINEOUT_EN+(4*LEFT_ATTN)+(4*RIGHT_ATTN) 1099 ;TONE_INPUT EQU MIC_IN_SELECT+(15*MONITOR_ATTN) 1100 ;CTRL_WD_12 equ NO_PREAMP+HI_PASS_FILT+SAMP_RATE_48+STEREO+DATA_16 ;CLB=0 1101 ;CTRL_WD_34 equ IMMED_3STATE+XTAL1_SELECT+BITS_64+CODEC_MASTER 1102 ;CTRL_WD_56 equ $000000 1103 ;CTRL_WD_78 equ $000000 1104 1105 000300 CTRL_WD_12 equ MIN_LEFT_ATTN+MIN_RIGHT_ATTN+LIN2+RIN2 1106 000000 CTRL_WD_34 equ MIN_LEFT_GAIN+MIN_RIGHT_GAIN 1107 1108 1109 P:000050 org p:$50 ;SCI Recieve Data Interrupt 1110 P:000050 0BF080 jsr ISCIRD 0001AD 1111 1112 P:000100 org p:$100 1113 START 1114 main 1115 P:000100 08F4BD movep #$040003,x:M_PCTL ; set PLL for MPY of 4X 040003 1116 P:000102 08F4BB movep #$012421,x:M_BCR ; set up one ext. wait state for all AAR areas 012421 Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 pass_c~1.asm Page 2 1117 P:000104 0003F8 ori #3,mr ;mask interrupts 1118 P:000105 0500BB movec #0,sp ;clear hardware stack pointer 1119 P:000106 0500BA move #0,omr ;operating mode 0 1120 P:000107 364000 move #$40,r6 ; initialise stack pointer 1121 P:000108 05F426 move #-1,m6 ; linear addressing FFFFFF 1122 P:00010A 0BF080 jsr ada_init ; initialize codec 00021E 1123 1124 1125 ; initialize SCI 1126 ; 10-bit asynchronous mode 1127 ; enable reciever and transmitter 1128 P:00010C 07F41C movep #$000B02,x:M_SCR ; SCI control register 000B02 1129 ; set interrupt priority for SCI RECV to 1 1130 P:00010E 56F000 move x:M_IPRP,a ; grab register current value FFFFFE 1131 ; enable tx and rx pins 1132 P:000110 07F41F movep #$000003,x:M_PCRE ; Port E Control Register 000003 1133 P:000112 0140C2 or #000080,a ; set bits for interrupt priority 2 000050 1134 ; Reciever/Transmitter clocks use external clock from SCLK 1135 P:000114 07F41B movep #$00C000,x:M_SCCR ; SCI Clock Control Register 00C000 1136 P:000116 567000 move a,x:M_IPRP ; put value in interrupt priority peripheral register FFFFFE 1137 1138 ;print a greeting and instructions 1139 P:000118 65F400 move #greet,r5 000009 1140 P:00011A 0BF080 jsr print 00018C 1141 1142 loop_1 1143 1144 P:00011C 01B7A2 jset #2,x:M_SSISR0,* ;wait for frame sync to pass 00011C 1145 P:00011E 01B782 jclr #2,x:M_SSISR0,* ;wait for frame sync 00011E 1146 1147 P:000120 568000 move x:RX_BUFF_BASE,a ;receive left 1148 P:000121 578100 move x:RX_BUFF_BASE+1,b ;receive right 1149 P:000122 0BF080 jsr process_stereo 00012D 1150 P:000124 560400 move a,x:TX_BUFF_BASE ;transmit left 1151 P:000125 570500 move b,x:TX_BUFF_BASE+1 ;transmit right 1152 1153 P:000126 46F400 move #CTRL_WD_12,y0 ;set up control words 000300 1154 P:000128 460600 move y0,x:TX_BUFF_BASE+2 1155 P:000129 46F400 move #CTRL_WD_12,y0 000300 1156 P:00012B 460700 move y0,x:TX_BUFF_BASE+3 1157 Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 pass_c~1.asm Page 3 1158 P:00012C 0C011C jmp loop_1 1159 1160 1161 process_stereo 1162 1163 P:00012D 5E7000 move a,y:newa ;store new right channel value 000005 1164 P:00012F 5F7000 move b,y:newb ;store new left channel value 000006 1165 1166 P:000131 5EF000 move y:mode,a 000008 1167 P:000133 200003 tst a 1168 P:000134 0D1042 bne delta 000011 1169 1170 1171 1172 P:000136 2F8000 move #$800000,b ;initial mask 1173 P:000137 4CF000 move y:masksz,x0 000001 1174 P:000139 0C1E79 asr x0,b,b ; shift the mask **** 1175 [pass_c~1.asm 108]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1175 P:00013A 5F7000 move b,y:mask 000007 1176 1177 P:00013C 5EF000 move y:newa,a 000005 1178 P:00013E 5FF000 move y:newb,b 000006 1179 1180 P:000140 4EF000 move y:mask,y0 000007 1181 P:000142 200056 and y0,a 1182 P:000143 20005E and y0,b 1183 P:000144 00000C rts 1184 1185 P:000145 4EF000 delta move y:diff,y0 ;load max delta mask into y0 000000 1186 1187 P:000147 5EF000 move y:newa,a 000005 1188 P:000149 5FF000 move y:olda,b ;new in a, old in b 000003 1189 1190 P:00014B 200014 sub b,a ; get difference **** 1191 [pass_c~1.asm 124]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1191 P:00014C 5E7000 move a,y:temp ; hold difference in temp 000002 1192 P:00014E 200026 abs a ; check to see if it is in range 1193 P:00014F 200055 cmp y0,a 1194 P:000150 0D1049 blt gooda 000012 1195 1196 P:000152 5EF000 move y:temp,a 000002 Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 pass_c~1.asm Page 4 1197 P:000154 200003 tst a 1198 P:000155 0D1047 bgt posa 000009 1199 1200 P:000157 5EF000 move y:diff,a 000000 1201 P:000159 200036 neg a **** 1202 [pass_c~1.asm 135]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1202 P:00015A 5E7000 move a,y:temp 000002 1203 P:00015C 0D10C0 bra gooda 000006 1204 P:00015E 5EF000 posa move y:diff,a 000000 1205 P:000160 5E7000 move a,y:temp 000002 1206 P:000162 5EF000 gooda move y:temp,a 000002 1207 P:000164 200010 add b,a ;add delta back in **** 1208 [pass_c~1.asm 141]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1208 P:000165 5E7000 move a,y:olda ; store new value 000003 1209 1210 1211 P:000167 5EF000 move y:newb,a 000006 1212 P:000169 5FF000 move y:oldb,b ;new in a, old in b 000004 1213 P:00016B 200014 sub b,a ; get difference **** 1214 [pass_c~1.asm 147]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1214 P:00016C 5E7000 move a,y:temp ; hold difference in temp 000002 1215 P:00016E 200026 abs a ; check to see if it is in range 1216 P:00016F 200055 cmp y0,a 1217 P:000170 0D1049 blt goodb 000012 1218 1219 P:000172 5EF000 move y:temp,a 000002 1220 P:000174 200003 tst a 1221 P:000175 0D1047 bgt posb 000009 1222 1223 P:000177 5EF000 move y:diff,a 000000 1224 P:000179 200036 neg a **** 1225 [pass_c~1.asm 158]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1225 P:00017A 5E7000 move a,y:temp 000002 1226 P:00017C 0D10C0 bra goodb 000006 1227 P:00017E 5EF000 posb move y:diff,a 000000 1228 P:000180 5E7000 move a,y:temp 000002 1229 P:000182 5EF000 goodb move y:temp,a Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 pass_c~1.asm Page 5 000002 1230 P:000184 200010 add b,a ;add delta back in **** 1231 [pass_c~1.asm 164]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1231 P:000185 5E7000 move a,y:oldb ; store new value 000004 1232 1233 P:000187 5EF000 move y:olda,a 000003 1234 P:000189 5FF000 move y:oldb,b 000004 1235 1236 P:00018B 00000C rts 1237 1238 1239 ;print subroutine takes address in register r5 1240 ;exits when most significant byte is zero 1241 ;ignores zeros in lower bytes 1242 ; clobbers accumulator A and B and register r5 1243 print 1244 P:00018C 5EDD00 prbegin move y:(r5)+,a 1245 ; cmp #$00ffff,a ;check to see if done (char=$00) 1246 ; blt prend 1247 P:00018D 014085 cmp #$000000,a ;check to see if done (char=$00) 1248 P:00018E 0D104A beq prend 00001E 1249 P:000190 019381 jclr #1,x:M_SSR,* ;wait for tx to finish 000190 1250 P:000192 019380 jclr #0,x:M_SSR,* ;wait for tx to finish 000192 1251 P:000194 567000 move a,x:M_STXH ; send high byte FFFF97 1252 P:000196 0140C6 and #$00ffff,a 00FFFF 1253 P:000198 0140C5 cmp #$0000ff,a 0000FF 1254 P:00019A 0597D2 blt prbegin 1255 P:00019B 019381 jclr #1,x:M_SSR,* ;wait for tx to finish 00019B 1256 P:00019D 019380 jclr #0,x:M_SSR,* ;wait for tx to finish 00019D 1257 P:00019F 567000 move a,x:M_STXM ; send mid byte FFFF96 1258 P:0001A1 0140C6 and #$0000ff,a 0000FF 1259 P:0001A3 014085 cmp #$000000,a 1260 P:0001A4 0597C8 blt prbegin 1261 P:0001A5 019381 jclr #1,x:M_SSR,* ;wait for tx to finish 0001A5 1262 P:0001A7 019380 jclr #0,x:M_SSR,* ;wait for tx to finish 0001A7 1263 P:0001A9 567000 move a,x:M_STXL ; send low byte FFFF95 1264 P:0001AB 050FC1 bra prbegin 1265 P:0001AC 00000C prend rts 1266 1267 Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 pass_c~1.asm Page 6 1268 ; the SCI interrupt is triggered when a character is received 1269 ; this function takes the character, checks to make sure it is 1270 ; in the correct range (1-9, A-G, a-g) prints a message and 1271 ; modifies the output mask for that number of bits 1272 P:0001AD 21C600 ISCIRD move a,y0 ;back up A 1273 P:0001AE 56F000 move x:M_SRXL,a FFFF98 1274 P:0001B0 017185 cmp #$31,a ; >='1' 1275 P:0001B1 0D1049 blt iscend 00006B 1276 P:0001B3 017A85 cmp #$3A,a ; <='9' 1277 P:0001B4 0D1049 blt iscnum 00001D 1278 1279 P:0001B6 0140C5 cmp #$53,a ; =='S' ; change mode 000053 1280 P:0001B8 0D104A beq iscmode 000043 1281 P:0001BA 0140C5 cmp #$73,a ; =='s' 000073 1282 P:0001BC 0D104A beq iscmode 00003F 1283 1284 P:0001BE 0140C5 cmp #$40,a ; >='A' 000040 1285 P:0001C0 0D1049 blt iscend 00005C 1286 P:0001C2 0140C5 cmp #$48,a ; <='G' 000048 1287 P:0001C4 0D1049 blt isclet 00000E 1288 P:0001C6 0140C5 cmp #$60,a ; >='a' 000060 1289 P:0001C8 0D1049 blt iscend 000054 1290 P:0001CA 0140C5 cmp #$67,a ; <='g' 000067 1291 P:0001CC 0D1047 bgt iscend 000050 1292 P:0001CE 016084 sub #$20,a 1293 P:0001CF 0D10C0 bra isclet 000003 1294 1295 P:0001D1 014780 iscnum add #$07,a 1296 P:0001D2 014980 isclet add #$09,a 1297 1298 P:0001D3 019381 isciup jclr #1,x:M_SSR,* ;wait for tx to finish 0001D3 1299 P:0001D5 019380 jclr #0,x:M_SSR,* ;wait for tx to finish 0001D5 1300 P:0001D7 07F415 movep #$0d,x:M_STXL ;print LF 00000D 1301 P:0001D9 2F8000 move #$800000,b ;initial mask 1302 P:0001DA 5E7000 move a,y:temp ;hold onto value temporarially 000002 1303 P:0001DC 0140C4 sub #$41,a ; ammount to shift mask Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 pass_c~1.asm Page 7 000041 1304 P:0001DE 5E7000 move a,y:masksz 000001 1305 P:0001E0 21C400 move a,x0 1306 P:0001E1 0C1E79 asr x0,b,b ; shift the mask 1307 1308 P:0001E2 56F400 move #>$00000f,a ;calculate bit shift 00000F 1309 P:0001E4 200044 sub x0,a 1310 P:0001E5 0C1E35 lsr a1,b 1311 P:0001E6 2B0000 move #<$00,b2 1312 1313 P:0001E7 5EF000 move y:temp,a 000002 1314 P:0001E9 5F7000 move b,y:diff 000000 1315 1316 P:0001EB 015084 sub #$10,a 1317 P:0001EC 017A85 cmp #$3A,a ; is a 10 digit? 1318 P:0001ED 0D1049 blt isci0 000005 1319 1320 P:0001EF 014A84 isci1 sub #$0a,a 1321 P:0001F0 0140C2 or #$001100,a ; add 10's digit if necessary 001100 1322 1323 P:0001F2 0140C0 isci0 add #$202000,a 202000 1324 P:0001F4 5E7000 move a,y:bits 000094 1325 P:0001F6 65F400 move #modech,r5 000093 1326 P:0001F8 0D018C jsr print 1327 1328 P:0001F9 0D10C0 bra iscend 000023 1329 1330 P:0001FB 5EF000 iscmode move y:modech,a ;change modes 000093 1331 P:0001FD 0140C5 cmp #$53202d,a ;check mode 53202D 1332 P:0001FF 0D1042 bne iscms 00000B 1333 P:000201 56F400 move #$44202d,a ; change to delta mode 44202D 1334 P:000203 5E7000 move a,y:modech 000093 1335 P:000205 2E0100 move #1,a **** 1336 [pass_c~1.asm 269]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1336 P:000206 5E7000 move a,y:mode 000008 1337 P:000208 0D10C0 bra iscmend 00000B 1338 P:00020A 56F400 iscms move #$53202d,a ;change to sample mode 53202D 1339 P:00020C 5E7000 move a,y:modech Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 pass_c~1.asm Page 8 000093 1340 P:00020E 2E0000 move #0,a **** 1341 [pass_c~1.asm 274]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1341 P:00020F 5E7000 move a,y:mode 000008 1342 P:000211 0D10C0 bra iscmend 000002 1343 P:000213 019381 iscmend jclr #1,x:M_SSR,* ;wait for tx to finish 000213 1344 P:000215 019380 jclr #0,x:M_SSR,* ;wait for tx to finish 000215 1345 P:000217 07F415 movep #$0d,x:M_STXL ;print LF 00000D 1346 P:000219 65F400 move #modech,r5 000093 1347 P:00021B 0D018C jsr print 1348 1349 1350 P:00021C 20CE00 iscend move y0,a ;restore A 1351 P:00021D 000004 rti 1352 1353 1354 1355 1356 include 'ada_init.asm' 1357 page 132,60 1358 ;************************************************************************** 1359 ; ADA_INIT.ASM Ver 1.2 1360 ; Example program to initialize the CS4218 1361 ; 1362 ; Copyright (c) MOTOROLA 1995, 1996, 1997, 1998 1363 ; Semiconductor Products Sector 1364 ; Wireless Signal Processing Division 1365 ; 1366 ; History: 1367 ; 14 June 1996: RLR/LJD - ver 1.0 1368 ; 21 July 1997: BEA - ver 1.1 1369 ; 23 Sept 1998: TTL - ver 1.2 1370 ;************************************************************************** 1371 X:00000A org x: 1372 1373 ; Codec control constants 1374 X:00000A CTRL_WD_HI ds 1 1375 X:00000B CTRL_WD_LO ds 1 1376 1377 1378 ; GPIO pin constants 1379 1380 ; ESSI0 - audio data GPIO mode 1381 ; DSP CODEC 1382 ; --------------------------- 1383 CODEC_RESET 1384 000000 equ 0 ; bit0 SC00 ---> CODEC_RESET~ 1385 1386 ; ESSI1 - control data GPIO Mode 1387 ; DSP CODEC Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 ada_init.asm Page 9 1388 ;---------------------------- 1389 000000 CCS equ 0 ; bit0 SC10 ---> CCS~ 1390 000001 CCLK equ 1 ; bit1 SC11 ---> CCLK 1391 000002 CDIN equ 2 ; bit2 SC12 ---> CDIN 1392 1393 ;************************************************************************** 1394 ; Initialize the CS4218 codec 1395 ; --------------------------- 1396 ; Serial Mode 4 (SM4), DSP Slave/Codec Master, 32-bits per frame 1397 ; 1398 ; After a reset, the control port must be written once to initialize it 1399 ; if the port will be accessed to read or write control bits. The initial 1400 ; write is a "dummy" write since the data is ignored by the codec. A second 1401 ; write is needed to configure the codec as desired. Then, the control port 1402 ; only needs to be written to when a change is desired, or to obtain status 1403 ; information. 1404 ; 1405 ; Although only 23 bits contain useful data in CDIN, a minimum of 31 bits 1406 ; must be written. 1407 ; 1408 ; CDIN 1409 ;------------------------------------------------ 1410 ; bit 31 0 1411 ;------------------------------------------------ 1412 ; bit 30 mask interrupt 1413 ; 0=no mask on MF5:\INT pin 1414 ; 1=mask on MF5:\INT pin 1415 ;------------------------------------------------ 1416 ; bit 29 DO1 1417 ;------------------------------------------------ 1418 ; bits 28-24 left output D/A sttenuation (1.5dB steps) 1419 ; 00000=No attenuation 0dB 1420 ; 11111=Max attenuation -46.5dB 1421 ;------------------------------------------------ 1422 ; bits 23-19 right output D/A attenuation (1.5dB steps) 1423 ; 00000=No attenuation 0dB 1424 ; 11111=Max attenuation -46.5dB 1425 ;------------------------------------------------ 1426 ; bit 18 mute D/A outputs 1427 ; 0=outputs ON 1428 ; 1=outputs MUTED 1429 ;------------------------------------------------ 1430 ; bit 17 input mux, left select 1431 ; 0=RIN1 1432 ; 1=RIN2 (used on EVM) 1433 ;------------------------------------------------ 1434 ; bit 16 input mux, right select 1435 ; 0=LIN1 1436 ; 1=LIN2 (used on EVM) 1437 ;------------------------------------------------ 1438 ; bits 15-12 left input A/D gain (1.5dB steps) 1439 ; 0000=No gain 0dB 1440 ; 1111=Max gain +22.5dB 1441 ;------------------------------------------------ 1442 ; bits 11-8 right input A/D gain (1.5dB steps) 1443 ; 0000=No gain 0dB Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 ada_init.asm Page 10 1444 ; 1111=Max gain +22.5dB 1445 ;------------------------------------------------ 1446 ; bits 7-0 00000000 1447 ;------------------------------------------------ 1448 ;************************************************************************** 1449 1450 1451 P:00021E org p: 1452 ada_init 1453 1454 ; reset ESSI ports 1455 P:00021E 07F43F movep #$0000,x:M_PCRC ; reset ESSI0 port 000000 1456 P:000220 07F42F movep #$0000,x:M_PCRD ; reset ESSI1 port 000000 1457 1458 ; Set Control Register A and B 1459 P:000222 07F435 movep #$101807,x:M_CRA0 ; 12.288MHz/16 = 768KHz SCLK 101807 1460 ; prescale modulus = 8 1461 ; frame rate divider = 2 1462 ; 16-bits per word 1463 ; 32-bits per frame 1464 ; 16-bit data aligned to bit 23 1465 1466 P:000224 07F436 movep #$ff330c,x:M_CRB0 ; Enable REIE,TEIE,RLIE,TLIE, FF330C 1467 ; RIE,TIE,RE,TE0 1468 ; network mode, synchronous, 1469 ; out on rising/in on falling 1470 ; shift MSB first 1471 ; external clock source drives SCK 1472 ; (codec is master) 1473 ; RX frame sync pulses active for 1474 ; 1 bit clock immediately before 1475 ; transfer period 1476 ; positive frame sync polarity 1477 ; frame sync length is 1-bit 1478 1479 ; Configure GPIO pins -- (functionality and direction ) 1480 P:000226 07F43F movep #$0000,x:M_PCRC ; Enable GPIO pin 0 SC00=CODEC_RESET 000000 1481 P:000228 07F42F movep #$0000,x:M_PCRD ; Enable GPIO CSS (pin 0),CCLK (pin 1), CDIN (pin 2) 000000 1482 1483 P:00022A 07F43E movep #$0001,x:M_PRRC ; set PC0=CODEC_RESET~ as output 000001 1484 P:00022C 07F42E movep #$0007,x:M_PRRD ; set PD0=CCS~ as output 000007 1485 ; set PD1=CCLK as output 1486 ; set PD2=CDIN as output 1487 1488 ; Codec Reset 1489 P:00022E 013D00 bclr #CODEC_RESET,x:M_PDRC ; assert CODEC_RESET~ 1490 P:00022F 012D00 bclr #CCS,x:M_PDRD ; assert CCS~ -- allows control register to be writte Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 ada_init.asm Page 11 n to 1491 1492 ; Delay to allow Codec to reset 1493 P:000230 06E883 do #1000,_delay_loop 000233 1494 P:000232 06E8A3 rep #1000 ; minimum 50 ms delay 1495 P:000233 000000 nop 1496 _delay_loop 1497 1498 1499 ; Setting up to send Codec control information 1500 P:000234 013D20 bset #CODEC_RESET,x:M_PDRC ; deassert CODEC_RESET~ 1501 1502 1503 ; Sending control words 1504 set_control 1505 P:000235 44F400 move #CTRL_WD_12,x0 ; transfer control value to control variable 000300 1506 P:000237 440A00 move x0,x:CTRL_WD_HI 1507 P:000238 240000 move #CTRL_WD_34,x0 1508 P:000239 440B00 move x0,x:CTRL_WD_LO 1509 P:00023A 0BF080 jsr codec_control ; send in dummy control information 000244 1510 P:00023C 0BF080 jsr codec_control ; send in correct control information 000244 1511 1512 1513 ; Set and enable interrupts 1514 P:00023E 08F4BE movep #$000c,x:M_IPRP ; set interrupt priority level for ESSI0 to 3 00000C 1515 P:000240 00FCB8 andi #$fc,mr ; enable interrupts 1516 1517 ; Set ESSI functionality 1518 P:000241 07F43F movep #$003e,x:M_PCRC ; enable ESSI0 except SC00=CODEC_RESET 00003E 1519 1520 P:000243 00000C rts 1521 1522 1523 ;------------------------------------------------------------- 1524 ; codec_control routine 1525 ; Input: CTRL_WD_LO and CTRL_WD_HI 1526 ; Output: CDIN 1527 ; Description: Used to send control information to CODEC 1528 ; NOTE: does not preserve the 'a' register. 1529 ;------------------------------------------------------------- 1530 codec_control 1531 P:000244 200013 clr a 1532 P:000245 012D00 bclr #CCS,x:M_PDRD ; assert CCS 1533 P:000246 548A00 move x:CTRL_WD_HI,a1 ; upper 16 bits of control data 1534 P:000247 0BF080 jsr send_codec ; shift out upper control word 00024E 1535 P:000249 548B00 move x:CTRL_WD_LO,a1 ; lower 16 bits of control data 1536 P:00024A 0BF080 jsr send_codec ; shift out lower control word 00024E 1537 P:00024C 012D20 bset #CCS,x:M_PDRD ; deassert CCS Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 ada_init.asm Page 12 1538 P:00024D 00000C rts 1539 1540 1541 ;--------------------------------------------------------------- 1542 ; send_codec routine 1543 ; Input: a1 containing control information 1544 ; Output: sends bits to CDIN 1545 ; Description: Determines bits to send to CDIN 1546 ;--------------------------------------------------------------- 1547 1548 send_codec 1549 P:00024E 061080 do #16,end_send_codec ; 16 bits per word 00025A 1550 P:000250 012D21 bset #CCLK,x:M_PDRD ; toggle CCLK clock high 1551 P:000251 0ACC17 jclr #23,a1,bit_low ; test msb 000256 1552 P:000253 012D22 bset #CDIN,x:M_PDRD ; send high into CDIN 1553 P:000254 0AF080 jmp continue 000257 1554 bit_low 1555 P:000256 012D02 bclr #CDIN,x:M_PDRD ; send low into CDIN 1556 continue 1557 P:000257 0602A0 rep #2 ; delay 1558 P:000258 000000 nop 1559 P:000259 012D01 bclr #CCLK,x:M_PDRD ; restart cycle 1560 P:00025A 200033 lsl a ; shift control word to 1 bit 1561 ; to left 1562 end_send_codec 1563 P:00025B 00000C rts 1564 1565 1566 1567 1568 ;**************************************************************************** 1569 ; SSI0_ISR.ASM Ver.2.0 1570 ; Example program to handle interrupts through 1571 ; the 56307 SSI0 to move audio through the CS4218 1572 ; 1573 ; Copyright (c) MOTOROLA 1995, 1996, 1997, 1998 1574 ; Semiconductor Products Sector 1575 ; Digital Signal Processing Division 1576 ; 1577 ; 1578 ; History: 1579 ; 14 June 1996: RLR/LJD - ver 1.0 1580 ; 23 July 1997: BEA - ver 1.1 1581 ;****************************************************************************** 1582 1583 1584 ;----the actual interrupt service routines (ISRs) follow: 1585 1586 ;************************ SSI TRANSMIT ISR ********************************* 1587 ssi_txe_isr 1588 P:00025C 013704 bclr #4,x:M_SSISR0 ; Read SSISR to clear exception flag 1589 ; explicitly clears underrun flag 1590 ssi_tx_isr Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 ada_init.asm Page 13 1591 P:00025D 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1592 P:00025E 055F20 move m0,x:(r7)+ ; Save m0 to the stack. 1593 P:00025F 0501A0 move #1,m0 ; Modulus 2 buffer. 1594 P:000260 608900 move x:TX_PTR,r0 ; Load the pointer to the tx buffer. 1595 P:000261 000000 nop 1596 P:000262 000000 nop 1597 P:000263 000000 nop 1598 P:000264 07D83C movep x:(r0)+,x:M_TX00 ; SSI transfer data register. 1599 P:000265 600900 move r0,x:TX_PTR ; Update tx buffer pointer. 1600 P:000266 05FF20 move x:-(r7),m0 ; Restore m0. 1601 P:000267 60FF00 move x:-(r7),r0 ; Restore r0. 1602 P:000268 000004 rti 1603 1604 ;********************* SSI TRANSMIT LAST SLOT ISR ************************** 1605 ssi_txls_isr 1606 P:000269 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1607 P:00026A 300400 move #TX_BUFF_BASE,r0 ; Reset pointer. 1608 P:00026B 000000 nop 1609 P:00026C 600900 move r0,x:TX_PTR ; Reset tx buffer pointer just in 1610 P:00026D 000000 nop ; case it was corrupted. 1611 P:00026E 60FF00 move x:-(r7),r0 ; Restore r0. 1612 P:00026F 000004 rti 1613 1614 ;************************** SSI receive ISR ******************************** 1615 ssi_rxe_isr 1616 P:000270 013705 bclr #5,x:M_SSISR0 ; Read SSISR to clear exception flag 1617 ; explicitly clears overrun flag 1618 ssi_rx_isr 1619 P:000271 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1620 P:000272 055F20 move m0,x:(r7)+ ; Save m0 to the stack. 1621 P:000273 0501A0 move #1,m0 ; Modulus 2 buffer. 1622 P:000274 608800 move x:RX_PTR,r0 ; Load the pointer to the rx buffer. 1623 P:000275 000000 nop 1624 P:000276 000000 nop 1625 P:000277 000000 nop 1626 P:000278 075838 movep x:M_RX0,x:(r0)+ ; Read out received data to buffer. 1627 P:000279 600800 move r0,x:RX_PTR ; Update rx buffer pointer. 1628 P:00027A 05FF20 move x:-(r7),m0 ; Restore m0. 1629 P:00027B 60FF00 move x:-(r7),r0 ; Restore r0. 1630 P:00027C 000004 rti 1631 1632 ;********************** SSI receive last slot ISR ************************** 1633 ssi_rxls_isr 1634 P:00027D 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1635 P:00027E 300000 move #RX_BUFF_BASE,r0 ; Reset rx buffer pointer just in 1636 ; case it was corrupted. 1637 P:00027F 600800 move r0,x:RX_PTR ; Update rx buffer pointer. 1638 P:000280 60FF00 move x:-(r7),r0 ; Restore r0. 1639 P:000281 000004 rti 1640 1641 Y:000000 org y: 1642 Y:000000 diff dc $7fff00 1643 Y:000001 masksz dc $0f 1644 Y:000002 temp dc $0 1645 Y:000003 olda dc $0 1646 Y:000004 oldb dc $0 Motorola DSP56300 Assembler Version 6.2.0 99-12-04 16:09:08 pass_c~1.asm Page 14 1647 Y:000005 newa dc $0 1648 Y:000006 newb dc $0 1649 Y:000007 mask dc $ffffff 1650 Y:000008 mode dc $0 ;0=sampling 1=delta 1651 Y:000009 greet dc $0a0d00 1652 Y:00000A dc "This program demonstrates 16-bit audio sampling on the Motorola" 1653 Y:00001F dc $0a0d00 1654 Y:000020 dc "DSP56303 with delta encoding and bit sampling using 1-16 bits." 1655 Y:000035 dc $0a0d00 1656 Y:000036 dc "Attach the audio input to the Line-In jack and speakers/headphones" 1657 Y:00004C dc $0a0d00 1658 Y:00004D dc "to the Headphone-Out jack. " 1659 Y:000057 dc $0a0d00 1660 Y:000058 dc $0a0d00 1661 Y:000059 dc "Type 1-9 or A-G to get the different max delta/resolutions" 1662 Y:00006D dc $0a0d00 1663 Y:00006E dc "1=1 bit, G=16 bit. Type S to change between Sampled (S)" 1664 Y:000081 dc $0a0d00 1665 Y:000082 dc "and Delta (D)" 1666 Y:000087 dc $0a0d00,$0a0d00 1667 Y:000089 dc "Mode - Resolution (bits) :" 1668 Y:000092 dc $0a0d00 1669 Y:000093 modech dc $53202d ; ="S -" 1670 Y:000094 bits dc $203136 ; ="16" 1671 Y:000095 dc $0 1672 Y:000096 crlf dc $0a0d00,$0 1673 1674 ;echo 1675 end 0 Errors 9 Warnings