Index: output/otp.dat
===================================================================
--- /1121s/branch/shutter/branch/shutter/yb_project/yc1386s_shutter_376/output/otp.dat	(revision 6157)
+++ /1121s/branch/shutter/branch/shutter/yb_project/yc1386s_shutter_376/output/otp.dat	(working copy)
@@ -11,8 +11,8 @@
 00
 aa
 55
-da
-08
+ea
+09
 c2
 84
 00
@@ -20,87 +20,91 @@
 c0
 00
 00
-18
+19
 c0
 01
 00
-5a
+82
 c0
 08
 80
-63
+9b
 c0
 0a
 01
-c1
+fb
 c0
 0a
-80
-f6
+81
+30
 c0
 0c
 01
-04
+3e
 c0
 0c
 80
-c3
+fd
 c0
 0d
 00
-71
+a9
 c0
 0e
 00
-1c
+44
 c0
 12
 82
-15
+4f
 c0
 13
 82
-0a
+44
 c0
 58
 81
-0e
+48
 c0
 62
 81
-0b
+45
 c0
 6d
 01
-aa
+e4
 20
 20
 23
 5a
 c0
 12
-01
-e3
+02
+1d
 c0
 12
 80
-55
+7d
 c0
 13
 00
-45
+6d
 c0
 1c
-81
-dd
+82
+17
+c0
+1d
+00
+1d
 c0
 1f
 80
-2a
+52
 c0
 26
-81
-e1
+82
+1b
 c1
 7f
 80
@@ -125,6 +129,162 @@
 20
 20
 02
+ef
+e1
+00
+06
+c0
+02
+00
+22
+c0
+03
+2e
+c8
+c0
+02
+ae
+8a
+20
+60
+00
+00
+18
+c2
+22
+00
+6f
+e0
+c3
+cb
+c0
+03
+66
+d5
+c0
+07
+d0
+3d
+1a
+22
+0c
+00
+ef
+e1
+80
+06
+67
+e1
+c3
+97
+c0
+06
+00
+2b
+20
+20
+2b
+96
+ef
+e1
+00
+06
+67
+e1
+06
+b5
+98
+00
+22
+00
+68
+49
+43
+98
+18
+46
+7c
+07
+20
+22
+80
+32
+20
+20
+2d
+50
+d8
+c0
+42
+6b
+ef
+e0
+80
+06
+9a
+26
+72
+00
+24
+21
+2e
+03
+20
+40
+7c
+6d
+20
+40
+2e
+46
+1f
+20
+84
+01
+20
+40
+7d
+b0
+1f
+e2
+22
+00
+1f
+e2
+26
+00
+20
+40
+2e
+10
+58
+00
+00
+0d
+e7
+e0
+80
+05
+1a
+60
+f3
+ff
+68
+49
+06
+b5
+20
+40
+7c
+67
+98
+40
+8c
+00
+20
+20
+7c
+cc
 70
 8a
 20
@@ -176,7 +336,7 @@
 c3
 00
 00
-22
+4a
 20
 20
 22
@@ -188,7 +348,7 @@
 20
 37
 00
-2d
+55
 24
 36
 a9
@@ -212,7 +372,7 @@
 24
 3a
 00
-3e
+66
 6f
 e0
 c3
@@ -383,8 +543,8 @@
 48
 20
 40
-2a
-45
+00
+8b
 20
 40
 20
@@ -395,8 +555,8 @@
 ad
 20
 40
-20
-18
+00
+93
 20
 40
 31
@@ -408,7 +568,71 @@
 20
 20
 00
-5a
+82
+6f
+f0
+89
+60
+79
+3f
+fe
+01
+67
+f0
+89
+60
+20
+40
+2a
+45
+6f
+f0
+89
+60
+79
+20
+7e
+01
+67
+f0
+89
+60
+20
+60
+00
+00
+6f
+f0
+89
+60
+79
+3f
+fe
+01
+67
+f0
+89
+60
+20
+40
+20
+18
+6f
+f0
+89
+60
+79
+20
+7e
+01
+67
+f0
+89
+60
+20
+60
+00
+00
 70
 8a
 0f
@@ -487,6 +711,10 @@
 10
 70
 8a
