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