Index: output/eeprom.dat
===================================================================
--- /YC1308AC/branch/mouse_project/YDN_Project/usb_16M_Allpowerful/output/eeprom.dat	(revision 605)
+++ /YC1308AC/branch/mouse_project/YDN_Project/usb_16M_Allpowerful/output/eeprom.dat	(working copy)
@@ -2,8 +2,8 @@
 02
 aa
 55
-9a
-01
+12
+02
 c2
 84
 00
@@ -11,7 +11,7 @@
 c0
 41
 80
-1b
+29
 c0
 45
 80
@@ -19,15 +19,15 @@
 c0
 57
 00
-24
+32
 c0
 5d
 80
-2c
+3a
 c0
 5e
 00
-2e
+4c
 20
 20
 13
@@ -35,11 +35,11 @@
 c0
 48
 00
-4f
+6d
 c0
 4a
 80
-60
+7e
 c0
 54
 80
@@ -108,10 +108,66 @@
 89
 69
 76
+70
+8a
+8b
+e6
 20
+40
+12
+6a
+20
+40
+12
+71
 20
+40
 12
-56
+77
+70
+8a
+6d
+09
+70
+8a
+03
+05
+70
+8a
+7a
+94
+6f
+e0
+c0
+c5
+c0
+84
+12
+60
+70
+8a
+08
+34
+70
+8a
+01
+ff
+20
+00
+00
+64
+70
+8a
+02
+0e
+70
+8a
+00
+03
+20
+20
+12
+65
 70
 89
 00
@@ -135,7 +191,7 @@
 c0
 04
 00
-22
+30
 20
 20
 11
@@ -166,8 +222,8 @@
 02
 20
 40
-36
-20
+00
+3c
 20
 40
 62
@@ -183,11 +239,75 @@
 20
 40
 00
-2a
+38
 20
 20
 36
 b5
+58
+00
+00
+3f
+67
+e1
+48
+89
+20
+20
+36
+22
+6f
+e0
+c8
+b9
+c0
+00
+36
+e6
+c0
+00
+b6
+82
+c0
+07
+80
+44
+20
+60
+00
+00
+58
+00
+00
+85
+67
+e0
+c1
+e8
+67
+e0
+c8
+cc
+20
+40
+00
+49
+20
+20
+36
+7e
+70
+8a
+39
+5b
+70
+8a
+3a
+03
+20
+20
+12
+2a
 6f
 e0
 c8
@@ -203,7 +323,7 @@
 20
 40
 00
-33
+51
 20
 20
 36
@@ -215,11 +335,11 @@
 20
 40
 00
-36
+54
 20
 20
 00
-42
+60
 6f
 e0
 c9
@@ -335,7 +455,7 @@
 c0
 00
 00
-54
+72
 20
 20
 7a
@@ -363,7 +483,7 @@
 c0
 00
 80
-5b
+79
 20
 20
 7a
@@ -375,7 +495,7 @@
 c0
 04
 80
-5e
+7c
 20
 20
 7a
@@ -412,8 +532,8 @@
 20
 7c
 59
-eb
-1d
+85
+ef
 aa
 55
 40
@@ -585,5 +705,5 @@
 55
 76
 1b
-ef
-ce
+d5
+57
Index: output/program.lis
===================================================================
--- /YC1308AC/branch/mouse_project/YDN_Project/usb_16M_Allpowerful/output/program.lis	(revision 605)
+++ /YC1308AC/branch/mouse_project/YDN_Project/usb_16M_Allpowerful/output/program.lis	(working copy)
@@ -1,16 +1,16 @@
               include "bt_format "
               org 0x0000
 0000 c2840007 bbit1 8 ,pf_patch_ext 
-0001 c041801b beq patch10_3 ,p_set_sync_on 
+0001 c0418029 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 c05d802c beq patch17_3 ,p_dongle_usb_dispatch 
-0005 c05e002e beq patch17_4 ,p_dongle_work_mode_auto 
+0003 c0570032 beq patch15_6 ,p_app_init 
+0004 c05d803a beq patch17_3 ,p_dongle_usb_dispatch 
+0005 c05e004c beq patch17_4 ,p_dongle_work_mode_auto 
 0006 2020137c branch loop 
 
 pf_patch_ext:
-0007 c048004f beq patch32_0 ,p_usb_class_type 
-0008 c04a8060 beq patch32_5 ,p_usb_tx 
+0007 c048006d beq patch32_0 ,p_usb_class_type 
+0008 c04a807e beq patch32_5 ,p_usb_tx 
 0009 c054800b beq patch35_1 ,p_le_enable 
 000a 2020137c branch loop 
 
@@ -32,110 +32,150 @@
 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 
+001a 708a8be6 jam 0xe6 ,core_syn_aac_cfg1 
+001b 2040126a call initialize_syn_afc_cfg1 
+001c 20401271 call initialize_rf_ldo_cfg1 
+001d 20401277 call initialize_rc_cal 
+001e 708a6d09 jam 0x09 ,core_rx_bq_cfg0 
+001f 708a0305 jam 5 ,core_clkpll_cfg0 
+0020 708a7a94 jam 0x94 ,core_rx_iqadc_cfg 
+0021 6fe0c0c5 fetch 1 ,mem_fcomp_div 
+0022 c0841260 bne xtal_16m ,initialize_radio_cont_next 
+0023 708a0834 jam 0x34 ,core_clkpll_cfg5 
+
+p_initialize_radio_cont_next:
+0024 708a01ff jam 0xff ,core_clkpll_ctrl1 
+0025 20000064 nop 100 
+0026 708a020e jam 0x0e ,core_clkpll_ctrl2 
+0027 708a0003 jam 0x03 ,core_clkpll_ctrl0 
+0028 20201265 branch initialize_radio_cont_next + 5 
 
 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 
+0029 70890005 jam 0x5 ,modem_en 
+002a 20000002 nop 2 
+002b 70890000 jam 0x0 ,modem_en 
+002c 6fe0c0c5 fetch 1 ,mem_fcomp_div 
+002d c00c1168 beq xtal_24m ,set_sync_on_24m 
+002e c0040030 beq xtal_16m ,p_set_sync_on_16m 
+002f 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 
+0030 708a8729 jam 0x29 ,core_syn_afc_cfg1 
+0031 2020117d branch set_sync_on_16m 
 
 p_app_init:
-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 20403620 call dongle_init 
-0029 2040623c call wdt_set_enable 
+0032 d840aa00 arg 0xaa00 ,temp 
+0033 20402320 call g24_rx_window_store 
+0034 70486402 jam 0x02 ,mem_24g_rx_phy 
+0035 70486502 jam 0x02 ,mem_24g_tx_phy 
+0036 2040003c call p_dongle_init 
+0037 2040623c call wdt_set_enable 
 
 p_wdt_kick:
-002a 5800007d setarg 125 
-002b 2020622d branch wdt_init_config 
+0038 5800007d setarg 125 
+0039 2020622d branch wdt_init_config 
 
 p_dongle_usb_dispatch:
-002c 2040002a call p_wdt_kick 
-002d 202036b5 branch dongle_usb_dispatch + 1 
+003a 20400038 call p_wdt_kick 
+003b 202036b5 branch dongle_usb_dispatch + 1 
+
+p_dongle_init:
+003c 5800003f setarg p_dongle_dispatch 
+003d 67e14889 store 2 ,mem_cb_24g_receive_process 
+003e 20203622 branch dongle_init + 2 
+
+p_dongle_dispatch:
+003f 6fe0c8b9 fetch 1 ,mem_24g_pair_mode 
+0040 c00036e6 beq 0x00 ,dongle_auto_bind 
+0041 c000b682 beq 0x01 ,dongle_pc_bind 
+0042 c0078044 beq 0x0f ,p_dongle_all_powerful 
+0043 20600000 rtn 
+
+p_dongle_all_powerful:
+0044 58000085 setarg tx_power_f5db 
+0045 67e0c1e8 store 1 ,mem_tx_power 
+0046 67e0c8cc store 1 ,mem_tx_power_temp 
+0047 20400049 call p_set_tx_power_f10db 
+0048 2020367e branch dongle_all_powerful 
+
+p_set_tx_power_f10db:
+0049 708a395b jam 0x5b ,core_tx_pwr_ctrl0 
+004a 708a3a03 jam 0x03 ,core_tx_pwr_ctrl1 
+004b 2020122a branch set_rf_ldo_cfg89 
 
 p_dongle_work_mode_auto:
-002e 6fe0c8bf fetch 1 ,mem_24g_work_mode 
-002f c1800000 rtnne dongle_work 
-0030 20402491 call g24_work_mode_start 
-0031 20400033 call p_dongle_g24_blank_data_process 
-0032 202036f2 branch dongle_work_mode_auto + 5 
+004c 6fe0c8bf fetch 1 ,mem_24g_work_mode 
+004d c1800000 rtnne dongle_work 
+004e 20402491 call g24_work_mode_start 
+004f 20400051 call p_dongle_g24_blank_data_process 
+0050 202036f2 branch dongle_work_mode_auto + 5 
 
 p_dongle_g24_blank_data_process:
-0033 2040368a call dongle_g24_ms_blank_data 
-0034 20400036 call p_dongle_g24_kb_blank_data 
-0035 20200042 branch p_dongle_g24_kb_mul_blank_data 
+0051 2040368a call dongle_g24_ms_blank_data 
+0052 20400054 call p_dongle_g24_kb_blank_data 
+0053 20200060 branch p_dongle_g24_kb_mul_blank_data 
 
 p_dongle_g24_kb_blank_data:
-0036 6fe0c906 fetch 1 ,mem_dg_kb_blank_data_enable 
-0037 207a0000 rtn blank 
-0038 d8e0000e arg timer_kb_blank ,queue 
-0039 20407d74 call timer_check 
-003a 247a0000 nrtn blank 
-003b 70490600 jam 0 ,mem_dg_kb_blank_data_enable 
-003c d8a00c0f arg mem_usb_kb_data ,contw 
-003d df200002 arg 2 ,loopcnt 
-003e 20407d17 call memset0 
-003f 6fe40c0f fetch 8 ,mem_usb_kb_data 
-0040 67e448f2 store 8 ,mem_dg_kb_data_last_data 
-0041 202036a2 branch dongle_usb_tx_kb_data 
+0054 6fe0c906 fetch 1 ,mem_dg_kb_blank_data_enable 
+0055 207a0000 rtn blank 
+0056 d8e0000e arg timer_kb_blank ,queue 
+0057 20407d74 call timer_check 
+0058 247a0000 nrtn blank 
+0059 70490600 jam 0 ,mem_dg_kb_blank_data_enable 
+005a d8a00c0f arg mem_usb_kb_data ,contw 
+005b df200002 arg 2 ,loopcnt 
+005c 20407d17 call memset0 
+005d 6fe40c0f fetch 8 ,mem_usb_kb_data 
+005e 67e448f2 store 8 ,mem_dg_kb_data_last_data 
+005f 202036a2 branch dongle_usb_tx_kb_data 
 
 p_dongle_g24_kb_mul_blank_data:
-0042 6fe0c907 fetch 1 ,mem_dg_kb_mul_blank_data_enable 
-0043 207a0000 rtn blank 
-0044 d8e0000c arg timer_kb_mul_blank ,queue 
-0045 20407d74 call timer_check 
-0046 247a0000 nrtn blank 
-0047 70490700 jam 0 ,mem_dg_kb_mul_blank_data_enable 
-0048 d8a00c1f arg mem_usb_kb_multikey ,contw 
-0049 df200002 arg 2 ,loopcnt 
-004a 20407d17 call memset0 
-004b 700c1f03 jam kb_multikey_report_id ,mem_usb_kb_multikey 
-004c 6fe18c1f fetch 3 ,mem_usb_kb_multikey 
-004d 67e1c8fd store 3 ,mem_dg_kb_multikey_last_data 
-004e 202036b2 branch dongle_usb_tx_multikey_data 
+0060 6fe0c907 fetch 1 ,mem_dg_kb_mul_blank_data_enable 
+0061 207a0000 rtn blank 
+0062 d8e0000c arg timer_kb_mul_blank ,queue 
+0063 20407d74 call timer_check 
+0064 247a0000 nrtn blank 
+0065 70490700 jam 0 ,mem_dg_kb_mul_blank_data_enable 
+0066 d8a00c1f arg mem_usb_kb_multikey ,contw 
+0067 df200002 arg 2 ,loopcnt 
+0068 20407d17 call memset0 
+0069 700c1f03 jam kb_multikey_report_id ,mem_usb_kb_multikey 
+006a 6fe18c1f fetch 3 ,mem_usb_kb_multikey 
+006b 67e1c8fd store 3 ,mem_dg_kb_multikey_last_data 
+006c 202036b2 branch dongle_usb_tx_multikey_data 
 
 p_usb_class_type:
-004f 793f8023 set0 mark_isstr ,mark 
-0050 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
-0051 1fe17e80 and_into 0x80 ,pdata 
-0052 c0000054 beq out_device ,p_usb_out_device 
-0053 20207a34 branch usb_class_type + 4 
+006d 793f8023 set0 mark_isstr ,mark 
+006e 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
+006f 1fe17e80 and_into 0x80 ,pdata 
+0070 c0000072 beq out_device ,p_usb_out_device 
+0071 20207a34 branch usb_class_type + 4 
 
 p_usb_out_device:
-0054 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
-0055 1ff1fe00 rshift4 pdata ,pdata 
-0056 1fe37e00 rshift pdata ,pdata 
-0057 1fe17e03 and_into 0x03 ,pdata 
-0058 c0007a53 beq standard_req ,usb_out_standard_req 
-0059 c000805b beq class_req ,p_usb_out_class_req 
-005a 20207a43 branch usb_out_device + 4 
+0072 6fe08b59 fetch 1 ,mem_usb_setup_bmrequesttype 
+0073 1ff1fe00 rshift4 pdata ,pdata 
+0074 1fe37e00 rshift pdata ,pdata 
+0075 1fe17e03 and_into 0x03 ,pdata 
+0076 c0007a53 beq standard_req ,usb_out_standard_req 
+0077 c0008079 beq class_req ,p_usb_out_class_req 
+0078 20207a43 branch usb_out_device + 4 
 
 p_usb_out_class_req:
-005b 6fe08b5a fetch 1 ,mem_usb_setup_brequest 
-005c c004805e beq set_report ,p_usb_set_report 
-005d 20207a5c branch usb_out_class_req + 1 
+0079 6fe08b5a fetch 1 ,mem_usb_setup_brequest 
+007a c004807c beq set_report ,p_usb_set_report 
+007b 20207a5c branch usb_out_class_req + 1 
 
 p_usb_set_report:
-005e 20003a98 nop 15000 
-005f 20207bd8 branch usb_set_report 
+007c 20003a98 nop 15000 
+007d 20207bd8 branch usb_set_report 
 
 p_usb_tx:
-0060 6fe08bf9 fetch 1 ,mem_usb_tx_enable 
-0061 207a0000 rtn blank 
-0062 6ff08c24 fetch 1 ,core_usb_txbusy 
-0063 1fe17e0f and_into 0x0f ,pdata 
-0064 243a7ca4 nbranch usb_inwake_state_tx_dispose ,blank 
-0065 20207c59 branch usb_tx + 3 
+007e 6fe08bf9 fetch 1 ,mem_usb_tx_enable 
+007f 207a0000 rtn blank 
+0080 6ff08c24 fetch 1 ,core_usb_txbusy 
+0081 1fe17e0f and_into 0x0f ,pdata 
+0082 243a7ca4 nbranch usb_inwake_state_tx_dispose ,blank 
+0083 20207c59 branch usb_tx + 3 
               org 0x800
 
 start:
Index: program/patch.prog
===================================================================
--- /YC1308AC/branch/mouse_project/YDN_Project/usb_16M_Allpowerful/program/patch.prog	(revision 605)
+++ /YC1308AC/branch/mouse_project/YDN_Project/usb_16M_Allpowerful/program/patch.prog	(working copy)
@@ -39,7 +39,29 @@
 	jam 0x76,core_agc_wb_sat_th
 	jam 0x76,core_agc_nb_sat_th
 
-	branch initialize_radio_cont+1
+	jam 0xe6,core_syn_aac_cfg1
+
+	call initialize_syn_afc_cfg1
+	call initialize_rf_ldo_cfg1
+	call initialize_rc_cal
+	
+	jam 0x09,core_rx_bq_cfg0
+
+	jam 5,core_clkpll_cfg0
+	jam 0x94,core_rx_iqadc_cfg
+	
+	fetch 1,mem_fcomp_div
+	bne XTAL_16M,initialize_radio_cont_next
+	jam 0x34,core_clkpll_cfg5		//16M XTAL
+p_initialize_radio_cont_next:
+	jam 0xff,core_clkpll_ctrl1
+	nop 100
+	jam 0x0e,core_clkpll_ctrl2
+	jam 0x03,core_clkpll_ctrl0
+	
+	//call set_tx_power_0db
+
+	branch initialize_radio_cont_next+5
 
 p_set_sync_on:
 	jam 0x5,modem_en
@@ -61,7 +83,7 @@
 	jam 0x02,mem_24g_rx_phy
 	jam 0x02,mem_24g_tx_phy
 
-	call dongle_init
+	call p_dongle_init
 	
 	//watch dog enable
 	call wdt_set_enable
@@ -77,6 +99,29 @@
 	branch dongle_usb_dispatch+1
 
 
+p_dongle_init:
+	setarg p_dongle_dispatch
+	store 2,mem_cb_24g_receive_process
+	branch dongle_init+2
+p_dongle_dispatch:
+	fetch 1,mem_24g_pair_mode
+	beq 0x00,dongle_auto_bind
+	beq 0x01,dongle_pc_bind
+	beq 0x0f,p_dongle_all_powerful
+	rtn
+
+p_dongle_all_powerful:
+	setarg TX_POWER_F5DB
+	store 1,mem_tx_power
+	store 1,mem_tx_power_temp
+	call p_set_tx_power_f10db
+	branch dongle_all_powerful
+
+p_set_tx_power_f10db:
+	jam 0x5b,core_tx_pwr_ctrl0
+	jam 0x03,core_tx_pwr_ctrl1
+	branch set_rf_ldo_cfg89
+		
 /************************keyboard blank patch**********/
 p_dongle_work_mode_auto:
 	fetch 1,mem_24g_work_mode