+88
+40
+70
+8a
 13
 cd
 70
@@ -507,8 +735,8 @@
 fe
 20
 40
-00
-cb
+01
+05
 6f
 e0
 c4
@@ -520,7 +748,7 @@
 24
 55
 80
-41
+69
 37
 d9
 82
@@ -536,7 +764,7 @@
 c0
 08
 00
-b8
+f2
 6f
 e0
 c4
@@ -580,7 +808,7 @@
 20
 40
 00
-aa
+e4
 70
 80
 43
@@ -604,15 +832,15 @@
 20
 40
 01
-7c
+b6
 20
 40
 01
-a7
+e1
 20
 40
 00
-a5
+df
 70
 80
 43
@@ -636,19 +864,19 @@
 20
 40
 01
-7c
+b6
 20
 40
 01
-a7
+e1
 20
 40
 00
-a5
+df
 70
 8a
 30
-1e
+06
 70
 8a
 32
@@ -656,12 +884,16 @@
 70
 8a
 88
-e4
+e0
 70
 8a
 8c
 2d
 70
+8a
+31
+78
+70
 41
 48
 0c
@@ -672,7 +904,7 @@
 20
 20
 01
-a9
+e3
 37
 d9
 82
@@ -700,7 +932,7 @@
 c0
 0c
 00
-b0
+ea
 6f
 e0
 c4
@@ -792,15 +1024,15 @@
 20
 20
 00
-8b
+c4
 6f
 e0
 c1
 41
 c0
 05
+01
 00
-c6
 20
 20
 22
@@ -827,8 +1059,8 @@
 00
 20
 35
-80
-f2
+81
+2c
 6f
 e2
 02
@@ -995,8 +1227,8 @@
 0f
 20
 20
-00
-dc
+01
+16
 20
 40
 68
@@ -1164,7 +1396,7 @@
 58
 00
 01
-33
+6d
 67
 e1
 43
@@ -1172,7 +1404,7 @@
 58
 00
 01
-36
+70
 67
 e1
 43
@@ -1188,7 +1420,7 @@
 58
 00
 01
-74
+ae
 67
 e1
 43
@@ -1196,7 +1428,7 @@
 58
 00
 01
-41
+7b
 67
 e1
 45
@@ -1216,7 +1448,7 @@
 c0
 00
 01
-30
+6a
 6f
 e0
 c5
@@ -1260,15 +1492,15 @@
 c0
 18
 81
-3b
+75
 c0
 0a
 81
-3d
+77
 c0
 1f
 81
-75
+af
 20
 20
 62
@@ -1312,7 +1544,7 @@
 20
 3a
 01
-48
+82
 70
 48
 c2
@@ -1324,7 +1556,7 @@
 20
 20
 01
-52
+8c
 70
 48
 c2
@@ -1356,7 +1588,7 @@
 24
 3a
 01
-51
+8b
 70
 48
 c1
@@ -1380,11 +1612,11 @@
 c0
 00
 01
-62
+9c
 c0
 00
 81
-58
+92
 20
 60
 00
@@ -1428,7 +1660,7 @@
 20
 20
 01
-71
+ab
 58
 00
 00
@@ -1468,7 +1700,7 @@
 20
 20
 01
-71
+ab
 68
 49
 44
@@ -1584,7 +1816,7 @@
 20
 40
 01
-99
+d3
 2a
 2f
 fe
@@ -1616,7 +1848,7 @@
 20
 40
 01
-99
+d3
 d8
 a0
 8a
@@ -1644,7 +1876,7 @@
 20
 21
 01
-8e
+c8
 20
 20
 21
@@ -1748,7 +1980,7 @@
 20
 40
 01
-ba
+f4
 70
 8a
 08
@@ -1792,7 +2024,7 @@
 c3
 02
 81
-bb
+f5
 68
 59
 01
@@ -1827,8 +2059,8 @@
 99
 c0
 08
-01
-da
+02
+14
 58
 00
 57
@@ -1871,8 +2103,8 @@
 99
 c0
 08
-01
-d7
+02
+11
 58
 00
 2b
@@ -1907,8 +2139,8 @@
 07
 20
 20
-01
-d3
+02
+0d
 58
 00
 83
@@ -1919,8 +2151,8 @@
 07
 20
 20
-01
-c8
+02
+02
 6f
 e0
 c3
@@ -1951,8 +2183,8 @@
 c2
 c5
 97
-81
-e9
+82
+23
 78
 3c
 fc
@@ -1995,8 +2227,8 @@
 00
 20
 37
-01
-f2
+02
+2c
 1b
 42
 04
@@ -2044,7 +2276,7 @@
 20
 40
 02
-00
+3a
 6f
 e0
 81
@@ -2160,7 +2392,7 @@
 20
 40
 00
-a7
+e1
 6f
 e2
 40
@@ -2176,11 +2408,51 @@
 20
 40
 02
-1e
+62
+6f
+e0
+c0
+cb
+79
 20
+7e
+04
 20
+40
+23
+e1
 24
-25
+55
+a3
+cb
+37
+d9
+82
+00
+1b
+22
+7e
+00
+67
+e3
+40
+b1
+6f
+e1
+c0
+c6
+6a
+20
+c0
+c9
+df
+20
+00
+03
+20
+20
+24
+2e
 60
 04
 40
@@ -2248,7 +2520,7 @@
 20
 22
 82
-31
+75
 e7
 e0
 80
@@ -2268,7 +2540,7 @@
 c2
 00
 02
-2b
+6f
 1a
 42
 04
@@ -2277,8 +2549,8 @@
 60
 00
 00
-2c
-ed
+bf
+a3
 aa
 55
 40
@@ -2324,7 +2596,7 @@
 70
 00
 00
-82
+86
 00
 20
 00
@@ -2661,7 +2933,7 @@
 aa
 aa
 55
-e8
+ec
 55
-a2
-96
+4d
+81
Index: output/ramcode.rom
===================================================================
--- /1121s/branch/shutter/branch/shutter/yb_project/yc1386s_shutter_376/output/ramcode.rom	(revision 6157)
+++ /1121s/branch/shutter/branch/shutter/yb_project/yc1386s_shutter_376/output/ramcode.rom	(working copy)
@@ -1,31 +1,71 @@
 c2840010
-c0000018
-c001005a
-c0088063
-c00a01c1
-c00a80f6
-c00c0104
-c00c80c3
-c00d0071
-c00e001c
-c0128215
-c013820a
-c058810e
-c062810b
-c06d01aa
+c0000019
+c0010082
+c008809b
+c00a01fb
+c00a8130
+c00c013e
+c00c80fd
+c00d00a9
+c00e0044
+c012824f
+c0138244
+c0588148
+c0628145
+c06d01e4
 2020235a
-c01201e3
-c0128055
-c0130045
-c01c81dd
-c01f802a
-c02681e1
+c012021d
+c012807d
+c013006d
+c01c8217
+c01d001d
+c01f8052
+c026821b
 c17f8000
 2020235a
 2435a002
 37d98200
 37d98200
 20202002
+efe10006
+c0020022
+c0032ec8
+c002ae8a
+20600000
+18c22200
+6fe0c3cb
+c00366d5
+c007d03d
+1a220c00
+efe18006
+67e1c397
+c006002b
+20202b96
+efe10006
+67e106b5
+98002200
+68494398
+18467c07
+20228032
+20202d50
+d8c0426b
+efe08006
+9a267200
+24212e03
+20407c6d
+20402e46
+1f208401
+20407db0
+1fe22200
+1fe22600
+20402e10
+5800000d
+e7e08005
+1a60f3ff
+684906b5
+20407c67
+98408c00
+20207ccc
 708a2030
 708a23dd
 204021d0
@@ -38,16 +78,16 @@
 98467c00
 20216ca3
 6ff08a7c
-c3000022
+c300004a
 2020229a
 7855fc00
-2037002d
+20370055
 2436a9b8
 204024d2
 6fe1409a
 67e10176
 6fe0c8ae
-243a003e
+243a0066
 6fe0c321
 c282a4e0
 c507a4e0
@@ -90,13 +130,29 @@
 2020268e
 20407552
 20407448
-20402a45
+2040008b
 2040202a
 204042ad
-20402018
+20400093
 2040310f
 2040248c
-2020005a
+20200082
+6ff08960
+793ffe01
+67f08960
+20402a45
+6ff08960
+79207e01
+67f08960
+20600000
+6ff08960
+793ffe01
+67f08960
+20402018
+6ff08960
+79207e01
+67f08960
+20600000
 708a0f60
 708a10aa
 708a127a
@@ -116,19 +172,20 @@
 37d98200
 7089460d
 70896f10
+708a8840
 708a13cd
 708a0610
 708a844a
 708a8540
 708a16fe
-204000cb
+20400105
 6fe0c436
 205a70d7
-24558041
+24558069
 37d98200
 70813b5f
 6fe0c099
-c00800b8
+c00800f2
 6fe0c438
 1fe1fe04
 67f08a02
@@ -139,37 +196,38 @@
 67f18a73
 708a8660
 708a8b3b
-204000aa
+204000e4
 70804300
 70804205
 58557474
 67f18968
 7089606e
-2040017c
-204001a7
-204000a5
+204001b6
+204001e1
+204000df
 70804300
 70804205
 58557474
 67f18968
 7089606e
-2040017c
-204001a7
-204000a5
-708a301e
+204001b6
+204001e1
+204000df
+708a3006
 708a32dd
-708a88e4
+708a88e0
 708a8c2d
+708a3178
 7041480c
 20406f4e
-202001a9
+202001e3
 37d98200
 6fe0c11c
 67f0813a
 37d98200
 20600000
 6fe0c099
-c00c00b0
+c00c00ea
 6fe0c438
 1fe1fe06
 67f08a02
@@ -192,16 +250,16 @@
 67f18a73
 708a762a
 70890204
-2020008b
+202000c4
 6fe0c141
-c00500c6
+c0050100
 2020220e
 708a1425
 58a93f3f
 67f18a60
 708a631f
 20600000
-203580f2
+2035812c
 6fe2020d
 207a0000
 37d98200
@@ -243,7 +301,7 @@
 6fe1415b
 207a0000
 67e1020f
-202000dc
+20200116
 2040686f
 204021ba
 18002a08
@@ -285,20 +343,20 @@
 67e44512
 6fe448a6
 67e444fa
-58000133
+5800016d
 67e143db
-58000136
+58000170
 67e143dd
 5800638a
 67e143df
-58000174
+580001ae
 67e143e3
-58000141
+5800017b
 67e14524
 204062c2
 20406396
 6fe0c51a
-c0000130
+c000016a
 6fe0c51b
 67e0c4ec
 202063a1
@@ -309,9 +367,9 @@
 204070c8
 20206327
 1a627e00
-c018813b
-c00a813d
-c01f8175
+c0188175
+c00a8177
+c01f81af
 202062da
 7048ae01
 20600000
@@ -322,10 +380,10 @@
 2040635d
 24760000
 1a227e00
-203a0148
+203a0182
 7048c200
 20404323
-20200152
+2020018c
 7048c201
 7048c100
 20404325
@@ -333,14 +391,14 @@
 6fe0c8c1
 247a0000
 6fe0c8c2
-243a0151
+243a018b
 7048c101
 20206371
 6fe0c8c3
 79407e00
 67e0c8c3
-c0000162
-c0008158
+c000019c
+c0008192
 20600000
 58000000
 67e1452e
@@ -351,7 +409,7 @@
 58000006
 67e1455b
 da60452e
-20200171
+202001ab
 58000000
 67e1452e
 58000002
@@ -361,7 +419,7 @@
 58000006
 67e1455b
 da60452e
-20200171
+202001ab
 68494430
 e7e08002
 efe08005
@@ -390,7 +448,7 @@
 708ac200
 708ac300
 d8e00006
-20400199
+204001d3
 2a2ffe0d
 2040211d
 2a4ffe0d
@@ -398,14 +456,14 @@
 d8e00005
 2040211c
 2040211e
-20400199
+204001d3
 d8a08ac2
 1a31fe00
 20402117
 1a51fe00
 20402117
 18e08fff
-2021018e
+202101c8
 2020214f
 2000003c
 58000f00
@@ -431,7 +489,7 @@
 6fe0c409
 67f080cd
 20000bb8
-204001ba
+204001f4
 708a08c1
 6a40c419
 df200008
@@ -442,7 +500,7 @@
 20600000
 7080cc03
 6ff08129
-c30281bb
+c30281f5
 68590164
 6049440a
 7080cc00
@@ -451,7 +509,7 @@
 708a8d12
 708a8e0a
 6fe0c099
-c00801da
+c0080214
 58005762
 67f10907
 70890103
@@ -462,7 +520,7 @@
 708a8d44
 708a8e0a
 6fe0c099
-c00801d7
+c0080211
 58002bb1
 67f10907
 c6978000
@@ -471,10 +529,10 @@
 20600000
 58004189
 67f10907
-202001d3
+2020020d
 58008312
 67f10907
-202001c8
+20200202
 6fe0c334
 c1000000
 c001b04a
@@ -482,7 +540,7 @@
 793f8030
 20202af6
 204025c2
-c59781e9
+c5978223
 783cfc00
 2000001e
 204025c2
@@ -493,7 +551,7 @@
 78507c00
 19623600
 37c18400
-203701f2
+2037022c
 1b420400
 604b000f
 242c26fa
@@ -505,7 +563,7 @@
 984fb600
 20406877
 20372677
-20400200
+2040023a
 6fe08168
 c301a677
 2055a477
@@ -534,12 +592,22 @@
 6fe143e9
 20407d79
 58000012
-204000a7
+204000e1
 6fe240ad
 9840fe00
 67e240ad
-2040021e
-20202425
+20400262
+6fe0c0cb
+79207e04
+204023e1
+2455a3cb
+37d98200
+1b227e00
+67e340b1
+6fe1c0c6
+6a20c0c9
+df200003
+2020242e
 600440e7
 d8c08070
 d8a040cc
@@ -556,11 +624,11 @@
 efe08011
 e8408013
 98467c00
-20228231
+20228275
 e7e08013
 37d98200
 1a20a201
 1a60a601
-c200022b
+c200026f
 1a420400
 20600000
Index: output/sched.rom
===================================================================
--- /1121s/branch/shutter/branch/shutter/yb_project/yc1386s_shutter_376/output/sched.rom	(revision 6157)
+++ /1121s/branch/shutter/branch/shutter/yb_project/yc1386s_shutter_376/output/sched.rom	(working copy)
@@ -38,7 +38,7 @@
 70   #mem_patch24
 00   #mem_patch25
 00   #mem_patch26
-82   #mem_patch27
+86   #mem_patch27
 00   #mem_patch28
 20   #mem_patch29
 00   #mem_patch2a
Index: program/patch.prog
===================================================================
--- /1121s/branch/shutter/branch/shutter/yb_project/yc1386s_shutter_376/program/patch.prog	(revision 6157)
+++ /1121s/branch/shutter/branch/shutter/yb_project/yc1386s_shutter_376/program/patch.prog	(working copy)
@@ -30,6 +30,7 @@
 	beq patch24_5,p_le_rx_dec
 	beq patch24_6,p_le_rx_nopayload
 	beq patch27_1,p_le_parse
+	beq patch27_2,p_le_parse_l2cap
 	beq patch27_7,p_le_lpm_set_mult
 	beq patch29_5,p_le_init_adv
 	rtneq patch3f_7
@@ -41,6 +42,56 @@
 	until null,lpo_edge
 	branch soft_reset+1
 
+p_le_parse_l2cap:
+	ifetch 2,contr
+	beq LE_L2CAP_CID_ATT,p_le_parse_att
+	beq LE_L2CAP_CID_SMP,le_parse_smp
+	beq LE_L2CAP_CID_SIGNAL,le_parse_signaling
+	rtn
+
+p_le_parse_att:
+	copy contr,rega
+	fetch 1,mem_device_option
+	beq DVC_OP_SHUTTER_DY,shutter_dy_le_parse_att
+	beq DVC_OP_KEYBOARD,keyboard_le_att_auto_reco_process
+	copy rega,contr
+	ifetch 3,contr
+	store 3,mem_le_att_opcode
+p_le_parse_att2:
+	beq ATTOP_READ_BLOB_REQUEST,p_le_parse_att_read_blob_request
+	branch le_parse_att2
+
+p_le_parse_att_read_blob_request:
+	ifetch 2,contr
+	store 2,mem_le_att_offset
+	iforce rega
+	fetcht 2,mem_le_att_handle
+	sub temp,0x07,null
+	branch p_shutter_readblob_name_fix,zero
+	branch le_send_att_read_blob_response
+
+
+p_shutter_readblob_name_fix:
+	//call ice_break
+	arg mem_le_name_len,contr
+	ifetch 1,contr
+	isub rega,loopcnt
+	nbranch le_send_att_error_response_notfound,positive
+	call store_contr
+	call le_get_search_max_mtu_data
+	add loopcnt,1,temp
+	call not_greater_than
+	copy pdata,rega
+	copy pdata,regc
+	call le_fifo_malloc_tx_l2cap_gatt
+	setarg ATTOP_READ_BLOB_RESPONSE
+	istore 1,contw
+	add regc,-1,loopcnt
+	fetcht 2,mem_le_att_offset
+	call get_contr
+	iadd temp,contr
+	branch memcpy_fast
+
 p_aac_ghpc:
 	jam 0x30,0x8a20
 	jam 0xdd,0x8a23
@@ -126,14 +177,33 @@
 	call sp_calc_sequence_256
 	call sp_calc_sequence_256_check
 endif
-	call le_advertising_dispatch
+	call p_le_advertising_dispatch
 	call idle_dispatch
 	call app_process_idle
-	call connection_dispatch
+	call p_connection_dispatch
 	call g24_dispatch
 	call lpm_dispatch
 	branch p_main_loop
 
+p_le_advertising_dispatch:
+	fetch 1,core_rf_rx_agc_ctrl
+	set0 1,pdata
+	store 1,core_rf_rx_agc_ctrl
+	call le_advertising_dispatch
+	fetch 1,core_rf_rx_agc_ctrl
+	set1 1,pdata
+	store 1,core_rf_rx_agc_ctrl
+	rtn
+
+p_connection_dispatch:
+	fetch 1,core_rf_rx_agc_ctrl
+	set0 1,pdata
+	store 1,core_rf_rx_agc_ctrl
+	call connection_dispatch
+	fetch 1,core_rf_rx_agc_ctrl
+	set1 1,pdata
+	store 1,core_rf_rx_agc_ctrl
+	rtn
 
 p_set_sync_on:
 	jam 0x60,0x8a0f
@@ -160,6 +230,7 @@
 	jam 0x0d,0x8946
 	jam 0x10,0x896f
 
+	jam 0x40,core_rx_cfg0
 	jam 0xcd,0x8a13
 	jam 0x10,0x8a06
 	jam 0x4a,0x8a84
@@ -202,10 +273,11 @@
 	call p_rx_dcoc
 	call p_rfpll_aac_ghpc
 	call p_set_xtal_cap
-	jam 0x1e,0x8a30
+	jam 0x06,0x8a30
 	jam 0xdd,0x8a32
-	jam 0xe4,0x8a88
+	jam 0xe0,0x8a88
 	jam 0x2d,0x8a8c
+	jam 0x78,0x8a31
 	jam SYSTEM_CLK_12M,mem_system_clk
 	call sadc_calibration
 	branch p_dpll_ring_ibias_calc
@@ -811,7 +883,18 @@
 	iadd temp,pdata
 	store 4,mem_sleep_counter_all
 	call p_lpm_save_context
-	branch lpm_sleep_skip_cb_function+4
+	fetch 1,mem_lpm_hv_sel
+	set1 LPM_DOZE_EN_BIT, pdata
+	call lpm_write_sel_hv
+	ncall lpm_preon_counter,wake
+	until null,lpo_edge
+	copy clkn,pdata
+	store 6,mem_sleep_clkn
+	// storer clkn,6,mem_sleep_clkn
+	fetch 3,mem_lpm_isogate
+	fetchr rega,1,mem_lpm_ldo_sel
+	arg 3,loopcnt
+	branch lpm_sleep_loop
 
 p_lpm_save_context:
 	storer mark,8,mem_saved_mark
