Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 c:\windows\desktop\hi08\60hzhi08.asm Page 1 1 page 132,60 2 ;**************************************************************************** 3 ; 60HZHI08.ASM 4 ; Example program to demonstrate the difference between 24-bit data 5 ; capabilities and 16-bit data capabilities 6 ; 7 ; Modified to work with the HI08 to trigger the different filtering modes 8 ; Ellery Blood September 1999 9 ; 10 ; Copyright (c) MOTOROLA 1994 11 ; Semiconductor Products Sector 12 ; Digital Signal Processing Division 13 ; 14 ; ver. 1.1 3/16/95 Placed coefficients on modulo boundaries. Moved the 15 ; "state" variable locations. Set sine amplitude to 0.3. 16 ; 6/20/96 PFS Modified for 56303 17 ; 9/16/99 Modified for HI08 interface 18 ; 19 ;****************************************************************************** 20 ; This code demonstrates the benefits of a 24-bit architecture over that of 21 ; a 16-bit architecture. The demonstration runs on the DSP56303EVM evaluation 22 ; module. An external audio signal is input through the microphone connector 23 ; on the EVM. A 60 Hz tone is generated by the DSP (via a digital oscillator) 24 ; and then added to the digitized audio signal. The resulting data is then 25 ; sent through a filter with one of three sets of coefficients. The first 26 ; set of coefficients is located at location y:no_filter and performs no 27 ; filtering at all, simply allowing the corrupted signal to pass. This first 28 ; set of coefficients are used by the filter when the demo first begins or 29 ; following the IRQB (IRQB). The second set of coefficients 30 ; (located at y:coef_24) are 24-bit coefficients that make up a 60 Hz notch 31 ; filter which removes the 60 Hz portion of the corrupted signal. This second 32 ; set of coefficients are used following the external interrupt A (IRQA). The 33 ; final set of coefficients (located at y:coeff_16) are the same coefficients 34 ; as those for the 24-bit filter, only rounded to 16 bits. These 16-bit 35 ; coefficients are used by the filter following the external interrupt D 36 ; (IRQD). 37 ;****************************************************************************** 780 include 'vectors.asm' 781 ; page 132,60 782 ;**************************************************************************** 783 ; VECTORS.ASM 784 ; Vector table for the 5630x 785 ; 786 ; Copyright (c) MOTOROLA 1996 787 ; Semiconductor Products Sector 788 ; Digital Signal Processing Division 789 ; 790 ;**************************************************************************** 791 ; 792 P:000000 ORG P:0 793 ; 794 P:000000 0AF080 vectors JMP START ; Hardware RESET 000100 795 ; 796 P:000002 0C0002 jmp * 797 P:000003 000000 NOP ; Stack Error Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 vectors.asm Page 2 798 799 P:000004 0C0004 jmp * 800 P:000005 000000 NOP ;- Debug Request Interrupt 801 ; 802 P:000006 0C0006 jmp * 803 P:000007 000000 NOP ;- Debug Request Interrupt 804 ; 805 P:000008 0C0008 jmp * 806 P:000009 000000 NOP ;- Trap 807 ; 808 P:00000A 0C000A jmp * 809 P:00000B 000000 NOP ;- NMI 810 ; 811 P:00000C 000000 NOP ;- Reserved 812 P:00000D 000000 NOP 813 ; 814 P:00000E 000000 NOP ;- Reserved 815 P:00000F 000000 NOP 816 ; 817 P:000010 0BF080 jsr main ;- IRQA 000100 818 ; 819 P:000012 0C0012 jmp * 820 P:000013 000000 NOP ;- IRQB 821 ; 822 P:000014 0C0014 jmp * 823 P:000015 000000 NOP ;- IRQC 824 ; 825 ; jsr echo ;- IRQD 826 P:000016 0C0016 jmp * 827 P:000017 000000 NOP 828 ; 829 P:000018 0C0018 jmp * 830 P:000019 000000 NOP ;- DMA Channel 0 831 ; 832 P:00001A 0C001A jmp * 833 P:00001B 000000 NOP ;- DMA Channel 1 834 ; 835 P:00001C 0C001C jmp * 836 P:00001D 000000 NOP ;- DMA Channel 2 837 ; 838 P:00001E 0C001E jmp * 839 P:00001F 000000 NOP ;- DMA Channel 3 840 ; 841 P:000020 0C0020 jmp * 842 P:000021 000000 NOP ;- DMA Channel 4 843 ; 844 P:000022 0C0022 jmp * 845 P:000023 000000 NOP ;- DMA Channel 5 846 ; 847 P:000024 0C0024 jmp * 848 P:000025 000000 NOP ;- Timer 0 Compare 849 ; 850 P:000026 0C0026 jmp * 851 P:000027 000000 NOP ;- Timer 0 Overflow 852 ; Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 vectors.asm Page 3 853 P:000028 0C0028 jmp * 854 P:000029 000000 NOP ;- Timer 1 Compare 855 ; 856 P:00002A 0C002A jmp * 857 P:00002B 000000 NOP ;- Timer 1 Overflow 858 ; 859 P:00002C 0C002C jmp * 860 P:00002D 000000 NOP ;- Timer 2 Compare 861 ; 862 P:00002E 0C002E jmp * 863 P:00002F 000000 NOP ;- Timer 2 Overflow 864 ; 865 P:000030 0BF080 jsr ssi_rx_isr ;- ESSI0 Receive Data 0001DE 866 ; 867 P:000032 0BF080 jsr ssi_rxe_isr ;- ESSI0 Receive Data w/ Exception Status 0001DD 868 ; 869 P:000034 0BF080 jsr ssi_rxls_isr ;- ESSI0 Receive last slot 0001EA 870 ; 871 P:000036 0BF080 jsr ssi_tx_isr ;- ESSI0 Transmit Data 0001CA 872 ; 873 P:000038 0BF080 jsr ssi_txe_isr ;- ESSI0 Transmit Data w/ Exception Status 0001C9 874 ; 875 P:00003A 0BF080 jsr ssi_txls_isr ;- ESSI0 Transmit last slot 0001D6 876 ; 877 P:00003C 000000 NOP ;- Reserved 878 P:00003D 000000 NOP 879 ; 880 P:00003E 000000 NOP ;- Reserved 881 P:00003F 000000 NOP 882 ; 883 P:000040 0C0040 jmp * 884 P:000041 000000 NOP ;- ESSI1 Receive Data 885 ; 886 P:000042 0C0042 jmp * 887 P:000043 000000 NOP ;- ESSI1 Receive Data w/ Exception Status 888 ; 889 P:000044 0C0044 jmp * 890 P:000045 000000 NOP ;- ESSI1 Receive last slot 891 ; 892 P:000046 0C0046 jmp * 893 P:000047 000000 NOP ;- ESSI1 Transmit Data 894 ; 895 P:000048 0C0048 jmp * 896 P:000049 000000 NOP ;- ESSI1 Transmit Data w/ Exception Status 897 ; 898 P:00004A 0C004A jmp * 899 P:00004B 000000 NOP ;- ESSI1 Transmit last slot 900 ; 901 902 P:00004C 000000 NOP ;- Reserved Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 vectors.asm Page 4 903 P:00004D 000000 NOP 904 ; 905 P:00004E 000000 NOP ;- Reserved 906 P:00004F 000000 NOP 907 ; 908 P:000050 0C0050 jmp * 909 P:000051 000000 NOP ;- SCI Receive Data 910 ; 911 P:000052 0C0052 jmp * 912 P:000053 000000 NOP ;- SCI Receive Data w/ Exception Status 913 ; 914 P:000054 0C0054 jmp * 915 P:000055 000000 NOP ;- SCI Transmit Data 916 ; 917 P:000056 0C0056 jmp * 918 P:000057 000000 NOP ;- SCI Idle Line 919 ; 920 P:000058 0C0058 jmp * 921 P:000059 000000 NOP ;- SCI Timer 922 ; 923 P:00005A 000000 NOP ;- Reserved 924 P:00005B 000000 NOP 925 ; 926 P:00005C 000000 NOP ;- Reserved 927 P:00005D 000000 NOP 928 ; 929 P:00005E 000000 NOP ;- Reserved 930 P:00005F 000000 NOP 931 ; 932 ; 933 P:000060 0C0060 jmp * 934 P:000061 000000 NOP ; Host receive data full 935 ; 936 ; 937 P:000062 0C0062 jmp * 938 P:000063 000000 NOP ;- Host transmit data empty 939 ; 940 P:000064 0C0064 jmp * 941 P:000065 000000 NOP ; Available for Host Command 942 P:000066 0C0066 jmp * 943 P:000067 000000 NOP ; Available for Host Command 944 P:000068 0C0068 jmp * 945 P:000069 000000 NOP ; Available for Host Command 946 P:00006A 0C006A jmp * 947 P:00006B 000000 NOP ; Available for Host Command 948 P:00006C 0C006C jmp * 949 P:00006D 000000 NOP ; Available for Host Command 950 P:00006E 0C006E jmp * 951 P:00006F 000000 NOP ; Available for Host Command 952 P:000070 0C0070 jmp * 953 P:000071 000000 NOP ; Available for Host Command 954 P:000072 0C0072 jmp * 955 P:000073 000000 NOP ; Available for Host Command 956 P:000074 0C0074 jmp * 957 P:000075 000000 NOP ; Available for Host Command 958 P:000076 0C0076 jmp * Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 vectors.asm Page 5 959 P:000077 000000 NOP ; Available for Host Command 960 P:000078 0C0078 jmp * 961 P:000079 000000 NOP ; Available for Host Command 962 P:00007A 0C007A jmp * 963 P:00007B 000000 NOP ; Available for Host Command 964 P:00007C 0C007C jmp * 965 P:00007D 000000 NOP ; Available for Host Command 966 P:00007E 0C007E jmp * 967 P:00007F 000000 NOP ; Available for Host Command 968 P:000080 0C0080 jmp * 969 P:000081 000000 NOP ; Available for Host Command 970 P:000082 0C0082 jmp * 971 P:000083 000000 NOP ; Available for Host Command 972 P:000084 0C0084 jmp * 973 P:000085 000000 NOP ; Available for Host Command 974 P:000086 0C0086 jmp * 975 P:000087 000000 NOP ; Available for Host Command 976 P:000088 0C0088 jmp * 977 P:000089 000000 NOP ; Available for Host Command 978 P:00008A 0C008A jmp * 979 P:00008B 000000 NOP ; Available for Host Command 980 P:00008C 0C008C jmp * 981 P:00008D 000000 NOP ; Available for Host Command 982 P:00008E 0C008E jmp * 983 P:00008F 000000 NOP ; Available for Host Command 984 P:000090 0C0090 jmp * 985 P:000091 000000 NOP ; Available for Host Command 986 P:000092 0C0092 jmp * 987 P:000093 000000 NOP ; Available for Host Command 988 P:000094 0C0094 jmp * 989 P:000095 000000 NOP ; Available for Host Command 990 P:000096 0C0096 jmp * 991 P:000097 000000 NOP ; Available for Host Command 992 P:000098 0C0098 jmp * 993 P:000099 000000 NOP ; Available for Host Command 994 P:00009A 0C009A jmp * 995 P:00009B 000000 NOP ; Available for Host Command 996 P:00009C 0C009C jmp * 997 P:00009D 000000 NOP ; Available for Host Command 998 P:00009E 0C009E jmp * 999 P:00009F 000000 NOP ; Available for Host Command 1000 P:0000A0 0C00A0 jmp * 1001 1002 P:0000A1 000000 NOP ; Available for Host Command 1003 P:0000A2 0C00A2 jmp * 1004 P:0000A3 000000 NOP ; Available for Host Command 1005 P:0000A4 0C00A4 jmp * 1006 P:0000A5 000000 NOP ; Available for Host Command 1007 P:0000A6 0C00A6 jmp * 1008 P:0000A7 000000 NOP ; Available for Host Command 1009 P:0000A8 0C00A8 jmp * 1010 P:0000A9 000000 NOP ; Available for Host Command 1011 P:0000AA 0C00AA jmp * 1012 P:0000AB 000000 NOP ; Available for Host Command 1013 P:0000AC 0C00AC jmp * 1014 P:0000AD 000000 NOP ; Available for Host Command Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 vectors.asm Page 6 1015 P:0000AE 0C00AE jmp * 1016 P:0000AF 000000 NOP ; Available for Host Command 1017 P:0000B0 0C00B0 jmp * 1018 P:0000B1 000000 NOP ; Available for Host Command 1019 P:0000B2 0C00B2 jmp * 1020 P:0000B3 000000 NOP ; Available for Host Command 1021 P:0000B4 0C00B4 jmp * 1022 P:0000B5 000000 NOP ; Available for Host Command 1023 P:0000B6 0C00B6 jmp * 1024 P:0000B7 000000 NOP ; Available for Host Command 1025 P:0000B8 0C00B8 jmp * 1026 P:0000B9 000000 NOP ; Available for Host Command 1027 P:0000BA 0C00BA jmp * 1028 P:0000BB 000000 NOP ; Available for Host Command 1029 P:0000BC 0C00BC jmp * 1030 P:0000BD 000000 NOP ; Available for Host Command 1031 P:0000BE 0C00BE jmp * 1032 P:0000BF 000000 NOP ; Available for Host Command 1033 P:0000C0 0C00C0 jmp * 1034 P:0000C1 000000 NOP ; Available for Host Command 1035 P:0000C2 0C00C2 jmp * 1036 P:0000C3 000000 NOP ; Available for Host Command 1037 P:0000C4 0C00C4 jmp * 1038 P:0000C5 000000 NOP ; Available for Host Command 1039 P:0000C6 0C00C6 jmp * 1040 P:0000C7 000000 NOP ; Available for Host Command 1041 P:0000C8 0C00C8 jmp * 1042 P:0000C9 000000 NOP ; Available for Host Command 1043 P:0000CA 0C00CA jmp * 1044 P:0000CB 000000 NOP ; Available for Host Command 1045 P:0000CC 0C00CC jmp * 1046 P:0000CD 000000 NOP ; Available for Host Command 1047 P:0000CE 0C00CE jmp * 1048 P:0000CF 000000 NOP ; Available for Host Command 1049 P:0000D0 0C00D0 jmp * 1050 P:0000D1 000000 NOP ; Available for Host Command 1051 P:0000D2 0C00D2 jmp * 1052 P:0000D3 000000 NOP ; Available for Host Command 1053 P:0000D4 0C00D4 jmp * 1054 P:0000D5 000000 NOP ; Available for Host Command 1055 P:0000D6 0C00D6 jmp * 1056 P:0000D7 000000 NOP ; Available for Host Command 1057 P:0000D8 0C00D8 jmp * 1058 P:0000D9 000000 NOP ; Available for Host Command 1059 P:0000DA 0C00DA jmp * 1060 P:0000DB 000000 NOP ; Available for Host Command 1061 P:0000DC 0C00DC jmp * 1062 P:0000DD 000000 NOP ; Available for Host Command 1063 P:0000DE 0C00DE jmp * 1064 1065 1066 P:0000DF 000000 NOP ; Available for Host Command 1067 P:0000E0 0C00E0 jmp * 1068 P:0000E1 000000 NOP ; Available for Host Command 1069 P:0000E2 0C00E2 jmp * 1070 P:0000E3 000000 NOP ; Available for Host Command Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 vectors.asm Page 7 1071 P:0000E4 0C00E4 jmp * 1072 P:0000E5 000000 NOP ; Available for Host Command 1073 P:0000E6 0C00E6 jmp * 1074 P:0000E7 000000 NOP ; Available for Host Command 1075 P:0000E8 0C00E8 jmp * 1076 P:0000E9 000000 NOP ; Available for Host Command 1077 P:0000EA 0C00EA jmp * 1078 P:0000EB 000000 NOP ; Available for Host Command 1079 P:0000EC 0C00EC jmp * 1080 P:0000ED 000000 NOP ; Available for Host Command 1081 P:0000EE 0C00EE jmp * 1082 P:0000EF 000000 NOP ; Available for Host Command 1083 P:0000F0 0C00F0 jmp * 1084 P:0000F1 000000 NOP ; Available for Host Command 1085 P:0000F2 0C00F2 jmp * 1086 P:0000F3 000000 NOP ; Available for Host Command 1087 P:0000F4 0C00F4 jmp * 1088 P:0000F5 000000 NOP ; Available for Host Command 1089 P:0000F6 0C00F6 jmp * 1090 P:0000F7 000000 NOP ; Available for Host Command 1091 P:0000F8 0C00F8 jmp * 1092 P:0000F9 000000 NOP ; Available for Host Command 1093 P:0000FA 0C00FA jmp * 1094 P:0000FB 000000 NOP ; Available for Host Command 1095 P:0000FC 0C00FC jmp * 1096 P:0000FD 000000 NOP ; Available for Host Command 1097 P:0000FE 0C00FE jmp * 1098 P:0000FF 000000 NOP ; Available for Host Command 1099 ; 1100 ; 1101 1102 4.800000E+004 Fs set 48000.0 ;Specify sampling frequency. 1103 3.141593E+000 PI set 2.0*@asn(1.0) ;Compute PI as 2.0*arcsin(1.0) 1104 1.745329E-002 factor set PI/180.0 ;Multiplier for degrees to radians 1105 000012 eighteen set 18 1106 000020 hex_twenty set $20 1107 1108 ;****************************************************************************** 1109 ; Specification for tone a. 1110 6.000000E+001 freq_a set 60.0 ;Specify frequency in Hertz. 1111 4.500000E-001 phi_a set 360.0*(freq_a/Fs) ;Compute phi 1112 0.000000E+000 phase_a set 0.0 ;Specify the phase angle in 1113 ; degrees (-180 -- +180). 1114 3.000000E-001 amp_a set 0.3 ;Specify amplitude (0-1). 1115 -9.000000E-001 theta2_a set (phase_a-(2.0*phi_a)) ;Compute theta2 1116 -4.500000E-001 theta1_a set (phase_a-phi_a) ;Compute theta1 1117 -4.712195E-003 s2_a set amp_a*@sin(factor*theta2_a) ;Compute s2 1118 -2.356170E-003 s1_a set amp_a*@sin(factor*theta1_a) ;Compute s1 1119 9.999692E-001 coeff_a set @cos(factor*phi_a) ;Compute rcoef in 2:14 format 1120 1121 1122 ;****************************************************************************** 1123 ; These three interrupts (IRQA, IRQD, and IRQB) load the program memory location 1124 ; of the appropriate filter routine (24-bit, 16-bit, or NMI). 1125 ; 1126 P:000000 org p:$0 Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 c:\windows\desktop\hi08\60hzhi08.asm Page 8 1127 P:000000 0AF080 jmp START 000100 1128 P:000010 org p:$10 ; IRQA--Filter in 24 bit mode. 1129 P:000010 64F400 move #coef_24+1,r4 ; Load code pointer. (command 08) 000001 1130 P:000012 org p:$12 ; IRQB--no filtering 1131 P:000012 64F400 move #no_filter+1,r4 ; Load code pointer. (command 09) 000021 1132 P:000014 org p:$14 ; IRQC--Filter in 16 bit mode. 1133 P:000014 64F400 move #coef_16+1,r4 ; Load code pointer. (command 0A) 000011 1134 P:000016 org p:$16 ; IRQD--Filter in 16 bit mode. 1135 P:000016 64F400 move #coef_16+1,r4 ; Load code pointer. (command 0B) 000011 1136 1137 1138 ;********************************************* 1139 ; Equates for the HI08 interface 1140 ; 1141 ;M_HTX EQU $FFFFC7 ; Host Transmit Register 1142 ;M_HRX EQU $FFFFC6 ; Host Receive Register 1143 ;M_HBAR EQU $FFFFC5 ; Host Base Address Register 1144 ;M_HPCR EQU $FFFFC4 ; Host Port Control Register 1145 ;M_HSR EQU $FFFFC3 ; Host Status Register 1146 ;M_HCR EQU $FFFFC2 ; Host Control Register 1147 1148 1149 ; org p:$30 1150 ; jsr ssi_rx_isr ;- ESSI0 Receive Data 1151 ; jsr ssi_rxe_isr ;- ESSI0 Receive Data w/ Exception Status 1152 ; jsr ssi_rxls_isr ;- ESSI0 Receive last slot 1153 ; jsr ssi_tx_isr ;- ESSI0 Transmit Data 1154 ; jsr ssi_txe_isr ;- ESSI0 Transmit Data w/ Exception Status 1155 ; jsr ssi_txls_isr ;- ESSI0 Transmit last slot 1156 1157 1158 000003 nsec equ 3 ;number of second order sections 1159 000001 scount equ 1 ;final shift count 1160 1161 1162 ;****************************************************************************** 1163 ;---Buffer for talking to the CS4215 1164 1165 X:000000 org x:0 1166 RX_BUFF_BASE 1167 000000 equ * 1168 RX_data_1_2 1169 X:000000 ds 1 ;data time slot 1/2 for RX ISR 1170 RX_data_3_4 1171 X:000001 ds 1 ;data time slot 3/4 for RX ISR 1172 RX_data_5_6 1173 X:000002 ds 1 ;data time slot 5/6 for RX ISR 1174 RX_data_7_8 1175 X:000003 ds 1 ;data time slot 7/8 for RX ISR 1176 1177 Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 c:\windows\desktop\hi08\60hzhi08.asm Page 9 1178 TX_BUFF_BASE 1179 000004 equ * 1180 TX_data_1_2 1181 X:000004 ds 1 ;data time slot 1/2 for TX ISR 1182 TX_data_3_4 1183 X:000005 ds 1 ;data time slot 3/4 for TX ISR 1184 TX_data_5_6 1185 X:000006 ds 1 ;data time slot 5/6 for TX ISR 1186 TX_data_7_8 1187 X:000007 ds 1 ;data time slot 7/8 for TX ISR 1188 1189 X:000008 RX_PTR ds 1 ; Pointer for rx buffer 1190 X:000009 TX_PTR ds 1 ; Pointer for tx buffer 1191 1192 1193 1194 X:00000A org x: 1195 DOSC_BUFF_BASE 1196 00000A EQU * 1197 X:00000A coeff ds 1 ; data location for osc. a's coeff. 1198 X:00000B s1 ds 1 ; data location for osc. a's sr1. 1199 X:00000C s2 ds 1 ; data location for osc. a's sr2. 1200 X:00000D LEFT_HUM ds 1 ;storage for Left Signal + Hum 1201 X:00000E RIGHT_HUM ds 1 ;storage for Left Signal + Hum 1202 X:000010 org x:$10 1203 X:000010 state1 dsm nsec 1204 X:00001C org x:$1c 1205 X:00001C state1_r dsm nsec 1206 X:000020 org x:$20 1207 X:000020 state2 dsm nsec 1208 X:00002C org x:$2c 1209 X:00002C state2_r dsm nsec 1210 1211 ;****************************************************************************** 1212 Y:000000 org y: 1213 coef_24 1214 Y:000000 dc $3FFD61 ;b(*,0)/2 =0.49992001 section number 1 1215 Y:000001 dc $800641 ;b(*,1)/2 =-.99980915 section number 1 1216 Y:000002 dc $7FF9C0 ;a(*,1)/2 =0.99980927 section number 1 1217 Y:000003 dc $3FFD61 ;b(*,2)/2 =0.49992001 section number 1 1218 Y:000004 dc $C0053E ;a(*,2)/2 =-.49984002 section number 1 1219 Y:000005 dc $3E3C48 ;b(*,0)/2 =0.48621464 section number 2 1220 Y:000006 dc $83886C ;b(*,1)/2 =-.97239923 section number 2 1221 Y:000007 dc $7FFDB8 ;a(*,1)/2 =0.99993038 section number 2 1222 Y:000008 dc $3E3C48 ;b(*,2)/2 =0.48621464 section number 2 1223 Y:000009 dc $C0013F ;a(*,2)/2 =-.49996197 section number 2 1224 Y:00000A dc $20E7A1 ;b(*,0)/ 4 =0.25706875 section number 3 1225 Y:00000B dc $BE3142 ;b(*,1)/ 4 =-.51412177 section number 3 1226 Y:00000C dc $7FFDCE ;a(*,1)/ 2 =0.99993300 section number 3 1227 Y:00000D dc $20E7A1 ;b(*,2)/ 4 =0.25706875 section number 3 1228 Y:00000E dc $C00136 ;a(*,2)/ 2 =-.49996305 section number 3 1229 Y:00000F dc 0 1230 1231 coef_16 1232 Y:000010 dc $3FFD00 ;b(*,0)/2 =0.49991 section number 1 1233 Y:000011 dc $800600 ;b(*,1)/2 =-.99982 section number 1 Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 c:\windows\desktop\hi08\60hzhi08.asm Page 10 1234 Y:000012 dc $7FFA00 ;a(*,1)/2 =0.99982 section number 1 1235 Y:000013 dc $3FFD00 ;b(*,2)/2 =0.49991 section number 1 1236 Y:000014 dc $C00500 ;a(*,2)/2 =-.49985 section number 1 1237 Y:000015 dc $3E3C00 ;b(*,0)/2 =0.48621 section number 2 1238 Y:000016 dc $838800 ;b(*,1)/2 =-.97241 section number 2 1239 Y:000017 dc $7FFE00 ;a(*,1)/2 =0.99994 section number 2 1240 Y:000018 dc $3E3C00 ;b(*,2)/2 =0.48621 section number 2 1241 Y:000019 dc $C00100 ;a(*,2)/2 =-.49997 section number 2 1242 Y:00001A dc $20E800 ;b(*,0)/ 4 =0.25708 section number 3 1243 Y:00001B dc $BE3100 ;b(*,1)/ 4 =-.51413 section number 3 1244 Y:00001C dc $7FFE00 ;a(*,1)/ 2 =0.99994 section number 3 1245 Y:00001D dc $20E800 ;b(*,2)/ 4 =0.25708 section number 3 1246 Y:00001E dc $C00100 ;a(*,2)/ 2 =-.49997 section number 3 1247 Y:00001F dc 0 1248 1249 no_filter 1250 Y:000020 dc $400000 ;b(*,0)/2 =0.50000000 section number 1 1251 Y:000021 dc $000000 ;b(*,1)/2 =0.00000000 section number 1 1252 Y:000022 dc $000000 ;a(*,1)/2 =0.00000000 section number 1 1253 Y:000023 dc $000000 ;b(*,2)/2 =0.00000000 section number 1 1254 Y:000024 dc $000000 ;a(*,2)/2 =0.00000000 section number 1 1255 Y:000025 dc $400000 ;b(*,0)/2 =0.50000000 section number 2 1256 Y:000026 dc $000000 ;b(*,1)/2 =0.00000000 section number 2 1257 Y:000027 dc $000000 ;a(*,1)/2 =0.00000000 section number 2 1258 Y:000028 dc $000000 ;b(*,2)/2 =0.00000000 section number 2 1259 Y:000029 dc $000000 ;a(*,2)/2 =0.00000000 section number 2 1260 Y:00002A dc $200000 ;b(*,0)/ 4 =0.25000000 section number 3 1261 Y:00002B dc $000000 ;b(*,1)/ 4 =0.00000000 section number 3 1262 Y:00002C dc $000000 ;a(*,1)/ 2 =0.00000000 section number 3 1263 Y:00002D dc $000000 ;b(*,2)/ 4 =0.00000000 section number 3 1264 Y:00002E dc $000000 ;a(*,2)/ 2 =0.00000000 section number 3 1265 1266 1267 Y:00002F left_a ds 1 1268 Y:000030 left_y0 ds 1 1269 Y:000031 right_a ds 1 1270 Y:000032 right_y0 ds 1 1271 1272 1273 ;****************************************************************************** 1274 ;TONE_OUTPUT EQU HEADPHONE_EN+LINEOUT_EN+(4*LEFT_ATTN)+(4*RIGHT_ATTN) 1275 ;TONE_INPUT EQU MIC_IN_SELECT+(15*MONITOR_ATTN) 1276 ;CTRL_WD_12 equ NO_PREAMP+HI_PASS_FILT+SAMP_RATE_48+STEREO+DATA_16 ;CLB=0 1277 ;CTRL_WD_34 equ IMMED_3STATE+XTAL1_SELECT+BITS_64+CODEC_MASTER 1278 ;CTRL_WD_56 equ $000000 1279 ;CTRL_WD_78 equ $000000 1280 1281 000300 CTRL_WD_12 equ MIN_LEFT_ATTN+MIN_RIGHT_ATTN+LIN2+RIN2 1282 000000 CTRL_WD_34 equ MIN_LEFT_GAIN+MIN_RIGHT_GAIN 1283 1284 1285 P:000100 org p:$100 1286 1287 1288 START 1289 main Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 c:\windows\desktop\hi08\60hzhi08.asm Page 11 1290 1291 ; Initialize SC0, SC1 as GPIO inputs 1292 P:000100 08F4BD movep #$040003,x:M_PCTL ; PLL = 4 x 16.9344Mhz = 67.7Mhz 040003 1293 P:000102 08F4BB movep #$012421,x:M_BCR ; one wait state for external spaces 012421 1294 P:000104 08F4BF movep #$000E07,X:M_IPRC ; IRQA/IRQD/SSI level 3 interrupts. edge sensitive 000E07 1295 1296 P:000106 0500BA move #0,omr 1297 P:000107 0500BB movec #0,sp 1298 1299 1300 P:000108 364000 move #$40,r6 ; initialize stack pointer 1301 P:000109 05F426 move #-1,m6 ; linear addressing FFFFFF 1302 P:00010B 240000 move #RX_BUFF_BASE,x0 1303 P:00010C 440800 move x0,x:RX_PTR ; Initialize the rx pointer 1304 P:00010D 240400 move #TX_BUFF_BASE,x0 1305 P:00010E 440900 move x0,x:TX_PTR ; Initialize the tx pointer 1306 1307 1308 ; --- INIT THE CODEC --- 1309 1310 P:00010F 0BF080 jsr ada_init ; Jump to initialize the codec 00018B 1311 1312 ; --- Init the HI08 --- 1313 P:000111 08F484 movep #$002e0e,x:M_HPCR ; Set Port Control signals 002E0E 1314 P:000113 08F485 movep #$000060,x:M_HBAR ; Set Base Address for HC11 to $6000 000060 1315 P:000115 08F482 movep #$000004,x:M_HCR ; Set Host Command Interrupt Enable bit 000004 1316 P:000117 08F484 movep #$002e4e,x:M_HPCR ; Enable HI08 002E4E 1317 P:000119 0ABE21 bset #$01,x:$fffffe ; $fffffe = IPR-P (Interrupt Priority Register P) 1318 P:00011A 0ABE22 bset #$02,x:$fffffe ; Set HI08 interrupt priority to 3 (non-maskable) 1319 1320 1321 ; Initialize Filter Parameters 1322 P:00011B 331000 move #state1,r3 ;point to filter state1 1323 P:00011C 312000 move #state2,r1 ;point to filter state2 1324 P:00011D 342000 move #no_filter,r4 ;Initialize for unity filter. 1325 P:00011E 050EA4 move #5*nsec-1,m4 ;addressing modulo 5*nsec 1326 P:00011F 200013 clr a ;initialize internal state storage 1327 P:000120 000000 nop ; avoid pipeline stall 1328 P:000121 5E2F00 move a,y:left_a 1329 P:000122 5E3100 move a,y:right_a 1330 P:000123 0604A0 rep #4 ;* zero state1 (BAK) 1331 P:000124 565B00 move a,x:(r3)+ ;* 1332 P:000125 0604A0 rep #4 ;* zero state2 (BAK) 1333 P:000126 565900 move a,x:(r1)+ ;* 1334 P:000127 331C00 move #state1_r,r3 ;point to filter state1 (BAK) 1335 P:000128 312C00 move #state2_r,r1 ;point to filter state2 (BAK) 1336 P:000129 0604A0 rep #4 ;* zero state1_r (BAK) Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 c:\windows\desktop\hi08\60hzhi08.asm Page 12 1337 P:00012A 565B00 move a,x:(r3)+ ;* (BAK) 1338 P:00012B 0604A0 rep #4 ;* zero state2_r (BAK) 1339 P:00012C 565900 move a,x:(r1)+ ;* (BAK) 1340 P:00012D 4EDC00 move y:(r4)+,y0 ;a must be initially zero ,y0=b10/2 1341 P:00012E 4E3000 move y0,y:left_y0 1342 P:00012F 4E3200 move y0,y:right_y0 1343 P:000130 67F400 move #filter,r7 ; Load filter location. 00017E 1344 1345 ; Initialize Digital Oscillator Parameters 1346 P:000132 07F436 movep #$FF310C,x:M_CRB0 ; Enable the SSI interrupts. FF310C 1347 P:000134 44F400 move #coeff_a,x0 7FFEFD 1348 P:000136 440A00 move x0,x:DOSC_BUFF_BASE ; Load coeff. for osc. a. 1349 P:000137 44F400 move #s1_a,x0 FFB2CB 1350 P:000139 440B00 move x0,x:DOSC_BUFF_BASE+1 ; Load s1 for osc. a. 1351 P:00013A 44F400 move #s2_a,x0 FF6597 1352 P:00013C 440C00 move x0,x:DOSC_BUFF_BASE+2 ; Load s2 for osc. a. 1353 1354 1355 1356 1357 ; Main Loop 1358 loop_1 1359 P:00013D 01B7A2 jset #2,x:M_SSISR0,* ; Wait for frame sync to pass. 00013D 1360 P:00013F 01B782 jclr #2,x:M_SSISR0,* ; Wait for frame sync. 00013F 1361 1362 1363 P:000141 46F400 move #CTRL_WD_12,y0 ; headphones, line out, mute spkr, no attn. 000300 1364 P:000143 460600 move y0,x:TX_BUFF_BASE+2 1365 P:000144 260000 move #CTRL_WD_34,y0 ; no input gain, monitor mute 1366 P:000145 460700 move y0,x:TX_BUFF_BASE+3 1367 P:000146 350A00 move #DOSC_BUFF_BASE,r5 ; Load pointer to osc's coeff, sr1 and sr2 1368 P:000147 0BF080 jsr dosc_sin ; Call oscillator routine. 00015D 1369 P:000149 21C400 move a,x0 ; Copy new tone into x0. 1370 P:00014A 568000 move x:RX_BUFF_BASE,a ; Load the left channel input. 1371 P:00014B 200040 add x0,a ; Add the tone. 1372 P:00014C 000000 nop ; avoid pipeline stall 1373 P:00014D 560D00 move a,x:LEFT_HUM 1374 P:00014E 578100 move x:RX_BUFF_BASE+1,b ; Load the right channel input. 1375 P:00014F 200048 add x0,b ; Add the tone. 1376 P:000150 000000 nop ; avoid pipeline stall 1377 P:000151 570E00 move b,x:RIGHT_HUM 1378 1379 P:000152 331000 move #state1,r3 1380 P:000153 312000 move #state2,r1 1381 P:000154 0BF080 jsr bst60ev6_l ;bandstop filter at 60 Hz (Elliptical) 000166 1382 P:000156 560400 move a,x:TX_BUFF_BASE ; Put value in left channel tx. Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 c:\windows\desktop\hi08\60hzhi08.asm Page 13 1383 P:000157 331C00 move #state1_r,r3 1384 P:000158 312C00 move #state2_r,r1 1385 P:000159 0BF080 jsr bst60ev6_r ;bandstop filter at 60 Hz (Elliptical) 000172 1386 P:00015B 570500 move b,x:TX_BUFF_BASE+1 ; Put value in right channel tx. 1387 1388 P:00015C 0C013D jmp loop_1 ; Loop back. 1389 1390 1391 ;************************************************************************************* 1392 1393 ;--------------------------------------------------------------------------- 1394 1395 ;--------------------------------------------------------------------------- 1396 ; The following subroutine calculates the next sinusoidal output value as a 1397 ; function by the digital oscillator given that r5 points to the memory 1398 ; location that contains the "coeff" value followed by the memory location 1399 ; that contains the "s1" value, followed by the memory location that contains 1400 ; the "s2" value. The formula and block diagram of the oscillator are: 1401 ; 1402 ; s1[n] = coeff*s1[n-1] - s2[n-1] = coeff*s1[n-1] - s1[n-2] 1403 ; 1404 ; _______ _______ 1405 ; | | s1 | | s2 1406 ; +--->| z^-1 |--+--->| z^-1 |----+ 1407 ; | |_______| | |_______| | 1408 ; | | | 1409 ; | ___V___ ___V___ 1410 ; | | | | | 1411 ; | | coeff | | -1 | 1412 ; | |_______| |_______| 1413 ; | | | 1414 ; | | | 1415 ; | | | 1416 ; | +----->( + )<-----+ 1417 ; | | 1418 ; | | 1419 ; +------------------------+---------> sine output 1420 dosc_sin 1421 1422 P:00015D 44DD00 move x:(r5)+,x0 ; Load coeff 1423 P:00015E 46DD00 move x:(r5)+,y0 ; Load s1 into a. 1424 P:00015F 57D500 move x:(r5)-,b ; Load s2 into b, r5 points to s1. 1425 P:000160 2000D0 mpy x0,y0,a ;Get coef*s1 in a in 2:14 format 1426 P:000161 200016 subl b,a ;y0,b ;Get (coef*s1 -s2)=sin_val in a 1427 ; in fractional format 1428 P:000162 000000 nop ; avoid pipeline stall 1429 P:000163 565D00 move a,x:(r5)+ ; Save new s1. 1430 P:000164 466500 move y0,x:(r5) ; Save new s2. 1431 P:000165 00000C rts 1432 1433 1434 ;BST60EL6 1435 1436 1437 ; Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 c:\windows\desktop\hi08\60hzhi08.asm Page 14 1438 ; This code segment implements cascaded biquad sections in transpose form 1439 ; The "bit_24" section of the code implements the filter with 24 bit data 1440 ; and 24 bit coefficients. The "bit_16" section of the code implements the 1441 ; filter with coefficients that are truncated to 16 bits. The "bit_16" code 1442 ; also truncates the data to 16 bits before writing any accumulator value 1443 ; to memory. This "bit_16" code is to simulate the performance of a 16 bit 1444 ; processor implementing the same filter. In actuality, the filtering 1445 ; performed by "bit_16" will yield a better performance than that which 1446 ; a 16 bit processor would yield. 1447 ; 1448 ; 1449 1450 ; 1451 ; multiple shift left macro 1452 ; 1453 mshl macro scount,acc 1454 m if scount 1455 m rep #scount 1456 m asl acc 1457 m endif 1458 m endm 1459 1460 1461 1462 1463 bst60ev6_l ;Bandstop filter at 60Hz (Elliptical 1464 P:000166 0008F8 ori #$08,mr ;set scaling mode 1465 P:000167 478D00 move x:LEFT_HUM,y1 ;load left signal + Hum 1466 1467 P:000168 5EAF00 move y:left_a,a 1468 P:000169 4EB000 move y:left_y0,y0 1469 P:00016A 0BE780 jsr (r7) ; Call cascade biquad routine. 1470 P:00016B 4E3000 move y0,y:left_y0 1471 P:00016C 5E2F00 move a,y:left_a 1472 P:00016D 20EE00 move y1,a 1473 mshl scount,a ;bring gain back to 0 dB 1474 + if scount 1475 + P:00016E 0601A0 rep #scount 1476 + P:00016F 200032 asl a 1477 + endif 1478 P:000170 00F7B8 andi #$f7,mr ;disable scaling mode? 1479 P:000171 00000C rts 1480 1481 bst60ev6_r ;Bandstop filter at 60Hz (Elliptical 1482 P:000172 0008F8 ori #$08,mr ;set scaling mode 1483 P:000173 478E00 move x:RIGHT_HUM,y1 ;load right signal + Hum 1484 1485 P:000174 5EB100 move y:right_a,a 1486 P:000175 4EB200 move y:right_y0,y0 1487 P:000176 0BE780 jsr (r7) ; Call cascade biquad routine. 1488 P:000177 4E3200 move y0,y:right_y0 1489 P:000178 5E3100 move a,y:right_a 1490 P:000179 20EF00 move y1,b 1491 mshl scount,b ;bring gain back to 0 dB 1492 + if scount 1493 + P:00017A 0601A0 rep #scount Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 c:\windows\desktop\hi08\60hzhi08.asm Page 15 1494 + P:00017B 20003A asl b 1495 + endif 1496 P:00017C 00F7B8 andi #$f7,mr ;disable scaling mode? 1497 P:00017D 00000C rts 1498 1499 1500 1501 ; assumes each section's coefficients are divided by 2 1502 ; 1503 00017E filter EQU * 1504 P:00017E 060380 do #nsec,_end_filter ;do each section 000189 1505 P:000180 FC81B3 macr y0,y1,a x:(r1),b y:(r4)+,y0 ;a=x(n)*bi0/2+wi1/2,b=wi2,y0=bi1/2 1506 P:000181 000000 nop ; avoid pipeline stall 1507 P:000182 21C42A asr b a,x0 ;b=wi2/2,x0=y(n) 1508 P:000183 4EDCBA mac y0,y1,b y:(r4)+,y0 ;b=x(n)*bi1/2+wi2/2,y0=ai1/2 1509 P:000184 4EDCDB macr x0,y0,b y:(r4)+,y0 ;b=b+y(n)*ai1/2,y0=bi2/2 1510 P:000185 000000 nop ; avoid pipeline stall 1511 P:000186 FC1BB8 mpy y0,y1,b b,x:(r3)+ y:(r4)+,y0 ;b=x(n)*bi2/2,save wi1,y0=ai2 1512 P:000187 19A3DB macr x0,y0,b x:(r3),a a,y1 ;b=b+y(n)*ai2/2,a=next iter wi1, 1513 ;y1=output of section i 1514 P:000188 000000 nop ; avoid pipeline stall 1515 P:000189 FC1922 asr a b,x:(r1)+ y:(r4)+,y0 ;a=next iter wi1/2,save wi2, 1516 ;y0=next iter bi0 1517 _end_filter 1518 P:00018A 00000C rts ; Return from filter routine. 1519 1520 1521 ;****************************************************************************** 1522 1523 include 'ada_init.asm' 1524 page 132,60 1525 ;************************************************************************** 1526 ; ADA_INIT.ASM Ver 1.2 1527 ; Example program to initialize the CS4218 1528 ; 1529 ; Copyright (c) MOTOROLA 1995, 1996, 1997, 1998 1530 ; Semiconductor Products Sector 1531 ; Wireless Signal Processing Division 1532 ; 1533 ; History: 1534 ; 14 June 1996: RLR/LJD - ver 1.0 1535 ; 21 July 1997: BEA - ver 1.1 1536 ; 23 Sept 1998: TTL - ver 1.2 1537 ;************************************************************************** 1538 X:00002F org x: 1539 1540 ; Codec control constants 1541 X:00002F CTRL_WD_HI ds 1 1542 X:000030 CTRL_WD_LO ds 1 1543 1544 1545 ; GPIO pin constants 1546 1547 ; ESSI0 - audio data GPIO mode 1548 ; DSP CODEC Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 ada_init.asm Page 16 1549 ; --------------------------- 1550 CODEC_RESET 1551 000000 equ 0 ; bit0 SC00 ---> CODEC_RESET~ 1552 1553 ; ESSI1 - control data GPIO Mode 1554 ; DSP CODEC 1555 ;---------------------------- 1556 000000 CCS equ 0 ; bit0 SC10 ---> CCS~ 1557 000001 CCLK equ 1 ; bit1 SC11 ---> CCLK 1558 000002 CDIN equ 2 ; bit2 SC12 ---> CDIN 1559 1560 ;************************************************************************** 1561 ; Initialize the CS4218 codec 1562 ; --------------------------- 1563 ; Serial Mode 4 (SM4), DSP Slave/Codec Master, 32-bits per frame 1564 ; 1565 ; After a reset, the control port must be written once to initialize it 1566 ; if the port will be accessed to read or write control bits. The initial 1567 ; write is a "dummy" write since the data is ignored by the codec. A second 1568 ; write is needed to configure the codec as desired. Then, the control port 1569 ; only needs to be written to when a change is desired, or to obtain status 1570 ; information. 1571 ; 1572 ; Although only 23 bits contain useful data in CDIN, a minimum of 31 bits 1573 ; must be written. 1574 ; 1575 ; CDIN 1576 ;------------------------------------------------ 1577 ; bit 31 0 1578 ;------------------------------------------------ 1579 ; bit 30 mask interrupt 1580 ; 0=no mask on MF5:\INT pin 1581 ; 1=mask on MF5:\INT pin 1582 ;------------------------------------------------ 1583 ; bit 29 DO1 1584 ;------------------------------------------------ 1585 ; bits 28-24 left output D/A sttenuation (1.5dB steps) 1586 ; 00000=No attenuation 0dB 1587 ; 11111=Max attenuation -46.5dB 1588 ;------------------------------------------------ 1589 ; bits 23-19 right output D/A attenuation (1.5dB steps) 1590 ; 00000=No attenuation 0dB 1591 ; 11111=Max attenuation -46.5dB 1592 ;------------------------------------------------ 1593 ; bit 18 mute D/A outputs 1594 ; 0=outputs ON 1595 ; 1=outputs MUTED 1596 ;------------------------------------------------ 1597 ; bit 17 input mux, left select 1598 ; 0=RIN1 1599 ; 1=RIN2 (used on EVM) 1600 ;------------------------------------------------ 1601 ; bit 16 input mux, right select 1602 ; 0=LIN1 1603 ; 1=LIN2 (used on EVM) 1604 ;------------------------------------------------ Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 ada_init.asm Page 17 1605 ; bits 15-12 left input A/D gain (1.5dB steps) 1606 ; 0000=No gain 0dB 1607 ; 1111=Max gain +22.5dB 1608 ;------------------------------------------------ 1609 ; bits 11-8 right input A/D gain (1.5dB steps) 1610 ; 0000=No gain 0dB 1611 ; 1111=Max gain +22.5dB 1612 ;------------------------------------------------ 1613 ; bits 7-0 00000000 1614 ;------------------------------------------------ 1615 ;************************************************************************** 1616 1617 1618 P:00018B org p: 1619 ada_init 1620 1621 ; reset ESSI ports 1622 P:00018B 07F43F movep #$0000,x:M_PCRC ; reset ESSI0 port 000000 1623 P:00018D 07F42F movep #$0000,x:M_PCRD ; reset ESSI1 port 000000 1624 1625 ; Set Control Register A and B 1626 P:00018F 07F435 movep #$101807,x:M_CRA0 ; 12.288MHz/16 = 768KHz SCLK 101807 1627 ; prescale modulus = 8 1628 ; frame rate divider = 2 1629 ; 16-bits per word 1630 ; 32-bits per frame 1631 ; 16-bit data aligned to bit 23 1632 1633 P:000191 07F436 movep #$ff330c,x:M_CRB0 ; Enable REIE,TEIE,RLIE,TLIE, FF330C 1634 ; RIE,TIE,RE,TE0 1635 ; network mode, synchronous, 1636 ; out on rising/in on falling 1637 ; shift MSB first 1638 ; external clock source drives SCK 1639 ; (codec is master) 1640 ; RX frame sync pulses active for 1641 ; 1 bit clock immediately before 1642 ; transfer period 1643 ; positive frame sync polarity 1644 ; frame sync length is 1-bit 1645 1646 ; Configure GPIO pins -- (functionality and direction ) 1647 P:000193 07F43F movep #$0000,x:M_PCRC ; Enable GPIO pin 0 SC00=CODEC_RESET 000000 1648 P:000195 07F42F movep #$0000,x:M_PCRD ; Enable GPIO CSS (pin 0),CCLK (pin 1), CDIN (pin 2) 000000 1649 1650 P:000197 07F43E movep #$0001,x:M_PRRC ; set PC0=CODEC_RESET~ as output 000001 1651 P:000199 07F42E movep #$0007,x:M_PRRD ; set PD0=CCS~ as output 000007 Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 ada_init.asm Page 18 1652 ; set PD1=CCLK as output 1653 ; set PD2=CDIN as output 1654 1655 ; Codec Reset 1656 P:00019B 013D00 bclr #CODEC_RESET,x:M_PDRC ; assert CODEC_RESET~ 1657 P:00019C 012D00 bclr #CCS,x:M_PDRD ; assert CCS~ -- allows control register to be writte n to 1658 1659 ; Delay to allow Codec to reset 1660 P:00019D 06E883 do #1000,_delay_loop 0001A0 1661 P:00019F 06E8A3 rep #1000 ; minimum 50 ms delay 1662 P:0001A0 000000 nop 1663 _delay_loop 1664 1665 1666 ; Setting up to send Codec control information 1667 P:0001A1 013D20 bset #CODEC_RESET,x:M_PDRC ; deassert CODEC_RESET~ 1668 1669 1670 ; Sending control words 1671 set_control 1672 P:0001A2 44F400 move #CTRL_WD_12,x0 ; transfer control value to control variable 000300 1673 P:0001A4 442F00 move x0,x:CTRL_WD_HI 1674 P:0001A5 240000 move #CTRL_WD_34,x0 1675 P:0001A6 443000 move x0,x:CTRL_WD_LO 1676 P:0001A7 0BF080 jsr codec_control ; send in dummy control information 0001B1 1677 P:0001A9 0BF080 jsr codec_control ; send in correct control information 0001B1 1678 1679 1680 ; Set and enable interrupts 1681 P:0001AB 08F4BE movep #$000c,x:M_IPRP ; set interrupt priority level for ESSI0 to 3 00000C 1682 P:0001AD 00FCB8 andi #$fc,mr ; enable interrupts 1683 1684 ; Set ESSI functionality 1685 P:0001AE 07F43F movep #$003e,x:M_PCRC ; enable ESSI0 except SC00=CODEC_RESET 00003E 1686 1687 P:0001B0 00000C rts 1688 1689 1690 ;------------------------------------------------------------- 1691 ; codec_control routine 1692 ; Input: CTRL_WD_LO and CTRL_WD_HI 1693 ; Output: CDIN 1694 ; Description: Used to send control information to CODEC 1695 ; NOTE: does not preserve the 'a' register. 1696 ;------------------------------------------------------------- 1697 codec_control 1698 P:0001B1 200013 clr a 1699 P:0001B2 012D00 bclr #CCS,x:M_PDRD ; assert CCS 1700 P:0001B3 54AF00 move x:CTRL_WD_HI,a1 ; upper 16 bits of control data Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 ada_init.asm Page 19 1701 P:0001B4 0BF080 jsr send_codec ; shift out upper control word 0001BB 1702 P:0001B6 54B000 move x:CTRL_WD_LO,a1 ; lower 16 bits of control data 1703 P:0001B7 0BF080 jsr send_codec ; shift out lower control word 0001BB 1704 P:0001B9 012D20 bset #CCS,x:M_PDRD ; deassert CCS 1705 P:0001BA 00000C rts 1706 1707 1708 ;--------------------------------------------------------------- 1709 ; send_codec routine 1710 ; Input: a1 containing control information 1711 ; Output: sends bits to CDIN 1712 ; Description: Determines bits to send to CDIN 1713 ;--------------------------------------------------------------- 1714 1715 send_codec 1716 P:0001BB 061080 do #16,end_send_codec ; 16 bits per word 0001C7 1717 P:0001BD 012D21 bset #CCLK,x:M_PDRD ; toggle CCLK clock high 1718 P:0001BE 0ACC17 jclr #23,a1,bit_low ; test msb 0001C3 1719 P:0001C0 012D22 bset #CDIN,x:M_PDRD ; send high into CDIN 1720 P:0001C1 0AF080 jmp continue 0001C4 1721 bit_low 1722 P:0001C3 012D02 bclr #CDIN,x:M_PDRD ; send low into CDIN 1723 continue 1724 P:0001C4 0602A0 rep #2 ; delay 1725 P:0001C5 000000 nop 1726 P:0001C6 012D01 bclr #CCLK,x:M_PDRD ; restart cycle 1727 P:0001C7 200033 lsl a ; shift control word to 1 bit 1728 ; to left 1729 end_send_codec 1730 P:0001C8 00000C rts 1731 1732 1733 1734 1735 ;**************************************************************************** 1736 ; SSI0_ISR.ASM Ver.2.0 1737 ; Example program to handle interrupts through 1738 ; the 56307 SSI0 to move audio through the CS4218 1739 ; 1740 ; Copyright (c) MOTOROLA 1995, 1996, 1997, 1998 1741 ; Semiconductor Products Sector 1742 ; Digital Signal Processing Division 1743 ; 1744 ; 1745 ; History: 1746 ; 14 June 1996: RLR/LJD - ver 1.0 1747 ; 23 July 1997: BEA - ver 1.1 1748 ;****************************************************************************** 1749 1750 1751 ;----the actual interrupt service routines (ISRs) follow: Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 ada_init.asm Page 20 1752 1753 ;************************ SSI TRANSMIT ISR ********************************* 1754 ssi_txe_isr 1755 P:0001C9 013704 bclr #4,x:M_SSISR0 ; Read SSISR to clear exception flag 1756 ; explicitly clears underrun flag 1757 ssi_tx_isr 1758 P:0001CA 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1759 P:0001CB 055F20 move m0,x:(r7)+ ; Save m0 to the stack. 1760 P:0001CC 0501A0 move #1,m0 ; Modulus 2 buffer. 1761 P:0001CD 608900 move x:TX_PTR,r0 ; Load the pointer to the tx buffer. 1762 P:0001CE 000000 nop 1763 P:0001CF 000000 nop 1764 P:0001D0 000000 nop 1765 P:0001D1 07D83C movep x:(r0)+,x:M_TX00 ; SSI transfer data register. 1766 P:0001D2 600900 move r0,x:TX_PTR ; Update tx buffer pointer. 1767 P:0001D3 05FF20 move x:-(r7),m0 ; Restore m0. 1768 P:0001D4 60FF00 move x:-(r7),r0 ; Restore r0. 1769 P:0001D5 000004 rti 1770 1771 ;********************* SSI TRANSMIT LAST SLOT ISR ************************** 1772 ssi_txls_isr 1773 P:0001D6 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1774 P:0001D7 300400 move #TX_BUFF_BASE,r0 ; Reset pointer. 1775 P:0001D8 000000 nop 1776 P:0001D9 600900 move r0,x:TX_PTR ; Reset tx buffer pointer just in 1777 P:0001DA 000000 nop ; case it was corrupted. 1778 P:0001DB 60FF00 move x:-(r7),r0 ; Restore r0. 1779 P:0001DC 000004 rti 1780 1781 ;************************** SSI receive ISR ******************************** 1782 ssi_rxe_isr 1783 P:0001DD 013705 bclr #5,x:M_SSISR0 ; Read SSISR to clear exception flag 1784 ; explicitly clears overrun flag 1785 ssi_rx_isr 1786 P:0001DE 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1787 P:0001DF 055F20 move m0,x:(r7)+ ; Save m0 to the stack. 1788 P:0001E0 0501A0 move #1,m0 ; Modulus 2 buffer. 1789 P:0001E1 608800 move x:RX_PTR,r0 ; Load the pointer to the rx buffer. 1790 P:0001E2 000000 nop 1791 P:0001E3 000000 nop 1792 P:0001E4 000000 nop 1793 P:0001E5 075838 movep x:M_RX0,x:(r0)+ ; Read out received data to buffer. 1794 P:0001E6 600800 move r0,x:RX_PTR ; Update rx buffer pointer. 1795 P:0001E7 05FF20 move x:-(r7),m0 ; Restore m0. 1796 P:0001E8 60FF00 move x:-(r7),r0 ; Restore r0. 1797 P:0001E9 000004 rti 1798 1799 ;********************** SSI receive last slot ISR ************************** 1800 ssi_rxls_isr 1801 P:0001EA 605F00 move r0,x:(r7)+ ; Save r0 to the stack. 1802 P:0001EB 300000 move #RX_BUFF_BASE,r0 ; Reset rx buffer pointer just in 1803 ; case it was corrupted. 1804 P:0001EC 600800 move r0,x:RX_PTR ; Update rx buffer pointer. 1805 P:0001ED 60FF00 move x:-(r7),r0 ; Restore r0. 1806 P:0001EE 000004 rti 1807 Motorola DSP56300 Assembler Version 6.2.0 99-09-27 10:54:00 c:\windows\desktop\hi08\60hzhi08.asm Page 21 1808 ;****************************************************************************** 1809 echo ;added to provide complince with the same vectors.asm that echo.asm and fltr_tst.asm use 1810 end 0 Errors 0 Warnings