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