Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 pass_c~4.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 0001BC 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-06 15:21:30 pass_c~4.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 00027A 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 00019B 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-06 15:21:30 pass_c~4.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 [pass_c~4.asm 111]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1178 P:000142 5E7000 move a,y:count 000001 1179 P:000144 5EF000 move y:mode,a 000016 1180 P:000146 200003 tst a 1181 P:000147 0D1042 bne delta 000015 1182 1183 1184 1185 P:000149 2F8000 move #$800000,b ;initial mask 1186 P:00014A 4CF000 move y:masksz,x0 00000F 1187 P:00014C 0C1E79 asr x0,b,b ; shift the mask **** 1188 [pass_c~4.asm 121]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1188 P:00014D 5F7000 move b,y:mask 000015 1189 1190 P:00014F 5EF000 move y:newa,a 000013 1191 P:000151 5FF000 move y:newb,b 000014 1192 1193 P:000153 4EF000 move y:mask,y0 000015 1194 P:000155 200056 and y0,a Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 pass_c~4.asm Page 4 1195 P:000156 20005E and y0,b 1196 P:000157 5E7000 move a,y:olda 000011 1197 P:000159 5F7000 move b,y:oldb 000012 1198 P:00015B 00000C rts 1199 1200 P:00015C 4EF000 delta move y:diff,y0 ;load max delta mask into y0 00000E 1201 1202 P:00015E 5EF000 move y:newa,a 000013 1203 P:000160 5FF000 move y:olda,b ;new in a, old in b 000011 1204 1205 P:000162 200014 sub b,a ; get difference 1206 ; move a,y:temp ; hold difference in temp 1207 ; abs a ; check to see if it is in range 1208 ; cmp y0,a 1209 ; blt gooda 1210 1211 ; move y:temp,a 1212 P:000163 200003 tst a 1213 P:000164 0D1047 bgt posa 000009 1214 1215 P:000166 5EF000 move y:diff,a 00000E 1216 P:000168 200036 neg a **** 1217 [pass_c~4.asm 150]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1217 P:000169 5E7000 move a,y:temp 000010 1218 P:00016B 0D10C0 bra gooda 000006 1219 P:00016D 5EF000 posa move y:diff,a 00000E 1220 P:00016F 5E7000 move a,y:temp 000010 1221 P:000171 5EF000 gooda move y:temp,a 000010 1222 P:000173 200010 add b,a ;add delta back in **** 1223 [pass_c~4.asm 156]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1223 P:000174 5E7000 move a,y:olda ; store new value 000011 1224 1225 1226 P:000176 5EF000 move y:newb,a 000014 1227 P:000178 5FF000 move y:oldb,b ;new in a, old in b 000012 1228 P:00017A 200014 sub b,a ; get difference **** 1229 [pass_c~4.asm 162]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1229 P:00017B 5E7000 move a,y:temp ; hold difference in temp 000010 1230 P:00017D 200026 abs a ; check to see if it is in range 1231 P:00017E 200055 cmp y0,a Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 pass_c~4.asm Page 5 1232 P:00017F 0D1049 blt goodb 000012 1233 1234 P:000181 5EF000 move y:temp,a 000010 1235 P:000183 200003 tst a 1236 P:000184 0D1047 bgt posb 000009 1237 1238 P:000186 5EF000 move y:diff,a 00000E 1239 P:000188 200036 neg a **** 1240 [pass_c~4.asm 173]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1240 P:000189 5E7000 move a,y:temp 000010 1241 P:00018B 0D10C0 bra goodb 000006 1242 P:00018D 5EF000 posb move y:diff,a 00000E 1243 P:00018F 5E7000 move a,y:temp 000010 1244 P:000191 5EF000 goodb move y:temp,a 000010 1245 P:000193 200010 add b,a ;add delta back in **** 1246 [pass_c~4.asm 179]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1246 P:000194 5E7000 move a,y:oldb ; store new value 000012 1247 1248 P:000196 5EF000 move y:olda,a 000011 1249 P:000198 5FF000 move y:oldb,b 000012 1250 1251 P:00019A 00000C rts 1252 1253 1254 ;print subroutine takes address in register r5 1255 ;exits when most significant byte is zero 1256 ;ignores zeros in lower bytes 1257 ; clobbers accumulator A and B and register r5 1258 print 1259 P:00019B 5EDD00 prbegin move y:(r5)+,a 1260 ; cmp #$00ffff,a ;check to see if done (char=$00) 1261 ; blt prend 1262 P:00019C 014085 cmp #$000000,a ;check to see if done (char=$00) 1263 P:00019D 0D104A beq prend 00001E 1264 P:00019F 019381 jclr #1,x:M_SSR,* ;wait for tx to finish 00019F 1265 P:0001A1 019380 jclr #0,x:M_SSR,* ;wait for tx to finish 0001A1 1266 P:0001A3 567000 move a,x:M_STXH ; send high byte FFFF97 1267 P:0001A5 0140C6 and #$00ffff,a 00FFFF 1268 P:0001A7 0140C5 cmp #$0000ff,a Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 pass_c~4.asm Page 6 0000FF 1269 P:0001A9 0597D2 blt prbegin 1270 P:0001AA 019381 jclr #1,x:M_SSR,* ;wait for tx to finish 0001AA 1271 P:0001AC 019380 jclr #0,x:M_SSR,* ;wait for tx to finish 0001AC 1272 P:0001AE 567000 move a,x:M_STXM ; send mid byte FFFF96 1273 P:0001B0 0140C6 and #$0000ff,a 0000FF 1274 P:0001B2 014085 cmp #$000000,a 1275 P:0001B3 0597C8 blt prbegin 1276 P:0001B4 019381 jclr #1,x:M_SSR,* ;wait for tx to finish 0001B4 1277 P:0001B6 019380 jclr #0,x:M_SSR,* ;wait for tx to finish 0001B6 1278 P:0001B8 567000 move a,x:M_STXL ; send low byte FFFF95 1279 P:0001BA 050FC1 bra prbegin 1280 P:0001BB 00000C prend rts 1281 1282 1283 ; the SCI interrupt is triggered when a character is received 1284 ; this function takes the character, checks to make sure it is 1285 ; in the correct range (1-9, A-G, a-g) prints a message and 1286 ; modifies the output mask for that number of bits 1287 P:0001BC 21C600 ISCIRD move a,y0 ;back up A 1288 P:0001BD 56F000 move x:M_SRXL,a FFFF98 1289 1290 P:0001BF 016185 cmp #'!',a 1291 P:0001C0 0D104A beq iscd1 000081 1292 P:0001C2 0140C5 cmp #'@',a 000040 1293 P:0001C4 0D104A beq iscd2 000085 1294 P:0001C6 016385 cmp #'#',a 1295 P:0001C7 0D104A beq iscd3 00008A 1296 P:0001C9 016485 cmp #'$',a 1297 P:0001CA 0D104A beq iscd4 00008F 1298 P:0001CC 016585 cmp #'%',a 1299 P:0001CD 0D104A beq iscd5 000094 1300 P:0001CF 0140C5 cmp #'^',a 00005E 1301 P:0001D1 0D104A beq iscd6 000098 1302 1303 P:0001D3 017185 cmp #$31,a ; >='1' 1304 P:0001D4 0D1049 blt iscend 0000A4 1305 P:0001D6 017A85 cmp #$3A,a ; <='9' 1306 P:0001D7 0D1049 blt iscnum Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 pass_c~4.asm Page 7 00001D 1307 1308 P:0001D9 0140C5 cmp #'M',a ; =='M' ; change mode 00004D 1309 P:0001DB 0D104A beq iscmode 000043 1310 P:0001DD 0140C5 cmp #'m',a ; =='m' 00006D 1311 P:0001DF 0D104A beq iscmode 00003F 1312 1313 P:0001E1 0140C5 cmp #$40,a ; >='A' 000040 1314 P:0001E3 0D1049 blt iscend 000095 1315 P:0001E5 0140C5 cmp #$48,a ; <='G' 000048 1316 P:0001E7 0D1049 blt isclet 00000E 1317 P:0001E9 0140C5 cmp #$60,a ; >='a' 000060 1318 P:0001EB 0D1049 blt iscend 00008D 1319 P:0001ED 0140C5 cmp #$67,a ; <='g' 000067 1320 P:0001EF 0D1047 bgt iscend 000089 1321 P:0001F1 016084 sub #$20,a 1322 P:0001F2 0D10C0 bra isclet 000003 1323 1324 P:0001F4 014780 iscnum add #$07,a 1325 P:0001F5 014980 isclet add #$09,a 1326 1327 P:0001F6 019381 isciup jclr #1,x:M_SSR,* ;wait for tx to finish 0001F6 1328 P:0001F8 019380 jclr #0,x:M_SSR,* ;wait for tx to finish 0001F8 1329 P:0001FA 07F415 movep #$0d,x:M_STXL ;print LF 00000D 1330 P:0001FC 2F8000 move #$800000,b ;initial mask 1331 P:0001FD 5E7000 move a,y:temp ;hold onto value temporarially 000010 1332 P:0001FF 0140C4 sub #$41,a ; ammount to shift mask 000041 1333 P:000201 5E7000 move a,y:masksz 00000F 1334 P:000203 21C400 move a,x0 1335 P:000204 0C1E79 asr x0,b,b ; shift the mask 1336 1337 P:000205 56F400 move #>$00000f,a ;calculate bit shift 00000F 1338 P:000207 200044 sub x0,a 1339 P:000208 0C1E35 lsr a1,b 1340 P:000209 2B0000 move #<$00,b2 1341 Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 pass_c~4.asm Page 8 1342 P:00020A 5EF000 move y:temp,a 000010 1343 P:00020C 5F7000 move b,y:diff 00000E 1344 1345 P:00020E 015084 sub #$10,a 1346 P:00020F 017A85 cmp #$3A,a ; is a 10 digit? 1347 P:000210 0D1049 blt isci0 000005 1348 1349 P:000212 014A84 isci1 sub #$0a,a 1350 P:000213 0140C2 or #$001100,a ; add 10's digit if necessary 001100 1351 1352 P:000215 0140C0 isci0 add #$202000,a 202000 1353 P:000217 5E7000 move a,y:bits 0000BE 1354 P:000219 65F400 move #modech,r5 0000BD 1355 P:00021B 0D019B jsr print 1356 1357 P:00021C 0D10C0 bra iscend 00005C 1358 1359 P:00021E 5EF000 iscmode move y:modech,a ;change modes 0000BD 1360 P:000220 0140C5 cmp #$53202d,a ;check mode 53202D 1361 P:000222 0D1042 bne iscms 00000B 1362 P:000224 56F400 move #$44202d,a ; change to delta mode 44202D 1363 P:000226 5E7000 move a,y:modech 0000BD 1364 P:000228 2E0100 move #1,a **** 1365 [pass_c~4.asm 298]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1365 P:000229 5E7000 move a,y:mode 000016 1366 P:00022B 0D10C0 bra iscmend 00000B 1367 P:00022D 56F400 iscms move #$53202d,a ;change to sample mode 53202D 1368 P:00022F 5E7000 move a,y:modech 0000BD 1369 P:000231 2E0000 move #0,a **** 1370 [pass_c~4.asm 303]: WARNING --- Pipeline stall reading register written in previous instruction (Y data move field) 1370 P:000232 5E7000 move a,y:mode 000016 1371 P:000234 0D10C0 bra iscmend 000002 1372 P:000236 019381 iscmend jclr #1,x:M_SSR,* ;wait for tx to finish 000236 1373 P:000238 019380 jclr #0,x:M_SSR,* ;wait for tx to finish 000238 1374 P:00023A 07F415 movep #$0d,x:M_STXL ;print LF Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 pass_c~4.asm Page 9 00000D 1375 P:00023C 65F400 move #modech,r5 0000BD 1376 P:00023E 0D019B jsr print 1377 P:00023F 0D10C0 bra iscend 000039 1378 1379 P:000241 5EF000 iscd1 move y:d1,a 000002 1380 P:000243 5E7000 move a,y:div 0000C1 1381 P:000245 56F400 move #>$1,a 000001 1382 ; move a,y:divider 1383 P:000247 0D10C0 bra isccend 00002A 1384 1385 P:000249 5EF000 iscd2 move y:d2,a 000004 1386 P:00024B 5E7000 move a,y:div 0000C1 1387 P:00024D 56F400 move #>$2,a 000002 1388 ; move a,y:divider 1389 P:00024F 0D10C0 bra isccend 000022 1390 1391 P:000251 5EF000 iscd3 move y:d4,a 000006 1392 P:000253 5E7000 move a,y:div 0000C1 1393 P:000255 56F400 move #>$4,a 000004 1394 ; move a,y:divider 1395 P:000257 0D10C0 bra isccend 00001A 1396 1397 P:000259 5EF000 iscd4 move y:d8,a 000008 1398 P:00025B 5E7000 move a,y:div 0000C1 1399 P:00025D 56F400 move #>$8,a 000008 1400 ; move a,y:divider 1401 P:00025F 0D10C0 bra isccend 000012 1402 1403 P:000261 5EF000 iscd5 move y:d16,a 00000A 1404 P:000263 5E7000 move a,y:div 0000C1 1405 P:000265 56F400 move #>$10,a 000010 1406 ; move a,y:divider 1407 P:000267 0D10C0 bra isccend 00000A Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 pass_c~4.asm Page 10 1408 1409 P:000269 5EF000 iscd6 move y:d32,a 00000C 1410 P:00026B 5E7000 move a,y:div 0000C1 1411 P:00026D 56F400 move #>$20,a 000020 1412 ; move a,y:divider 1413 P:00026F 0D10C0 bra isccend 000002 1414 1415 P:000271 5E7000 isccend move a,y:divider 000000 1416 P:000273 65F400 move #modech,r5 0000BD 1417 P:000275 0D019B jsr print 1418 P:000276 0D10C0 bra iscend 000002 1419 1420 P:000278 20CE00 iscend move y0,a ;restore A 1421 P:000279 000004 rti 1422 1423 1424 1425 1426 include 'ada_init.asm' 1427 page 132,60 1428 ;************************************************************************** 1429 ; ADA_INIT.ASM Ver 1.2 1430 ; Example program to initialize the CS4218 1431 ; 1432 ; Copyright (c) MOTOROLA 1995, 1996, 1997, 1998 1433 ; Semiconductor Products Sector 1434 ; Wireless Signal Processing Division 1435 ; 1436 ; History: 1437 ; 14 June 1996: RLR/LJD - ver 1.0 1438 ; 21 July 1997: BEA - ver 1.1 1439 ; 23 Sept 1998: TTL - ver 1.2 1440 ;************************************************************************** 1441 X:00000A org x: 1442 1443 ; Codec control constants 1444 X:00000A CTRL_WD_HI ds 1 1445 X:00000B CTRL_WD_LO ds 1 1446 1447 1448 ; GPIO pin constants 1449 1450 ; ESSI0 - audio data GPIO mode 1451 ; DSP CODEC 1452 ; --------------------------- 1453 CODEC_RESET 1454 000000 equ 0 ; bit0 SC00 ---> CODEC_RESET~ 1455 1456 ; ESSI1 - control data GPIO Mode Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 ada_init.asm Page 11 1457 ; DSP CODEC 1458 ;---------------------------- 1459 000000 CCS equ 0 ; bit0 SC10 ---> CCS~ 1460 000001 CCLK equ 1 ; bit1 SC11 ---> CCLK 1461 000002 CDIN equ 2 ; bit2 SC12 ---> CDIN 1462 1463 ;************************************************************************** 1464 ; Initialize the CS4218 codec 1465 ; --------------------------- 1466 ; Serial Mode 4 (SM4), DSP Slave/Codec Master, 32-bits per frame 1467 ; 1468 ; After a reset, the control port must be written once to initialize it 1469 ; if the port will be accessed to read or write control bits. The initial 1470 ; write is a "dummy" write since the data is ignored by the codec. A second 1471 ; write is needed to configure the codec as desired. Then, the control port 1472 ; only needs to be written to when a change is desired, or to obtain status 1473 ; information. 1474 ; 1475 ; Although only 23 bits contain useful data in CDIN, a minimum of 31 bits 1476 ; must be written. 1477 ; 1478 ; CDIN 1479 ;------------------------------------------------ 1480 ; bit 31 0 1481 ;------------------------------------------------ 1482 ; bit 30 mask interrupt 1483 ; 0=no mask on MF5:\INT pin 1484 ; 1=mask on MF5:\INT pin 1485 ;------------------------------------------------ 1486 ; bit 29 DO1 1487 ;------------------------------------------------ 1488 ; bits 28-24 left output D/A sttenuation (1.5dB steps) 1489 ; 00000=No attenuation 0dB 1490 ; 11111=Max attenuation -46.5dB 1491 ;------------------------------------------------ 1492 ; bits 23-19 right output D/A attenuation (1.5dB steps) 1493 ; 00000=No attenuation 0dB 1494 ; 11111=Max attenuation -46.5dB 1495 ;------------------------------------------------ 1496 ; bit 18 mute D/A outputs 1497 ; 0=outputs ON 1498 ; 1=outputs MUTED 1499 ;------------------------------------------------ 1500 ; bit 17 input mux, left select 1501 ; 0=RIN1 1502 ; 1=RIN2 (used on EVM) 1503 ;------------------------------------------------ 1504 ; bit 16 input mux, right select 1505 ; 0=LIN1 1506 ; 1=LIN2 (used on EVM) 1507 ;------------------------------------------------ 1508 ; bits 15-12 left input A/D gain (1.5dB steps) 1509 ; 0000=No gain 0dB 1510 ; 1111=Max gain +22.5dB 1511 ;------------------------------------------------ 1512 ; bits 11-8 right input A/D gain (1.5dB steps) Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 ada_init.asm Page 12 1513 ; 0000=No gain 0dB 1514 ; 1111=Max gain +22.5dB 1515 ;------------------------------------------------ 1516 ; bits 7-0 00000000 1517 ;------------------------------------------------ 1518 ;************************************************************************** 1519 1520 1521 P:00027A org p: 1522 ada_init 1523 1524 ; reset ESSI ports 1525 P:00027A 07F43F movep #$0000,x:M_PCRC ; reset ESSI0 port 000000 1526 P:00027C 07F42F movep #$0000,x:M_PCRD ; reset ESSI1 port 000000 1527 1528 ; Set Control Register A and B 1529 P:00027E 07F435 movep #$101807,x:M_CRA0 ; 12.288MHz/16 = 768KHz SCLK 101807 1530 ; prescale modulus = 8 1531 ; frame rate divider = 2 1532 ; 16-bits per word 1533 ; 32-bits per frame 1534 ; 16-bit data aligned to bit 23 1535 1536 P:000280 07F436 movep #$ff330c,x:M_CRB0 ; Enable REIE,TEIE,RLIE,TLIE, FF330C 1537 ; RIE,TIE,RE,TE0 1538 ; network mode, synchronous, 1539 ; out on rising/in on falling 1540 ; shift MSB first 1541 ; external clock source drives SCK 1542 ; (codec is master) 1543 ; RX frame sync pulses active for 1544 ; 1 bit clock immediately before 1545 ; transfer period 1546 ; positive frame sync polarity 1547 ; frame sync length is 1-bit 1548 1549 ; Configure GPIO pins -- (functionality and direction ) 1550 P:000282 07F43F movep #$0000,x:M_PCRC ; Enable GPIO pin 0 SC00=CODEC_RESET 000000 1551 P:000284 07F42F movep #$0000,x:M_PCRD ; Enable GPIO CSS (pin 0),CCLK (pin 1), CDIN (pin 2) 000000 1552 1553 P:000286 07F43E movep #$0001,x:M_PRRC ; set PC0=CODEC_RESET~ as output 000001 1554 P:000288 07F42E movep #$0007,x:M_PRRD ; set PD0=CCS~ as output 000007 1555 ; set PD1=CCLK as output 1556 ; set PD2=CDIN as output 1557 1558 ; Codec Reset 1559 P:00028A 013D00 bclr #CODEC_RESET,x:M_PDRC ; assert CODEC_RESET~ Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 ada_init.asm Page 13 1560 P:00028B 012D00 bclr #CCS,x:M_PDRD ; assert CCS~ -- allows control register to be writte n to 1561 1562 ; Delay to allow Codec to reset 1563 P:00028C 06E883 do #1000,_delay_loop 00028F 1564 P:00028E 06E8A3 rep #1000 ; minimum 50 ms delay 1565 P:00028F 000000 nop 1566 _delay_loop 1567 1568 1569 ; Setting up to send Codec control information 1570 P:000290 013D20 bset #CODEC_RESET,x:M_PDRC ; deassert CODEC_RESET~ 1571 1572 1573 ; Sending control words 1574 set_control 1575 P:000291 44F400 move #CTRL_WD_12,x0 ; transfer control value to control variable 000300 1576 P:000293 440A00 move x0,x:CTRL_WD_HI 1577 P:000294 240000 move #CTRL_WD_34,x0 1578 P:000295 440B00 move x0,x:CTRL_WD_LO 1579 P:000296 0BF080 jsr codec_control ; send in dummy control information 0002A0 1580 P:000298 0BF080 jsr codec_control ; send in correct control information 0002A0 1581 1582 1583 ; Set and enable interrupts 1584 P:00029A 08F4BE movep #$000c,x:M_IPRP ; set interrupt priority level for ESSI0 to 3 00000C 1585 P:00029C 00FCB8 andi #$fc,mr ; enable interrupts 1586 1587 ; Set ESSI functionality 1588 P:00029D 07F43F movep #$003e,x:M_PCRC ; enable ESSI0 except SC00=CODEC_RESET 00003E 1589 1590 P:00029F 00000C rts 1591 1592 1593 ;------------------------------------------------------------- 1594 ; codec_control routine 1595 ; Input: CTRL_WD_LO and CTRL_WD_HI 1596 ; Output: CDIN 1597 ; Description: Used to send control information to CODEC 1598 ; NOTE: does not preserve the 'a' register. 1599 ;------------------------------------------------------------- 1600 codec_control 1601 P:0002A0 200013 clr a 1602 P:0002A1 012D00 bclr #CCS,x:M_PDRD ; assert CCS 1603 P:0002A2 548A00 move x:CTRL_WD_HI,a1 ; upper 16 bits of control data 1604 P:0002A3 0BF080 jsr send_codec ; shift out upper control word 0002AA 1605 P:0002A5 548B00 move x:CTRL_WD_LO,a1 ; lower 16 bits of control data 1606 P:0002A6 0BF080 jsr send_codec ; shift out lower control word 0002AA Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 ada_init.asm Page 14 1607 P:0002A8 012D20 bset #CCS,x:M_PDRD ; deassert CCS 1608 P:0002A9 00000C rts 1609 1610 1611 ;--------------------------------------------------------------- 1612 ; send_codec routine 1613 ; Input: a1 containing control information 1614 ; Output: sends bits to CDIN 1615 ; Description: Determines bits to send to CDIN 1616 ;--------------------------------------------------------------- 1617 1618 send_codec 1619 P:0002AA 061080 do #16,end_send_codec ; 16 bits per word 0002B6 1620 P:0002AC 012D21 bset #CCLK,x:M_PDRD ; toggle CCLK clock high 1621 P:0002AD 0ACC17 jclr #23,a1,bit_low ; test msb 0002B2 1622 P:0002AF 012D22 bset #CDIN,x:M_PDRD ; send high into CDIN 1623 P:0002B0 0AF080 jmp continue 0002B3 1624 bit_low 1625 P:0002B2 012D02 bclr #CDIN,x:M_PDRD ; send low into CDIN 1626 continue 1627 P:0002B3 0602A0 rep #2 ; delay 1628 P:0002B4 000000 nop 1629 P:0002B5 012D01 bclr #CCLK,x:M_PDRD ; restart cycle 1630 P:0002B6 200033 lsl a ; shift control word to 1 bit 1631 ; to left 1632 end_send_codec 1633 P:0002B7 00000C rts 1634 1635 1636 1637 1638 ;**************************************************************************** 1639 ; SSI0_ISR.ASM Ver.2.0 1640 ; Example program to handle interrupts through 1641 ; the 56307 SSI0 to move audio through the CS4218 1642 ; 1643 ; Copyright (c) MOTOROLA 1995, 1996, 1997, 1998 1644 ; Semiconductor Products Sector 1645 ; Digital Signal Processing Division 1646 ; 1647 ; 1648 ; History: 1649 ; 14 June 1996: RLR/LJD - ver 1.0 1650 ; 23 July 1997: BEA - ver 1.1 1651 ;****************************************************************************** 1652 1653 1654 ;----the actual interrupt service routines (ISRs) follow: 1655 1656 ;************************ SSI TRANSMIT ISR ********************************* 1657 ssi_txe_isr 1658 P:0002B8 013704 bclr #4,x:M_SSISR0 ; Read SSISR to clear exception flag 1659 ; explicitly clears underrun flag Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 ada_init.asm Page 15 1660 ssi_tx_isr 1661 P:0002B9 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1662 P:0002BA 055F20 move m0,x:(r7)+ ; Save m0 to the stack. 1663 P:0002BB 0501A0 move #1,m0 ; Modulus 2 buffer. 1664 P:0002BC 608900 move x:TX_PTR,r0 ; Load the pointer to the tx buffer. 1665 P:0002BD 000000 nop 1666 P:0002BE 000000 nop 1667 P:0002BF 000000 nop 1668 P:0002C0 07D83C movep x:(r0)+,x:M_TX00 ; SSI transfer data register. 1669 P:0002C1 600900 move r0,x:TX_PTR ; Update tx buffer pointer. 1670 P:0002C2 05FF20 move x:-(r7),m0 ; Restore m0. 1671 P:0002C3 60FF00 move x:-(r7),r0 ; Restore r0. 1672 P:0002C4 000004 rti 1673 1674 ;********************* SSI TRANSMIT LAST SLOT ISR ************************** 1675 ssi_txls_isr 1676 P:0002C5 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1677 P:0002C6 300400 move #TX_BUFF_BASE,r0 ; Reset pointer. 1678 P:0002C7 000000 nop 1679 P:0002C8 600900 move r0,x:TX_PTR ; Reset tx buffer pointer just in 1680 P:0002C9 000000 nop ; case it was corrupted. 1681 P:0002CA 60FF00 move x:-(r7),r0 ; Restore r0. 1682 P:0002CB 000004 rti 1683 1684 ;************************** SSI receive ISR ******************************** 1685 ssi_rxe_isr 1686 P:0002CC 013705 bclr #5,x:M_SSISR0 ; Read SSISR to clear exception flag 1687 ; explicitly clears overrun flag 1688 ssi_rx_isr 1689 P:0002CD 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1690 P:0002CE 055F20 move m0,x:(r7)+ ; Save m0 to the stack. 1691 P:0002CF 0501A0 move #1,m0 ; Modulus 2 buffer. 1692 P:0002D0 608800 move x:RX_PTR,r0 ; Load the pointer to the rx buffer. 1693 P:0002D1 000000 nop 1694 P:0002D2 000000 nop 1695 P:0002D3 000000 nop 1696 P:0002D4 075838 movep x:M_RX0,x:(r0)+ ; Read out received data to buffer. 1697 P:0002D5 600800 move r0,x:RX_PTR ; Update rx buffer pointer. 1698 P:0002D6 05FF20 move x:-(r7),m0 ; Restore m0. 1699 P:0002D7 60FF00 move x:-(r7),r0 ; Restore r0. 1700 P:0002D8 000004 rti 1701 1702 ;********************** SSI receive last slot ISR ************************** 1703 ssi_rxls_isr 1704 P:0002D9 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1705 P:0002DA 300000 move #RX_BUFF_BASE,r0 ; Reset rx buffer pointer just in 1706 ; case it was corrupted. 1707 P:0002DB 600800 move r0,x:RX_PTR ; Update rx buffer pointer. 1708 P:0002DC 60FF00 move x:-(r7),r0 ; Restore r0. 1709 P:0002DD 000004 rti 1710 1711 Y:000000 org y: 1712 Y:000000 divider dc $1 1713 Y:000001 count dc $0 1714 ;doffset dc $0 1715 Motorola DSP56300 Assembler Version 6.2.0 99-12-06 15:21:30 pass_c~4.asm Page 16 1716 ;d dc d1,d2,d4,d8,d16,d32 1717 Y:000002 d1 dc "1 ",$0 ; 48 1718 Y:000004 d2 dc "2 ",$0 ; 24 1719 Y:000006 d4 dc "4 ",$0 ; 12 1720 Y:000008 d8 dc "8 ",$0 ; 6 1721 Y:00000A d16 dc "16 ",$0 ; 3 1722 Y:00000C d32 dc "32 ",$0 ; 1.5 1723 1724 Y:00000E diff dc $7fff00 1725 Y:00000F masksz dc $0f 1726 Y:000010 temp dc $0 1727 Y:000011 olda dc $0 1728 Y:000012 oldb dc $0 1729 Y:000013 newa dc $0 1730 Y:000014 newb dc $0 1731 Y:000015 mask dc $ffffff 1732 Y:000016 mode dc $0 ;0=sampling 1=delta 1733 Y:000017 greet dc $0a0d00 1734 Y:000018 dc "This program demonstrates 16-bit audio sampling on the Motorola" 1735 Y:00002D dc $0a0d00 1736 Y:00002E dc "DSP56303 with delta encoding and bit sampling using 1-16 bits." 1737 Y:000043 dc $0a0d00 1738 Y:000044 dc "Attach the audio input to the Line-In jack and speakers/headphones" 1739 Y:00005A dc $0a0d00 1740 Y:00005B dc "to the Headphone-Out jack. " 1741 Y:000065 dc $0a0d00 1742 Y:000066 dc $0a0d00 1743 Y:000067 dc "Type 1-9 or A-G to get the different max delta/resolutions" 1744 Y:00007B dc $0a0d00 1745 Y:00007C dc "1=1 bit, G=16 bit. Type M to change between Sampled (S)" 1746 Y:00008F dc $0a0d00 1747 Y:000090 dc "and Delta (D) modes. Type [Shift}+1-6 to change the sampling" 1748 Y:0000A5 dc $0a0d00 1749 Y:0000A6 dc "rate, 48/2^(n-1) kHz" 1750 Y:0000AD dc $0a0d00,$0a0d00 1751 Y:0000AF dc "Mode - Resolution (bits) - Freq (kHz):" 1752 Y:0000BC dc $0a0d00 1753 Y:0000BD modech dc $53202d ; ="S -" 1754 Y:0000BE bits dc $203136 ; =" 16" 1755 Y:0000BF hz dc " - 48/" 1756 Y:0000C1 div dc "1 " 1757 Y:0000C2 dc $0d0000,$0 1758 Y:0000C4 crlf dc $0a0d00,$0 1759 ;echo 1760 end 0 Errors 9 Warnings