initial commit

This commit is contained in:
josch 2014-06-26 09:38:06 +02:00
commit 36da235535
34 changed files with 10160 additions and 0 deletions

5
Makefile Normal file
View file

@ -0,0 +1,5 @@
CC=gcc
CFLAGS=-Wall
LDFLAGS=-lusb -lm
keenectl: keenectl.o

114
PRG/CAL.LST Normal file
View file

@ -0,0 +1,114 @@
文件CAL.ASM 盛群编译器版本 2.86 页次1
1 0000 ;8 bit unsigned mul
2 0000 unbin_mul_8 proc ;data0*data4---->to1to0
3 0000 init
Error(A0010) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 3 : 非预期的符号 'init'
4 0000 0F08 mov a, 08h
5 0001 0000 mov count0, a
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 5 : 语法错误
6 0002 rradd:
7 0002 0000 rrc to1
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 7 : 语法错误
8 0003 0000 rrc data4
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 8 : 语法错误
9 0004 380A snz [0ah].0
10 0005 2800 R jmp rr1 ;当前data4.0=0,移位<E7A7BB>
11 0006 0F00 mov a, data0 ;当前data4.0=1,移位相加
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 11 : 未定义的符号 'data0'
12 0007 0000 addm a, to1
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 12 : 语法错误
13 0008 rr1:
14 0008 0000 sdz count0
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 14 : 语法错误
15 0009 2800 R jmp rradd
16 000A 0000 rrc to1
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 16 : 语法错误
17 000B 0000 rrc data4
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 17 : 语法错误
18 000C 0F00 mov a, data4
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 18 : 未定义的符号 'data4'
19 000D 0000 mov to0, a
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 19 : 语法错误
20 000E 0003 ret
21 000F unbin_mul_8 endp
22 000F
23 000F
24 000F ;8 bit unsigned div
25 000F unbin_div_8 proc ;data0/data4---->data0(to0)---to1
26 000F init
Error(A0010) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 26 : 非预期的符号 'init'
27 000F 0F08 mov a, 08h ;循环次数8
28 0010 0000 mov count0, a
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 28 : 语法错误
29 0011
30 0011 0000 sz data4 ;除数为0则溢出
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 30 : 语法错误
31 0012 2800 R jmp start0
32 0013 2800 R jmp over8
33 0014 start0:
34 0014 0000 sz data0 ;被除数为0则结束
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 34 : 语法错误
35 0015 2800 R jmp div0
36 0016 2800 R jmp dispa
37 0017 div0:
38 0017 340A clr [0Ah].0 ;准备左移
39 0018 0000 rlc data0
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 39 : 语法错误
40 0019 0000 rlc to1 ;左移一位结束
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 40 : 语法错误
41 001A 0F00 mov a, to1 ;开始部分余数减除数
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 41 : 未定义的符号 'to1'
文件CAL.ASM 盛群编译器版本 2.86 页次2
42 001B 0A00 sub a, data4
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 42 : 未定义的符号 'data4'
43 001C 380A snz [0Ah].0
44 001D 2800 R jmp next0 ;不够减则转移
45 001E 0000 mov to1, a ;够减则商为1
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 45 : 语法错误
46 001F 0000 inc data0
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 46 : 语法错误
47 0020 next0:
48 0020 0000 sdz count0
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 48 : 语法错误
49 0021 2800 R jmp div0
50 0022 dispa:
51 0022 0F00 mov a, data0 ;显示商
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 51 : 未定义的符号 'data0'
52 0023 0000 mov to0, a
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 52 : 语法错误
53 0024 ;; mov a, data4
54 0024 ;; mov to1, a
55 0024 0003 ret
56 0025 over8:
57 0025 0003 ret
58 0026 unbin_div_8 endp
59 0026
60 0026
61 0026 ;16 bit unsigned div
62 0026 unbin_div_16 proc ;data0data1/data4data5---->data1data0(to1to0)---to2to3
63 0026 init
Error(A0010) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 63 : 非预期的符号 'init'
64 0026 0F10 mov a, 10h
65 0027 0000 mov count0, a
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 65 : 语法错误
66 0028 0000 sz data5
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 66 : 语法错误
67 0029 2800 R jmp start16
68 002A 0000 sz data4
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 68 : 语法错误
69 002B 2800 R jmp start16
70 002C 2800 R jmp over16
71 002D start16:
72 002D 0000 sz data1
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 72 : 语法错误
73 002E 2800 R jmp div16
74 002F 0000 sz data0
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM 74 : 语法错误
Error(A0052) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\CAL.ASM : 错误过多
31 Errors

236
PRG/DES.ASM Normal file
View file

@ -0,0 +1,236 @@
;====================================================================
; ROM Size , HT82A821R = 2K , last page = 0700H
; HT82A822R = 4K , last page = 0F00H
; If use HT82A821R
; #defined HT82A821R 1
; #defined HT82A822R 0
; If use HT82A822R
; #defined HT82A821R 0
; #defined HT82A822R 1
;====================================================================
; Use ReportID , Report ID 1 = Volume HID control
; Report ID 2 = Transform Other Data
;====================================================================
#include ht82a821r.inc
#include const.inc
#define HT82A821R 1
#define HT82A822R 0
IF HT82A821R
Descript .Section at 0700h 'code'
ENDIF
IF HT82A822R
Descript .Section at 0F00h 'code'
ENDIF
control_read_table:
device_desc_table:
DW 00112H ;descriptor type (device descriptor) , size of descriptor (18 bytes)
DW 00110H ;USB spec release (ver 1.1)
DW 00000H ;device sub-class , device class
DW 00800H ;maximum packet size , device sub-sub-class
DW 0046DH ;vender ID = 004D9H
DW 03F0EH
DW 03F0AH ;product ID (Sample Device) = 0x2821
DW 00100H ;product version ID
DW 00201H ;product string index (device show) , manufacturer string index
DW 00100H ;number of configurations
config_desc_table:
DW 00209H ;descriptor type (config descriptor) , size of descriptor
DW 00087H ;total length of descriptor (34 bytes)
DW 00103H ;1 configuration , 3 interface
DW 03F00H ;configuration string index
DW 03FA0H ;configuration attributes (bus supply), Remote Wakeup
DW 03FFAH ;maxpower (500ma)
Interface_Descriptor:
Interface0_descriptor:
standard_audio_control_interface_control:
DW 00409H ;descriptor type (interface descriptor) , size of descriptor (9 bytes)
DW 00000H ;interface alternate setting , interface number (0 base)
DW 00100H ;interface class(01H for audio class) , number of endpoint (1 end point)
DW 00001H ;interface protocol , interface sub-class (audio control)
DW 03F00H ;x , interface string index
class_specific_audio_control_interface_descriptor:
DW 02409H ;descriptor type (CS_INTERFACE) , size of descriptor (9 bytes)
DW 03F01H ;descriptor subtype (Header)
DW 00100H ;audio device class specification release number(1.00)
DW 00028H ;total number of bytes for the class-specific audiocontrol interface descriptor
DW 00101H ;streaming interface number belongs to audio control interface , the number of streaming interface
input_terminal:
DW 0240CH ;descriptor type(CS_INTERFACE) , size of descriptor
DW 00102H ;ID of this terminal(ID=1) , descriptor subtype(INPUT_TERMINAL)
DW 00101H ;terminal type(USB streaming type)
DW 00200H ;number of channel(two channel) , associate with output terminal
DW 00003H ;channel config(Left/Right Front)
DW 00000H ;channelname(unused) , terminal name(unused)
feature_unit:
DW 0240AH ;descriptor type(CS_INTERFACE) , size of descriptor(10 bytes)
DW 00D06H ;UnitID , descriptorSubtype(FEATURE_UNIT)
DW 00101H ;control size(1) , SourceID(input terminal 01)
DW 00003H ;D1(volume)control is enable foe channel 1 , D0(mute) D1(volume) is enable for channel 0
DW 00000H ;index of this descriptor , D1(volume)control is enable for channel 2
output_terminal:
DW 02409H ;descriptor type(CS_INTERFACE) , size of descriptor(9 bytes)
DW 00303H ;terminal ID(03) , descriptorsubtype(OUTPUT_TERMINAL)
DW 00301H ;terminal is speaker
DW 00D00H ;sourceID(feature unit ID=0D) , associate terminal
DW 03F00H ;index of this descriptor
Interface1_descriptor:
zero_bw:
DW 00409H ;descriptor type(INTERFACE) , sizoe of descriptor
DW 00001H ;index of ths setting(alternatesetting = 0) , index of this interface
DW 00100H ;interface-class(AUDIO) , number of endpoint(0)
DW 00002H ;interface protocol(unused) , InterfaceSubClass(AUDIO_STREAMING)
DW 03F00H ;index string of this descriptor
audio_streaming:
DW 00409H ;descriptor type(INTERFACE) , size of descriptor
DW 00101H ;index of the setting(alternatesetting = 1) ,index of this interface
DW 00101H ;interface-class(AUDIO) , number of endpoint(1)
DW 00002H ;interface protocol(unused) , InterfaceSubClass(AUDIO_STREAMING)
DW 03F00H ;index string of this descriptor
class_specific_as_interface_desc:
DW 02407H ;descriptor type(CS_INTERFACE) , size of descriptor
DW 00101H ;terminalLink(Input terminal) , descriptor subtype(AS_GENERAL)
DW 03F01H ;interface delay(1)
DW 00001H ;PCM format
format_type_descriptor:
DW 0240BH ;descriptor type(CS_INTERFACE) , size of descriptor
DW 00102H ;FormatType(FORMAT_TYPE_I) , descriptorSubType(FORMAT_TYPE)
DW 00202H ;SubFrameSize(2 byte per slot) , number of channel(2 channels)
DW 00110H ;SamFreqType(support 1 type) , BitSolution(16 bits)
DW 03F80H ;Sample Frequency(48000 Hz)
DW 000BBH ;
end_point_descriptor:
DW 00509H ;descriptor type(END_POINT) , size of descriptor
DW 00902H ;endpoint attributes(adaptive,isochronous) , endpoint2(out direction)
DW 000C0H ;maxPacketSize(192 bytes)
DW 00001H ;Refresh(0) , Interval(1ms)
DW 03F00H ;index string of this descriptor
class_specific_endpoint_descriptor:
DW 02507H ;descriptor type(CS_ENDPOINT) , size of descriptor
DW 00001H ;Attributes(no sampling frequency , no pitch , no maxpackets control) , descriptorType(EP_GENERAL)
DW 03F00H ;LockedDelayUnit(unused)
DW 00000H ;LockDelay(unused)
Interface2_descriptor:
HID_class:
DW 00409H ;INTERFACE descriptor , Size of this descriptor
DW 00002H ;Index of this string , index of this interface
DW 00301H ;HID , 1 endpoint
DW 00000H ;Unused , Non-Boot Device
DW 03F00H ;null string
HID_Desc:
DW 02109H ;HID , Size of this descriptor
DW 00110H ;HID spec rev #1.10
DW 00100H ;bNumDescriptor , bCountryCode
DW 03F22H ;Report Descriptor
;====================================================================
; Use ReportID , Report ID 1 = Volume HID control
; Report ID 2 = Transform Other Data
;====================================================================
IF UseReportID
DW 00016H ;67 bytes
ELSE
DW 00016H
ENDIF
HID_end_point_descriptor:
DW 00507H ;Endpoint descriptor , Length of this descriptor
DW 00381H ;Interrupt , Endpoint 1 In direction
DW 00008H ;wMaxPacketSize = 1 Bytes
DW 03F30H ;48ms Interval
end_config_desc_table:
hid_report_desc_table:
;====================================================================
; Use ReportID , Report ID 1 = Volume HID control
; Report ID 2 = Transform Other Data
;====================================================================
;;vender defined
DW 03F06H ;//Usage Page(Global)
DW 03F00H
DW 03FFFH ;//Usage Page
DW 00109H ;//Usage(Local 1 bytes)
DW 001A1H ;//collection(Main)
;input report
;; DW 03F19H
;; DW 03FA6H
;; DW 03F29H ;//Usage(Local)
;; DW 03FACH
;; DW 03F15H ;//Global Logical Minimum
;; DW 03F80H
;; DW 03F25H ;//Global Logical Maximum
;; DW 03F7FH
;; DW 00875H ;//Global Report Size 8 bits
;; DW 00795H ;//Global Report Count 7 (field)
;; DW 00281H ;//Main Input (Data,Variable,Absolute)
;output
DW 00015H ;//LOGICAL MINIMUM (0)
DW 03F25H
DW 03FffH ;//LOGICAL MAXIMUM (FF)
DW 00019H ;//Usage Min (#)
DW 00129H ;//Usage Max (#)
DW 00895H ;//Report Count(8)
DW 00875H ;//Report Size(8)
DW 00291H ;//OUTPUT: (Data, Array)
DW 03FC0H ;End Collection
end_hid_report_desc_table:
string_descriptor:
USBStringLanguageDescription:
DW 00304h ; Length , Type (3=string)
DW 00409h ; Language: English , Sub-language: US
imanufacturer_string: ;Vendor Name
USBStringDescription1:
DW 00310h, 00048h, 0004fh, 0004ch, 00054h, 00045h, 0004bh, 00020h ;HOLTEK
iproduct_string: ;Product Name
USBStringDescription2:
;DW 00326h, 00042h, 0002Dh, 0004ch, 00049h, 0004Eh, 0004bh, 00020h ;B-LINK
DW 00055h, 00053h, 00042h, 00020h ;USB
DW 00041h, 00075h, 00064h, 00069h, 0006fh, 00020h, 00020h ;Audio
isnumber_string: ;Serial Number
USBStringDescription3:
DW 0030Ah, 00038h, 00032h, 00031h, 00052h ;821R
config_desc_length:
DW 00087H
report_desc_length:
IF UseReportID
DW 00016H
ELSE
DW 00016H
ENDIF
hid_desc_length:
DW 00009H
Public control_read_table
Public device_desc_table
Public config_desc_table
Public end_config_desc_table
Public USBStringLanguageDescription
Public USBStringDescription1
Public USBStringDescription2
Public USBStringDescription3
Public HID_Desc
Public hid_report_desc_table
Public end_hid_report_desc_table
Public config_desc_length
Public hid_desc_length
Public report_desc_length

258
PRG/DES.LST Normal file
View file

