Index: output/eeprom.dat
===================================================================
--- /YC1308AC/branch/mouse_project/XZR/dongle_16M_eeprom/output/eeprom.dat	(revision 726)
+++ /YC1308AC/branch/mouse_project/XZR/dongle_16M_eeprom/output/eeprom.dat	(working copy)
@@ -2,20 +2,24 @@
 02
 aa
 55
-ba
-00
+62
+01
 c2
 84
 00
-04
+05
 c0
 45
 80
-07
+08
 c0
-5d
-80
-16
+5e
+00
+21
+c0
+57
+00
+15
 20
 20
 13
@@ -23,11 +27,11 @@
 c0
 48
 00
-18
+42
 c0
 4a
 80
-28
+52
 20
 20
 13
@@ -81,25 +85,189 @@
 b8
 1e
 20
-40
-62
-3c
+60
+00
+00
+58
+00
+36
+4e
+67
+e1
+48
+89
+58
+00
+37
+01
+67
+e1
+48
+8d
+58
+00
+37
+12
+67
+e1
+48
+8f
+58
+00
+36
+f5
+67
+e1
+48
+8b
 58
 00
+36
+5b
+67
+e1
+0b
+45
+70
+48
+e9
+5b
+20
+20
+79
+9d
+6f
+e0
+c8
+bf
+c1
+80
+00
+00
+20
+40
+24
+91
+20
+40
+00
+26
+20
+20
+36
+f2
+20
+40
+36
+8a
+20
+40
+00
+29
+20
+20
+00
+35
+6f
+e0
+c9
+06
+20
+7a
+00
+00
+d8
+e0
+00
+0e
+20
+40
+7d
+74
+24
+7a
+00
+00
+70
+49
+06
+00
+d8
+a0
+0c
+0f
+df
+20
 00
+02
+20
+40
 7d
+17
+6f
+e4
+0c
+0f
+67
+e4
+48
+f2
 20
 20
-62
-2d
+36
+a2
+6f
+e0
+c9
+07
+20
+7a
+00
+00
+d8
+e0
+00
+0c
 20
 40
+7d
+74
+24
+7a
+00
+00
+70
+49
+07
 00
-14
+d8
+a0
+0c
+1f
+df
+20
+00
+02
+20
+40
+7d
+17
+70
+0c
+1f
+03
+6f
+e1
+8c
+1f
+67
+e1
+c8
+fd
 20
 20
 36
-b5
+b2
 79
 3f
 80
@@ -115,7 +283,7 @@
 c0
 00
 00
-1d
+47
 20
 20
 7a
@@ -139,7 +307,7 @@
 c0
 00
 80
-23
+4d
 20
 20
 7a
@@ -151,7 +319,7 @@
 c0
 04
 80
-26
+50
 20
 20
 7a
@@ -188,8 +356,8 @@
 20
 7c
 59
-62
-94
+1b
+cf
 aa
 55
 01
@@ -220,9 +388,9 @@
 55
 01
 00
-17
+15
+40
 40
-08
 aa
 55
 01
@@ -243,12 +411,12 @@
 00
 7b
 41
-11
+16
 55
 aa
 aa
 55
-7b
+b6
 0c
-d8
-2b
+56
+cc
Index: output/program.lis
===================================================================
--- /YC1308AC/branch/mouse_project/XZR/dongle_16M_eeprom/output/program.lis	(revision 726)
+++ /YC1308AC/branch/mouse_project/XZR/dongle_16M_eeprom/output/program.lis	(working copy)
@@ -1,69 +1,119 @@
               include "bt_format "
               org 0x0000
-0000 c2840004 bbit1 8 ,pf_patch_ext 
-0001 c0458007 beq patch11_3 ,p_initialize_radio_cont 
-0002 c05d8016 beq patch17_3 ,p_dongle_usb_dispatch 
-0003 2020137c branch loop 
+0000 c2840005 bbit1 8 ,pf_patch_ext 
+0001 c0458008 beq patch11_3 ,p_initialize_radio_cont 
+0002 c05e0021 beq patch17_4 ,p_dongle_work_mode_auto 
+0003 c0570015 beq patch15_6 ,p_app_init 
+0004 2020137c branch loop 
 
 pf_patch_ext:
-0004 c0480018 beq patch32_0 ,p_usb_class_type 
-0005 c04a8028 beq patch32_5 ,p_usb_tx 
-0006 2020137c branch loop 
+0005 c0480042 beq patch32_0 ,p_usb_class_type 
+0006 c04a8052 beq patch32_5 ,p_usb_tx 
+0007 2020137c branch loop 
 
 p_initialize_radio_cont:
-0007 7041eaff jam 0xff ,mem_gain_fix 
-0008 204012d1 call init_lpm_ctrl 
-0009 20000064 nop 100 
-000a 708a0e0b jam 0x0b ,core_rf_ldo_cfg2 
-000b 708a0f05 jam 0x05 ,core_rf_ldo_cfg3 
-000c 708a8390 jam 0x90 ,core_syn_pfd_lkd_cfg 
-000d 70896876 jam 0x76 ,core_agc_wb_sat_th 
-000e 70896976 jam 0x76 ,core_agc_nb_sat_th 
-000f 20401256 call initialize_radio_cont + 1 
-0010 d8406978 arg 0x6978 ,temp 
-0011 20402320 call g24_rx_window_store 
-0012 7048b81e jam 0x1e ,mem_24g_hop_interval 
-0013 2040623c call wdt_set_enable 
-
-p_wdt_kick:
-0014 5800007d setarg 125 
-0015 2020622d branch wdt_init_config 
-
-p_dongle_usb_dispatch:
-0016 20400014 call p_wdt_kick 
-0017 202036b5 branch dongle_usb_dispatch + 1 
+0008 7041eaff jam 0xff ,mem_gain_fix 
+0009 204012d1 call init_lpm_ctrl 
+000a 20000064 nop 100 
+000b 708a0e0b jam 0x0b ,core_rf_ldo_cfg2 
+000c 708a0f05 jam 0x05 ,core_rf_ldo_cfg3 
+000d 708a8390 jam 0x90 ,core_syn_pfd_lkd_cfg 
+000e 70896876 jam 0x76 ,core_agc_wb_sat_th 
+000f 70896976 jam 0x76 ,core_agc_nb_sat_th 
+0010 20401256 call initialize_radio_cont + 1 
+0011 d8406978 arg 0x6978 ,temp 
+0012 20402320 call g24_rx_window_store 
+0013 7048b81e jam 0x1e ,mem_24g_hop_interval 
+0014 20600000 rtn 
+
+p_app_init:
+
+p_dongle_init:
+0015 5800364e setarg dongle_dispatch 
+0016 67e14889 store 2 ,mem_cb_24g_receive_process 
+0017 58003701 setarg dongle_g24_mouse 
+0018 67e1488d store 2 ,mem_cb_24g_data_device1 
+0019 58003712 setarg dongle_g24_kb 
+001a 67e1488f store 2 ,mem_cb_24g_data_device2 
+001b 580036f5 setarg dongle_ackpayload_prep 
+001c 67e1488b store 2 ,mem_cb_24g_ackpayload 
+001d 5800365b setarg dongle_usb_config 
+001e 67e10b45 store 2 ,mem_cb_usb_config 
+001f 7048e95b jam dongle_kb_bind_success ,mem_dg_kb_bind_flag 
+0020 2020799d branch usb_init 
+
+p_dongle_work_mode_auto:
+0021 6fe0c8bf fetch 1 ,mem_24g_work_mode 
+0022 c1800000 rtnne dongle_work 
+0023 20402491 call g24_work_mode_start 
+0024 20400026 call p_dongle_g24_blank_data_process 
+0025 202036f2 branch dongle_work_mode_auto + 5 
+
+p_dongle_g24_blank_data_process:
+0026 2040368a call dongle_g24_ms_blank_data 
+0027 20400029 call p_dongle_g24_kb_blank_data 
+0028 20200035 branch p_dongle_g24_kb_mul_blank_data 
+
+p_dongle_g24_kb_blank_data:
+0029 6fe0c906 fetch 1 ,mem_dg_kb_blank_data_enable 
+002a 207a0000 rtn blank 
+002b d8e0000e arg timer_kb_blank ,queue 
+002c 20407d74 call timer_check 
+002d 247a0000 nrtn blank 
+002e 70490600 jam 0 ,mem_dg_kb_blank_data_enable 
+002f d8a00c0f arg mem_usb_kb_data ,contw 
+0030 df200002 arg 2 ,loopcnt 
+0031 20407d17 call memset0 
+0032 6fe40c0f fetch 8 ,mem_usb_kb_data 
+0033 67e448f2 store 8 ,mem_dg_kb_data_last_data 
+0034 202036a2 branch dongle_usb_tx_kb_data 
+
+p_dongle_g24_kb_mul_blank_data:
+0035 6fe0c907 fetch 1 ,mem_dg_kb_mul_blank_data_enable 
+0036 207a0000 rtn blank 
+0037 d8e0000c arg timer_kb_mul_blank ,queue 
+0038 20407d74 call timer_check 
+0039 247a0000 nrtn blank 
+003a 70490700 jam 0 ,mem_dg_kb_mul_blank_data_enable 
+003b d8a00c1f arg mem_usb_kb_multikey ,contw 
+003c df200002 arg 2 ,loopcnt 
+003d 20407d17 call memset0 
+003e 700c1f03 jam kb_multikey_report_id ,mem_usb_kb_multikey 
+003f 6fe18c1f fetch 3 ,mem_usb_kb_multikey 
+0040 67e1c8fd store 3 ,mem_dg_kb_multikey_last_data 
+0041 202036b2 branch dongle_usb_tx_multikey_data 
 
 p_usb_class_type:
