Index: format/app_mouse.format
===================================================================
--- /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/format/app_mouse.format	(revision 5270)
+++ /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/format/app_mouse.format	(working copy)
@@ -470,6 +470,10 @@
 1 mem_device_pair_flag
 1 mem_mouse_repair_pack_flag
 1 mem_mouse_g24_pack_conut
+
+//freq
+1 mem_mouse_ch_set_flag
+1 mem_mouse_ch_count
 )
 (
 0x33 ROM_MAX_HANDLE
Index: format/regs.format
===================================================================
--- /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/format/regs.format	(revision 5270)
+++ /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/format/regs.format	(working copy)
@@ -159,6 +159,7 @@
 	0x828a core_docd_pdata
 
 	0x8900 modem_en
+	0x890d core_tx_test_mode
 	0x8938 mod_value_scale1
 	0x8960 core_rf_rx_agc_ctrl
 	0x8961 core_rf_rx_gain_fix
Index: output/eeprom.dat
===================================================================
--- /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/eeprom.dat	(revision 5270)
+++ /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/eeprom.dat	(working copy)
@@ -2,8 +2,8 @@
 02
 aa
 55
-ca
-1c
+6e
+1d
 20
 20
 00
@@ -310,8 +310,8 @@
 87
 c0
 64
-06
-f5
+07
+1e
 c0
 64
 84
@@ -370,8 +370,8 @@
 00
 c0
 6c
-86
-fb
+87
+24
 c0
 6d
 05
@@ -1962,12 +1962,12 @@
 5e
 20
 40
-06
-ec
+07
+15
 20
 40
-06
-fd
+07
+26
 20
 40
 41
@@ -1986,8 +1986,8 @@
 66
 20
 40
-06
-ef
+07
+18
 20
 40
 04
@@ -3610,8 +3610,8 @@
 84
 20
 40
-06
-f5
+07
+1e
 20
 20
 32
@@ -3670,8 +3670,8 @@
 e6
 20
 20
-06
-f1
+07
+1a
 20
 40
 22
@@ -5078,12 +5078,12 @@
 00
 c0
 1e
-06
-f7
+07
+20
 c0
 1c
-86
-f3
+87
+1c
 c0
 1d
 05
@@ -5094,8 +5094,8 @@
 50
 c0
 0a
-86
-f9
+87
+22
 c0
 0a
 05
@@ -5298,8 +5298,8 @@
 f2
 24
 5a
-06
-f5
+07
+1e
 6f
 e4
 48
@@ -7092,6 +7092,170 @@
 20
 61
 2c
+70
+48
+68
+01
+70
+4e
+39
+00
+20
+40
+07
+02
+20
+40
+06
+f2
+20
+40
+07
+08
+20
+20
+06
+ef
+20
+40
+06
+b6
+1a
+21
+7e
+07
+c0
+00
+86
+f7
+70
+4e
+38
+00
+20
+60
+00
+00
+6f
+e0
+ce
+38
+24
+7a
+00
+00
+70
+4e
+38
+01
+6f
+e0
+ce
+39
+1f
+e0
+fe
+01
+1f
+e1
+7e
+03
+67
+e0
+ce
+39
+c0
+00
+07
+02
+c0
+00
+87
+04
+c0
+01
+07
+06
+20
+60
+00
+00
+70
+48
+3d
+00
+20
+60
+00
+00
+70
+48
+3d
+26
+20
+60
+00
+00
+70
+48
+3d
+4c
+20
+60
+00
+00
+70
+41
+e8
+00
+20
+40
+21
+f5
+78
+43
+fc
+00
+78
+2e
+fc
+00
+78
+30
+7c
+00
+79
+20
+2a
+00
+70
+89
+0d
+22
+58
+00
+ff
+ff
+1f
+e2
+72
+00
+ef
+e0
+80
+06
+08
+00
+86
+08
+c2
+00
+07
+11
+20
+60
+00
+00
 20
 75
 80
@@ -7103,7 +7267,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7111,7 +7275,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7119,7 +7283,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7127,7 +7291,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7135,7 +7299,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7143,7 +7307,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7151,7 +7315,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7159,7 +7323,7 @@
 20
 20
 07
-00
+29
 20
 75
 80
@@ -7171,7 +7335,7 @@
 20
 20
 07
-00
+29
 68
 48
 cd
@@ -7191,7 +7355,7 @@
 20
 22
 87
-1c
+45
 60
 48
 cd
@@ -7231,19 +7395,19 @@
 20
 40
 07
-1e
+47
 20
 40
 07
-2a
+53
 20
 40
 07
-21
+4a
 24
 22
 87
-0e
+37
 6f
 e2
 0e
@@ -7259,7 +7423,7 @@
 24
 22
 87
-0e
+37
 58
 00
 0e
@@ -7327,7 +7491,7 @@
 c2
 00
 07
-24
+4d
 ef
 e2
 00
@@ -7372,8 +7536,8 @@
 20
 3f
 a5
-34
-70
+91
+78
 aa
 55
 40
@@ -7545,14 +7709,14 @@
 00
 11
 49
-0d
 0e
+0d
 0f
 07
 03
 ff
-0c
 0b
+0c
 aa
 55
 0b
@@ -8828,14 +8992,14 @@
 00
 d3
 4d
-88
-28
+2c
+29
 00
 55
 aa
 aa
 55
-b7
+5c
 ac
 ff
 20
@@ -9873,11 +10037,23 @@
 c0
 08
 80
-2a
+2d
 20
 60
 00
 00
+20
+40
+41
+50
+1a
+21
+7e
+07
+c0
+01
+86
+ec
 6f
 e4
 4b
@@ -9885,7 +10061,7 @@
 c2
 97
 80
-23
+26
 6f
 e0
 c9
@@ -9893,7 +10069,7 @@
 c0
 00
 00
-15
+18
 20
 40
 04
@@ -9909,11 +10085,11 @@
 c0
 00
 80
-0e
+11
 c0
 01
 00
-10
+13
 20
 60
 00
@@ -9925,7 +10101,7 @@
 20
 20
 00
-11
+14
 6f
 e3
 49
@@ -9973,11 +10149,11 @@
 c2
 98
 00
-25
+28
 c3
 18
 80
-25
+28
 20
 40
 41
@@ -10102,22 +10278,10 @@
 00
 00
 00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-93
-88
-01
-78
+8d
+eb
+46
+d4
 20
 20
 00
@@ -10378,5 +10542,5 @@
 00
 00
 00
-de
-2e
+15
+94
Index: output/flash.dat
===================================================================
--- /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/flash.dat	(revision 5270)
+++ /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/flash.dat	(working copy)
@@ -2,8 +2,8 @@
 02
 aa
 55
-ca
-1c
+6e
+1d
 20
 20
 00
@@ -310,8 +310,8 @@
 87
 c0
 64
-06
-f5
+07
+1e
 c0
 64
 84
@@ -370,8 +370,8 @@
 00
 c0
 6c
-86
-fb
+87
+24
 c0
 6d
 05
@@ -1962,12 +1962,12 @@
 5e
 20
 40
-06
-ec
+07
+15
 20
 40
-06
-fd
+07
+26
 20
 40
 41
@@ -1986,8 +1986,8 @@
 66
 20
 40
-06
-ef
+07
+18
 20
 40
 04
@@ -3610,8 +3610,8 @@
 84
 20
 40
-06
-f5
+07
+1e
 20
 20
 32
@@ -3670,8 +3670,8 @@
 e6
 20
 20
-06
-f1
+07
+1a
 20
 40
 22
@@ -5078,12 +5078,12 @@
 00
 c0
 1e
-06
-f7
+07
+20
 c0
 1c
-86
-f3
+87
+1c
 c0
 1d
 05
@@ -5094,8 +5094,8 @@
 50
 c0
 0a
-86
-f9
+87
+22
 c0
 0a
 05
@@ -5298,8 +5298,8 @@
 f2
 24
 5a
-06
-f5
+07
+1e
 6f
 e4
 48
@@ -7092,6 +7092,170 @@
 20
 61
 2c
+70
+48
+68
+01
+70
+4e
+39
+00
+20
+40
+07
+02
+20
+40
+06
+f2
+20
+40
+07
+08
+20
+20
+06
+ef
+20
+40
+06
+b6
+1a
+21
+7e
+07
+c0
+00
+86
+f7
+70
+4e
+38
+00
+20
+60
+00
+00
+6f
+e0
+ce
+38
+24
+7a
+00
+00
+70
+4e
+38
+01
+6f
+e0
+ce
+39
+1f
+e0
+fe
+01
+1f
+e1
+7e
+03
+67
+e0
+ce
+39
+c0
+00
+07
+02
+c0
+00
+87
+04
+c0
+01
+07
+06
+20
+60
+00
+00
+70
+48
+3d
+00
+20
+60
+00
+00
+70
+48
+3d
+26
+20
+60
+00
+00
+70
+48
+3d
+4c
+20
+60
+00
+00
+70
+41
+e8
+00
+20
+40
+21
+f5
+78
+43
+fc
+00
+78
+2e
+fc
+00
+78
+30
+7c
+00
+79
+20
+2a
+00
+70
+89
+0d
+22
+58
+00
+ff
+ff
+1f
+e2
+72
+00
+ef
+e0
+80
+06
+08
+00
+86
+08
+c2
+00
+07
+11
+20
+60
+00
+00
 20
 75
 80
@@ -7103,7 +7267,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7111,7 +7275,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7119,7 +7283,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7127,7 +7291,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7135,7 +7299,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7143,7 +7307,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7151,7 +7315,7 @@
 20
 20
 07
-00
+29
 70
 4d
 cd
@@ -7159,7 +7323,7 @@
 20
 20
 07
-00
+29
 20
 75
 80
@@ -7171,7 +7335,7 @@
 20
 20
 07
-00
+29
 68
 48
 cd
@@ -7191,7 +7355,7 @@
 20
 22
 87
-1c
+45
 60
 48
 cd
@@ -7231,19 +7395,19 @@
 20
 40
 07
-1e
+47
 20
 40
 07
-2a
+53
 20
 40
 07
-21
+4a
 24
 22
 87
-0e
+37
 6f
 e2
 0e
@@ -7259,7 +7423,7 @@
 24
 22
 87
-0e
+37
 58
 00
 0e
@@ -7327,7 +7491,7 @@
 c2
 00
 07
-24
+4d
 ef
 e2
 00
@@ -7372,8 +7536,8 @@
 20
 3f
 a5
-34
-70
+91
+78
 aa
 55
 40
@@ -7545,14 +7709,14 @@
 00
 11
 49
-0d
 0e
+0d
 0f
 07
 03
 ff
-0c
 0b
+0c
 aa
 55
 0b
@@ -8828,14 +8992,14 @@
 00
 d3
 4d
-88
-28
+2c
+29
 00
 55
 aa
 aa
 55
-b7
+5c
 ac
 ff
 20
@@ -9873,11 +10037,23 @@
 c0
 08
 80
-2a
+2d
 20
 60
 00
 00
+20
+40
+41
+50
+1a
+21
+7e
+07
+c0
+01
+86
+ec
 6f
 e4
 4b
@@ -9885,7 +10061,7 @@
 c2
 97
 80
-23
+26
 6f
 e0
 c9
@@ -9893,7 +10069,7 @@
 c0
 00
 00
-15
+18
 20
 40
 04
@@ -9909,11 +10085,11 @@
 c0
 00
 80
-0e
+11
 c0
 01
 00
-10
+13
 20
 60
 00
@@ -9925,7 +10101,7 @@
 20
 20
 00
-11
+14
 6f
 e3
 49
@@ -9973,11 +10149,11 @@
 c2
 98
 00
-25
+28
 c3
 18
 80
-25
+28
 20
 40
 41
@@ -10102,22 +10278,10 @@
 00
 00
 00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-93
-88
-01
-78
+8d
+eb
+46
+d4
 20
 20
 00
@@ -10378,5 +10542,5 @@
 00
 00
 00
-de
-2e
+15
+94
Index: output/memmap.format
===================================================================
--- /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/memmap.format	(revision 5270)
+++ /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/memmap.format	(working copy)
@@ -2331,6 +2331,8 @@
 0x4e35 mem_device_pair_flag
 0x4e36 mem_mouse_repair_pack_flag
 0x4e37 mem_mouse_g24_pack_conut
+0x4e38 mem_mouse_ch_set_flag
+0x4e39 mem_mouse_ch_count
 0x48d4 mem_remote_car_hard_soft_switch
 0x48d5 mem_remote_car_queue_each_size
 0x48d6 mem_remote_car_queue_length
Index: output/program.lis
===================================================================
--- /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/program.lis	(revision 5270)
+++ /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/program.lis	(working copy)
@@ -82,7 +82,7 @@
 0049 c0618394 beq patch18_3 ,p_mouse_start_work 
 004a c0630380 beq patch18_6 ,p_mouse_app_enter_hibernate 
 004b c0638387 beq patch18_7 ,p_mouse_before_hibernate 
-004c c06406f5 beq patch19_0 ,p_mouse_setgpio_hibernate 
+004c c064071e beq patch19_0 ,p_mouse_setgpio_hibernate 
 004d c0648492 beq patch19_1 ,p_mouse_lpm_before_common 
 004e c0668686 beq patch19_5 ,p_mouse_motion 
 004f c06704da beq patch19_6 ,p_mouse_dpi_process 
@@ -97,7 +97,7 @@
 0058 c0700177 beq patch1c_0 ,p_mouse_led_off 
 0059 c0708174 beq patch1c_1 ,p_mouse_led_on 
 005a c06b0600 beq patch1a_6 ,p_mouse_le 
-005b c06c86fb beq patch1b_1 ,p_mouse_start_discovery 
+005b c06c8724 beq patch1b_1 ,p_mouse_start_discovery 
 005c c06d055f beq patch1b_2 ,p_mouse_stop_discovery 
 005d c06e0463 beq patch1b_4 ,p_mouse_store_device_info 
 005e 2020137e branch loop 
@@ -645,13 +645,13 @@
 
 p_mouse_init:
 01e8 20406e5e call enable_authrom 
-01e9 204006ec call p_mouse_setting_config 
-01ea 204006fd call p_mouse_report_param_set 
+01e9 20400715 call p_mouse_setting_config 
+01ea 20400726 call p_mouse_report_param_set 
 01eb 204041e7 call mouse_init_sunt 
 01ec 20758000 rtn wake 
 01ed 204004e3 call p_mouse_seting_sensor_type 
 01ee 20404766 call mouse_drawing_optima_init 
-01ef 204006ef call p_mouse_cb_fuction 
+01ef 20400718 call p_mouse_cb_fuction 
 01f0 20400484 call p_mouse_sensor_powerdown 
 01f1 20203c7f branch mouse_init_wireless 
 
@@ -1179,7 +1179,7 @@
 0384 20400484 call p_mouse_sensor_powerdown 
 
 p_mouse_app_enter_hibernate_set:
-0385 204006f5 call p_mouse_setgpio_hibernate 
+0385 2040071e call p_mouse_setgpio_hibernate 
 0386 20203289 branch app_enter_hibernate 
 
 p_mouse_before_hibernate:
@@ -1198,7 +1198,7 @@
 0393 202060e6 branch gpio_clr_wake 
 
 p_mouse_start_work:
-0394 202006f1 branch p_mouse_start_work_next 
+0394 2020071a branch p_mouse_start_work_next 
 
 p_mouse_bb_event_timer:
 0395 204022e1 call g24_pair_timeout_timer 
@@ -1714,11 +1714,11 @@
 
 p_mouse_priority_bb_event:
 04f3 1a627e00 copy regc ,pdata 
-04f4 c01e06f7 beq bt_evt_24g_attempt_success ,p_mouse_24g_attempt_success 
-04f5 c01c86f3 beq bt_evt_24g_pairing_complete ,p_mouse_24g_pairing_complete 
+04f4 c01e0720 beq bt_evt_24g_attempt_success ,p_mouse_24g_attempt_success 
+04f5 c01c871c beq bt_evt_24g_pairing_complete ,p_mouse_24g_pairing_complete 
 04f6 c01d0506 beq bt_evt_24g_attempt_fail ,p_mouse_24g_attempt_fail 
 04f7 c0190550 beq bt_evt_le_start_enc ,p_mouse_le_ll_start_encryt 
-04f8 c00a86f9 beq bt_evt_le_disconnected ,p_mouse_le_bb_disconnected 
+04f8 c00a8722 beq bt_evt_le_disconnected ,p_mouse_le_bb_disconnected 
 04f9 c00a055c beq bt_evt_le_connected ,p_mouse_le_bb_event_connected 
 04fa c0200557 beq bt_evt_le_parse_conn_papa_update_rsp ,p_mouse_le_conn_param_update_rsp_recieved 
 04fb c00104fd beq bt_evt_bb_disconnected ,p_mouse_bb_disconnected 
@@ -1781,7 +1781,7 @@
 0528 704c3201 jam 1 ,mem_long_sleep_flag 
 0529 204002ac call p_send_time_long_wake 
 052a 6fe0cbf2 fetch 1 ,mem_sensor_shutdown_flag 
-052b 245a06f5 ncall p_mouse_setgpio_hibernate ,blank 
+052b 245a071e ncall p_mouse_setgpio_hibernate ,blank 
 052c 6fe4485f fetch 8 ,mem_24g_enter_hibernate 
 052d 202026bf branch g24_long_seep2 
 
@@ -2379,107 +2379,166 @@
 06ea d840003e arg gpcfg_output_low ,temp 
 06eb 2020612c branch gpio_config_function_int 
 
+p_mouse_freq_test_mode:
+06ec 70486801 jam 0x01 ,mem_24g_tx_phy 
+06ed 704e3900 jam 0 ,mem_mouse_ch_count 
+06ee 20400702 call p_mouse_set_ch_l 
+
+p_mouse_freq_test_mode_loop:
+06ef 204006f2 call p_mouse_freq_test_mode_state_check 
+06f0 20400708 call p_mouse_freq_test_single_wave 
+06f1 202006ef branch p_mouse_freq_test_mode_loop 
+
+p_mouse_freq_test_mode_state_check:
+06f2 204006b6 call p_mouse_check_key_gpio 
+06f3 1a217e07 and rega ,0x07 ,pdata 
+06f4 c00086f7 beq mouse_l_button ,p_mouse_change_freq_set 
+06f5 704e3800 jam 0 ,mem_mouse_ch_set_flag 
+06f6 20600000 rtn 
+
+p_mouse_change_freq_set:
+06f7 6fe0ce38 fetch 1 ,mem_mouse_ch_set_flag 
+06f8 247a0000 nrtn blank 
+06f9 704e3801 jam 1 ,mem_mouse_ch_set_flag 
+06fa 6fe0ce39 fetch 1 ,mem_mouse_ch_count 
+06fb 1fe0fe01 increase 1 ,pdata 
+06fc 1fe17e03 and pdata ,0x03 ,pdata 
+06fd 67e0ce39 store 1 ,mem_mouse_ch_count 
+06fe c0000702 beq 0 ,p_mouse_set_ch_l 
+06ff c0008704 beq 1 ,p_mouse_set_ch_m 
+0700 c0010706 beq 2 ,p_mouse_set_ch_h 
+0701 20600000 rtn 
+
+p_mouse_set_ch_l:
+0702 70483d00 jam 0 ,mem_24g_ch 
+0703 20600000 rtn 
+
+p_mouse_set_ch_m:
+0704 70483d26 jam 0x26 ,mem_24g_ch 
+0705 20600000 rtn 
+
+p_mouse_set_ch_h:
+0706 70483d4c jam 0x4c ,mem_24g_ch 
+0707 20600000 rtn 
+
+p_mouse_freq_test_single_wave:
+0708 7041e800 jam tx_power_0db ,mem_tx_power 
+0709 204021f5 call g24_set_freq_tx 
+070a 7843fc00 disable enable_white 
+070b 782efc00 enable encode_fec0 
+070c 78307c00 enable is_tx 
+070d 79202a00 set1 txgfsk ,radio_ctrl 
+070e 70890d22 jam 0x22 ,core_tx_test_mode 
+070f 5800ffff setarg 0xffff 
+0710 1fe27200 copy pdata ,loopcnt 
+
+p_pnloop_carrier:
+0711 efe08006 ifetch 1 ,contr 
+0712 08008608 inject mod ,8 
+0713 c2000711 loop p_pnloop_carrier 
+0714 20600000 rtn 
+
 p_mouse_setting_config:
-06ec 20758000 rtn wake 
-06ed 704dcd00 jam zcode_00 ,mem_zcode_temp_param0 
-06ee 20200700 branch p_zcode_entrance 
+0715 20758000 rtn wake 
+0716 704dcd00 jam zcode_00 ,mem_zcode_temp_param0 
+0717 20200729 branch p_zcode_entrance 
 
 p_mouse_cb_fuction:
-06ef 704dcd01 jam zcode_01 ,mem_zcode_temp_param0 
-06f0 20200700 branch p_zcode_entrance 
+0718 704dcd01 jam zcode_01 ,mem_zcode_temp_param0 
+0719 20200729 branch p_zcode_entrance 
 
 p_mouse_start_work_next:
-06f1 704dcd10 jam zcode_10 ,mem_zcode_temp_param0 
-06f2 20200700 branch p_zcode_entrance 
+071a 704dcd10 jam zcode_10 ,mem_zcode_temp_param0 
+071b 20200729 branch p_zcode_entrance 
 
 p_mouse_24g_pairing_complete:
-06f3 704dcd11 jam zcode_11 ,mem_zcode_temp_param0 
-06f4 20200700 branch p_zcode_entrance 
+071c 704dcd11 jam zcode_11 ,mem_zcode_temp_param0 
+071d 20200729 branch p_zcode_entrance 
 
 p_mouse_setgpio_hibernate:
-06f5 704dcd20 jam zcode_20 ,mem_zcode_temp_param0 
-06f6 20200700 branch p_zcode_entrance 
+071e 704dcd20 jam zcode_20 ,mem_zcode_temp_param0 
+071f 20200729 branch p_zcode_entrance 
 
 p_mouse_24g_attempt_success:
-06f7 704dcd21 jam zcode_21 ,mem_zcode_temp_param0 
-06f8 20200700 branch p_zcode_entrance 
+0720 704dcd21 jam zcode_21 ,mem_zcode_temp_param0 
+0721 20200729 branch p_zcode_entrance 
 
 p_mouse_le_bb_disconnected:
-06f9 704dcd30 jam zcode_30 ,mem_zcode_temp_param0 
-06fa 20200700 branch p_zcode_entrance 
+0722 704dcd30 jam zcode_30 ,mem_zcode_temp_param0 
+0723 20200729 branch p_zcode_entrance 
 
 p_mouse_start_discovery:
-06fb 704dcd31 jam zcode_31 ,mem_zcode_temp_param0 
-06fc 20200700 branch p_zcode_entrance 
+0724 704dcd31 jam zcode_31 ,mem_zcode_temp_param0 
+0725 20200729 branch p_zcode_entrance 
 
 p_mouse_report_param_set:
-06fd 20758000 rtn wake 
-06fe 704dcd40 jam zcode_40 ,mem_zcode_temp_param0 
-06ff 20200700 branch p_zcode_entrance 
+0726 20758000 rtn wake 
+0727 704dcd40 jam zcode_40 ,mem_zcode_temp_param0 
+0728 20200729 branch p_zcode_entrance 
 
 p_zcode_entrance:
-0700 6848cdcd fetcht 1 ,mem_zcode_temp_param0 
-0701 18518400 rshift4 temp ,temp 
-0702 6fe0cdd2 fetch 1 ,mem_zcode_current_number 
-0703 98467c00 isub temp ,null 
-0704 2022871c branch p_zcode_run ,zero 
-0705 6048cdd2 storet 1 ,mem_zcode_current_number 
-0706 18408401 increase 1 ,temp 
-0707 58000100 setarg zcode_buff_size 
-0708 984f8400 imul32 temp ,temp 
-0709 6fe1cdd3 fetch 3 ,mem_xip_flash_offset 
-070a 98467e00 isub temp ,pdata 
-070b 6849cdd6 fetcht 3 ,mem_flash_start_addr 
-070c 9840fe00 iadd temp ,pdata 
-070d 67e1cdd9 store 3 ,mem_flash_address 
+0729 6848cdcd fetcht 1 ,mem_zcode_temp_param0 
+072a 18518400 rshift4 temp ,temp 
+072b 6fe0cdd2 fetch 1 ,mem_zcode_current_number 
+072c 98467c00 isub temp ,null 
+072d 20228745 branch p_zcode_run ,zero 
+072e 6048cdd2 storet 1 ,mem_zcode_current_number 
+072f 18408401 increase 1 ,temp 
+0730 58000100 setarg zcode_buff_size 
+0731 984f8400 imul32 temp ,temp 
+0732 6fe1cdd3 fetch 3 ,mem_xip_flash_offset 
+0733 98467e00 isub temp ,pdata 
+0734 6849cdd6 fetcht 3 ,mem_flash_start_addr 
+0735 9840fe00 iadd temp ,pdata 
+0736 67e1cdd9 store 3 ,mem_flash_address 
 
 p_zcode_read_loop:
-070e 2040071e call p_zcode_buff_clear 
-070f 2040072a call p_read_data_from_flash 
-0710 20400721 call p_zcode_data_check 
-0711 2422870e nbranch p_zcode_read_loop ,zero 
-0712 6fe20e00 fetch 4 ,mem_zcode_buff 
-0713 684a4ddc fetcht 4 ,mem_zcode_head 
-0714 98467c00 isub temp ,null 
-0715 2422870e nbranch p_zcode_read_loop ,zero 
-0716 58000e00 setarg mem_zcode_buff 
-0717 67e141a6 store 2 ,mem_patch_ptr 
-0718 7041a840 jam zcode_code_size ,mem_patch_len 
-0719 20405ca3 call load_ucode 
-071a 58000000 setarg 0 
-071b 67e241a6 store 4 ,mem_patch_ptr 
+0737 20400747 call p_zcode_buff_clear 
+0738 20400753 call p_read_data_from_flash 
+0739 2040074a call p_zcode_data_check 
+073a 24228737 nbranch p_zcode_read_loop ,zero 
+073b 6fe20e00 fetch 4 ,mem_zcode_buff 
+073c 684a4ddc fetcht 4 ,mem_zcode_head 
+073d 98467c00 isub temp ,null 
+073e 24228737 nbranch p_zcode_read_loop ,zero 
+073f 58000e00 setarg mem_zcode_buff 
+0740 67e141a6 store 2 ,mem_patch_ptr 
+0741 7041a840 jam zcode_code_size ,mem_patch_len 
+0742 20405ca3 call load_ucode 
+0743 58000000 setarg 0 
+0744 67e241a6 store 4 ,mem_patch_ptr 
 
 p_zcode_run:
-071c 6fe0cdcd fetch 1 ,mem_zcode_temp_param0 
-071d 20200001 branch p_zcode 
+0745 6fe0cdcd fetch 1 ,mem_zcode_temp_param0 
+0746 20200001 branch p_zcode 
 
 p_zcode_buff_clear:
-071e d8a00e00 arg mem_zcode_buff ,contw 
-071f df200100 arg 256 ,loopcnt 
-0720 20207d9b branch clear_mem 
+0747 d8a00e00 arg mem_zcode_buff ,contw 
+0748 df200100 arg 256 ,loopcnt 
+0749 20207d9b branch clear_mem 
 
 p_zcode_data_check:
-0721 d8c00e00 arg mem_zcode_buff ,contr 
-0722 da200000 arg 0 ,rega 
-0723 df20003f arg 63 ,loopcnt 
+074a d8c00e00 arg mem_zcode_buff ,contr 
+074b da200000 arg 0 ,rega 
+074c df20003f arg 63 ,loopcnt 
 
 p_zcode_data_loop:
-0724 efe20006 ifetch 4 ,contr 
-0725 9a20a200 iadd rega ,rega 
-0726 c2000724 loop p_zcode_data_loop 
-0727 efe20006 ifetch 4 ,contr 
-0728 9a267c00 isub rega ,null 
-0729 20600000 rtn 
+074d efe20006 ifetch 4 ,contr 
+074e 9a20a200 iadd rega ,rega 
+074f c200074d loop p_zcode_data_loop 
+0750 efe20006 ifetch 4 ,contr 
+0751 9a267c00 isub rega ,null 
+0752 20600000 rtn 
 
 p_read_data_from_flash:
-072a 20405daf call spid_init_flash 
-072b 2040464a call mouse_spid_flash_release_form_powerdown 
-072c 6fe1cdd9 fetch 3 ,mem_flash_address 
-072d d8400100 arg zcode_buff_size ,temp 
-072e da200e00 arg mem_zcode_buff ,rega 
-072f 20405dd2 call spid_read_flash 
-0730 20404651 call mouse_spid_flash_powerdown 
-0731 20203fa5 branch mouse_sensor_spi_init 
+0753 20405daf call spid_init_flash 
+0754 2040464a call mouse_spid_flash_release_form_powerdown 
+0755 6fe1cdd9 fetch 3 ,mem_flash_address 
+0756 d8400100 arg zcode_buff_size ,temp 
+0757 da200e00 arg mem_zcode_buff ,rega 
+0758 20405dd2 call spid_read_flash 
+0759 20404651 call mouse_spid_flash_powerdown 
+075a 20203fa5 branch mouse_sensor_spi_init 
               org 0x800
 
 start:
@@ -42950,71 +43009,74 @@
 
 z_entrance1:
 20001 c0080004 beq zcode_10 ,z_mouse_start_work_next 
-20002 c008802a beq zcode_11 ,z_mouse_24g_pairing_complete 
+20002 c008802d beq zcode_11 ,z_mouse_24g_pairing_complete 
 20003 20600000 rtn 
 
 z_mouse_start_work_next:
-20004 6fe44bbc fetch mouse_flag_len ,mem_mouse_flag 
-20005 c2978023 bbit1 mouse_enable_24g_first_auto_pairing ,z_mouse_24g_first_start_auto_pair_mode 
-20006 6fe0c93d fetch 1 ,mem_device_flag 
-20007 c0000015 beq mode_24g_device ,z_mouse_24g_start_mode 
+20004 20404150 call mouse_key_check_once 
+20005 1a217e07 and rega ,0x07 ,pdata 
+20006 c00186ec beq mouse_lr_button ,p_mouse_freq_test_mode 
+20007 6fe44bbc fetch mouse_flag_len ,mem_mouse_flag 
+20008 c2978026 bbit1 mouse_enable_24g_first_auto_pairing ,z_mouse_24g_first_start_auto_pair_mode 
+20009 6fe0c93d fetch 1 ,mem_device_flag 
+2000a c0000018 beq mode_24g_device ,z_mouse_24g_start_mode 
 
 z_mouse_le_fast_conn_judge:
-20008 20400413 call p_mouse_device_le_reconn_led_config 
-20009 20404354 call mouse_bluetooth_fast_conn_disable 
-2000a 6fe0c93d fetch 1 ,mem_device_flag 
-2000b c000800e beq mode_bt_device1 ,z_mouse_le_device1_judge 
-2000c c0010010 beq mode_bt_device2 ,z_mouse_le_device2_judge 
-2000d 20600000 rtn 
+2000b 20400413 call p_mouse_device_le_reconn_led_config 
+2000c 20404354 call mouse_bluetooth_fast_conn_disable 
+2000d 6fe0c93d fetch 1 ,mem_device_flag 
+2000e c0008011 beq mode_bt_device1 ,z_mouse_le_device1_judge 
+2000f c0010013 beq mode_bt_device2 ,z_mouse_le_device2_judge 
+20010 20600000 rtn 
 
 z_mouse_le_device1_judge:
-2000e 6fe3493f fetch 6 ,mem_device1_addr 
-2000f 20200011 branch z_mouse_le_addr_compare 
+20011 6fe3493f fetch 6 ,mem_device1_addr 
+20012 20200014 branch z_mouse_le_addr_compare 
 
 z_mouse_le_device2_judge:
-20010 6fe3495c fetch 6 ,mem_device2_addr 
+20013 6fe3495c fetch 6 ,mem_device2_addr 
 
 z_mouse_le_addr_compare:
-20011 684b4979 fetcht 6 ,mem_mouse_compare_addr_ff 
-20012 98467c00 isub temp ,null 
-20013 2022c32b branch mouse_buletooth_fast_conn_init ,zero 
-20014 20203e1c branch mouse_start_reconnect_device 
+20014 684b4979 fetcht 6 ,mem_mouse_compare_addr_ff 
+20015 98467c00 isub temp ,null 
+20016 2022c32b branch mouse_buletooth_fast_conn_init ,zero 
+20017 20203e1c branch mouse_start_reconnect_device 
 
 z_mouse_24g_start_mode:
-20015 6fe44bbc fetch mouse_flag_len ,mem_mouse_flag 
-20016 c308c842 bbit0 mouse_enable_24g ,mouse_24g_mode_setup_error 
-20017 20400401 call p_mouse_device_24g_led_config 
-20018 20403e28 call mouse_wakeup_from_power_check 
-20019 20344845 branch mouse_24g_reconn_dongle_start ,user 
-2001a 6fe44bbc fetch mouse_flag_len ,mem_mouse_flag 
-2001b c2980025 bbit1 mouse_enable_auto_24g_paring ,z_mouse_24g_reconn_general_dongle 
-2001c c3188025 bbit0 mouse_enable_24g_power_on_pairing ,z_mouse_24g_reconn_general_dongle 
-2001d 20404150 call mouse_key_check_once 
-2001e 1a217e07 and rega ,0x07 ,pdata 
-2001f 6848cbdc fetcht 1 ,mem_mouse_commbination_key_24g 
-20020 98467c00 isub temp ,null 
-20021 2022854d branch p_mouse_24g_start_pair_mode ,zero 
-20022 2020484b branch mouse_24g_reconn_general_dongle 
+20018 6fe44bbc fetch mouse_flag_len ,mem_mouse_flag 
+20019 c308c842 bbit0 mouse_enable_24g ,mouse_24g_mode_setup_error 
+2001a 20400401 call p_mouse_device_24g_led_config 
+2001b 20403e28 call mouse_wakeup_from_power_check 
+2001c 20344845 branch mouse_24g_reconn_dongle_start ,user 
+2001d 6fe44bbc fetch mouse_flag_len ,mem_mouse_flag 
+2001e c2980028 bbit1 mouse_enable_auto_24g_paring ,z_mouse_24g_reconn_general_dongle 
+2001f c3188028 bbit0 mouse_enable_24g_power_on_pairing ,z_mouse_24g_reconn_general_dongle 
+20020 20404150 call mouse_key_check_once 
+20021 1a217e07 and rega ,0x07 ,pdata 
+20022 6848cbdc fetcht 1 ,mem_mouse_commbination_key_24g 
+20023 98467c00 isub temp ,null 
+20024 2022854d branch p_mouse_24g_start_pair_mode ,zero 
+20025 2020484b branch mouse_24g_reconn_general_dongle 
 
 z_mouse_24g_first_start_auto_pair_mode:
-20023 20403e28 call mouse_wakeup_from_power_check 
-20024 20344855 branch mouse_24g_first_start_reconn ,user 
+20026 20403e28 call mouse_wakeup_from_power_check 
+20027 20344855 branch mouse_24g_first_start_reconn ,user 
 
 z_mouse_24g_reconn_general_dongle:
-20025 70493d00 jam mode_24g_device ,mem_device_flag 
-20026 6fe14bcb fetch 2 ,mem_mouse_24g_power_on_fast_conn_timer 
-20027 67e1488b store 2 ,mem_24g_reconn_timeout 
-20028 70488f01 jam fast_conn_and_receiver ,mem_24g_reconn_type 
-20029 20202562 branch g24_reconn_start 
+20028 70493d00 jam mode_24g_device ,mem_device_flag 
+20029 6fe14bcb fetch 2 ,mem_mouse_24g_power_on_fast_conn_timer 
+2002a 67e1488b store 2 ,mem_24g_reconn_timeout 
+2002b 70488f01 jam fast_conn_and_receiver ,mem_24g_reconn_type 
+2002c 20202562 branch g24_reconn_start 
 
 z_mouse_24g_pairing_complete:
-2002a 704e3501 jam 1 ,mem_device_pair_flag 
-2002b 704b030a jam 10 ,mem_le_battery_level_updata_timer 
-2002c 704de305 jam 5 ,mem_device_tx_dpi_data_delay_timer 
-2002d 20400504 call p_mouse_agc_disable_nomal_power 
-2002e 20404584 call mouse_no_data_timer_init 
-2002f 204003fb call p_mouse_device_poweron_led_config 
-20030 20204896 branch mouse_24g_pairing_complete 
+2002d 704e3501 jam 1 ,mem_device_pair_flag 
+2002e 704b030a jam 10 ,mem_le_battery_level_updata_timer 
+2002f 704de305 jam 5 ,mem_device_tx_dpi_data_delay_timer 
+20030 20400504 call p_mouse_agc_disable_nomal_power 
+20031 20404584 call mouse_no_data_timer_init 
+20032 204003fb call p_mouse_device_poweron_led_config 
+20033 20204896 branch mouse_24g_pairing_complete 
               org 0x30001
 
 z_entrance2:
Index: output/ramcode.rom
===================================================================
--- /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/ramcode.rom	(revision 5270)
+++ /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/ramcode.rom	(working copy)
@@ -74,7 +74,7 @@
 c0618394
 c0630380
 c0638387
-c06406f5
+c064071e
 c0648492
 c0668686
 c06704da
@@ -89,7 +89,7 @@
 c0700177
 c0708174
 c06b0600
-c06c86fb
+c06c8724
 c06d055f
 c06e0463
 2020137e
@@ -487,13 +487,13 @@
 708a3a00
 20201226
 20406e5e
-204006ec
-204006fd
+20400715
+20400726
 204041e7
 20758000
 204004e3
 20404766
-204006ef
+20400718
 20400484
 20203c7f
 6fe0c923
@@ -899,7 +899,7 @@
 c2818385
 2040048b
 20400484
-204006f5
+2040071e
 20203289
 6ff20138
 79207e1a
@@ -914,7 +914,7 @@
 20403f96
 6848c915
 202060e6
-202006f1
+2020071a
 204022e1
 2040255f
 204003a9
@@ -1266,11 +1266,11 @@
 704cb201
 20600000
 1a627e00
-c01e06f7
-c01c86f3
+c01e0720
+c01c871c
 c01d0506
 c0190550
-c00a86f9
+c00a8722
 c00a055c
 c0200557
 c00104fd
@@ -1321,7 +1321,7 @@
 704c3201
 204002ac
 6fe0cbf2
-245a06f5
+245a071e
 6fe4485f
 202026bf
 6fe0cde5
@@ -1770,31 +1770,72 @@
 c17f8000
 d840003e
 2020612c
+70486801
+704e3900
+20400702
+204006f2
+20400708
+202006ef
+204006b6
+1a217e07
+c00086f7
+704e3800
+20600000
+6fe0ce38
+247a0000
+704e3801
+6fe0ce39
+1fe0fe01
+1fe17e03
+67e0ce39
+c0000702
+c0008704
+c0010706
+20600000
+70483d00
+20600000
+70483d26
+20600000
+70483d4c
+20600000
+7041e800
+204021f5
+7843fc00
+782efc00
+78307c00
+79202a00
+70890d22
+5800ffff
+1fe27200
+efe08006
+08008608
+c2000711
+20600000
 20758000
 704dcd00
-20200700
+20200729
 704dcd01
-20200700
+20200729
 704dcd10
-20200700
+20200729
 704dcd11
-20200700
+20200729
 704dcd20
-20200700
+20200729
 704dcd21
-20200700
+20200729
 704dcd30
-20200700
+20200729
 704dcd31
-20200700
+20200729
 20758000
 704dcd40
-20200700
+20200729
 6848cdcd
 18518400
 6fe0cdd2
 98467c00
-2022871c
+20228745
 6048cdd2
 18408401
 58000100
@@ -1804,14 +1845,14 @@
 6849cdd6
 9840fe00
 67e1cdd9
-2040071e
-2040072a
-20400721
-2422870e
+20400747
+20400753
+2040074a
+24228737
 6fe20e00
 684a4ddc
 98467c00
-2422870e
+24228737
 58000e00
 67e141a6
 7041a840
@@ -1828,7 +1869,7 @@
 df20003f
 efe20006
 9a20a200
-c2000724
+c200074d
 efe20006
 9a267c00
 20600000
Index: output/romcode.rom
===================================================================
--- /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/romcode.rom	(revision 5270)
+++ /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/output/romcode.rom	(working copy)
@@ -30609,20 +30609,23 @@
 67e1489f
 20203c89
 c0080004
-c008802a
+c008802d
 20600000
+20404150
+1a217e07
+c00186ec
 6fe44bbc
-c2978023
+c2978026
 6fe0c93d
-c0000015
+c0000018
 20400413
 20404354
 6fe0c93d
-c000800e
-c0010010
+c0008011
+c0010013
 20600000
 6fe3493f
-20200011
+20200014
 6fe3495c
 684b4979
 98467c00
@@ -30634,8 +30637,8 @@
 20403e28
 20344845
 6fe44bbc
-c2980025
-c3188025
+c2980028
+c3188028
 20404150
 1a217e07
 6848cbdc
@@ -30766,4 +30769,4 @@
 67e1cc16
 202026e8
 20600000
-0000e139
+00007178
Index: program/patch.prog
===================================================================
--- /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/program/patch.prog	(revision 5270)
+++ /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/program/patch.prog	(working copy)
@@ -9,6 +9,7 @@
 //define USB
 //define AUTO_SEND
 //define ADC
+define FREQ_TEST
 
 p_start:
 	branch p_patch_array
@@ -3036,6 +3037,64 @@
 
 endif
 
+ifdef FREQ_TEST
+p_mouse_freq_test_mode:
+	jam 0x01,mem_24g_tx_phy
+	jam 0,mem_mouse_ch_count
+	call p_mouse_set_ch_l
+p_mouse_freq_test_mode_loop:
+	call p_mouse_freq_test_mode_state_check
+	call p_mouse_freq_test_single_wave
+	branch p_mouse_freq_test_mode_loop
+
+p_mouse_freq_test_mode_state_check:
+	call p_mouse_check_key_gpio
+	and rega,0x07,pdata
+	beq MOUSE_L_BUTTON,p_mouse_change_freq_set
+	jam 0,mem_mouse_ch_set_flag
+	rtn
+p_mouse_change_freq_set:
+	fetch 1,mem_mouse_ch_set_flag
+	nrtn blank
+	jam 1,mem_mouse_ch_set_flag
+	
+	fetch 1,mem_mouse_ch_count
+	increase 1,pdata
+	and pdata,0x03,pdata
+	store 1,mem_mouse_ch_count
+	beq 0,p_mouse_set_ch_l
+	beq 1,p_mouse_set_ch_m
+	beq 2,p_mouse_set_ch_h
+	rtn
+
+p_mouse_set_ch_l:
+	jam 0,mem_24g_ch
+	rtn
+
+p_mouse_set_ch_m:
+	jam 0x26,mem_24g_ch
+	rtn
+
+p_mouse_set_ch_h:
+	jam 0x4c,mem_24g_ch
+	rtn
+
+p_mouse_freq_test_single_wave:
+	jam TX_POWER_0DB,mem_tx_power
+	call g24_set_freq_tx
+	disable enable_white
+	enable encode_fec0
+	enable is_tx
+	set1 TXGFSK,radio_ctrl
+	jam 0x22,core_tx_test_mode
+	setarg 0xffff
+	copy pdata,loopcnt
+p_pnloop_carrier:
+	ifetch 1,contr
+	inject mod,8
+	loop p_pnloop_carrier
+	rtn
+endif
 
 //=============================ZCODE CODE PATCH =============================//
 p_mouse_setting_config:
Index: program/z.prog
===================================================================
--- /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/program/z.prog	(revision 5270)
+++ /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/program/z.prog	(working copy)
@@ -95,6 +95,11 @@
 	rtn
 
 z_mouse_start_work_next:
+ifdef FREQ_TEST
+	call mouse_key_check_once
+	and rega,0x07,pdata
+	beq MOUSE_LR_BUTTON,p_mouse_freq_test_mode
+endif
 	fetch MOUSE_FLAG_LEN,mem_mouse_flag
 	bbit1 MOUSE_ENABLE_24G_FIRST_AUTO_PAIRING,z_mouse_24g_first_start_auto_pair_mode
 	fetch 1,mem_device_flag
Index: sched/mouse.dat
===================================================================
--- /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/sched/mouse.dat	(revision 5270)
+++ /YC1308AF/branch/mouse/USB_4Mode_Project/RongYuan_Project/mouse_public_3mode_usb/sched/mouse.dat	(working copy)
@@ -108,14 +108,14 @@
 mem_rssi_dis_min_ble_init:75
 mem_rssi_dis_max_ble_init:80
 
-mem_bk_button_gpio:0d
-mem_fw_button_gpio:0e
+mem_bk_button_gpio:0e
+mem_fw_button_gpio:0d
 mem_dpi_button_gpio:0f
 mem_matrix_public_gpio:07
 mem_sensor_motion_gpio:03
 mem_customer_key_gpio:ff
-mem_whee_a_data_gpio:0c
-mem_whee_b_data_gpio:0b
+mem_whee_a_data_gpio:0b
+mem_whee_b_data_gpio:0c
 mem_select_sensor_angle_gpio:ff
 mem_mouse_reuse_2ice_gpio:ff
 