@ -0,0 +1,258 @@
文件DES.ASM 盛群编译器版本 2.86 页次1
1 0000 ;====================================================================
2 0000 ; ROM Size , HT82A821R = 2K , last page = 0700H
3 0000 ; HT82A822R = 4K , last page = 0F00H
4 0000 ; If use HT82A821R
5 0000 ; #defined HT82A821R 1
6 0000 ; #defined HT82A822R 0
7 0000 ; If use HT82A822R
8 0000 ; #defined HT82A821R 0
9 0000 ; #defined HT82A822R 1
10 0000 ;====================================================================
11 0000 ; Use ReportID , Report ID 1 = Volume HID control
12 0000 ; Report ID 2 = Transform Other Data
13 0000 ;====================================================================
14 0000
15 0000 #include ht82a821r.inc
16 0000 #include const.inc
17 0000 #define HT82A821R 1
18 0000 #define HT82A822R 0
19 0000
20 0000 IF HT82A821R
21 0000 Descript .Section at 0700h 'code'
22 0000 ENDIF
23 0000
24 0000
25 0000 IF HT82A822R
26 0000 Descript .Section at 0F00h 'code'
27 0000 ENDIF
28 0000
29 0000
30 0000
31 0000 control_read_table:
32 0000 device_desc_table:
33 0000 0112 DW 00112H ;descriptor type (device descriptor) , size of descriptor (18 bytes)
34 0001 0110 DW 00110H ;USB spec release (ver 1.1)
35 0002 0000 DW 00000H ;device sub-class , device class
36 0003 0800 DW 00800H ;maximum packet size , device sub-sub-class
37 0004 046D DW 0046DH ;vender ID = 004D9H
38 0005 3F0E DW 03F0EH
39 0006 3F0A DW 03F0AH ;product ID (Sample Device) = 0x2821
40 0007 0100 DW 00100H ;product version ID
41 0008 0201 DW 00201H ;product string index (device show) , manufacturer string index
42 0009 0100 DW 00100H ;number of configurations
43 000A config_desc_table:
44 000A 0209 DW 00209H ;descriptor type (config descriptor) , size of descriptor
45 000B 0087 DW 00087H ;total length of descriptor (34 bytes)
46 000C 0103 DW 00103H ;1 configuration , 3 interface
47 000D 3F00 DW 03F00H ;configuration string index
48 000E 3FA0 DW 03FA0H ;configuration attributes (bus supply), Remote Wakeup
49 000F 3FFA DW 03FFAH ;maxpower (500ma)
50 0010 Interface_Descriptor:
51 0010 Interface0_descriptor:
52 0010 standard_audio_control_interface_control:
53 0010 0409 DW 00409H ;descriptor type (interface descriptor) , size of descriptor (9 bytes)
54 0011 0000 DW 00000H ;interface alternate setting , interface number (0 base)
55 0012 0100 DW 00100H ;interface class(01H for audio class) , number of endpoint (1 end point)
文件DES.ASM 盛群编译器版本 2.86 页次2
56 0013 0001 DW 00001H ;interface protocol , interface sub-class (audio control)
57 0014 3F00 DW 03F00H ;x , interface string index
58 0015 class_specific_audio_control_interface_descriptor:
59 0015 2409 DW 02409H ;descriptor type (CS_INTERFACE) , size of descriptor (9 bytes)
60 0016 3F01 DW 03F01H ;descriptor subtype (Header)
61 0017 0100 DW 00100H ;audio device class specification release number(1.00)
62 0018 0028 DW 00028H ;total number of bytes for the class-specific audiocontrol interface descriptor
63 0019 0101 DW 00101H ;streaming interface number belongs to audio control interface , the number of streaming interface
64 001A input_terminal:
65 001A 240C DW 0240CH ;descriptor type(CS_INTERFACE) , size of descriptor
66 001B 0102 DW 00102H ;ID of this terminal(ID=1) , descriptor subtype(INPUT_TERMINAL)
67 001C 0101 DW 00101H ;terminal type(USB streaming type)
68 001D 0200 DW 00200H ;number of channel(two channel) , associate with output terminal
69 001E 0003 DW 00003H ;channel config(Left/Right Front)
70 001F 0000 DW 00000H ;channelname(unused) , terminal name(unused)
71 0020 feature_unit:
72 0020 240A DW 0240AH ;descriptor type(CS_INTERFACE) , size of descriptor(10 bytes)
73 0021 0D06 DW 00D06H ;UnitID , descriptorSubtype(FEATURE_UNIT)
74 0022 0101 DW 00101H ;control size(1) , SourceID(input terminal 01)
75 0023 0003 DW 00003H ;D1(volume)control is enable foe channel 1 , D0(mute) D1(volume) is enable for channel 0
76 0024 0000 DW 00000H ;index of this descriptor , D1(volume)control is enable for channel 2
77 0025 output_terminal:
78 0025 2409 DW 02409H ;descriptor type(CS_INTERFACE) , size of descriptor(9 bytes)
79 0026 0303 DW 00303H ;terminal ID(03) , descriptorsubtype(OUTPUT_TERMINAL)
80 0027 0301 DW 00301H ;terminal is speaker
81 0028 0D00 DW 00D00H ;sourceID(feature unit ID=0D) , associate terminal
82 0029 3F00 DW 03F00H ;index of this descriptor
83 002A Interface1_descriptor:
84 002A zero_bw:
85 002A 0409 DW 00409H ;descriptor type(INTERFACE) , sizoe of descriptor
86 002B 0001 DW 00001H ;index of ths setting(alternatesetting = 0) , index of this interface
87 002C 0100 DW 00100H ;interface-class(AUDIO) , number of endpoint(0)
88 002D 0002 DW 00002H ;interface protocol(unused) , InterfaceSubClass(AUDIO_STREAMING)
89 002E 3F00 DW 03F00H ;index string of this descriptor
90 002F audio_streaming:
91 002F 0409 DW 00409H ;descriptor type(INTERFACE) , size of descriptor
92 0030 0101 DW 00101H ;index of the setting(alternatesetting = 1) ,index of this interface
93 0031 0101 DW 00101H ;interface-class(AUDIO) , number of endpoint(1)
94 0032 0002 DW 00002H ;interface protocol(unused) , InterfaceSubClass(AUDIO_STREAMING)
95 0033 3F00 DW 03F00H ;index string of this descriptor
96 0034 class_specific_as_interface_desc:
97 0034 2407 DW 02407H ;descriptor type(CS_INTERFACE) , size of descriptor
98 0035 0101 DW 00101H ;terminalLink(Input terminal) , descriptor subtype(AS_GENERAL)
99 0036 3F01 DW 03F01H ;interface delay(1)
100 0037 0001 DW 00001H ;PCM format
101 0038 format_type_descriptor:
102 0038 240B DW 0240BH ;descriptor type(CS_INTERFACE) , size of descriptor
103 0039 0102 DW 00102H ;FormatType(FORMAT_TYPE_I) , descriptorSubType(FORMAT_TYPE)
104 003A 0202 DW 00202H ;SubFrameSize(2 byte per slot) , number of channel(2 channels)
105 003B 0110 DW 00110H ;SamFreqType(support 1 type) , BitSolution(16 bits)
106 003C 3F80 DW 03F80H ;Sample Frequency(48000 Hz)
107 003D 00BB DW 000BBH ;
108 003E end_point_descriptor:
109 003E 0509 DW 00509H ;descriptor type(END_POINT) , size of descriptor
110 003F 0902 DW 00902H ;endpoint attributes(adaptive,isochronous) , endpoint2(out direction)
111 0040 00C0 DW 000C0H ;maxPacketSize(192 bytes)
112 0041 0001 DW 00001H ;Refresh(0) , Interval(1ms)
113 0042 3F00 DW 03F00H ;index string of this descriptor
114 0043 class_specific_endpoint_descriptor:
115 0043 2507 DW 02507H ;descriptor type(CS_ENDPOINT) , size of descriptor
文件DES.ASM 盛群编译器版本 2.86 页次3
116 0044 0001 DW 00001H ;Attributes(no sampling frequency , no pitch , no maxpackets control) , descriptorType(EP_GENERAL)
117 0045 3F00 DW 03F00H ;LockedDelayUnit(unused)
118 0046 0000 DW 00000H ;LockDelay(unused)
119 0047 Interface2_descriptor:
120 0047 HID_class:
121 0047 0409 DW 00409H ;INTERFACE descriptor , Size of this descriptor
122 0048 0002 DW 00002H ;Index of this string , index of this interface
123 0049 0301 DW 00301H ;HID , 1 endpoint
124 004A 0000 DW 00000H ;Unused , Non-Boot Device
125 004B 3F00 DW 03F00H ;null string
126 004C HID_Desc:
127 004C 2109 DW 02109H ;HID , Size of this descriptor
128 004D 0110 DW 00110H ;HID spec rev #1.10
129 004E 0100 DW 00100H ;bNumDescriptor , bCountryCode
130 004F 3F22 DW 03F22H ;Report Descriptor
131 0050 ;====================================================================
132 0050 ; Use ReportID , Report ID 1 = Volume HID control
133 0050 ; Report ID 2 = Transform Other Data
134 0050 ;====================================================================
135 0050 IF UseReportID
136 0050 DW 00016H ;67 bytes
137 0050 ELSE
138 0050 0016 DW 00016H
139 0051 ENDIF
140 0051
141 0051 HID_end_point_descriptor:
142 0051 0507 DW 00507H ;Endpoint descriptor , Length of this descriptor
143 0052 0381 DW 00381H ;Interrupt , Endpoint 1 In direction
144 0053 0008 DW 00008H ;wMaxPacketSize = 1 Bytes
145 0054 3F30 DW 03F30H ;48ms Interval
146 0055 end_config_desc_table:
147 0055
148 0055 hid_report_desc_table:
149 0055 ;====================================================================
150 0055 ; Use ReportID , Report ID 1 = Volume HID control
151 0055 ; Report ID 2 = Transform Other Data
152 0055 ;====================================================================
153 0055 ;;vender defined
154 0055 3F06 DW 03F06H ;//Usage Page(Global)
155 0056 3F00 DW 03F00H
156 0057 3FFF DW 03FFFH ;//Usage Page
157 0058
158 0058 0109 DW 00109H ;//Usage(Local 1 bytes)
159 0059 01A1 DW 001A1H ;//collection(Main)
160 005A ;input report
161 005A ;; DW 03F19H
162 005A ;; DW 03FA6H
163 005A ;; DW 03F29H ;//Usage(Local)
164 005A ;; DW 03FACH
165 005A ;; DW 03F15H ;//Global Logical Minimum
166 005A ;; DW 03F80H
167 005A ;; DW 03F25H ;//Global Logical Maximum
168 005A ;; DW 03F7FH
169 005A ;; DW 00875H ;//Global Report Size 8 bits
170 005A ;; DW 00795H ;//Global Report Count 7 (field)
171 005A ;; DW 00281H ;//Main Input (Data,Variable,Absolute)
172 005A ;output
173 005A 0015 DW 00015H ;//LOGICAL MINIMUM (0)
174 005B 3F25 DW 03F25H
175 005C 3FFF DW 03FffH ;//LOGICAL MAXIMUM (FF)
文件DES.ASM 盛群编译器版本 2.86 页次4
176 005D 0019 DW 00019H ;//Usage Min (#)
177 005E 0129 DW 00129H ;//Usage Max (#)
178 005F 0895 DW 00895H ;//Report Count(8)
179 0060 0875 DW 00875H ;//Report Size(8)
180 0061 0291 DW 00291H ;//OUTPUT: (Data, Array)
181 0062 3FC0 DW 03FC0H ;End Collection
182 0063 end_hid_report_desc_table:
183 0063
184 0063 string_descriptor:
185 0063 USBStringLanguageDescription:
186 0063 0304 DW 00304h ; Length , Type (3=string)
187 0064 0409 DW 00409h ; Language: English , Sub-language: US
188 0065
189 0065 imanufacturer_string: ;Vendor Name
190 0065 USBStringDescription1:
191 0065 0310 0048 DW 00310h, 00048h, 0004fh, 0004ch, 00054h, 00045h, 0004bh, 00020h ;HOLTEK
004F 004C 0054 0045 004B 0020
192 006D
193 006D iproduct_string: ;Product Name
194 006D USBStringDescription2:
195 006D ;DW 00326h, 00042h, 0002Dh, 0004ch, 00049h, 0004Eh, 0004bh, 00020h ;B-LINK
196 006D 0055 0053 DW 00055h, 00053h, 00042h, 00020h ;USB
0042 0020
197 0071 0041 0075 DW 00041h, 00075h, 00064h, 00069h, 0006fh, 00020h, 00020h ;Audio
0064 0069 006F 0020 0020
198 0078
199 0078 isnumber_string: ;Serial Number
200 0078 USBStringDescription3:
201 0078 030A 0038 DW 0030Ah, 00038h, 00032h, 00031h, 00052h ;821R
0032 0031 0052
202 007D
203 007D
204 007D
205 007D config_desc_length:
206 007D 0087 DW 00087H
207 007E
208 007E report_desc_length:
209 007E IF UseReportID
210 007E DW 00016H
211 007E ELSE
212 007E 0016 DW 00016H
213 007F ENDIF
214 007F hid_desc_length:
215 007F 0009 DW 00009H
216 0080
217 0080
218 0080
219 0080 Public control_read_table
220 0080 Public device_desc_table
221 0080 Public config_desc_table
222 0080 Public end_config_desc_table
223 0080 Public USBStringLanguageDescription
224 0080 Public USBStringDescription1
225 0080 Public USBStringDescription2
226 0080 Public USBStringDescription3
227 0080
228 0080 Public HID_Desc
229 0080 Public hid_report_desc_table
230 0080 Public end_hid_report_desc_table
231 0080
文件DES.ASM 盛群编译器版本 2.86 页次5
232 0080
233 0080 Public config_desc_length
234 0080 Public hid_desc_length
235 0080 Public report_desc_length
236 0080
0 Errors

BIN
PRG/DES.OBJ Normal file

Binary file not shown.

1444
PRG/FUNCTION.LST Normal file

File diff suppressed because it is too large Load diff

BIN
PRG/FUNCTION.OBJ Normal file

Binary file not shown.

BIN
PRG/HT82A821R.CV Normal file

Binary file not shown.

BIN
PRG/HT82A821R.DBG Normal file

Binary file not shown.

22
PRG/HT82A821R.MAK Normal file
View file

@ -0,0 +1,22 @@
# Generated by HT-IDE3000. DO NOT modify!
E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\DES.OBJ : "E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\DES.ASM"
HASMW32.EXE /NOLOGO @"C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\~ASM17"
E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\FUNCTION.OBJ : "E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\FUNCTION.ASM"
HASMW32.EXE /NOLOGO @"C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\~ASM18"
E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MACRO.OBJ : "E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MACRO.ASM"
HASMW32.EXE /NOLOGO @"C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\~ASM19"
E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MAIN.OBJ : "E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MAIN.ASM"
HASMW32.EXE /NOLOGO @"C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\~ASM20"
:CheckBreak
E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\HT82A821R.TSK : /
"E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\DES.OBJ" /
"E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\FUNCTION.OBJ" /
"E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MACRO.OBJ" /
"E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MAIN.OBJ"
HLINKW32.EXE /NOLOGO @"C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\~LNK21.BAT"
:CheckBreak
HCODGEN32.EXE @"E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\HT82A821R.KKK"
HLOAD32.EXE "E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\HT82A821R.OPT"
:CheckBreak
HLOAD32.EXE "E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\HT82A821R.TSK"
:CheckBreak

271
PRG/HT82A821R.MAP Normal file
View file

