⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 des.asm

📁 holtek usb音频IC应用DEMO汇编语言源程序。
💻 ASM
字号:
;====================================================================
;	ROM Size     , HT82A821R = 2K	, last page = 0700H
;		       HT82A822R = 4K	, last page = 0F00H
;		       HT82A832R = 4K	, last page = 0F00H
;	If use HT82A821R
;		       #defined HT82A821R 1
;		       #defined HT82A822R 0
;	If use HT82A822R
;		       #defined HT82A821R 0
;		       #defined HT82A822R 1
;	If use HT82A832R
;		       #defined HT82A821R 0
;		       #defined HT82A822R 1
;		       #define	UseReportID	1
;====================================================================
;	Use ReportID , Report ID 1 = Volume HID control
;		       Report ID 3 = Transform Other Data
;====================================================================



;#define		HT82A821R	1
;#define		HT82A822R	0
#define		UseReportID	1

;IF	HT82A821R
;Descript		.Section   at   0700h		'code'
;ENDIF


;IF	HT82A822R
Descript		.Section   at   0F00h		'code'
;ENDIF

#define AUDIO_8K 0


control_read_table:
	device_desc_table:
	;;18 bytes
		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	03F03H	;vendor ID
;;		DW	03F48H
		DW  	004D9H  ;vendor ID = 004D9H
		DW	02832H	;product version ID (Sample Device)
		DW	00100H	;product version ID
		DW	00201H	;product string index , manufacturer string index
		DW	00103H	;number of configurations , serial number string index
	config_desc_table:
	;;9 bytes
		DW	00209H	;descriptor type (config descriptor) , size of descriptor
		DW	000D9H	;total length of descriptor (D9 H=217 bytes)
		DW	00104H	;index of this configuration , 4 interface
		DW	03F00H	;configuration string index
		DW	03F80H	;configuration attributes (bus supply)
		DW	03FFAH	;maxpower (500ma)
	Interface_Descriptor:
	    Interface0_descriptor:
	    standard_audio_control_interface_control:
	    ;;9 bytes
		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 (0 end point)
		DW	00001H	;interface protocol , interface sub-class (audio control)
		DW	03F00H	;x , interface string index
	    class_specific_audio_control_interface_descriptor:
	    ;;10 bytes	
	    	DW	0240AH	;descriptor type (CS_INTERFACE) , size of descriptor (10 bytes)
	    	DW	03F01H	;descriptor subtype (Header)
 	    	DW	00100H	;audio device class specification release number(1.00)
		;modify 2006-08-09
	    	DW	00046H	;total number of bytes for the class-specific audiocontrol interface descriptor
		;---------------------
	    	DW	00102H	;streaming interface number belongs to audio control interface , the number of streaming interface
	    	DW	03F02H	;Streaming interface number 2 belongs to this audio control interface. In Interface
	    	
	    da_input_terminal:
	    ;;12 bytes
		;;(ID=1)
	    	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)
	    lineout_terminal:
	    ;;9 bytes
	    	;;(ID=3)
	    	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	00200H	;sourceID(feature unit ID=0D) , associate terminal
	    	DW	03F00H	;index of this descriptor
	    feature_unit_line_out:
	    ;;10 bytes
	    	;;(ID=2)
	    	DW	0240AH	;descriptor type(CS_INTERFACE) , size of descriptor(10 bytes)
	    	DW	00206H	;UnitID , descriptorSubtype(FEATURE_UNIT)
	    	DW	00101H	;control size(1) , SourceID(input terminal 01)
	    	;---------------------
		;modify 2006-07-27	
	    	DW	00300H	;D1(volume)control is enable foe channel 1 , D0(mute) D1(volume) is enable for channel 0
	    	DW	00003H	;index of this descriptor , D1(volume)control is enable for channel 2
	    	;---------------------
	    analog_mic_input_terminal:
	    ;;12 bytes	
	    	;;(ID=5)
	    	DW	0240CH	;CS_INTERFACE , Size of this descriptor
	    	DW	00502H	;ID of this terminal , INPUT_TERMINAL subtype
	    	DW	00201H	;Terminal is microphone
	    	DW	00100H	;One channel , No Associated
	    	DW	00000H	;Mono sets no positions bit
	    	DW	00000H	;Unused , Unused
	    ad_output_terminal:
	    ;;9 bytes
	    	;;(ID=7)
	    	DW	02409H	;CS_INTERFACE , Size of this descriptor
	    	DW	00703H	;ID of this terminal , OUTPUT_TERMINAL subtype
	    	DW	00101H	;Terminal is USB streaming
	    	DW	00600H	;From Feature Unit(ID=6) , No Associate
	    	DW	03F00H	;Unused
	    feature_unit_record_volume:
	    ;;(ID=6)
	    ;;8 bytes	
	    	DW	02408H	;CS_INTERFACE , Size of this descriptor
	    	DW	00606H	;ID of this feature Unit , FEATURE_UNIT
	    	DW	00105H	;One byte Control Array , From analog_mic_input_terminal
	    	DW	00003H	;Unused , D0(Mute)D1(Volume) supported

	    Interface1_descriptor:
	    zero_bw:
	    ;;9 bytes	
	    	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:
	    ;;9 bytes	
	    	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:
	    ;;7 bytes
	    	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:
	    ;;11 bytes
	    	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)
	    if  AUDIO_8K
	    	DW	03F40H	;Sample Frequency(8000 Hz)
	    	DW	0001FH	;
	    else	
	    	DW	03F80H	;Sample Frequency(48000 Hz)
	    	DW	000BBH	;
	    endif	
	    end_point_descriptor:
	    ;;9 bytes
	    	DW	00509H	;descriptor type(END_POINT) , size of descriptor
	    	DW	00902H	;endpoint attributes(adaptive,isochronous) , endpoint2(out direction)
	    if  AUDIO_8K	
	    	DW	00020H	;maxPacketSize(32 bytes)
	    else
	    	DW	000C0H	;maxPacketSize(192 bytes)
	    endif	
	    	DW	00001H	;Refresh(0) , Interval(1ms)
	    	DW	03F00H	;index string of this descriptor
	    class_specific_endpoint_descriptor:
	    ;;7 bytes	
	    	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)

	    Inetrface2_descriptor:
	    ad_zero_bw:
	    ;;9 bytes
	    	DW	00409H	;INTERFACE descriptor , Size of this descriptor
	    	DW	00002H	;Index of this setting , Index of this interface
	    	DW	00100H	;AUDIO , 0 Endpoint
	    	DW	00002H	;Unused , AUDIO_STREAMING
	    	DW	03F00H	;null string
	    ad_audio_streaming_data:
	    ;;9 bytes
	    	DW	00409H	;INTERFACE , Size of this descriptor
	    	DW	00102H	;index of this setting , index of this interface
	    	DW	00101H	;AUDIO , 1 endpoint
	    	DW	00002H	;Unused , AUDIO_STREAMING
	    	DW	03F00H	;null string
	    ad_class_specific_audio_streaming_interface_descriptor:
	    ;;7 bytes
	    	DW	02407H	;CS_INTERFACE , Size of this descriptor
	    	DW	00701H	;Unit ID of terminal(Output terminal ID) , AS_GENERAL
	    	DW	03F01H	;Interface delay
	    	DW	00001H	;PCM format
	    ad_typeI_format_type:
	    ;;11 bytes
	    	DW	0240BH	;CS_INTERFACE , Size of this descriptor
	    	DW	00102H	;FORMAT_TYPE_I , FORMAT_TYPE
	    	DW	00201H	;two bytes per slot , one channel
	    	DW	00110H	;1 frequency , 16 bits
	    	DW	03F40H	;8000hZ
	    	DW	0001FH	;
	    ad_standard_endpoint_descriptor:
	    ;;9 bytes	
	    	DW	00509H	;ENFPOINT descriptor , Size of this descriptor
	    	DW	00183H	;(bmAttributes) Isochronous , asynchronous,not share , IN endpoint 3
		DW	00010H	;2bytes*8sample*1ch=16 byte/frame
		DW	00001H	;Unused , 1 packet every frame(must be set to 1)
		DW	03F00H	;Unused
	    ad_class_specific_isochronous_audio_data_endpoint_descriptor:
	    ;;7 bytes
	    	DW	02507H	;CS_ENDPOINT , Size of this descriptor
	    	DW	00001H	;no Sampling frequency control , no pitch control , no packet padding,EP_GENERAL
	    	DW	03F00H	;Unused
	    	DW	00000H	;Unused

	    Interface3_descriptor:
	    HID_class:
	    	DW	00409H	;INTERFACE descriptor , Size of this descriptor
	    	DW	00003H	;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 3 = Transform Other Data
	    	;====================================================================
	    	IF	UseReportID
	    	DW	00043H	;67 bytes
		ELSE
		DW	0001FH	;31 bytes
		ENDIF

	    HID_end_point_descriptor:
	    	DW	00507H	;Endpoint descriptor , Length of this descriptor
	    	DW	00381H	;Interrupt , Endpoint 1 In direction
	    	DW	00008H	;wMaxPacketSize = 8 Bytes
	    	DW	03F30H	;48ms Interval
	end_config_desc_table:

	hid_report_desc_table:
		DW	00C05H		;//Usage Page(Consumer)
		DW	00109H		;//Usage Page(Consumer Control)
		DW	001A1H		;//Collection(Application)

		IF UseReportID
		DW	00185H		;//Report_ID(01)
		ENDIF

		DW	00015H		;//Logic Minimum(0)
		DW	00125H		;//Logic Maximum(1)
		DW	03F09H		;//Usage(Volume Increment)
		DW	03FE9H		
		DW	03F09H		;//Usage(Volume Decrement)
		DW	03FEAH		
		DW	00175H		;//Report Size(1) : DataLength(1)bit
		DW	00295H		;//Report Count(2): Number of Data(INC,DEC)
		DW	02A81H		;//Input(Data,Variable,Absolute,No_Wrap,No_Preferred)
		DW	03F09H		;//Usage(Mute)
		DW	03FE2H		
		DW	00195H		;//Report Count(1)
		DW	02E81H		;//Input(Data,Variable,Relative,No_Wrap,No_preferred)
		DW	00595H		;//Report Count(5)

		;;Add By Ansonku . (add call playmedia)
		;;DW	

		DW	00181H		;//Input(Constant)
		DW	03FC0H		;//End Collection
		