-0018 793f8023 set0 mark_isstr ,mark 
-0019 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
-001a 1fe17e80 and_into 0x80 ,pdata 
-001b c000001d beq out_device ,p_usb_out_device 
-001c 20207a34 branch usb_class_type + 4 
+0042 793f8023 set0 mark_isstr ,mark 
+0043 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
+0044 1fe17e80 and_into 0x80 ,pdata 
+0045 c0000047 beq out_device ,p_usb_out_device 
+0046 20207a34 branch usb_class_type + 4 
 
 p_usb_out_device:
-001d 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
-001e 1ff1fe00 rshift4 pdata ,pdata 
-001f 1fe37e00 rshift pdata ,pdata 
-0020 1fe17e03 and_into 0x03 ,pdata 
-0021 c0008023 beq class_req ,p_usb_out_class_req 
-0022 20207a43 branch usb_out_device + 4 
+0047 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
+0048 1ff1fe00 rshift4 pdata ,pdata 
+0049 1fe37e00 rshift pdata ,pdata 
+004a 1fe17e03 and_into 0x03 ,pdata 
+004b c000804d beq class_req ,p_usb_out_class_req 
+004c 20207a43 branch usb_out_device + 4 
 
 p_usb_out_class_req:
-0023 6fe08b5a fetch 1 ,mem_usb_setup_brequest 
-0024 c0048026 beq set_report ,p_usb_set_report 
-0025 20207a5c branch usb_out_class_req + 1 
+004d 6fe08b5a fetch 1 ,mem_usb_setup_brequest 
+004e c0048050 beq set_report ,p_usb_set_report 
+004f 20207a5c branch usb_out_class_req + 1 
 
 p_usb_set_report:
-0026 20003a98 nop 15000 
-0027 20207bd8 branch usb_set_report 
+0050 20003a98 nop 15000 
+0051 20207bd8 branch usb_set_report 
 
 p_usb_tx:
-0028 6fe08bf9 fetch 1 ,mem_usb_tx_enable 
-0029 207a0000 rtn blank 
-002a 6ff08c24 fetch 1 ,core_usb_txbusy 
-002b 1fe17e0f and_into 0x0f ,pdata 
-002c 243a7ca4 nbranch usb_inwake_state_tx_dispose ,blank 
-002d 20207c59 branch usb_tx + 3 
+0052 6fe08bf9 fetch 1 ,mem_usb_tx_enable 
+0053 207a0000 rtn blank 
+0054 6ff08c24 fetch 1 ,core_usb_txbusy 
+0055 1fe17e0f and_into 0x0f ,pdata 
+0056 243a7ca4 nbranch usb_inwake_state_tx_dispose ,blank 
+0057 20207c59 branch usb_tx + 3 
               org 0x800
 
 start:
Index: program/patch.prog
===================================================================
--- /YC1308AC/branch/mouse_project/XZR/dongle_16M_eeprom/program/patch.prog	(revision 726)
+++ /YC1308AC/branch/mouse_project/XZR/dongle_16M_eeprom/program/patch.prog	(working copy)
@@ -1,8 +1,9 @@
 
 	bbit1 8,pf_patch_ext
 	beq patch11_3,p_initialize_radio_cont
-	beq patch17_3,p_dongle_usb_dispatch
-//	beq patch17_4,p_dongle_work_mode_auto
+//	beq patch17_3,p_dongle_usb_dispatch
+	beq patch17_4,p_dongle_work_mode_auto
+	beq patch15_6,p_app_init
 	branch loop
 
 pf_patch_ext:
@@ -35,24 +36,42 @@
 	call g24_rx_window_store
 	//config hop interval
 	jam 0x1e,mem_24g_hop_interval
-
+	rtn
 
 	//watch dog enable
-	call wdt_set_enable
-p_wdt_kick:
-	//about 128ms
-	setarg 125
-	branch wdt_init_config
+//	call wdt_set_enable
+//p_wdt_kick:
+//	//about 128ms
+//	setarg 125
+//	branch wdt_init_config
 
 
 /********************add wdt************************/
-p_dongle_usb_dispatch:
-	call p_wdt_kick
-	branch dongle_usb_dispatch+1
+//p_dongle_usb_dispatch:
+//	call p_wdt_kick
+//	branch dongle_usb_dispatch+1
+
+p_app_init:
+p_dongle_init:
+	setarg dongle_dispatch
+	store 2,mem_cb_24g_receive_process
+	setarg dongle_g24_mouse
+	store 2,mem_cb_24g_data_device1
+	setarg dongle_g24_kb
+	store 2,mem_cb_24g_data_device2
+	setarg dongle_ackpayload_prep
+	store 2,mem_cb_24g_ackpayload
+
+	setarg dongle_usb_config
+	store 2,mem_cb_usb_config
+
+	jam DONGLE_KB_BIND_SUCCESS,mem_dg_kb_bind_flag
+	branch usb_init
+
 
 
 /************************keyboard blank patch**********//
-/*
+
 p_dongle_work_mode_auto:
 	fetch 1,mem_24g_work_mode
 	rtnne DONGLE_WORK
@@ -94,7 +113,7 @@
 	fetch 3,mem_usb_kb_multikey
 	store 3,mem_dg_kb_multikey_last_data	
 	branch dongle_usb_tx_multikey_data
-*/	
+	
 
 /************************keyboard led patch**********/
 p_usb_class_type:
Index: sched/dongle.dat
===================================================================
--- /YC1308AC/branch/mouse_project/XZR/dongle_16M_eeprom/sched/dongle.dat	(revision 726)
+++ /YC1308AC/branch/mouse_project/XZR/dongle_16M_eeprom/sched/dongle.dat	(working copy)
@@ -55,12 +55,13 @@
 
 
 mem_patch11:08
-mem_patch17:08
+#mem_patch17:08
+mem_patch15:40
 mem_patch32:21
 
 #with eeprom
 mem_device_option:04
-mem_lpm_ctrim:11	#xtal offset
+mem_lpm_ctrim:16	#xtal offset +2k
 #ce	#mem_lpm_padding
 #70	#mem_lpm_xtalcnt
 #mem_dig_aon_vsel:00