@ -0,0 +1,271 @@
盛群连接器 版本7.5
版权 盛群半导体公司 2002-2003
Input Object File: E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\DES.OBJ
Input Object File: E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\FUNCTION.OBJ
Input Object File: E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MACRO.OBJ
Input Object File: E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MAIN.OBJ
Input Library File: C:\HT-IDE3000\LIB\MATH6.LIB
Start End Length Class Name
0000h 0338h 0339h CODE CODE (E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MAIN.OBJ)
0339h 05fbh 02c3h CODE OLDMAIN (E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\FUNCTION.OBJ)
0700h 077fh 0080h CODE DESCRIPT (E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\DES.OBJ)
0040h 0072h 0033h DATA DATA (E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MAIN.OBJ)
Indepentent Local Sections
Start End Length Class Name
0073h 0073h 0000h ILOCAL DELAY (E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MAIN.OBJ)
Public Symbols Information
Address Public by Name
006bh[3] BFLAG_AUDIO_MUTE
006bh[2] BFLAG_ENUM_READY
004eh[5] BFLAG_FIFO_LEN0
004eh[4] BFLAG_FIFO_READY
004eh[6] BFLAG_RD_HTABLE
004eh[3] BFLAG_REAL_CMD
006bh[1] BFLAG_SCMD
004eh[1] BFLAG_SETCONFIGURATION_READY
004eh[2] BFLAG_SETINTERFACE_READY
006bh[0] BFLAG_SET_ADDRESS
004eh[7] BFLAG_WAIT_CONTROL_OUT
006bh[4] BRMTWAKEUP
006bh[5] B_WAKEUP
044ah CHECK_REAL_CMD
04b6h CLEARFEATURE
04bfh CLEARFEATURE_ENDPOINT
077dh CONFIG_DESC_LENGTH
070ah CONFIG_DESC_TABLE
040ch CONTROL_READ
0700h CONTROL_READ_TABLE
0067h DATA_COUNT
0068h DATA_START
05edh DELAY_3US
0700h DEVICE_DESC_TABLE
0755h END_CONFIG_DESC_TABLE
0763h END_HID_REPORT_DESC_TABLE
05e2h EXECUTE
0339h FIFO0_RD_CHECK
035dh FIFO0_WR_CHECK
033fh FIFO1_RD_CHECK
0363h FIFO1_WR_CHECK
0345h FIFO2_RD_CHECK
0369h FIFO2_WR_CHECK
034bh FIFO3_RD_CHECK
036fh FIFO3_WR_CHECK
0351h FIFO4_RD_CHECK
0375h FIFO4_WR_CHECK
0357h FIFO5_RD_CHECK
037bh FIFO5_WR_CHECK
0065h FIFO_ADDR
0059h FIFO_OUT1
005ah FIFO_OUT2
005bh FIFO_OUT3
005ch FIFO_OUT4
005dh FIFO_OUT5
005eh FIFO_OUT6
005fh FIFO_OUT7
0060h FIFO_OUT8
005ah FIFO_REQUEST
0058h FIFO_SENDLEN
0057h FIFO_SIZE
0061h FIFO_TEMP
0059h FIFO_TYPE
005eh FIFO_WINDEXH
005dh FIFO_WINDEXL
0060h FIFO_WLENGTHH
005fh FIFO_WLENGTHL
005ch FIFO_WVALUEH
005bh FIFO_WVALUEL
0509h GETCONFIGURATION
059eh GETCONFIGURATIONDESCRIPTOR
056eh GETCUR
04f1h GETDESCRIPTOR
0598h GETDEVICEDESCRIPTOR
0475h GETINTERFACE
054dh GETMAX
053ch GETMIN
05f4h GETPIPEBIT
055eh GETRES
0484h GETSTATUS
04a6h GETSTATUS_ENDPOINT
0496h GETSTATUS_INTERFACE
05a5h GETSTRINGDESCRIPTOR
03fch GET_DESCRIPTOR_LENGTH
074ch HID_DESC
077fh HID_DESC_LENGTH
0755h HID_REPORT_DESC_TABLE
0066h LOOP_COUNTER
0071h NCMDINDEX1
039ah READ_FIFO0
039eh READ_FIFO1
03a2h READ_FIFO2
03a6h READ_FIFO3
03aah READ_FIFO4
03aeh READ_FIFO5
077eh REPORT_DESC_LENGTH
05e7h SENDSTALL0
03c7h SEND_HAND_SHAKE
0451h SETADDRESS
0464h SETCONFIGURATION
052ah SETCUR
04cch SETFEATURE
04e5h SETFEATURE_ENDPOINT
0597h SETIDLE
046ch SETINTERFACE
0518h SETREPORT
011ch STAGEONE
0765h USBSTRINGDESCRIPTION1
076dh USBSTRINGDESCRIPTION2
0778h USBSTRINGDESCRIPTION3
0763h USBSTRINGLANGUAGEDESCRIPTION
0064h USB_CONFIGURATION
010fh USB_EP0_ISR_END
0062h USB_INTERFACE
0063h USB_INTERFACE_ALT
00adh USB_ISR_END
006fh VOLUMEH_SAVE
0070h VOLUMEL_SAVE
03d5h WRITE_FIFO0
03d7h WRITE_FIFO1
03d9h WRITE_FIFO2
03dbh WRITE_FIFO3
03ddh WRITE_FIFO4
03dfh WRITE_FIFO5
Address Public by Value
0057h FIFO_SIZE
0058h FIFO_SENDLEN
0059h FIFO_OUT1
0059h FIFO_TYPE
005ah FIFO_REQUEST
005ah FIFO_OUT2
005bh FIFO_OUT3
005bh FIFO_WVALUEL
005ch FIFO_WVALUEH
005ch FIFO_OUT4
005dh FIFO_OUT5
005dh FIFO_WINDEXL
005eh FIFO_WINDEXH
005eh FIFO_OUT6
005fh FIFO_OUT7
005fh FIFO_WLENGTHL
0060h FIFO_WLENGTHH
0060h FIFO_OUT8
0061h FIFO_TEMP
0062h USB_INTERFACE
0063h USB_INTERFACE_ALT
0064h USB_CONFIGURATION
0065h FIFO_ADDR
0066h LOOP_COUNTER
0067h DATA_COUNT
0068h DATA_START
006fh VOLUMEH_SAVE
0070h VOLUMEL_SAVE
0071h NCMDINDEX1
00adh USB_ISR_END
010fh USB_EP0_ISR_END
011ch STAGEONE
004eh[1] BFLAG_SETCONFIGURATION_READY
004eh[2] BFLAG_SETINTERFACE_READY
004eh[3] BFLAG_REAL_CMD
004eh[4] BFLAG_FIFO_READY
004eh[5] BFLAG_FIFO_LEN0
004eh[6] BFLAG_RD_HTABLE
004eh[7] BFLAG_WAIT_CONTROL_OUT
0339h FIFO0_RD_CHECK
033fh FIFO1_RD_CHECK
0345h FIFO2_RD_CHECK
034bh FIFO3_RD_CHECK
0351h FIFO4_RD_CHECK
0357h FIFO5_RD_CHECK
006bh[0] BFLAG_SET_ADDRESS
006bh[1] BFLAG_SCMD
006bh[2] BFLAG_ENUM_READY
006bh[3] BFLAG_AUDIO_MUTE
006bh[4] BRMTWAKEUP
035dh FIFO0_WR_CHECK
006bh[5] B_WAKEUP
0363h FIFO1_WR_CHECK
0369h FIFO2_WR_CHECK
036fh FIFO3_WR_CHECK
0375h FIFO4_WR_CHECK
037bh FIFO5_WR_CHECK
039ah READ_FIFO0
039eh READ_FIFO1
03a2h READ_FIFO2
03a6h READ_FIFO3
03aah READ_FIFO4
03aeh READ_FIFO5
03c7h SEND_HAND_SHAKE
03d5h WRITE_FIFO0
03d7h WRITE_FIFO1
03d9h WRITE_FIFO2
03dbh WRITE_FIFO3
03ddh WRITE_FIFO4
03dfh WRITE_FIFO5
03fch GET_DESCRIPTOR_LENGTH
040ch CONTROL_READ
044ah CHECK_REAL_CMD
0451h SETADDRESS
0464h SETCONFIGURATION
046ch SETINTERFACE
0475h GETINTERFACE
0484h GETSTATUS
0496h GETSTATUS_INTERFACE
04a6h GETSTATUS_ENDPOINT
04b6h CLEARFEATURE
04bfh CLEARFEATURE_ENDPOINT
04cch SETFEATURE
04e5h SETFEATURE_ENDPOINT
04f1h GETDESCRIPTOR
0509h GETCONFIGURATION
0518h SETREPORT
052ah SETCUR
053ch GETMIN
054dh GETMAX
055eh GETRES
056eh GETCUR
0597h SETIDLE
0598h GETDEVICEDESCRIPTOR
059eh GETCONFIGURATIONDESCRIPTOR
05a5h GETSTRINGDESCRIPTOR
05e2h EXECUTE
05e7h SENDSTALL0
05edh DELAY_3US
05f4h GETPIPEBIT
0700h CONTROL_READ_TABLE
0700h DEVICE_DESC_TABLE
070ah CONFIG_DESC_TABLE
074ch HID_DESC
0755h END_CONFIG_DESC_TABLE
0755h HID_REPORT_DESC_TABLE
0763h USBSTRINGLANGUAGEDESCRIPTION
0763h END_HID_REPORT_DESC_TABLE
0765h USBSTRINGDESCRIPTION1
076dh USBSTRINGDESCRIPTION2
0778h USBSTRINGDESCRIPTION3
077dh CONFIG_DESC_LENGTH
077eh REPORT_DESC_LENGTH
077fh HID_DESC_LENGTH
ROM Usage Statistics
Size Used Percent
0800h 067ch 81%
RAM Usage Statistics
Size Used Percent
00c0h 0033h 26%
Call Tree
HLINK程序的开始执行点在程序段'CODE'地址0。定义在'E:\项目\USB 音频发射\USB Audio(PC)\COD\PRG\MAIN.OBJ' 文件中
错误总数0 警告总数0

BIN
PRG/HT82A821R.OPT Normal file

Binary file not shown.

BIN
PRG/HT82A821R.OTP Normal file

Binary file not shown.

BIN
PRG/HT82A821R.PRJ Normal file

Binary file not shown.

BIN
PRG/HT82A821R.TSK Normal file

Binary file not shown.

BIN
PRG/HT82A821R.bin Normal file

Binary file not shown.

205
PRG/HT82A821R.dsw Normal file
View file

@ -0,0 +1,205 @@
[BarState-Bar0]
BarID=59392
XPos=-2
YPos=-2
Docking=1
MRUDockID=59419
MRUDockLeftPos=-2
MRUDockTopPos=-2
MRUDockRightPos=553
MRUDockBottomPos=30
MRUFloatStyle=8196
MRUFloatXPos=-1
MRUFloatYPos=0
[BarState-Bar1]
BarID=59393
[BarState-Bar2]
BarID=59419
Bars=15
Bar#0=0
Bar#1=59392
Bar#2=0
Bar#3=65552
Bar#4=0
Bar#5=65553
Bar#6=0
Bar#7=65555
Bar#8=0
Bar#9=65554
Bar#10=0
Bar#11=65559
Bar#12=0
Bar#13=65551
Bar#14=0
[BarState-Bar3]
BarID=59422
Bars=13
Bar#0=0
Bar#1=15
Bar#2=0
Bar#3=65552
Bar#4=0
Bar#5=65553
Bar#6=0
Bar#7=65555
Bar#8=0
Bar#9=65554
Bar#10=0
Bar#11=124928
Bar#12=0
[BarState-Bar4]
BarID=59420
Bars=14
Bar#0=0
Bar#1=65553
Bar#2=65552
Bar#3=0
Bar#4=124928
Bar#5=0
Bar#6=65551
Bar#7=0
Bar#8=65555
Bar#9=0
Bar#10=65554
Bar#11=0
Bar#12=65559
Bar#13=0
[BarState-Bar5]
BarID=59421
Bars=15
Bar#0=0
Bar#1=19
Bar#2=0
Bar#3=16
Bar#4=0
Bar#5=17
Bar#6=0
Bar#7=18
Bar#8=0
Bar#9=23
Bar#10=0
Bar#11=65551
Bar#12=0
Bar#13=124928
Bar#14=0
[BarState-Bar6]
BarID=19
Visible=0
XPos=-3
YPos=-2
Docking=1
MRUDockID=0
MRUDockLeftPos=-3
MRUDockTopPos=-2
MRUDockRightPos=97
MRUDockBottomPos=525
MRUFloatStyle=8196
MRUFloatXPos=-1
MRUFloatYPos=1008
[BarState-Bar7]
BarID=16
XPos=-2
YPos=-2
Docking=1
MRUDockID=0
MRUDockLeftPos=-2
MRUDockTopPos=-2
MRUDockRightPos=191
MRUDockBottomPos=923
MRUFloatStyle=8196
MRUFloatXPos=-1
MRUFloatYPos=-1
[BarState-Bar8]
BarID=17
XPos=189
YPos=-2
Docking=1
MRUDockID=59421
MRUDockLeftPos=189
MRUDockTopPos=-2
MRUDockRightPos=383
MRUDockBottomPos=923
MRUFloatStyle=8196
MRUFloatXPos=-1
MRUFloatYPos=1008
[BarState-Bar9]
BarID=18
Visible=0
XPos=727
YPos=-2
Docking=1
MRUDockID=0
MRUDockLeftPos=727
MRUDockTopPos=-2
MRUDockRightPos=944
MRUDockBottomPos=775
MRUFloatStyle=8196
MRUFloatXPos=-1
MRUFloatYPos=1008
[BarState-Bar10]
BarID=15
Visible=0
XPos=-2
YPos=-2
Docking=1
MRUDockID=0
MRUDockLeftPos=0
MRUDockTopPos=0
MRUDockRightPos=0
MRUDockBottomPos=0
MRUFloatStyle=8196
MRUFloatXPos=-2147483648
MRUFloatYPos=0
[BarState-Bar11]
BarID=23
Visible=0
XPos=-2
YPos=-2
Docking=1
MRUDockID=0
MRUDockLeftPos=-2
MRUDockTopPos=-2
MRUDockRightPos=98
MRUDockBottomPos=923
MRUFloatStyle=8196
MRUFloatXPos=-2147483648
MRUFloatYPos=0
[BarState-Summary]
Bars=10
ScreenCX=1680
ScreenCY=1050
[SizingBarState-SCBar-19]
sizeHorzCX=100
sizeHorzCY=150
sizeVertCX=100
sizeVertCY=527
sizeFloatCX=100
sizeFloatCY=150
[SizingBarState-SCBar-16]
sizeHorzCX=100
sizeHorzCY=150
sizeVertCX=193
sizeVertCY=925
sizeFloatCX=100
sizeFloatCY=150
[SizingBarState-SCBar-17]
sizeHorzCX=100
sizeHorzCY=150
sizeVertCX=194
sizeVertCY=925
sizeFloatCX=100
sizeFloatCY=150
[SizingBarState-SCBar-18]
sizeHorzCX=100
sizeHorzCY=150
sizeVertCX=217
sizeVertCY=777
sizeFloatCX=100
sizeFloatCY=150
[SizingBarState-SCBar-15]
sizeHorzCX=1684
sizeHorzCY=150
sizeVertCX=100
sizeVertCY=150
sizeFloatCX=100
sizeFloatCY=150

404
PRG/MACRO.LST Normal file
View file

@ -0,0 +1,404 @@
文件MACRO.ASM 盛群编译器版本 2.86 页次1
1 0000 ;*******************************************************************************
2 0000 ;*
3 0000 ;* (c) Copyright 2004, Holtek Semiconductor Inc.
4 0000 ;*
5 0000 ;******************************************************************************/
6 0000 ;*******************************************************************************
7 0000 ;MODULE: main.asm
8 0000
9 0000 ;INITIAL: 11/12/2004
10 0000
11 0000 ;AUTHOR: C351 Ansonku.
12 0000
13 0000 ;NOTE: HT48RB4 16 bit operation
14 0000
15 0000 ;REVISION: First issue
16 0000 ;*******************************************************************************
17 0000 ;*******************************************************************************
18 0000 ; 16 bit ADD with signed
19 0000 ; use ADD16 XH,XL,YH,YL,ZH,ZL
20 0000 ; operation
21 0000 ; XH XL
22 0000 ; +YH YL
23 0000 ; --------------
24 0000 ; ZH ZL
25 0000 ;*******************************************************************************
26 0000 ADD16 MACRO XH,XL,YH,YL,ZH,ZL
27 0000 MOV A,XL
28 0000 ADD A,YL
29 0000 MOV ZL,A
30 0000 MOV A,XH
31 0000 ADC A,YH
32 0000 MOV ZH,A
33 0000 ENDM
34 0000 ;*******************************************************************************
35 0000 ; 16 bit ADD with unsigned
36 0000 ; use ADD16 XH,XL,YL,ZH,ZL
37 0000 ; operation
38 0000 ; XH XL
39 0000 ; + YL
40 0000 ; --------------
41 0000 ; ZH ZL
42 0000 ;*******************************************************************************
43 0000 ADD16U MACRO XH,XL,YL,ZH,ZL
44 0000 mov a,xh
45 0000 mov zh,a
46 0000 MOV A,XL
47 0000 ADD A,YL
48 0000 SZ C
49 0000 INC ZH
50 0000 MOV ZL,A
51 0000 ENDM
52 0000
53 0000
54 0000 ;*******************************************************************************
55 0000 ; 16 bit sub with signed
56 0000 ; use SUB16 XH,XL,YH,YL,ZH,ZL
57 0000 ; operation
58 0000 ; XH XL
59 0000 ; -YH YL
文件MACRO.ASM 盛群编译器版本 2.86 页次2
60 0000 ; --------------
61 0000 ; ZH ZL
62 0000 ;*******************************************************************************
63 0000 SUB16 MACRO XH,XL,YH,YL,ZH,ZL
64 0000 MOV A,XL
65 0000 CLR C
66 0000 SUB A,YL
67 0000 MOV ZL,A
68 0000 MOV A,XH
69 0000 SBC A,YH
70 0000 MOV ZH,A
71 0000
72 0000 ENDM
73 0000
74 0000
75 0000 ;*******************************************************************************
76 0000 ; 16 bit shift right with signed
77 0000 ; use RR16 XH,XL,ZH,ZL
78 0000 ; operation
79 0000 ;*******************************************************************************
80 0000 RR16 MACRO XH,XL,ZH,ZL
81 0000 CLR C
82 0000 MOV A,XH
83 0000 AND A,80H
84 0000 SNZ Z
85 0000 SET C
86 0000 RRCA XH
87 0000 MOV ZH,A
88 0000 RRCA XL
89 0000 MOV ZL,A
90 0000 ENDM
91 0000 ;*******************************************************************************
92 0000 ; 16 bit shift left with signed
93 0000 ; use RL16 XH,XL,ZH,ZL
94 0000 ; operation
95 0000 ;*******************************************************************************
96 0000 RL16 MACRO XH,XL,ZH,ZL
97 0000 CLR C
98 0000 SZ XL.7
99 0000 SET C
100 0000
101 0000 RLCA XH
102 0000 MOV ZH,A
103 0000 CLR C
104 0000 RLCA XL
105 0000 MOV ZL,A
106 0000 ENDM
107 0000 ;*******************************************************************************
108 0000 ; 16 bit shift left with signed
109 0000 ; use RL16N XH,XL,ZH,ZL
110 0000 ; operation
111 0000 ;*******************************************************************************
112 0000 RL16N MACRO XH,XL,ZH,ZL,N
113 0000 ;MOV A,8
114 0000 ;SUB A,N
115 0000 ;mov a,Xl SHR A
116 0000 ;mov zh,a
117 0000 ;mov a,xh SHL N
118 0000 ;orm a,zh
119 0000 ENDM
文件MACRO.ASM 盛群编译器版本 2.86 页次3
120 0000 ;*******************************************************************************
121 0000 ; 8 bit multiply with signed
122 0000 ; use mul8 X,Y,ZH,ZL
123 0000 ; operation
124 0000 ;*******************************************************************************
125 0000 Mul8 MACRO X,Y,ZH,ZL
126 0000 Local Mul8_End
127 0000 CLR operator1H ;sum
128 0000 CLR operator1L
129 0000 CLR operator2H ;multiply
130 0000 CLR operator3H ;operator
131 0000 CLR operator3L
132 0000 mov A,Y
133 0000 mov operator2L,A
134 0000
135 0000 SZ X.7
136 0000 SET operator2H
137 0000 Mul16_doloop:
138 0000 MOV A,6
139 0000 MOV Counter3,A
140 0000 SDZ Counter3
141 0000 JMP Mul8_End
142 0000 SNZ X.Counter3
143 0000 jmp Mul18_Next_Bit
144 0000 RL16 operator2H,operator2L,operator3H,operator3L
145 0000 ADD16 operator3H,operator3L,operator1H,operaotr1L,operator1H,operator1L
146 0000
147 0000
148 0000 Mul18_Next_Bit:
149 0000 JMP Mul16_doloop
150 0000
151 0000
152 0000 Mul8_End:
153 0000
154 0000
155 0000 ENDM
156 0000
157 0000 ;*******************************************************************************
158 0000 ; 8 bit macro
159 0000 ;*******************************************************************************
160 0000 ;*******************************************************************************
161 0000 ; 16 bit ADD with signed
162 0000 ; use ADD16 X,Y,Z
163 0000 ; operation
164 0000 ; X
165 0000 ; +Y
166 0000 ; --------------
167 0000 ; Z
168 0000 ;*******************************************************************************
169 0000 ADD8 MACRO X1,Y1,Z1
170 0000 MOV A,X1
171 0000 ADD A,Y1
172 0000 MOV Z1,A
173 0000 ENDM
174 0000
175 0000 ;*******************************************************************************
176 0000 ; 16 bit sub with signed
177 0000 ; use SUB16 X,Y,Z
178 0000 ; operation
179 0000 ; X
文件MACRO.ASM 盛群编译器版本 2.86 页次4
180 0000 ; -Y
181 0000 ; --------------
182 0000 ; Z
183 0000 ;*******************************************************************************
184 0000 SUB8 MACRO X1,Y1,Z1
185 0000 MOV A,X1
186 0000 SUB A,Y1
187 0000 MOV Z1,A
188 0000 ENDM
189 0000
190 0000 ;*******************************************************************************
191 0000 ; 8 bit shift right with signed
192 0000 ; use RR8 X,Z
193 0000 ; operation
194 0000 ;*******************************************************************************
195 0000 RR8 MACRO X,Y
196 0000 Local RR8_End,RR8_Modify_FF,RR8_Modify_FF_End
197 0000 mov a,X
198 0000 inc acc
199 0000 SZ Z
200 0000 jmp RR8_Modify_FF
201 0000 jmp RR8_Modify_FF_End
202 0000 RR8_Modify_FF:
203 0000 clr Y
204 0000 jmp RR8_End
205 0000
206 0000 RR8_Modify_FF_End:
207 0000 CLR C
208 0000 MOV A,X
209 0000 AND A,80H
210 0000 SNZ Z
211 0000 SET C
212 0000 RRCA X
213 0000 MOV Y,A
214 0000
215 0000
216 0000
217 0000 RR8_End:
218 0000 ENDM
219 0000 ;*******************************************************************************
220 0000 ; 8 bit shift left with signed
221 0000 ; use RL16 X,Z
222 0000 ; operation
223 0000 ;*******************************************************************************
224 0000 RL8 MACRO X,Y
225 0000 CLR C
226 0000 RLCA X
227 0000 MOV Y,A
228 0000 ENDM
229 0000
230 0000 ;*******************************************************************************
231 0000 ; 8 bit abs
232 0000 ; use ABS8 X,Y
233 0000 ; operation
234 0000 ;*******************************************************************************
235 0000 ABS8 MACRO X,Y
236 0000 Local ABS8_End
237 0000
238 0000 kmov y,x
239 0000 mov a,x
文件MACRO.ASM 盛群编译器版本 2.86 页次5
240 0000 and a,80H
241 0000 SZ Z
242 0000 jmp ABS8_End
243 0000 CPL y
244 0000 INC y
245 0000
246 0000 ABS8_End:
247 0000
248 0000 ENDM
249 0000
250 0000
251 0000
252 0000
253 0000
254 0000
255 0000 ;*******************************************************************************
256 0000 ; kmov
257 0000 ; use kmov destination,source
258 0000 ; operation
259 0000 ;*******************************************************************************
260 0000 KMOV MACRO mem1,mem2
261 0000 mov a,mem2
262 0000 mov mem1,a
263 0000 ENDM
264 0000
265 0000 KOR MACRO mem1,mem2
266 0000 mov a,mem2
267 0000 orm a,mem1
268 0000 ENDM
269 0000
270 0000
271 0000
272 0000 ;*******************************************************************************
273 0000 ; make oled column address
274 0000 ; use oled_make_col_add source,MSB,LSB
275 0000 ;
276 0000 ;*******************************************************************************
277 0000 oled_make_col_add macro mem1,mem2,mem3
278 0000 mov a,0FH
279 0000 AND a,mem1
280 0000 mov mem3,a
281 0000 mov a,70H
282 0000 and a,mem1
283 0000 mov mem2,a
284 0000 clr c
285 0000 rrc mem2
286 0000 clr c
287 0000 rrc mem2
288 0000 clr c
289 0000 rrc mem2
290 0000 clr c
291 0000 rrc mem2
292 0000 set mem2.4
293 0000
294 0000 endm
295 0000
296 0000
297 0000
298 0000 ;***************************************
299 0000
文件MACRO.ASM 盛群编译器版本 2.86 页次6
300 0000 XMOV MACRO mem2,mem1
301 0000 mov a,mem1
302 0000 mov mem2,a
303 0000 ENDM
304 0000 ;-------------------------------------
305 0000 ;;Move ARG2->ARG1(move by bit)
306 0000 xmov1 MACRO ARG1,ARG2
307 0000 LOCAL xmov1_1,xmov1_end
308 0000 sz ARG2
309 0000 jmp xmov1_1
310 0000 clr ARG1
311 0000 jmp xmov1_end
312 0000 xmov1_1:
313 0000 set ARG1
314 0000 xmov1_end:
315 0000 ENDM
316 0000 ;-------------------------------------
317 0000 ;;if MEM2=MEM1 =>Skip Next Instruction
318 0000 EQUJMP MACRO MEM2,MEM1
319 0000 MOV A,MEM1
320 0000 XOR A,MEM2
321 0000 SNZ Z
322 0000 ENDM
323 0000 ;;------------------------
324 0000
325 0000 ;;if MEM2!=MEM1 =>Skip Next Instruction
326 0000 NEJMP MACRO MEM2,MEM1
327 0000 MOV A,MEM1
328 0000 XOR A,MEM2
329 0000 SZ Z
330 0000 ENDM
331 0000 ;;------------------------
332 0000 ;;if (REG1==REG2) goto REG3
333 0000 JLER MACRO REG1,REG2,REG3
334 0000 mov a,REG1
335 0000 sub a,REG2
336 0000 sz z
337 0000 jmp REG3
338 0000 ENDM
339 0000 ;**********************************************
340 0000 ;MACRO: JLNR
341 0000 ;PURPOSE: REG1 != REG2 goto REG3
342 0000 ;**********************************************
343 0000 JLNR MACRO REG1,REG2,REG3
344 0000 mov a,REG1
345 0000 sub a,REG2
346 0000 snz z
347 0000 jmp REG3
348 0000 ENDM
349 0000 ;;------------------------
350 0000 ;;if MEM2>MEM1 =>Skip Next Instruction
351 0000 LBRJ MACRO MEM2,MEM1
352 0000 MOV A,MEM1
353 0000 SUB A,MEM2
354 0000 SZ C
355 0000 ENDM
356 0000 ;;------------------------
357 0000
358 0000 ;;if MEM2<=MEM1 =>Skip Next Instruction
359 0000 LSERJ MACRO MEM2,MEM1
文件MACRO.ASM 盛群编译器版本 2.86 页次7
360 0000 MOV A,MEM1
361 0000 SUB A,MEM2
362 0000 SNZ C
363 0000 ENDM
364 0000 ;;------------------------
365 0000
366 0000 ;;if MEM2<MEM1 =>Skip Next Instruction
367 0000 LSRJ MACRO MEM2,MEM1
368 0000 MOV A,MEM2
369 0000 SUB A,MEM1
370 0000 SZ C
371 0000 ENDM
372 0000 ;;------------------------
373 0000
374 0000 ;;if MEM2>=MEM1 =>Skip Next Instruction
375 0000 LBERJ MACRO MEM2,MEM1
376 0000 MOV A,MEM2
377 0000 SUB A,MEM1
378 0000 SNZ C
379 0000 ENDM
380 0000 ;;------------------------
381 0000
382 0000 SWAPWORD MACRO DA
383 0000 EQU (DA>>8)+(DA<<8)
384 0000 ENDM
385 0000 ;;------------------------
386 0000
0 Errors

BIN
PRG/MACRO.OBJ Normal file

Binary file not shown.

1885
PRG/MAIN.LST Normal file

File diff suppressed because it is too large Load diff

BIN
PRG/MAIN.OBJ Normal file

Binary file not shown.

183
PRG/QN8027DRIVER.LST Normal file
View file

@ -0,0 +1,183 @@
文件QN8027DRIVER.ASM 盛群编译器版本 2.86 页次1
1 0000 ;;-----------------------------------------------
2 0000 ;;function: QN8072_I2C_Read_Data
3 0000 ;;in: mFMAddr
4 0000 ;;out: mFMData
5 0000 ;;description: Read AS6600 data
6 0000 ;;-----------------------------------------------
7 0000 QN8072_I2C_Read_Data:
8 0000
9 0000 L_I2CRd_Data_lp:
10 0000 0001 CLR WDT
11 0001
12 0001 0000 CLR mFMACK
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 12 : 语法错误
13 0002 2000 R CALL I2C_START
14 0003 0F00 MOV A,QN8072_I2C_WRITE_ADDR
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 14 : 未定义的符号 'QN8072_I2C_WRITE_ADDR'
15 0004 0000 MOV mFMSend,A ;;Set send data
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 15 : 语法错误
16 0005 2000 R CALL Write_I2C_Byte ;;Send data
17 0006
18 0006 0F00 MOV A,mFMAddr
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 18 : 未定义的符号 'mFMAddr'
19 0007 0000 MOV mFMSend,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 19 : 语法错误
20 0008 2000 R CALL Write_I2C_Byte
21 0009
22 0009 0F00 MOV A,mFMACK
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 22 : 未定义的符号 'mFMACK'
23 000A 0D00 OR A,0
24 000B 0000 SNZ Z ;;Z=1,OK
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 24 : 语法错误
25 000C 2800 R JMP L_I2CRd_Data_lp
26 000D ;;
27 000D L_I2CRd_Data_lp2:
28 000D 0001 CLR WDT
29 000E
30 000E 0000 CLR mFMACK
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 30 : 语法错误
31 000F 2000 R CALL I2C_START
32 0010
33 0010 0F00 MOV A,QN8072_I2C_READ_ADDR
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 33 : 未定义的符号 'QN8072_I2C_READ_ADDR'
34 0011 0000 MOV mFMSend,A ;;Set send data
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 34 : 语法错误
35 0012 2000 R CALL Write_I2C_Byte ;;Send data
36 0013
37 0013 0F00 MOV A,mFMACK
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 37 : 未定义的符号 'mFMACK'
38 0014 0D00 OR A,0
39 0015 0000 SNZ Z ;;Z=1,OK
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 39 : 语法错误
40 0016 2800 R JMP L_I2CRd_Data_lp2
41 0017
42 0017 2000 R CALL Read_I2C_Byte
43 0018 0000 MOV mFMData,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 43 : 语法错误
44 0019 2000 R CALL sendNoAck
45 001A
46 001A 2000 R CALL I2C_STOP
文件QN8027DRIVER.ASM 盛群编译器版本 2.86 页次2
47 001B 0003 RET
48 001C
49 001C ;;-----------------------------------------------
50 001C ;;function: QN8027_I2C_Write_Data
51 001C ;;in: mFMAddr,mFMData
52 001C ;;out:
53 001C ;;description: Write QN8027 data
54 001C ;;-----------------------------------------------
55 001C QN8027_I2C_Write_Data:
56 001C
57 001C L_I2CWt_Data_lp:
58 001C 0001 CLR WDT
59 001D
60 001D 0000 CLR mFMACK
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 60 : 语法错误
61 001E 2000 R CALL I2C_START
62 001F 0F00 MOV A,QN8072_I2C_WRITE_ADDR
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 62 : 未定义的符号 'QN8072_I2C_WRITE_ADDR'
63 0020 0000 MOV mFMSend,A ;;Set send data
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 63 : 语法错误
64 0021 2000 R CALL Write_I2C_Byte ;;Send data
65 0022
66 0022 0F00 MOV A,mFMAddr
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 66 : 未定义的符号 'mFMAddr'
67 0023 0000 MOV mFMSend,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 67 : 语法错误
68 0024 2000 R CALL Write_I2C_Byte
69 0025
70 0025 0F00 MOV A,mFMData
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 70 : 未定义的符号 'mFMData'
71 0026 0000 MOV mFMSend,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 71 : 语法错误
72 0027 2000 R CALL Write_I2C_Byte
73 0028
74 0028 2000 R CALL I2C_STOP
75 0029
76 0029 0F00 MOV A,mFMACK
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 76 : 未定义的符号 'mFMACK'
77 002A 0D00 OR A,0
78 002B 0000 SNZ Z ;;Z=1,OK
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 78 : 语法错误
79 002C 2800 R JMP L_I2CWt_Data_lp
80 002D
81 002D 0003 RET
82 002E
83 002E ;;-----------------------------------------------
84 002E ;;function: Delay5us
85 002E ;;in: NULL
86 002E ;;out: NULL
87 002E ;;description: Delay 5us
88 002E ;;-----------------------------------------------
89 002E Delay5us:
90 002E 2800 R JMP $+1
91 002F 2800 R JMP $+1
92 0030 2800 R JMP $+1
93 0031 2800 R JMP $+1
94 0032 2800 R JMP $+1
95 0033 2800 R JMP $+1
96 0034 2800 R JMP $+1
97 0035 0000 NOP
文件QN8027DRIVER.ASM 盛群编译器版本 2.86 页次3
98 0036 0003 RET
99 0037
100 0037 ;;-----------------------------------------------
101 0037 ;;function: sendAck
102 0037 ;;in: NULL
103 0037 ;;out: NULL
104 0037 ;;description: Send ACK
105 0037 ;;-----------------------------------------------
106 0037 sendAck:
107 0037 0000 CLR P_SDA ;;0
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 107 : 语法错误
108 0038 2000 R CALL Delay5us
109 0039
110 0039 0000 SET P_SCL
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 110 : 语法错误
111 003A 2000 R CALL Delay5us
112 003B 0000 CLR P_SCL
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 112 : 语法错误
113 003C 2000 R CALL Delay5us
114 003D 0003 RET
115 003E
116 003E ;;-----------------------------------------------
117 003E ;;function: sendNoAck
118 003E ;;in: NULL
119 003E ;;out: NULL
120 003E ;;description: Send No ACK
121 003E ;;-----------------------------------------------
122 003E sendNoAck:
123 003E 0000 SET P_SDA ;;1
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 123 : 语法错误
124 003F 2000 R CALL Delay5us
125 0040
126 0040 0000 SET P_SCL
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 126 : 语法错误
127 0041 2000 R CALL Delay5us
128 0042 0000 CLR P_SCL
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 128 : 语法错误
129 0043 2000 R CALL Delay5us
130 0044 0003 RET
131 0045
132 0045 ;;-----------------------------------------------
133 0045 ;;function: Read_I2C_Byte
134 0045 ;;in: NULL
135 0045 ;;out: ACC
136 0045 ;;description: Read data
137 0045 ;;-----------------------------------------------
138 0045 Read_I2C_Byte:
139 0045 0000 CLR mFMSend
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 139 : 语法错误
140 0046 0F08 MOV A,8D
141 0047 0000 MOV mFMCnt,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM 141 : 语法错误
Error(A0052) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8027DRIVER.ASM : 错误过多
31 Errors

237
PRG/QN8027Driver.asm Normal file
View file

@ -0,0 +1,237 @@
;;-----------------------------------------------
;;function: QN8072_I2C_Read_Data
;;in: mFMAddr
;;out: mFMData
;;description: Read AS6600 data
;;-----------------------------------------------
QN8072_I2C_Read_Data:
L_I2CRd_Data_lp:
CLR WDT
CLR mFMACK
CALL I2C_START
MOV A,QN8072_I2C_WRITE_ADDR
MOV mFMSend,A ;;Set send data
CALL Write_I2C_Byte ;;Send data
MOV A,mFMAddr
MOV mFMSend,A
CALL Write_I2C_Byte
MOV A,mFMACK
OR A,0
SNZ Z ;;Z=1,OK
JMP L_I2CRd_Data_lp
;;
L_I2CRd_Data_lp2:
CLR WDT
CLR mFMACK
CALL I2C_START
MOV A,QN8072_I2C_READ_ADDR
MOV mFMSend,A ;;Set send data
CALL Write_I2C_Byte ;;Send data
MOV A,mFMACK
OR A,0
SNZ Z ;;Z=1,OK
JMP L_I2CRd_Data_lp2
CALL Read_I2C_Byte
MOV mFMData,A
CALL sendNoAck
CALL I2C_STOP
RET
;;-----------------------------------------------
;;function: QN8027_I2C_Write_Data
;;in: mFMAddr,mFMData
;;out:
;;description: Write QN8027 data
;;-----------------------------------------------
QN8027_I2C_Write_Data:
L_I2CWt_Data_lp:
CLR WDT
CLR mFMACK
CALL I2C_START
MOV A,QN8072_I2C_WRITE_ADDR
MOV mFMSend,A ;;Set send data
CALL Write_I2C_Byte ;;Send data
MOV A,mFMAddr
MOV mFMSend,A
CALL Write_I2C_Byte
MOV A,mFMData
MOV mFMSend,A
CALL Write_I2C_Byte
CALL I2C_STOP
MOV A,mFMACK
OR A,0
SNZ Z ;;Z=1,OK
JMP L_I2CWt_Data_lp
RET
;;-----------------------------------------------
;;function: Delay5us
;;in: NULL
;;out: NULL
;;description: Delay 5us
;;-----------------------------------------------
Delay5us:
JMP $+1
JMP $+1
JMP $+1
JMP $+1
JMP $+1
JMP $+1
JMP $+1
NOP
RET
;;-----------------------------------------------
;;function: sendAck
;;in: NULL
;;out: NULL
;;description: Send ACK
;;-----------------------------------------------
sendAck:
CLR P_SDA ;;0
CALL Delay5us
SET P_SCL
CALL Delay5us
CLR P_SCL
CALL Delay5us
RET
;;-----------------------------------------------
;;function: sendNoAck
;;in: NULL
;;out: NULL
;;description: Send No ACK
;;-----------------------------------------------
sendNoAck:
SET P_SDA ;;1
CALL Delay5us
SET P_SCL
CALL Delay5us
CLR P_SCL
CALL Delay5us
RET
;;-----------------------------------------------
;;function: Read_I2C_Byte
;;in: NULL
;;out: ACC
;;description: Read data
;;-----------------------------------------------
Read_I2C_Byte:
CLR mFMSend
MOV A,8D
MOV mFMCnt,A
SET P_SDAC ;;SDA input
L_ReadI2C_lp:
CLR C
RLC mFMSend
CLR P_SCL
CALL Delay5us
SET P_SCL
CALL Delay5us
SZ P_SDA
SET mFMSend.0 ;;save data
SDZ mFMCnt
JMP L_ReadI2C_lp
CLR P_SCL
CLR P_SDAC ;;SDA Output
CALL Delay5us
MOV A,mFMSend
RET
;;-----------------------------------------------
;;function: Write_I2C_Byte
;;in: mFMSend
;;out: mFMAck
;;description: Write data
;;-----------------------------------------------
Write_I2C_Byte:
MOV A,8D
MOV mFMCnt,A
L_WriteI2C_lp:
SZ mFMSend.7
SET P_SDA
SNZ mFMSend.7
CLR P_SDA
RLC mFMSend ;;Next bit
CALL Delay5us
SET P_SCL
CALL Delay5us
CLR P_SCL
SDZ mFMCnt
JMP L_WriteI2C_lp ;;Send data
;;Get ACK
CALL Delay5us
SET P_SDAC ;;SDA input
CALL Delay5us
SET P_SCL
CALL Delay5us
SZ P_SDA
INC mFMACK ;;ACK=1,error
CLR P_SCL
CALL Delay5us
CLR P_SDAC ;;SDA output
RET
;;-----------------------------------------------
;;function: I2C_START
;;in: NULL
;;out: NULL
;;description: IIC Start
;;-----------------------------------------------
I2C_START:
SET P_SDA ;;Dat H
CALL Delay5us
SET P_SCL ;;CLK H
CALL Delay5us
CLR P_SDA ;;Dat L
CALL Delay5us
CLR P_SCL ;;CLK L
CALL Delay5us
RET
;;-----------------------------------------------
;;function: I2C_Stop
;;in: NULL
;;out: NULL
;;description: IIC Stop
;;-----------------------------------------------
I2C_Stop:
CLR P_SDA ;;Dat L
CALL Delay5us
SET P_SCL ;;CLK L
CALL Delay5us
SET P_SDA ;;Dat H
CALL Delay5us
RET

141
PRG/QN8072SUB.LST Normal file
View file

@ -0,0 +1,141 @@
文件QN8072SUB.ASM 盛群编译器版本 2.86 页次1
1 0000 ;;-----------------------------------------------
2 0000 ;;function: QN8072Init
3 0000 ;;in: mFreqL,mFreqH
4 0000 ;;out: NULL
5 0000 ;;description: Initial QN8027 Configer
6 0000 ;;-----------------------------------------------
7 0000 QN8072Init:
8 0000 ;;
9 0000 0F04 MOV A,04H
10 0001 0000 MOV mFMAddr,a ;;VGA
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 10 : 语法错误
11 0002 0F00 MOV A,mQNReg[4] ;;58H
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 11 : 未定义的符号 'mQNReg'
12 0003 0000 MOV mFMData,A ;;12M/101/2db/5k
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 12 : 语法错误
13 0004 2000 CALL QN8027_I2C_Write_Data
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 13 : 未定义的符号 'QN8027_I2C_Write_Data'
14 0005
15 0005 2000 R CALL Delay20ms
16 0006 ;;
17 0006 0F00 MOV A,00H
18 0007 0000 MOV mFMAddr,a ;;SYSTEM
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 18 : 语法错误
19 0008 0F00 MOV A,mQNReg[0] ;;51H
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 19 : 未定义的符号 'mQNReg'
20 0009 0000 MOV mFMData,A ;;MONO/NO MUTE
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 20 : 语法错误
21 000A 2000 CALL QN8027_I2C_Write_Data
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 21 : 未定义的符号 'QN8027_I2C_Write_Data'
22 000B
23 000B 2000 R CALL Delay20ms
24 000C ;;
25 000C 0000 CLR mQNReg[0].6
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 25 : 语法错误
26 000D 0F00 MOV A,00H
27 000E 0000 MOV mFMAddr,a ;;SYSTEM
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 27 : 语法错误
28 000F 0F00 MOV A,mQNReg[0] ;;51H
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 28 : 未定义的符号 'mQNReg'
29 0010 0000 MOV mFMData,A ;;MONO/NO MUTE
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 29 : 语法错误
30 0011 2000 CALL QN8027_I2C_Write_Data
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 30 : 未定义的符号 'QN8027_I2C_Write_Data'
31 0012
32 0012 0F18 MOV A,18H
33 0013 0000 MOV mFMAddr,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 33 : 语法错误
34 0014 0FE4 MOV A,0E4H
35 0015 0000 MOV mFMData,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 35 : 语法错误
36 0016 2000 CALL QN8027_I2C_Write_Data
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 36 : 未定义的符号 'QN8027_I2C_Write_Data'
37 0017
38 0017 0F1B MOV A,1bH
39 0018 0000 MOV mFMAddr,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 39 : 语法错误
40 0019 0FF0 MOV A,0f0H
41 001A 0000 MOV mFMData,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 41 : 语法错误
文件QN8072SUB.ASM 盛群编译器版本 2.86 页次2
42 001B 2000 CALL QN8027_I2C_Write_Data
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 42 : 未定义的符号 'QN8027_I2C_Write_Data'
43 001C
44 001C 0000 SET mQNReg[0].5 ;;Enter transmit mode
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 44 : 语法错误
45 001D 2000 R CALL QN8072FreqSet ;;Set fre
46 001E
47 001E 0F02 MOV A,02H
48 001F 0000 MOV mFMAddr,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 48 : 语法错误
49 0020 0FE9 MOV A,0e9H
50 0021 0000 MOV mFMData,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 50 : 语法错误
51 0022 2000 CALL QN8027_I2C_Write_Data
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 51 : 未定义的符号 'QN8027_I2C_Write_Data'
52 0023
53 0023 0F04 MOV A,04H
54 0024 0000 MOV mFMAddr,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 54 : 语法错误
55 0025 0F42 MOV A,42H
56 0026 0000 MOV mFMData,A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 56 : 语法错误
57 0027 2000 CALL QN8027_I2C_Write_Data
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 57 : 未定义的符号 'QN8027_I2C_Write_Data'
58 0028
59 0028 0003 RET
60 0029
61 0029 ;;-----------------------------------------------
62 0029 ;;function: QN8072FreqSet
63 0029 ;;in: mFreqL,mFreqH
64 0029 ;;out: NULL
65 0029 ;;description: Set QN8072 Freq
66 0029 ;; Frf = (76 + 0.05*Channel) -> Channel = (Frf-76)/0.05
67 0029 ;;-----------------------------------------------
68 0029 QN8072FreqSet:
69 0029 ;; CLR INTC0.@INTC0_EMI ;Global interrupt
70 0029 ;; CLR data0
71 0029 ;; CLR data1
72 0029 ;;
73 0029 ;; MOV A,mFreqL
74 0029 ;; SUB A,0B0H
75 0029 ;; MOV data0,A
76 0029 ;; MOV A,mFreqH
77 0029 ;; SBC A,1DH
78 0029 ;; MOV data1,A ;;(Freq - 7600)
79 0029 ;;
80 0029 ;; MOV A,05H
81 0029 ;; MOV data5,A
82 0029 ;; CLR data4
83 0029 ;; CALL unbin_div_16 ;;(Freq - 7600)/5 -> to1to0
84 0029 ;;
85 0029 ;; MOV A,03H
86 0029 ;; ANDM A,to1
87 0029 ;; MOV A,0FCH
88 0029 ;; ANDM A,mQNReg[0]
89 0029 ;; MOV A,to1
90 0029 ;; ORM A,mQNReg[0]
91 0029 ;; MOV A,to0
92 0029 ;; MOV mQNReg[1],A
93 0029 ;;
文件QN8072SUB.ASM 盛群编译器版本 2.86 页次3
94 0029
95 0029 0F00 MOV A,cFreqDefL
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 95 : 未定义的符号 'cFreqDefL'
96 002A 0000 MOV mQNReg[1],A
Error(A0024) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 96 : 语法错误
97 002B 0F00 MOV A,mQNReg[0]
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 97 : 未定义的符号 'mQNReg'
98 002C 0EFC AND A,0FCH
99 002D 0D00 OR A,cFreqDefH
Error(A0005) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM 99 : 未定义的符号 'cFreqDefH'
Error(A0052) E:\项目\USB 音频发射\USB AUDIO(PC)\COD\PRG\QN8072SUB.ASM : 错误过多
31 Errors

298
PRG/QN8072Sub.asm Normal file
View file

@ -0,0 +1,298 @@
;;-----------------------------------------------
;;function: QN8072Init
;;in: mFreqL,mFreqH
;;out: NULL
;;description: Initial QN8027 Configer
;;-----------------------------------------------
QN8072Init:
;;
MOV A,03H
MOV mFMAddr,a ;;crystal
MOV A,mQNReg[3] ;;50H
MOV mFMData,A ;;digital clock for XTAL1
CALL QN8027_I2C_Write_Data
;;
MOV A,04H
MOV mFMAddr,a ;;VGA
MOV A,mQNReg[4] ;;58H
MOV mFMData,A ;;12M/101/2db/5k
CALL QN8027_I2C_Write_Data
CALL Delay20ms
;;
MOV A,00H
MOV mFMAddr,a ;;SYSTEM
MOV A,mQNReg[0] ;;51H
MOV mFMData,A ;;MONO/NO MUTE
CALL QN8027_I2C_Write_Data
CALL Delay20ms
;;
CLR mQNReg[0].6
MOV A,00H
MOV mFMAddr,a ;;SYSTEM
MOV A,mQNReg[0] ;;51H
MOV mFMData,A ;;MONO/NO MUTE
CALL QN8027_I2C_Write_Data
MOV A,18H
MOV mFMAddr,A
MOV A,0E4H
MOV mFMData,A
CALL QN8027_I2C_Write_Data
MOV A,1bH
MOV mFMAddr,A
MOV A,0f0H
MOV mFMData,A
CALL QN8027_I2C_Write_Data
SET mQNReg[0].5 ;;Enter transmit mode
CALL QN8072FreqSet ;;Set fre
MOV A,02H
MOV mFMAddr,A
MOV A,0e9H
MOV mFMData,A
CALL QN8027_I2C_Write_Data
MOV A,04H
MOV mFMAddr,A
MOV A,42H
MOV mFMData,A
CALL QN8027_I2C_Write_Data
RET
;;-----------------------------------------------
;;function: QN8072FreqSet
;;in: mFreqL,mFreqH
;;out: NULL
;;description: Set QN8072 Freq
;; Frf = (76 + 0.05*Channel) -> Channel = (Frf-76)/0.05
;;-----------------------------------------------
QN8072FreqSet:
;; CLR INTC0.@INTC0_EMI ;Global interrupt
;; CLR data0
;; CLR data1
;;
;; MOV A,mFreqL
;; SUB A,0B0H
;; MOV data0,A
;; MOV A,mFreqH
;; SBC A,1DH
;; MOV data1,A ;;(Freq - 7600)
;;
;; MOV A,05H
;; MOV data5,A
;; CLR data4
;; CALL unbin_div_16 ;;(Freq - 7600)/5 -> to1to0
;;
;; MOV A,03H
;; ANDM A,to1
;; MOV A,0FCH
;; ANDM A,mQNReg[0]
;; MOV A,to1
;; ORM A,mQNReg[0]
;; MOV A,to0
;; MOV mQNReg[1],A
;;
MOV A,cFreqDefL
MOV mQNReg[1],A
MOV A,mQNReg[0]
AND A,0FCH
OR A,cFreqDefH
MOV mQNReg[0],A ;;Set define freq
MOV A,00H
MOV mFMAddr,A
MOV A,mQNReg[0]
MOV mFMData,A
CALL QN8027_I2C_Write_Data
MOV A,01H
MOV mFMAddr,A
MOV A,mQNReg[1]
MOV mFMData,A
CALL QN8027_I2C_Write_Data
;; SET INTC0.@INTC0_EMI ;Global interrupt
RET
;;-----------------------------------------------
;;function: Delay20ms
;;in: NULL
;;out: NULL
;;description: Delay 20ms
;;-----------------------------------------------
Delay20ms:
MOV A,200D
MOV mMK1,A
L_Dly20ms_1:
MOV A,100D
MOV mMK0,A
CLR WDT
SDZ mMK0
JMP $-1
NOP ;;3*100 = 100us
SDZ mMK1
JMP L_Dly20ms_1
RET
;;-----------------------------------------------
;;function: QN8027
;;in: FIFO_out1~FIFO_out8
;;out: NULL
;;description: deal QN8027 Data from EP1
;;-----------------------------------------------
QN8027:
;;Type check (main or set)
MOV A,cFMUSBType_Main
XOR A,FIFO_out2
SZ Z
JMP L_FMType_Main ;;Main data
MOV A,cFMUSBType_Set
XOR A,FIFO_out2
SZ Z
JMP L_FMType_Set ;;Set data
JMP L_QN8027_end
;;-----------------------------------------------
L_FMType_Main:
;;FIFO6 is Key
SZ FIFO_out6.@FMKeyTun
CALL L_FMFun_FMFreSet
SZ FIFO_out6.@FMKeyOn
CALL L_FMFun_FMWork
SZ FIFO_out6.@FMKeyOff
CALL L_FMFun_FMIdle
SZ FIFO_out6.@FMKeyMute
CALL L_FMFun_FMMute
SZ FIFO_out6.@FMKeyNoMute
CALL L_FMFun_FMNoMute
;;FIFO5 is PAC-VALUE(0x10)
SNZ mQNReg[0].5
JMP L_QN8027_end ;;Idle mode
MOV A,FIFO_out5
MOV mFMData,A
MOV A,10H
MOV mFMAddr,A
CALL QN8027_I2C_Write_Data
;;In idle and work for PA-ok
;; CALL L_FMFun_FMMute ;;Mute
;; CALL L_FMFun_FMIdle
;; CALL L_FMFun_FMWork
;; SZ FIFO_out6.@FMKeyNoMute
;; CALL L_FMFun_FMNoMute
JMP L_QN8027_end
;;
L_FMFun_FMNoMute:
CLR mQNReg[0].3 ;;Not mute
JMP $+2
L_FMFun_FMMute:
SET mQNReg[0].3
MOV A,00H
MOV mFMAddr,A
MOV A,mQNReg[0]
MOV mFMData,A
CALL QN8027_I2C_Write_Data ;;Set Mute/No Mute
;; JMP L_QN8027_end
RET
;;
L_FMFun_FMIdle:
SET P_LED
CLR mQNReg[0].5 ;;Idle mode
JMP $+3
L_FMFun_FMWork:
CLR P_LED
SET mQNReg[0].5 ;;Work mode
MOV A,00H
MOV mFMAddr,A
MOV A,mQNReg[0]
MOV mFMData,A
CALL QN8027_I2C_Write_Data ;;Set Idle/Work
;; JMP L_QN8027_end
RET
;;
L_FMFun_FMFreSet:
;;FIFO3/4 is Freq
MOV A,FIFO_out4
MOV mQNReg[1],A
MOV A,0FCH
ANDM A,mQNReg[0]
MOV A,FIFO_out3
AND A,03H
ORM A,mQNReg[0]
MOV A,00H
MOV mFMAddr,A
MOV A,mQNReg[0]
MOV mFMData,A
CALL QN8027_I2C_Write_Data
MOV A,01H
MOV mFMAddr,A
MOV A,mQNReg[1]
MOV mFMData,A
CALL QN8027_I2C_Write_Data
;; JMP L_QN8027_end
RET
;;-----------------------------------------------
L_FMType_Set:
;;FIFO_out3 is TX-GAIN
MOV A,mQNReg[4]
AND A,8CH ;;Set GVGA & RIN(GVGA = 000/RIN=11 --> GVGA=101/RIN=11 --> GVGA=000/RIN=10 --> GVGA=101/RIN=0)
OR A,FIFO_out3
MOV mQNReg[4],A
MOV A,04H
MOV mFMAddr,A
MOV A,mQNReg[4]
MOV mFMData,A
CALL QN8027_I2C_Write_Data ;;Set TX-GAIN
;;Set other
CLR mQNReg[0].4
SZ FIFO_out4.@FMMono
SET mQNReg[0].4
CLR mQNReg[2].7
SZ FIFO_out4.@FMDeemp
SET mQNReg[2].7
MOV A,00H
MOV mFMAddr,A
MOV A,mQNReg[0]
MOV mFMData,A
CALL QN8027_I2C_Write_Data ;;FM Mono
MOV A,02H
MOV mFMAddr,A
MOV A,mQNReg[2]
MOV mFMData,A
CALL QN8027_I2C_Write_Data ;;FM De-emp
;;JMP L_QN8027_end
L_QN8027_end:
RET

141
PRG/cal.asm Normal file
View file

@ -0,0 +1,141 @@
;8 bit unsigned mul
unbin_mul_8 proc ;data0*data4---->to1to0
init
mov a, 08h
mov count0, a
rradd:
rrc to1
rrc data4
snz [0ah].0
jmp rr1 ;当前data4.0=0,移位<E7A7BB>
mov a, data0 ;当前data4.0=1,移位相加
addm a, to1
rr1:
sdz count0
jmp rradd
rrc to1
rrc data4
mov a, data4
mov to0, a
ret
unbin_mul_8 endp
;8 bit unsigned div
unbin_div_8 proc ;data0/data4---->data0(to0)---to1
init
mov a, 08h ;循环次数8
mov count0, a
sz data4 ;除数为0则溢出
jmp start0
jmp over8
start0:
sz data0 ;被除数为0则结束
jmp div0
jmp dispa
div0:
clr [0Ah].0 ;准备左移
rlc data0
rlc to1 ;左移一位结束
mov a, to1 ;开始部分余数减除数
sub a, data4
snz [0Ah].0
jmp next0 ;不够减则转移
mov to1, a ;够减则商为1
inc data0
next0:
sdz count0
jmp div0
dispa:
mov a, data0 ;显示商
mov to0, a
;; mov a, data4
;; mov to1, a
ret
over8:
ret
unbin_div_8 endp
;16 bit unsigned div
unbin_div_16 proc ;data0data1/data4data5---->data1data0(to1to0)---to2to3
init
mov a, 10h
mov count0, a
sz data5
jmp start16
sz data4
jmp start16
jmp over16
start16:
sz data1
jmp div16
sz data0
jmp div16
jmp dispa16
div16:
clr [0Ah].0
rlc data0
rlc data1
rlc to2
rlc to3
mov a, to2
sub a, data4
mov com3, a
mov a, to3
sbc a, data5
snz [0Ah].0
jmp next16
mov to3, a
mov a, com3
mov to2, a
mov a, 01h
addm a, data0
mov a, 00h
adcm a, data1
next16:
sdz count0
jmp div16
dispa16:
mov a, data0
mov to0, a
mov a, data1
mov to1, a
mov a, 00h
mov to2, a
ret
over16:
ret
unbin_div_16 endp
;16 bit unsigned mul
unbin_mul_16 proc
init
mov a, 10h ;data0data1*data4data5---->to0to1to2to3
mov count0, a
clr [0ah].0
rradd16:
rrc to3
rrc to2
rrc data5
rrc data4
snz [0ah].0
jmp rr116
mov a, data0
addm a, to2
mov a, data1
adcm a, to3
rr116:
sdz count0
jmp rradd16
rrc to3
rrc to2
rrc data5
rrc data4
mov a, data4
mov to0, a
mov a, data5
mov to1, a
ret
unbin_mul_16 endp

304
PRG/const.inc Normal file
View file

@ -0,0 +1,304 @@
;****************************************************************
;Author:Ansonku
;Email:ansonku@holtek.com.tw
;================================================================
;Update Information
;================================================================
;2004/09/27
;define register for usb audio speaker chip
;the usb chip register are all at bank0
;
;****************************************************************
USB_REG_BANK EQU 0
;R0 EQU [00H]
;MP0 EQU [01H]
;R1 EQU [02H]
;MP1 EQU [03H]
;ACC EQU [05H]
;PCL EQU [06H]
;TBLP EQU [07H]
;TBLH EQU [08H]
;STATUS EQU [0AH]
;INTC0 EQU [0BH]
;TMR0 EQU [0DH]
;TMR0C EQU [0EH]
;TMR1H EQU [0FH]
;TMR1L EQU [10H]
;TMR1C EQU [11H]
;PA EQU [12H]
;PAC EQU [13H]
;PB EQU [14H]
;PBC EQU [15H]
;PC EQU [16H]
;PCC EQU [17H]
;PD EQU [18H]
;PDC EQU [19H]
;PE EQU [1AH]
;PEC EQU [1BH]
;INTC1 EQU [1EH]
EP0_FIFO_SIZE EQU 8
USB_FIFO0_SIZE EQU 8
USB_FIFO1_SIZE EQU 8
USB_FIFO2_SIZE EQU 8
USB_FIFO3_SIZE EQU 8
USB_FIFO4_SIZE EQU 8
USB_FIFO5_SIZE EQU 8
USB_USC EQU 020H
USB_USR EQU 021H
USB_UCC EQU 022H
USB_AWR EQU 023H
USB_STALL EQU 024H
USB_SIES EQU 025H
USB_MISC EQU 026H
USB_SETIO EQU 027H
USB_FIFO0 EQU 028H
USB_FIFO1 EQU 029H
USB_FIFO2 EQU 02AH
USB_FIFO3 EQU 02BH
USB_FIFO4 EQU 02CH
USB_FIFO5 EQU 02DH
;bit position define
@BIT0 EQU 0
@BIT1 EQU 1
@BIT2 EQU 2
@BIT3 EQU 3
@BIT4 EQU 4
@BIT5 EQU 5
@BIT6 EQU 6
@BIT7 EQU 7
;INTC0
@INTC0_EMI EQU @BIT0
@INTC0_EEI EQU @BIT1
@INTC0_ET0I EQU @BIT2
@INTC0_ET1I EQU @BIT3
@INTC0_EIF EQU @BIT4
@INTC0_T0F EQU @BIT5
@INTC0_T1F EQU @BIT6
;INTC1
@INTC1_EUI EQU @BIT0
@INTC1_EADI EQU @BIT1
@INTC1_ESII EQU @BIT2
@INTC1_USBF EQU @BIT4
@INTC1_ADF EQU @BIT5
@INTC1_SIF EQU @BIT6
;USC
@USC_SUSP EQU @BIT0
@USC_RMWK EQU @BIT1
@USC_URST EQU @BIT2
@USC_RESUME EQU @BIT3
@USC_V33C EQU @BIT4
@USC_URD EQU @BIT7
;USR
@USR_EP0F EQU @BIT0
@USR_EP1F EQU @BIT1
@USR_EP2F EQU @BIT2
@USR_EP3F EQU @BIT3
@USR_EP4F EQU @BIT4
@USR_EP5F EQU @BIT5
;UCC [20H]
@UCC_EPS0 EQU @BIT0
@UCC_EPS1 EQU @BIT1
@UCC_EPS2 EQU @BIT2
@UCC_USBCKEN EQU @BIT3
@UCC_SUSP2 EQU @BIT4
@UCC_SYSCLK EQU @BIT6
@UCC_UFLS EQU @BIT7
;AWR
@AWR_WKEN EQU @BIT0
;STALL
@STALL_STL0 EQU @BIT0
@STALL_STL1 EQU @BIT1
@STALL_STL2 EQU @BIT2
@STALL_STL3 EQU @BIT3
@STALL_STL4 EQU @BIT4
@STALL_STL5 EQU @BIT5
;SIES
@SIES_ASET EQU @BIT0
@SIES_ERR EQU @BIT1
@SIES_OUT EQU @BIT2
@SIES_IN EQU @BIT3
@SIES_NAK EQU @BIT4
@SIES_SETUP EQU @BIT5
;MISC
@MISC_REQ EQU @BIT0
@MISC_TX EQU @BIT1
@MISC_CLEAR EQU @BIT2
@MISC_ISOEN EQU @BIT4
@MISC_SCMD EQU @BIT5
@MISC_READY EQU @BIT6
@MISC_LEN0 EQU @BIT7
;SETIO
@SETIO_DATATG EQU @BIT0
@SETIO_SETIO1 EQU @BIT1
@SETIO_SETIO2 EQU @BIT2
@SETIO_SETIO3 EQU @BIT3
@SETIO_SETIO4 EQU @BIT4
@SETIO_SETIO5 EQU @BIT5
;
;===================================================
;Descriptor constant declarations
;===================================================
;Standard Request Codes
get_status EQU 0
clear_feature EQU 1
set_feature EQU 3
set_address EQU 5
get_descriptor EQU 6
set_descriptor EQU 7
get_configuration EQU 8
set_configuration EQU 9
get_interface EQU 10
set_interface EQU 11
synch_frame EQU 12
;Standard Descriptor types
device EQU 1
configuration EQU 2
string EQU 3
interface EQU 4
endpoint EQU 5
;Standard Feature Selectors
endpoint_stalled EQU 0
device_remote_wakeup EQU 1
;HID class
HID EQU 21H
report EQU 22H
physical EQU 23H
;calss specific request code from section 7.2 class specific requests
get_report EQU 1
get_idle EQU 2
get_protocol EQU 3
set_report EQU 09
set_idle EQU 10
set_protocol EQU 11
set_input_report EQU 1
set_output_report EQU 2
;===================================================
;USB packet constants (debug purposes)
;===================================================
setup EQU 0B4H
in EQU 096H
out EQU 087H
data0 EQU 0C3H
data1 EQU 0D2H
ack EQU 04BH
nak EQU 04AH
;===================================================
;USB Audio Class-Specific Request Code
;===================================================
REQUEST_CODE_UNDEFINED EQU 000H
SET_CUR EQU 001H
GET_CUR EQU 081H
SET_MIN EQU 002H
GET_MIN EQU 082H
SET_MAX EQU 003H
GET_MAX EQU 083H
SET_RES EQU 004H
GET_RES EQU 084H
SET_MEM EQU 005H
GET_MEM EQU 085H
GET_STAT EQU 0FFH
;Feature Unit Control Selectors
FU_CONTROL_UNDEFINED EQU 000H
MUTE_CONTROL EQU 001H
VOLUME_CONTROL EQU 002H
BASS_CONTROL EQU 003H
MID_CONTROL EQU 004H
TREBLE_CONTROL EQU 005H
GRAPHIC_EQUALIZER_CONTROL EQU 006H
AUTOMATIC_GAIN_CONTROL EQU 007H
DELAY_CONTROL EQU 008H
BASS_BOOST_CONTROL EQU 009H
LOUNDNESS_CONTROL EQU 00AH
;//just for HT23RB60 RAM bank
ABank0 EQU 000H
ABank1 EQU 001H
ABank2 EQU 002H
ABank3 EQU 003H
ABank4 EQU 004H
ABank5 EQU 005H
ABank6 EQU 006H
ABank7 EQU 007H
ABank8 EQU 008H
ABank9 EQU 009H
ABankA EQU 00aH
ABankB EQU 00bH
;//just for HT23RB60 ROM bank
OBank0 EQU 000H
OBank1 EQU 020H
OBank2 EQU 040H
OBank3 EQU 060H
;for HT16A102B 68k Parallel Mode
OLCD_DATA_PIN EQU PA
C68 EQU PB.0
RD EQU PB.1
RW EQU PB.2
DCOM EQU PB.3
RES EQU PB.4
;for volume control
Const_Counter EQU 00AH
VIOP EQU [12H]
@Mute EQU @BIT6
@Inc EQU @BIT4
@Dec EQU @BIT5
Min_Volume EQU 0C8H
Max_Volume EQU 000H
;//Max_Volume EQU 000H
Cur_Volume EQU 0FCH
;=============================================================
; IF USE key Debounced Function please set UseMedaiKey = 1
; Key_Defined represent which bit you want to detect
; For Example : I want to detect PA.0 and PA.1
; Then I set Key_Defined to 00000011'b = 03H
;=============================================================
#define UseMediaKey 0
#define UseReportID 0 ;des is changed usereport has problem
Key_Defined EQU 0FFH
USB_LED_ON EQU PB.0
MUTE_LED_ON EQU PB.1

1388
PRG/function.asm Normal file

File diff suppressed because it is too large Load diff

98
PRG/ht82a821r.inc Normal file
View file

@ -0,0 +1,98 @@
; ht48rb4.INC
; This file contains the definition of registers for
; Holtek ht48rb4 microcontroller.
; Generated by Cfg2IncH V1.0.
; Do not modify manually.
IAR0 EQU [00H]
R0 EQU [00H] ;old style declaration, not recommended for use
MP0 EQU [01H]
IAR1 EQU [02H]
R1 EQU [02H] ;old style declaration, not recommended for use
MP1 EQU [03H]
BP EQU [04H]
ACC EQU [05H]
PCL EQU [06H]
TBLP EQU [07H]
TBLH EQU [08H]
WDTS EQU [09H]
STATUS EQU [0AH]
INTC0 EQU [0BH]
TMR0H EQU [0CH]
TMR0L EQU [0DH]
TMR0C EQU [0EH]
TMR1H EQU [0FH]
TMR1L EQU [010H]
TMR1C EQU [011H]
PA EQU [012H]
PAC EQU [013H]
PB EQU [014H]
PBC EQU [015H]
PC EQU [016H]
PCC EQU [017H]
PD EQU [018H]
PDC EQU [019H]
USVC EQU [01CH]
USF EQU [01DH]
TBHP EQU [01FH]
USC EQU [020H]
USR EQU [021H]
UCC EQU [022H]
AWR EQU [023H]
STALREG EQU [024H]
STALL EQU [024H]
SIES EQU [025H]
MISC EQU [026H]
SETIO EQU [027H]
FIFO0 EQU [028H]
FIFO1 EQU [029H]
FIFO2 EQU [02AH]
TUSB_R EQU [02FH]
C EQU [0AH].0
AC EQU [0AH].1
Z EQU [0AH].2
OV EQU [0AH].3
PDF EQU [0AH].4
TO EQU [0AH].5
EMI EQU [0BH].0
EEI EQU [0BH].1
ET0I EQU [0BH].2
ET1I EQU [0BH].3
EIF EQU [0BH].4
T0F EQU [0BH].5
T1F EQU [0BH].6
PA0 EQU [012H].0
PA1 EQU [012H].1
PA2 EQU [012H].2
PA3 EQU [012H].3
PA4 EQU [012H].4
PA5 EQU [012H].5
PA6 EQU [012H].6
PA7 EQU [012H].7
PB0 EQU [014H].0
PB1 EQU [014H].1
PB2 EQU [014H].2
PB3 EQU [014H].3
PB4 EQU [014H].4
PB5 EQU [014H].5
PB6 EQU [014H].6
PB7 EQU [014H].7
PC0 EQU [016H].0
PC1 EQU [016H].1
PC2 EQU [016H].2
PC3 EQU [016H].3
PC4 EQU [016H].4
PC5 EQU [016H].5
PC6 EQU [016H].6
PC7 EQU [016H].7
PD0 EQU [018H].0
PD1 EQU [018H].1
PD2 EQU [018H].2
PD3 EQU [018H].3
PD4 EQU [018H].4
PD5 EQU [018H].5
PD6 EQU [018H].6
PD7 EQU [018H].7
LASTPAGE EQU 0700H

386
PRG/macro.asm Normal file
View file

@ -0,0 +1,386 @@
;*******************************************************************************
;*
;* (c) Copyright 2004, Holtek Semiconductor Inc.
;*
;******************************************************************************/
;*******************************************************************************
;MODULE: main.asm
;INITIAL: 11/12/2004
;AUTHOR: C351 Ansonku.
;NOTE: HT48RB4 16 bit operation
;REVISION: First issue
;*******************************************************************************
;*******************************************************************************
; 16 bit ADD with signed
; use ADD16 XH,XL,YH,YL,ZH,ZL
; operation
; XH XL
; +YH YL
; --------------
; ZH ZL
;*******************************************************************************
ADD16 MACRO XH,XL,YH,YL,ZH,ZL
MOV A,XL
ADD A,YL
MOV ZL,A
MOV A,XH
ADC A,YH
MOV ZH,A
ENDM
;*******************************************************************************
; 16 bit ADD with unsigned
; use ADD16 XH,XL,YL,ZH,ZL
; operation
; XH XL
; + YL
; --------------
; ZH ZL
;*******************************************************************************
ADD16U MACRO XH,XL,YL,ZH,ZL
mov a,xh
mov zh,a
MOV A,XL
ADD A,YL
SZ C
INC ZH
MOV ZL,A
ENDM
;*******************************************************************************
; 16 bit sub with signed
; use SUB16 XH,XL,YH,YL,ZH,ZL
; operation
; XH XL
; -YH YL
; --------------
; ZH ZL
;*******************************************************************************
SUB16 MACRO XH,XL,YH,YL,ZH,ZL
MOV A,XL
CLR C
SUB A,YL
MOV ZL,A
MOV A,XH
SBC A,YH
MOV ZH,A
ENDM
;*******************************************************************************
; 16 bit shift right with signed
; use RR16 XH,XL,ZH,ZL
; operation
;*******************************************************************************
RR16 MACRO XH,XL,ZH,ZL
CLR C
MOV A,XH
AND A,80H
SNZ Z
SET C
RRCA XH
MOV ZH,A
RRCA XL
MOV ZL,A
ENDM
;*******************************************************************************
; 16 bit shift left with signed
; use RL16 XH,XL,ZH,ZL
; operation
;*******************************************************************************
RL16 MACRO XH,XL,ZH,ZL
CLR C
SZ XL.7
SET C
RLCA XH
MOV ZH,A
CLR C
RLCA XL
MOV ZL,A
ENDM
;*******************************************************************************
; 16 bit shift left with signed
; use RL16N XH,XL,ZH,ZL
; operation
;*******************************************************************************
RL16N MACRO XH,XL,ZH,ZL,N
;MOV A,8
;SUB A,N
;mov a,Xl SHR A
;mov zh,a
;mov a,xh SHL N
;orm a,zh
ENDM
;*******************************************************************************
; 8 bit multiply with signed
; use mul8 X,Y,ZH,ZL
; operation
;*******************************************************************************
Mul8 MACRO X,Y,ZH,ZL
Local Mul8_End
CLR operator1H ;sum
CLR operator1L
CLR operator2H ;multiply
CLR operator3H ;operator
CLR operator3L
mov A,Y
mov operator2L,A
SZ X.7
SET operator2H
Mul16_doloop:
MOV A,6
MOV Counter3,A
SDZ Counter3
JMP Mul8_End
SNZ X.Counter3
jmp Mul18_Next_Bit
RL16 operator2H,operator2L,operator3H,operator3L
ADD16 operator3H,operator3L,operator1H,operaotr1L,operator1H,operator1L
Mul18_Next_Bit:
JMP Mul16_doloop
Mul8_End:
ENDM
;*******************************************************************************
; 8 bit macro
;*******************************************************************************
;*******************************************************************************
; 16 bit ADD with signed
; use ADD16 X,Y,Z
; operation
; X
; +Y
; --------------
; Z
;*******************************************************************************
ADD8 MACRO X1,Y1,Z1
MOV A,X1
ADD A,Y1
MOV Z1,A
ENDM
;*******************************************************************************
; 16 bit sub with signed
; use SUB16 X,Y,Z
; operation
; X
; -Y
; --------------
; Z
;*******************************************************************************
SUB8 MACRO X1,Y1,Z1
MOV A,X1
SUB A,Y1
MOV Z1,A
ENDM
;*******************************************************************************
; 8 bit shift right with signed
; use RR8 X,Z
; operation
;*******************************************************************************
RR8 MACRO X,Y
Local RR8_End,RR8_Modify_FF,RR8_Modify_FF_End
mov a,X
inc acc
SZ Z
jmp RR8_Modify_FF
jmp RR8_Modify_FF_End
RR8_Modify_FF:
clr Y
jmp RR8_End
RR8_Modify_FF_End:
CLR C
MOV A,X
AND A,80H
SNZ Z
SET C
RRCA X
MOV Y,A
RR8_End:
ENDM
;*******************************************************************************
; 8 bit shift left with signed
; use RL16 X,Z
; operation
;*******************************************************************************
RL8 MACRO X,Y
CLR C
RLCA X
MOV Y,A
ENDM
;*******************************************************************************
; 8 bit abs
; use ABS8 X,Y
; operation
;*******************************************************************************
ABS8 MACRO X,Y
Local ABS8_End
kmov y,x
mov a,x
and a,80H
SZ Z
jmp ABS8_End
CPL y
INC y
ABS8_End:
ENDM
;*******************************************************************************
; kmov
; use kmov destination,source
; operation
;*******************************************************************************
KMOV MACRO mem1,mem2
mov a,mem2
mov mem1,a
ENDM
KOR MACRO mem1,mem2
mov a,mem2
orm a,mem1
ENDM
;*******************************************************************************
; make oled column address
; use oled_make_col_add source,MSB,LSB
;
;*******************************************************************************
oled_make_col_add macro mem1,mem2,mem3
mov a,0FH
AND a,mem1
mov mem3,a
mov a,70H
and a,mem1
mov mem2,a
clr c
rrc mem2
clr c
rrc mem2
clr c
rrc mem2
clr c
rrc mem2
set mem2.4
endm
;***************************************
XMOV MACRO mem2,mem1
mov a,mem1
mov mem2,a
ENDM
;-------------------------------------
;;Move ARG2->ARG1(move by bit)
xmov1 MACRO ARG1,ARG2
LOCAL xmov1_1,xmov1_end
sz ARG2
jmp xmov1_1
clr ARG1
jmp xmov1_end
xmov1_1:
set ARG1
xmov1_end:
ENDM
;-------------------------------------
;;if MEM2=MEM1 =>Skip Next Instruction
EQUJMP MACRO MEM2,MEM1
MOV A,MEM1
XOR A,MEM2
SNZ Z
ENDM
;;------------------------
;;if MEM2!=MEM1 =>Skip Next Instruction
NEJMP MACRO MEM2,MEM1
MOV A,MEM1
XOR A,MEM2
SZ Z
ENDM
;;------------------------
;;if (REG1==REG2) goto REG3
JLER MACRO REG1,REG2,REG3
mov a,REG1
sub a,REG2
sz z
jmp REG3
ENDM
;**********************************************
;MACRO: JLNR
;PURPOSE: REG1 != REG2 goto REG3
;**********************************************
JLNR MACRO REG1,REG2,REG3
mov a,REG1
sub a,REG2
snz z
jmp REG3
ENDM
;;------------------------
;;if MEM2>MEM1 =>Skip Next Instruction
LBRJ MACRO MEM2,MEM1
MOV A,MEM1
SUB A,MEM2
SZ C
ENDM
;;------------------------
;;if MEM2<=MEM1 =>Skip Next Instruction
LSERJ MACRO MEM2,MEM1
MOV A,MEM1
SUB A,MEM2
SNZ C
ENDM
;;------------------------
;;if MEM2<MEM1 =>Skip Next Instruction
LSRJ MACRO MEM2,MEM1
MOV A,MEM2
SUB A,MEM1
SZ C
ENDM
;;------------------------
;;if MEM2>=MEM1 =>Skip Next Instruction
LBERJ MACRO MEM2,MEM1
MOV A,MEM2
SUB A,MEM1
SNZ C
ENDM
;;------------------------
SWAPWORD MACRO DA
EQU (DA>>8)+(DA<<8)
ENDM
;;------------------------

1807
PRG/main.asm Normal file

File diff suppressed because it is too large Load diff

60
PRG/memory.inc Normal file
View file

@ -0,0 +1,60 @@
;;***********************************************
;;QN8072 memory
;;***********************************************
mQNReg db 5 dup (?) ;;QN8072 Reg0~4
mFMAddr db ? ;;QN8072 Reg addr
mFMData db ? ;;QN8072 Reg data
mFreqL db ? ;;QN8072 Freq
mFreqH db ?
mFMACK db ? ;;IIC ACK get OK?
mFMSend db ? ;;IIC Send data
mFMCnt db ? ;;IIC Send count
;;***********************************************
;;Temp
;;***********************************************
mMK0 db ?
mMK1 db ?
;;***********************************************
;;BIT
;;***********************************************
bIniFMOK dbit ;;0-FM initial no. 1-FM initial OK
;;***********************************************
;;IO Define
;;***********************************************
P_LEDC EQU [013H].3
P_LED EQU PA.3
P_SCLC EQU [013H].0
P_SCL EQU PA.0
P_SDAC EQU [013H].1
P_SDA EQU PA.1
;;***********************************************
;;User Define
;;***********************************************
cFreqDefL EQU 18H
cFreqDefH EQU 01H ;;QN8072 define freq : 90.00MHz (Chanel = (Freq-76)/0.05)
QN8072_I2C_WRITE_ADDR EQU 58H ;;QN8072 Write address
QN8072_I2C_READ_ADDR EQU 59H ;;QN8072 Read address
;;***********************************************
;;USB Translate Define
;;***********************************************
cFMUSBType_Main EQU 50H ;;USB Data is main data
cFMUSBType_Set EQU 51H ;;USB Data is Set data
@FMKeyOn EQU 0 ;;FM On
@FMKeyOff EQU 1 ;;FM Off
@FMKeyMute EQU 2 ;;FM Mute
@FMKeyNoMute EQU 3 ;;FM NoMute
@FMKeyTun EQU 4 ;;FM Tun(add/dec)
@FMMono EQU 0 ;;FM Stereo(0)/mono(1)
@FMFreq EQU 1 ;;FM freq 87.5~108M(0)/76~90(1)
@FMDeemp EQU 2 ;;FM De-emphasis 50(0)/75(1)

198
keenectl.c Normal file
View file

@ -0,0 +1,198 @@
#include <stdio.h>
#include <string.h>
#include <usb.h>
#include <math.h>
#define LED_VENDOR_ID 0x046d
#define LED_PRODUCT_ID 0x0a0e
static void send_data(struct usb_dev_handle *handle, char *data)
{
int ret;
ret = usb_control_msg(handle,
USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, // request type
0x00000009, // request
0x0200, // value
0x02, // index
data,
0x00000008,
5000);
if (ret == -1) {
fprintf(stderr, "Permission Denied\n");
} else {
fprintf(stderr, "usb_control_msg returned %d\n", ret);
}
}
static struct usb_device *device_init(void)
{
struct usb_bus *usb_bus;
struct usb_device *dev;
usb_init();
usb_find_busses();
usb_find_devices();
for (usb_bus = usb_busses;
usb_bus;
usb_bus = usb_bus->next) {
for (dev = usb_bus->devices;
dev;
dev = dev->next) {
if ((dev->descriptor.idVendor
== LED_VENDOR_ID) &&
(dev->descriptor.idProduct
== LED_PRODUCT_ID))
return dev;
}
}
return NULL;
}
int main(int argc, char **argv)
{
struct usb_device *usb_dev;
struct usb_dev_handle *usb_handle;
usb_dev = device_init();
if (usb_dev == NULL) {
fprintf(stderr, "Device not found\n");
return 1;
}
usb_handle = usb_open(usb_dev);
if (usb_handle == NULL) {
fprintf(stderr,
"Not able to claim the USB device\n");
usb_close(usb_handle);
return 1;
}
if (argc != 8) {
fprintf(stderr,
"incorrect number of arguments\n");
usb_close(usb_handle);
return 1;
}
enum settings {
PREEM_50 = 0x00,
PREEM_75 = 0x04,
STEREO = 0x00,
MONO = 0x01,
ENABLE = 0x01,
DISABLE = 0x2,
MUTE = 0x04,
UNMUTE = 0x08,
FREQ = 0x10
};
char conf1[8] = "\x00\x50\x00\x00\x00\x00\x00\x00";
char conf2[8] = "\x00\x51\x00\x00\x00\x00\x00\x00";
int ival, ret;
float fval;
// get TX
if (!strcasecmp(argv[1], "-")) {
conf2[2] = '\x00';
} else {
ret = sscanf(argv[1], "%d", &ival);
if (ret == 1) {
if (ival >= 0 && ival <= 23) {
conf2[2] = (ival%6)<<4 | (23-ival)/6;
} else {
fprintf(stderr, "TX must be from 0 to 23\n");
return 1;
}
} else {
fprintf(stderr, "TX must be integer\n");
return 1;
}
}
// get preemphasis
if (!strcasecmp(argv[2], "-") || !strcasecmp(argv[2], "50us")) {
conf2[3] |= PREEM_50;
} else if (!strcasecmp(argv[2], "75us")) {
conf2[3] |= PREEM_75;
} else {
fprintf(stderr, "preemphasis must be either 50us or 75us\n");
return 1;
}
// get channels
if (!strcasecmp(argv[3], "-") || !strcasecmp(argv[3], "stereo")) {
conf2[3] |= STEREO;
} else if (!strcasecmp(argv[3], "mono")) {
conf2[3] |= MONO;
} else {
fprintf(stderr, "channels must be mono or stereo\n");
return 1;
}
// get frequency
if (!strcasecmp(argv[4], "-")) {
fval = 90.0f;
} else {
ret = sscanf(argv[4], "%f", &fval);
if (ret == 1) {
if (fval < 76.0f || fval > 108.0f) {
fprintf(stderr, "frequency must be from 76.0 to 108.0\n");
return 1;
}
} else {
fprintf(stderr, "frequency must be float\n");
return 1;
}
}
long int ifreq = lround(20.0f*(fval-76.0f));
conf1[2] = (ifreq >> 8) & 0xff;
conf1[3] = ifreq & 0xff;
// get PA
if (!strcasecmp(argv[5], "-")) {
conf1[4] = 120;
} else {
ret = sscanf(argv[5], "%d", &ival);
if (ret == 1) {
if (ival >= 30 && ival <= 120) {
conf1[4] = ival;
} else {
fprintf(stderr, "PA ust be from 30 to 120\n");
return 1;
}
} else {
fprintf(stderr, "PA must be integer\n");
return 1;
}
}
// get enable
if (!strcasecmp(argv[6], "-") || !strcasecmp(argv[6], "enable")) {
conf1[5] |= ENABLE;
} else if (!strcasecmp(argv[6], "disable")) {
conf1[5] |= DISABLE;
} else {
fprintf(stderr, "must be enable or disable");
return 1;
}
// get mute
if (!strcasecmp(argv[7], "-") || !strcasecmp(argv[7], "unmute")) {
conf1[5] |= UNMUTE;
} else if (!strcasecmp(argv[7], "mute")) {
conf1[5] |= MUTE;
} else {
fprintf(stderr, "mute must be mute or unmute");
return 1;
}
conf1[5] |= FREQ;
send_data(usb_handle, conf1);
send_data(usb_handle, conf2);
return 0;
}

75
notes Normal file
View file

@ -0,0 +1,75 @@
add50: 00 50 01 1b 1e 19 00 34
add100: 00 50 01 1d 1e 19 00 34
add200: 00 50 01 21 1e 19 00 34
configclose: 00 51 03 20 00 00 00 44
configclose: 00 51 02 00 00 00 00 44
disable: 00 50 01 18 1e 0a 00 05
enable: 00 50 01 18 1e 09 00 00
mute: 00 50 01 19 1e 05 00 8c
unmute: 00 50 01 19 1e 09 00 8c
PA30: 00 50 01 19 1e 09 73 d0
PA48: 00 50 01 19 30 09 73 d0
PA77: 00 50 01 19 4d 09 73 d0
PA103: 00 50 01 19 67 09 73 d0
PA120: 00 50 01 19 78 09 73 d0
TX0: 00 51 03 00 03 1e 00 1d
TX6: 00 51 02 00 03 1e 00 1d
TX15: 00 51 31 00 03 1e 00 1d
TX23: 00 51 50 00 03 1e 00 1d
MAIN:
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0x0 | 0x50 | freq | PA | f|u|m|d|e| 0x0 or 0x73 | enable, disable, freq, PA, (un)mute
CONFIG:
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0x0 | 0x51 | TX | |7| |m| | TX, close
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0 0 0 0 0 0 0 0|0 1 0 1 0 0 0 1|'00000011'(TX) | 7 m|0|PA30-PA120 |0 0 0 f U M O O| 0x73 when PA | config close: 0x44
|0 1 0 1 0 0 0 0|'00010011' | 5 o|0|0x1e-0x78 | r N U F N| val is set | freq: 0x44, 0x34, 0xd4
| |'00100011' | u n| | | e M T F | 0 otherwise | TX: 0x1d
| |'00110011' | s o| | q U E | | PA: 0xd0
'01000011' | | | T | | (un)mute: 0x8c
'01010011' +-+-+ | | E | | enable: 0x00
'00000010' |freq 0x0 - 0x280 | | | | disable: 0x05
'00010010' | 76 - 108 |
'00100010' | |
'00110010'
'01000010'
'01010010'
'00000001'
'00010001'
'00100001'
'00110001'
'01000001'
'01010001'
'00000000'
'00010000'
'00100000'
'00110000'
'01000000'
'01010000'
TX:
0x3, 0x13, 0x23, 0x33, 0x43, 0x53, 0x02, 0x12, 0x22, 0x32, 0x42, 0x52, 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x00, 0x10, 0x20, 0x30, 0x40, 0x50
3, 19, 35, 51, 67, 83, 2, 18, 34, 50, 66, 82, 1, 17, 33, 49, 65, 81, 0, 16, 32, 48, 64, 80
[(i%6)*16+(23-i)/6 for i in xrange(24)]
[(i%6)<<4 | (23-i)/6 for i in xrange(24)]
freq:
= lroundf(20.0f*(x-76.0f))
PA:
0x1e - 0x78