;====================================================================
;	Use ReportID , Report ID 1 = Volume HID control
;		       Report ID 3 = Transform Other Data
;====================================================================		
		IF UseReportID
		;;vender defined
		DW	03F06H		;//Usage Page(Global)
		DW	03F00H
		DW	03FFFH		;//Usage Page



		DW	03F09H		;//Usage(Local 1 bytes)
		DW	03FA5H
		DW	001A1H		;//collection(Main)
		DW	00385H		;//Report_ID(03)
		;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	03F19H
		DW	03FB0H
		DW	03F29H
		DW	03FB6H
		DW	00875H		;//Report size (8 bits)
		DW	00795H		;//Report Count(7)
		DW	00291H		;//Main Output (Data,Variable,Absolute)
		DW	03FC0H		;End Collection
		ENDIF
	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	00314h, 00048h, 00054h, 00038h, 00032h, 00041h, 00038h,	00033h, 00032h, 00052h	;HT82A832R
		DW	00322h, 00048h, 0004fh, 0004ch, 00054h, 00045h, 0004bh, 00020h	;HOLTEK
		DW	00055h, 00053h, 00042h, 00020h					;USB
		DW	00050h, 00048h, 0004Fh, 0004Eh, 00045h				;PHONE
	
	isnumber_string:	;Serial Number
	USBStringDescription3:	
		DW	0030Ah, 00038h,	00033h, 00032h, 00052h	;832R


	config_desc_length:
		DW	000D9H
	report_desc_length:
		IF	UseReportID
		DW	00043H
		ELSE
		DW	0001FH
		ENDIF
		
	hid_desc_length:
		DW	00009H

	LogTable:
		
	 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
	 Public		LogTable

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -