Index: output/eeprom.dat
===================================================================
--- /branch/Shutter/Ble shutter/AB Shutter3 YC1021W/output/eeprom.dat	(revision 1071)
+++ /branch/Shutter/Ble shutter/AB Shutter3 YC1021W/output/eeprom.dat	(working copy)
@@ -171,7 +171,7 @@
 02
 aa
 55
-46
+de
 01
 c2
 84
@@ -180,43 +180,51 @@
 c0
 00
 00
-0c
+0e
 c0
 42
 80
-0f
+11
 c0
 58
 80
-28
+2a
 c0
 7a
 80
-2a
+2c
 20
 20
 2a
 8e
 c0
+2c
+80
+31
+c0
+33
+00
+3e
+c0
 41
 00
-2f
+55
 c0
 42
 80
-41
+67
 c0
 51
 00
-47
+6d
 c0
 51
 80
-4d
+73
 c0
 66
 80
-4e
+74
 20
 20
 2a
@@ -236,7 +244,7 @@
 20
 30
 80
-1f
+21
 70
 89
 55
@@ -268,27 +276,27 @@
 c0
 00
 00
-1d
+1f
 c0
 00
 80
-21
+23
 c0
 01
 00
-1d
+1f
 c0
 01
 80
-21
+23
 c0
 02
 00
-21
+23
 c0
 10
 00
-21
+23
 70
 89
 55
@@ -316,7 +324,7 @@
 20
 20
 00
-1f
+21
 d8
 e0
 00
@@ -336,7 +344,7 @@
 20
 40
 00
-24
+26
 20
 20
 2c
@@ -344,7 +352,7 @@
 58
 00
 00
-2d
+2f
 60
 01
 41
@@ -361,6 +369,150 @@
 20
 46
 b3
+68
+00
+84
+3f
+c4
+03
+00
+00
+20
+40
+00
+36
+24
+74
+00
+00
+20
+20
+55
+a0
+78
+34
+7c
+00
+68
+00
+84
+5a
+1f
+f1
+fe
+00
+c1
+87
+80
+00
+68
+00
+84
+60
+1f
+f1
+fe
+00
+c1
+80
+00
+00
+20
+20
+7f
+e9
+c6
+07
+80
+00
+20
+40
+58
+90
+24
+7a
+00
+00
+68
+00
+82
+d9
+1f
+e1
+7e
+03
+60
+00
+c5
+0c
+e8
+c0
+80
+00
+1f
+e1
+7e
+1f
+60
+00
+c5
+0b
+20
+7a
+00
+00
+18
+c2
+7e
+00
+60
+01
+45
+0d
+68
+00
+c5
+0c
+c0
+01
+80
+4d
+20
+20
+56
+8d
+68
+00
+82
+db
+c0
+00
+80
+50
+20
+20
+5c
+65
+e8
+c2
+80
+00
+60
+02
+c3
+ce
+e8
+c1
+00
+00
+60
+01
+04
+5f
+20
+20
+5c
+8a
 78
 54
 7c
@@ -380,7 +532,7 @@
 c2
 83
 80
-35
+5b
 20
 20
 60
@@ -388,11 +540,11 @@
 c0
 42
 00
-38
+5e
 c0
 41
 80
-3b
+61
 20
 20
 60
@@ -400,7 +552,7 @@
 20
 40
 00
-3e
+64
 68
 00
 80
@@ -412,7 +564,7 @@
 20
 40
 00
-3e
+64
 68
 00
 80
@@ -497,8 +649,8 @@
 20
 74
 bd
-b3
-6e
+25
+17
 aa
 55
 01
@@ -1133,8 +1285,8 @@
 00
 00
 00
-00
-00
+02
+40
 00
 00
 00
@@ -1310,160 +1462,8 @@
 40
 e1
 41
-b5
-e6
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
-ff
+34
+44
 ff
 ff
 ff
@@ -1996,5 +1996,5 @@
 ff
 ff
 ff
-2b
-cd
+27
+b6
Index: output/program.lis
===================================================================
--- /branch/Shutter/Ble shutter/AB Shutter3 YC1021W/output/program.lis	(revision 1071)
+++ /branch/Shutter/Ble shutter/AB Shutter3 YC1021W/output/program.lis	(working copy)
@@ -1,50 +1,52 @@
 include "bt_format "
 org 0x0000
 0000 c2840006 bbit1 8 ,pf_patch_ext 
-0001 c000000c beq patch00_0 ,p_soft_reset 
-0002 c042800f beq patch10_5 ,p_shutdown_radio 
-0003 c0588028 beq patch16_1 ,p_lpm_check_wake_lock 
-0004 c07a802a beq patch1e_5 ,p_shutter_init 
+0001 c000000e beq patch00_0 ,p_soft_reset 
+0002 c0428011 beq patch10_5 ,p_shutdown_radio 
+0003 c058802a beq patch16_1 ,p_lpm_check_wake_lock 
+0004 c07a802c beq patch1e_5 ,p_shutter_init 
 0005 20202a8e branch loop 
 
 pf_patch_ext:
-0006 c041002f beq patch30_2 ,p_send_lmp 
-0007 c0428041 beq patch30_5 ,p_ssp_disable 
-0008 c0510047 beq patch34_2 ,p_keyscan_key_process 
-0009 c051804d beq patch34_3 ,p_keyscan_send_key_data 
-000a c066804e beq patch39_5 ,p_sdp_process 
-000b 20202a8e branch loop 
+0006 c02c8031 beq patch2b_1 ,p_le_update_channel_map 
+0007 c033003e beq patch2c_6 ,p_le_parse 
+0008 c0410055 beq patch30_2 ,p_send_lmp 
+0009 c0428067 beq patch30_5 ,p_ssp_disable 
+000a c051006d beq patch34_2 ,p_keyscan_key_process 
+000b c0518073 beq patch34_3 ,p_keyscan_send_key_data 
+000c c0668074 beq patch39_5 ,p_sdp_process 
+000d 20202a8e branch loop 
 
 p_soft_reset:
-000c 20800000 clear_stack 
-000d 204074b9 call enable_authrom 
-000e 20202003 branch soft_reset + 2 
+000e 20800000 clear_stack 
+000f 204074b9 call enable_authrom 
+0010 20202003 branch soft_reset + 2 
 
 p_shutdown_radio:
-000f 2030801f branch p_shutdown_radio0 ,is_rx 
-0010 708955d4 hjam 0xd4 ,0x955 
-0011 20000004 nop 4 
-0012 708955d2 hjam 0xd2 ,0x955 
+0011 20308021 branch p_shutdown_radio0 ,is_rx 
+0012 708955d4 hjam 0xd4 ,0x955 
 0013 20000004 nop 4 
-0014 708955d1 hjam 0xd1 ,0x955 
+0014 708955d2 hjam 0xd2 ,0x955 
 0015 20000004 nop 4 
-0016 6800c1de fetch 1 ,mem_tx_power 
-0017 c000001d beq tx_power_0db ,p_shutdown_radio_0db 
-0018 c0008021 beq tx_power_3db ,p_shutdown_radio_3db 
-0019 c001001d beq tx_power_5db ,p_shutdown_radio_5db 
-001a c0018021 beq tx_power_f3db ,p_shutdown_radio_f3db 
-001b c0020021 beq tx_power_f5db ,p_shutdown_radio_f5db 
-001c c0100021 beq tx_power_pair ,p_shutdown_radio_pair 
+0016 708955d1 hjam 0xd1 ,0x955 
+0017 20000004 nop 4 
+0018 6800c1de fetch 1 ,mem_tx_power 
+0019 c000001f beq tx_power_0db ,p_shutdown_radio_0db 
+001a c0008023 beq tx_power_3db ,p_shutdown_radio_3db 
+001b c001001f beq tx_power_5db ,p_shutdown_radio_5db 
+001c c0018023 beq tx_power_f3db ,p_shutdown_radio_f3db 
+001d c0020023 beq tx_power_f5db ,p_shutdown_radio_f5db 
+001e c0100023 beq tx_power_pair ,p_shutdown_radio_pair 
 
 p_shutdown_radio_5db:
 
 p_shutdown_radio_0db:
-001d 708955d0 hjam 0xd0 ,0x955 
-001e 708956e0 hjam 0xe0 ,0x956 
+001f 708955d0 hjam 0xd0 ,0x955 
+0020 708956e0 hjam 0xe0 ,0x956 
 
 p_shutdown_radio0:
-001f 18002a08 force 0x08 ,radio_ctrl 
-0020 2020290a branch shutdown_radio0 
+0021 18002a08 force 0x08 ,radio_ctrl 
+0022 2020290a branch shutdown_radio0 
 
 p_shutdown_radio_pair:
 
@@ -53,80 +55,126 @@
 p_shutdown_radio_f3db:
 
 p_shutdown_radio_3db:
-0021 708955d0 hjam 0xd0 ,0x955 
-0022 708956c0 hjam 0xc0 ,0x956 
-0023 2020001f branch p_shutdown_radio0 
+0023 708955d0 hjam 0xd0 ,0x955 
+0024 708956c0 hjam 0xc0 ,0x956 
+0025 20200021 branch p_shutdown_radio0 
 
 p_lpm_check_ble_tx:
-0024 d8e00004 arg wake_lock_ble_tx_patch ,queue 
-0025 6800c4ff fetch 1 ,mem_le_tx_buff_used 
-0026 243a2c32 nbranch lpm_get_wake_lock ,blank 
-0027 20202c36 branch lpm_put_wake_lock 
+0026 d8e00004 arg wake_lock_ble_tx_patch ,queue 
+0027 6800c4ff fetch 1 ,mem_le_tx_buff_used 
+0028 243a2c32 nbranch lpm_get_wake_lock ,blank 
+0029 20202c36 branch lpm_put_wake_lock 
 
 p_lpm_check_wake_lock:
-0028 20400024 call p_lpm_check_ble_tx 
-0029 20202c3b branch lpm_check_wake_lock + 1 
+002a 20400026 call p_lpm_check_ble_tx 
+002b 20202c3b branch lpm_check_wake_lock + 1 
 
 p_shutter_init:
-002a 5800002d setarg p_shutter_process_lpm_before 
-002b 600141ed store 2 ,mem_cb_before_lpm 
-002c 20204603 branch shutter_init + 0x25 
+002c 5800002f setarg p_shutter_process_lpm_before 
+002d 600141ed store 2 ,mem_cb_before_lpm 
+002e 20204603 branch shutter_init + 0x25 
 
 p_shutter_process_lpm_before:
-002d 20406835 call gpio_set_before_lpm_common 
-002e 202046b3 branch shutter_process_lpm_before 
+002f 20406835 call gpio_set_before_lpm_common 
+0030 202046b3 branch shutter_process_lpm_before 
+
+p_le_update_channel_map:
+0031 6800843f fetch 1 ,mem_le_state 
+0032 c4030000 rtnbit0 lestate_update_map 
+0033 20400036 call p_le_channel_map_overflow_check 
+0034 24740000 nrtn user 
+0035 202055a0 branch le_update_channel_map + 3 
+
+p_le_channel_map_overflow_check:
+0036 78347c00 enable user 
+0037 6800845a fetch 1 ,mem_le_event_count + 1 
+0038 1ff1fe00 rshift4 pdata ,pdata 
+0039 c1878000 rtnne 0x0f 
+003a 68008460 fetch 1 ,mem_le_instant + 1 
+003b 1ff1fe00 rshift4 pdata ,pdata 
+003c c1800000 rtnne 0x00 
+003d 20207fe9 branch disable_user 
+
+p_le_parse:
+003e c6078000 rtnmark1 mark_old_packet 
+003f 20405890 call le_fifo_check_full 
+0040 247a0000 nrtn blank 
+0041 680082d9 fetch 1 ,mem_le_rxbuf 
+0042 1fe17e03 and pdata ,0x3 ,pdata 
+0043 6000c50c store 1 ,mem_le_packet_llid 
+0044 e8c08000 ifetch 1 ,contr 
+0045 1fe17e1f and pdata ,0x1f ,pdata 
+0046 6000c50b store 1 ,mem_le_packet_size 
+0047 207a0000 rtn blank 
+0048 18c27e00 copy contr ,pdata 
+0049 6001450d store 2 ,mem_le_payload_ptr 
+004a 6800c50c fetch 1 ,mem_le_packet_llid 
+004b c001804d beq llid_le_ll ,p_le_parse_ll 
+004c 2020568d branch le_parse_l2cap 
+
+p_le_parse_ll:
+004d 680082db fetch 1 ,mem_le_rxbuf + 2 
+004e c0008050 beq ll_channel_map_req ,p_le_parse_channel_map_req 
+004f 20205c65 branch le_parse_ll + 1 
+
+p_le_parse_channel_map_req:
+0050 e8c28000 ifetch 5 ,contr 
+0051 6002c3ce store 5 ,mem_le_new_map 
+0052 e8c10000 ifetch 2 ,contr 
+0053 6001045f store 2 ,mem_le_instant 
+0054 20205c8a branch le_parse_channel_map_req + 7 
 
 p_send_lmp:
-002f 78547c00 disable user 
-0030 204062c1 call lmo_fifo_process 
-0031 68008048 fetch 1 ,mem_lmp_to_send 
-0032 207a0000 rtn blank 
-0033 c2838035 bbit1 7 ,p_send_lmp_escape 
-0034 20206010 branch send_lmp0 
+0055 78547c00 disable user 
+0056 204062c1 call lmo_fifo_process 
+0057 68008048 fetch 1 ,mem_lmp_to_send 
+0058 207a0000 rtn blank 
+0059 c283805b bbit1 7 ,p_send_lmp_escape 
+005a 20206010 branch send_lmp0 
 
 p_send_lmp_escape:
-0035 c0420038 beq lmp_ext_features_res ,p_send_lmpext_features_res 
-0036 c041803b beq lmp_ext_features_req ,p_send_lmpext_features_req 
-0037 2020603f branch send_lmp_escape 
+005b c042005e beq lmp_ext_features_res ,p_send_lmpext_features_res 
+005c c0418061 beq lmp_ext_features_req ,p_send_lmpext_features_req 
+005d 2020603f branch send_lmp_escape 
 
 p_send_lmpext_features_res:
-0038 2040003e call p_check_ssp_enable 
-0039 68008048 fetch 1 ,mem_lmp_to_send 
-003a 20206099 branch send_lmpext_features_res 
+005e 20400064 call p_check_ssp_enable 
+005f 68008048 fetch 1 ,mem_lmp_to_send 
+0060 20206099 branch send_lmpext_features_res 
 
 p_send_lmpext_features_req:
-003b 2040003e call p_check_ssp_enable 
-003c 68008048 fetch 1 ,mem_lmp_to_send 
-003d 2020610d branch send_lmpext_features_req 
+0061 20400064 call p_check_ssp_enable 
+0062 68008048 fetch 1 ,mem_lmp_to_send 
+0063 2020610d branch send_lmpext_features_req 
 
 p_check_ssp_enable:
-003e 6800c65a fetch 1 ,mem_ssp_enable 
-003f 203a612b branch ssp_disable ,blank 
-0040 20206124 branch ssp_enable 
+0064 6800c65a fetch 1 ,mem_ssp_enable 
+0065 203a612b branch ssp_disable ,blank 
+0066 20206124 branch ssp_enable 
 
 p_ssp_disable:
-0041 6800c09e fetch 1 ,mem_features + 6 
-0042 793ffe03 set0 param_featrue_ssp ,pdata 
-0043 6000c09e store 1 ,mem_features + 6 
-0044 58000001 setarg 0x1 
-0045 600104ce store 2 ,mem_lmpext_ssp_enable 
-0046 20600000 rtn 
+0067 6800c09e fetch 1 ,mem_features + 6 
+0068 793ffe03 set0 param_featrue_ssp ,pdata 
+0069 6000c09e store 1 ,mem_features + 6 
+006a 58000001 setarg 0x1 
+006b 600104ce store 2 ,mem_lmpext_ssp_enable 
+006c 20600000 rtn 
 
 p_keyscan_key_process:
-0047 680148ed fetch 2 ,mem_key_value_copy 
-0048 60010b14 store 2 ,mem_key_value 
-0049 20406981 call keyscan_key_process + 9 
-004a 68010b14 fetch 2 ,mem_key_value 
-004b 600148ed store 2 ,mem_key_value_copy 
-004c 20600000 rtn 
+006d 680148ed fetch 2 ,mem_key_value_copy 
+006e 60010b14 store 2 ,mem_key_value 
+006f 20406981 call keyscan_key_process + 9 
+0070 68010b14 fetch 2 ,mem_key_value 
+0071 600148ed store 2 ,mem_key_value_copy 
+0072 20600000 rtn 
 
 p_keyscan_send_key_data:
-004d 202069a2 branch keyscan_send_key_data + 1 
+0073 202069a2 branch keyscan_send_key_data + 1 
 
 p_sdp_process:
-004e 204074b9 call enable_authrom 
-004f 20406e12 call sdp_process + 1 
-0050 202074bd branch disable_authrom 
+0074 204074b9 call enable_authrom 
+0075 20406e12 call sdp_process + 1 
+0076 202074bd branch disable_authrom 
 org 0x2000
 
 start:
Index: program/patch.prog
===================================================================
--- /branch/Shutter/Ble shutter/AB Shutter3 YC1021W/program/patch.prog	(revision 1071)
+++ /branch/Shutter/Ble shutter/AB Shutter3 YC1021W/program/patch.prog	(working copy)
@@ -8,6 +8,8 @@
 	beq patch1e_5,p_shutter_init
 	branch loop
 pf_patch_ext:
+	beq patch2b_1,p_le_update_channel_map
+	beq patch2c_6,p_le_parse
 	beq patch30_2,p_send_lmp
 	beq patch30_5,p_ssp_disable
 	beq patch34_2,p_keyscan_key_process
@@ -74,7 +76,51 @@
 p_shutter_process_lpm_before:
 	call gpio_set_before_lpm_common
 	branch shutter_process_lpm_before
-	
+
+
+p_le_update_channel_map:
+	fetch 1,mem_le_state
+	rtnbit0 lestate_update_map
+	call p_le_channel_map_overflow_check
+	nrtn user
+	branch le_update_channel_map+3
+p_le_channel_map_overflow_check:
+	enable user
+	fetch 1,mem_le_event_count+1
+	rshift4 pdata,pdata
+	rtnne 0x0f
+	fetch 1,mem_le_instant+1
+	rshift4 pdata,pdata
+	rtnne 0x00
+	branch disable_user
+
+p_le_parse:
+	rtnmark1 mark_old_packet
+	call le_fifo_check_full
+	nrtn blank
+	fetch 1,mem_le_rxbuf
+	and pdata,0x3,pdata
+	store 1,mem_le_packet_llid
+	ifetch 1,contr
+	and pdata,0x1f,pdata
+	store 1,mem_le_packet_size
+	rtn blank							//empty rtn
+	copy contr,pdata
+	store 2,mem_le_payload_ptr
+	fetch 1,mem_le_packet_llid
+	beq LLID_LE_LL,p_le_parse_ll
+	branch le_parse_l2cap
+p_le_parse_ll:
+	fetch 1,mem_le_rxbuf+2
+	beq LL_CHANNEL_MAP_REQ,p_le_parse_channel_map_req
+	branch le_parse_ll+1
+p_le_parse_channel_map_req:
+	ifetch 5,contr
+	store 5,mem_le_new_map
+	ifetch 2,contr
+	store 2,mem_le_instant
+	branch le_parse_channel_map_req+7
+
 
 p_send_lmp:
 	disable user
Index: sched/109x.dat
===================================================================
--- /branch/Shutter/Ble shutter/AB Shutter3 YC1021W/sched/109x.dat	(revision 1071)
+++ /branch/Shutter/Ble shutter/AB Shutter3 YC1021W/sched/109x.dat	(working copy)
@@ -44,8 +44,8 @@
 00   #mem_patch28
 00   #mem_patch29
 00   #mem_patch2A
-00   #mem_patch2B
-00   #mem_patch2C
+02   #mem_patch2B
+40   #mem_patch2C
 00   #mem_patch2D
 00   #mem_patch2E
 00   #mem_patch2F
