Index: output/eeprom.dat
===================================================================
--- /YC1308AC/branch/mouse_project/YDN_Project/usb_16M/output/eeprom.dat	(revision 581)
+++ /YC1308AC/branch/mouse_project/YDN_Project/usb_16M/output/eeprom.dat	(working copy)
@@ -2,28 +2,32 @@
 02
 aa
 55
-52
+9e
 01
 c2
 84
 00
-06
+07
+c0
+41
+80
+1b
 c0
 45
 80
-09
+11
 c0
 57
 00
-11
+24
 c0
 5d
 80
-1a
+2d
 c0
 5e
 00
-1c
+2f
 20
 20
 13
@@ -31,17 +35,45 @@
 c0
 48
 00
-3d
+50
 c0
 4a
 80
-4e
+61
+c0
+54
+80
+0b
 20
 20
 13
 7c
 20
 40
+16
+a6
+70
+8a
+6d
+89
+6f
+f0
+8a
+43
+1f
+e1
+fe
+0f
+67
+f0
+8a
+43
+20
+60
+00
+00
+20
+40
 12
 d1
 20
@@ -61,6 +93,14 @@
 83
 90
 70
+8a
+85
+00
+70
+89
+21
+40
+70
 89
 68
 76
@@ -72,6 +112,42 @@
 20
 12
 56
+70
+89
+00
+05
+20
+00
+00
+02
+70
+89
+00
+00
+6f
+e0
+c0
+c5
+c0
+0c
+11
+68
+c0
+04
+00
+22
+20
+20
+11
+68
+70
+8a
+87
+29
+20
+20
+11
+7d
 d8
 40
 aa
@@ -111,7 +187,7 @@
 20
 40
 00
-18
+2b
 20
 20
 36
@@ -131,7 +207,7 @@
 20
 40
 00
-21
+34
 20
 20
 36
@@ -143,11 +219,11 @@
 20
 40
 00
-24
+37
 20
 20
 00
-30
+43
 6f
 e0
 c9
@@ -263,7 +339,7 @@
 c0
 00
 00
-42
+55
 20
 20
 7a
@@ -291,7 +367,7 @@
 c0
 00
 80
-49
+5c
 20
 20
 7a
@@ -303,7 +379,7 @@
 c0
 04
 80
-4c
+5f
 20
 20
 7a
@@ -340,8 +416,8 @@
 20
 7c
 59
-06
-2e
+5f
+4a
 aa
 55
 40
@@ -364,7 +440,7 @@
 00
 00
 00
-00
+08
 08
 00
 00
@@ -401,7 +477,7 @@
 21
 00
 00
-00
+02
 00
 00
 00
@@ -530,7 +606,7 @@
 aa
 aa
 55
-bc
+c6
 22
-e3
-a3
+01
+9e
Index: output/program.lis
===================================================================
--- /YC1308AC/branch/mouse_project/YDN_Project/usb_16M/output/program.lis	(revision 581)
+++ /YC1308AC/branch/mouse_project/YDN_Project/usb_16M/output/program.lis	(working copy)
@@ -1,117 +1,142 @@
               include "bt_format "
               org 0x0000
-0000 c2840006 bbit1 8 ,pf_patch_ext 
-0001 c0458009 beq patch11_3 ,p_initialize_radio_cont 
-0002 c0570011 beq patch15_6 ,p_app_init 
-0003 c05d801a beq patch17_3 ,p_dongle_usb_dispatch 
-0004 c05e001c beq patch17_4 ,p_dongle_work_mode_auto 
-0005 2020137c branch loop 
+0000 c2840007 bbit1 8 ,pf_patch_ext 
+0001 c041801b beq patch10_3 ,p_set_sync_on 
+0002 c0458011 beq patch11_3 ,p_initialize_radio_cont 
+0003 c0570024 beq patch15_6 ,p_app_init 
+0004 c05d802d beq patch17_3 ,p_dongle_usb_dispatch 
+0005 c05e002f beq patch17_4 ,p_dongle_work_mode_auto 
+0006 2020137c branch loop 
 
 pf_patch_ext:
-0006 c048003d beq patch32_0 ,p_usb_class_type 
-0007 c04a804e beq patch32_5 ,p_usb_tx 
-0008 2020137c branch loop 
+0007 c0480050 beq patch32_0 ,p_usb_class_type 
+0008 c04a8061 beq patch32_5 ,p_usb_tx 
+0009 c054800b beq patch35_1 ,p_le_enable 
+000a 2020137c branch loop 
+
+p_le_enable:
+000b 204016a6 call le_enable + 1 
+000c 708a6d89 jam 0x89 ,core_rx_bq_cfg0 
+000d 6ff08a43 fetch 1 ,core_syn_cal_ctrl 
+000e 1fe1fe0f or pdata ,0x0f ,pdata 
+000f 67f08a43 store 1 ,core_syn_cal_ctrl 
+0010 20600000 rtn 
 
 p_initialize_radio_cont:
-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 20201256 branch initialize_radio_cont + 1 
+0011 204012d1 call init_lpm_ctrl 
+0012 20000064 nop 100 
+0013 708a0e0b jam 0x0b ,core_rf_ldo_cfg2 
+0014 708a0f05 jam 0x05 ,core_rf_ldo_cfg3 
+0015 708a8390 jam 0x90 ,core_syn_pfd_lkd_cfg 
+0016 708a8500 jam 0x00 ,core_syn_loopdiv_dsm_cfg 
+0017 70892140 jam 0x40 ,0x8921 
+0018 70896876 jam 0x76 ,core_agc_wb_sat_th 
+0019 70896976 jam 0x76 ,core_agc_nb_sat_th 
+001a 20201256 branch initialize_radio_cont + 1 
+
+p_set_sync_on:
+001b 70890005 jam 0x5 ,modem_en 
+001c 20000002 nop 2 
+001d 70890000 jam 0x0 ,modem_en 
+001e 6fe0c0c5 fetch 1 ,mem_fcomp_div 
+001f c00c1168 beq xtal_24m ,set_sync_on_24m 
+0020 c0040022 beq xtal_16m ,p_set_sync_on_16m 
+0021 20201168 branch set_sync_on_24m 
+
+p_set_sync_on_16m:
+0022 708a8729 jam 0x29 ,core_syn_afc_cfg1 
+0023 2020117d branch set_sync_on_16m 
 
 p_app_init:
-0011 d840aa00 arg 0xaa00 ,temp 
-0012 20402320 call g24_rx_window_store 
-0013 70486402 jam 0x02 ,mem_24g_rx_phy 
-0014 70486502 jam 0x02 ,mem_24g_tx_phy 
-0015 70487b4a jam 0x4a ,mem_24g_pair_ch 
-0016 20403620 call dongle_init 
-0017 2040623c call wdt_set_enable 
+0024 d840aa00 arg 0xaa00 ,temp 
+0025 20402320 call g24_rx_window_store 
+0026 70486402 jam 0x02 ,mem_24g_rx_phy 
+0027 70486502 jam 0x02 ,mem_24g_tx_phy 
+0028 70487b4a jam 0x4a ,mem_24g_pair_ch 
+0029 20403620 call dongle_init 
+002a 2040623c call wdt_set_enable 
 
 p_wdt_kick:
-0018 5800007d setarg 125 
-0019 2020622d branch wdt_init_config 
+002b 5800007d setarg 125 
+002c 2020622d branch wdt_init_config 
 
 p_dongle_usb_dispatch:
-001a 20400018 call p_wdt_kick 
-001b 202036b5 branch dongle_usb_dispatch + 1 
+002d 2040002b call p_wdt_kick 
+002e 202036b5 branch dongle_usb_dispatch + 1 
 
 p_dongle_work_mode_auto:
-001c 6fe0c8bf fetch 1 ,mem_24g_work_mode 
-001d c1800000 rtnne dongle_work 
-001e 20402491 call g24_work_mode_start 
-001f 20400021 call p_dongle_g24_blank_data_process 
-0020 202036f2 branch dongle_work_mode_auto + 5 
+002f 6fe0c8bf fetch 1 ,mem_24g_work_mode 
+0030 c1800000 rtnne dongle_work 
+0031 20402491 call g24_work_mode_start 
+0032 20400034 call p_dongle_g24_blank_data_process 
+0033 202036f2 branch dongle_work_mode_auto + 5 
 
 p_dongle_g24_blank_data_process:
-0021 2040368a call dongle_g24_ms_blank_data 
-0022 20400024 call p_dongle_g24_kb_blank_data 
-0023 20200030 branch p_dongle_g24_kb_mul_blank_data 
+0034 2040368a call dongle_g24_ms_blank_data 
+0035 20400037 call p_dongle_g24_kb_blank_data 
+0036 20200043 branch p_dongle_g24_kb_mul_blank_data 
 
 p_dongle_g24_kb_blank_data:
-0024 6fe0c906 fetch 1 ,mem_dg_kb_blank_data_enable 
-0025 207a0000 rtn blank 
-0026 d8e0000e arg timer_kb_blank ,queue 
-0027 20407d74 call timer_check 
-0028 247a0000 nrtn blank 
-0029 70490600 jam 0 ,mem_dg_kb_blank_data_enable 
-002a d8a00c0f arg mem_usb_kb_data ,contw 
-002b df200002 arg 2 ,loopcnt 
-002c 20407d17 call memset0 
-002d 6fe40c0f fetch 8 ,mem_usb_kb_data 
-002e 67e448f2 store 8 ,mem_dg_kb_data_last_data 
-002f 202036a2 branch dongle_usb_tx_kb_data 
+0037 6fe0c906 fetch 1 ,mem_dg_kb_blank_data_enable 
+0038 207a0000 rtn blank 
+0039 d8e0000e arg timer_kb_blank ,queue 
+003a 20407d74 call timer_check 
+003b 247a0000 nrtn blank 
+003c 70490600 jam 0 ,mem_dg_kb_blank_data_enable 
+003d d8a00c0f arg mem_usb_kb_data ,contw 
+003e df200002 arg 2 ,loopcnt 
+003f 20407d17 call memset0 
+0040 6fe40c0f fetch 8 ,mem_usb_kb_data 
+0041 67e448f2 store 8 ,mem_dg_kb_data_last_data 
+0042 202036a2 branch dongle_usb_tx_kb_data 
 
 p_dongle_g24_kb_mul_blank_data:
-0030 6fe0c907 fetch 1 ,mem_dg_kb_mul_blank_data_enable 
-0031 207a0000 rtn blank 
-0032 d8e0000c arg timer_kb_mul_blank ,queue 
-0033 20407d74 call timer_check 
-0034 247a0000 nrtn blank 
-0035 70490700 jam 0 ,mem_dg_kb_mul_blank_data_enable 
-0036 d8a00c1f arg mem_usb_kb_multikey ,contw 
-0037 df200002 arg 2 ,loopcnt 
-0038 20407d17 call memset0 
-0039 700c1f03 jam kb_multikey_report_id ,mem_usb_kb_multikey 
-003a 6fe18c1f fetch 3 ,mem_usb_kb_multikey 
-003b 67e1c8fd store 3 ,mem_dg_kb_multikey_last_data 
-003c 202036b2 branch dongle_usb_tx_multikey_data 
+0043 6fe0c907 fetch 1 ,mem_dg_kb_mul_blank_data_enable 
+0044 207a0000 rtn blank 
+0045 d8e0000c arg timer_kb_mul_blank ,queue 
+0046 20407d74 call timer_check 
+0047 247a0000 nrtn blank 
+0048 70490700 jam 0 ,mem_dg_kb_mul_blank_data_enable 
+0049 d8a00c1f arg mem_usb_kb_multikey ,contw 
+004a df200002 arg 2 ,loopcnt 
+004b 20407d17 call memset0 
+004c 700c1f03 jam kb_multikey_report_id ,mem_usb_kb_multikey 
+004d 6fe18c1f fetch 3 ,mem_usb_kb_multikey 
+004e 67e1c8fd store 3 ,mem_dg_kb_multikey_last_data 
+004f 202036b2 branch dongle_usb_tx_multikey_data 
 
 p_usb_class_type:
-003d 793f8023 set0 mark_isstr ,mark 
-003e 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
-003f 1fe17e80 and_into 0x80 ,pdata 
-0040 c0000042 beq out_device ,p_usb_out_device 
-0041 20207a34 branch usb_class_type + 4 
+0050 793f8023 set0 mark_isstr ,mark 
+0051 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
+0052 1fe17e80 and_into 0x80 ,pdata 
+0053 c0000055 beq out_device ,p_usb_out_device 
+0054 20207a34 branch usb_class_type + 4 
 
 p_usb_out_device:
-0042 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
-0043 1ff1fe00 rshift4 pdata ,pdata 
-0044 1fe37e00 rshift pdata ,pdata 
-0045 1fe17e03 and_into 0x03 ,pdata 
-0046 c0007a53 beq standard_req ,usb_out_standard_req 
-0047 c0008049 beq class_req ,p_usb_out_class_req 
-0048 20207a43 branch usb_out_device + 4 
+0055 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
+0056 1ff1fe00 rshift4 pdata ,pdata 
+0057 1fe37e00 rshift pdata ,pdata 
+0058 1fe17e03 and_into 0x03 ,pdata 
+0059 c0007a53 beq standard_req ,usb_out_standard_req 
+005a c000805c beq class_req ,p_usb_out_class_req 
+005b 20207a43 branch usb_out_device + 4 
 
 p_usb_out_class_req:
-0049 6fe08b5a fetch 1 ,mem_usb_setup_brequest 
-004a c004804c beq set_report ,p_usb_set_report 
-004b 20207a5c branch usb_out_class_req + 1 
+005c 6fe08b5a fetch 1 ,mem_usb_setup_brequest 
+005d c004805f beq set_report ,p_usb_set_report 
+005e 20207a5c branch usb_out_class_req + 1 
 
 p_usb_set_report:
-004c 20003a98 nop 15000 
-004d 20207bd8 branch usb_set_report 
+005f 20003a98 nop 15000 
+0060 20207bd8 branch usb_set_report 
 
 p_usb_tx:
-004e 6fe08bf9 fetch 1 ,mem_usb_tx_enable 
-004f 207a0000 rtn blank 
-0050 6ff08c24 fetch 1 ,core_usb_txbusy 
-0051 1fe17e0f and_into 0x0f ,pdata 
-0052 243a7ca4 nbranch usb_inwake_state_tx_dispose ,blank 
-0053 20207c59 branch usb_tx + 3 
+0061 6fe08bf9 fetch 1 ,mem_usb_tx_enable 
+0062 207a0000 rtn blank 
+0063 6ff08c24 fetch 1 ,core_usb_txbusy 
+0064 1fe17e0f and_into 0x0f ,pdata 
+0065 243a7ca4 nbranch usb_inwake_state_tx_dispose ,blank 
+0066 20207c59 branch usb_tx + 3 
               org 0x800
 
 start:
Index: program/patch.prog
===================================================================
--- /YC1308AC/branch/mouse_project/YDN_Project/usb_16M/program/patch.prog	(revision 581)
+++ /YC1308AC/branch/mouse_project/YDN_Project/usb_16M/program/patch.prog	(working copy)
@@ -1,5 +1,6 @@
 
 	bbit1 8,pf_patch_ext
+	beq patch10_3,p_set_sync_on
 	beq patch11_3,p_initialize_radio_cont
 	beq patch15_6,p_app_init
 	beq patch17_3,p_dongle_usb_dispatch
@@ -9,7 +10,15 @@
 pf_patch_ext:
 	beq patch32_0,p_usb_class_type
 	beq patch32_5,p_usb_tx
+	beq patch35_1,p_le_enable
 	branch loop
+p_le_enable:
+	call le_enable+1
+	jam 0x89,core_rx_bq_cfg0
+	fetch 1,core_syn_cal_ctrl
+	or pdata,0x0f,pdata
+	store 1,core_syn_cal_ctrl
+	rtn
 	
 
 
@@ -24,12 +33,26 @@
 	jam 0x05,core_rf_ldo_cfg3
 	jam 0x90,core_syn_pfd_lkd_cfg
 
+	jam 0x00,core_syn_loopdiv_dsm_cfg
+	jam 0x40,0x8921
 	//Improve auto agc
 	jam 0x76,core_agc_wb_sat_th
 	jam 0x76,core_agc_nb_sat_th
 
 	branch initialize_radio_cont+1
 
+p_set_sync_on:
+	jam 0x5,modem_en
+	nop 2
+	jam 0x0,modem_en					/* if called from tx or rx */
+	fetch 1,mem_fcomp_div
+	beq XTAL_24M,set_sync_on_24m
+	beq XTAL_16M,p_set_sync_on_16m
+	branch set_sync_on_24m
+
+p_set_sync_on_16m:
+	jam 0x29,core_syn_afc_cfg1
+	branch set_sync_on_16m
 
 p_app_init:
 /********************dongle rx window patch************************/
