@@ -47,23 +47,25 @@ struct dap_context {
47
47
48
48
static struct dap_context dap_ctx [1 ];
49
49
50
+ #define CMSIS_DAP_PACKET_MIN_SIZE 64
51
+
50
52
BUILD_ASSERT (sizeof (CONFIG_CMSIS_DAP_PROBE_VENDOR ) <=
51
- MIN (CONFIG_CMSIS_DAP_PACKET_SIZE - 2 , UINT8_MAX - 2 ),
53
+ MIN (CMSIS_DAP_PACKET_MIN_SIZE - 2 , UINT8_MAX - 2 ),
52
54
"PROBE_VENDOR string is too long." );
53
55
BUILD_ASSERT (sizeof (CONFIG_CMSIS_DAP_PROBE_NAME ) <=
54
- MIN (CONFIG_CMSIS_DAP_PACKET_SIZE - 2 , UINT8_MAX - 2 ),
56
+ MIN (CMSIS_DAP_PACKET_MIN_SIZE - 2 , UINT8_MAX - 2 ),
55
57
"PROBE_NAME string is too long." );
56
58
BUILD_ASSERT (sizeof (CONFIG_CMSIS_DAP_BOARD_VENDOR ) <=
57
- MIN (CONFIG_CMSIS_DAP_PACKET_SIZE - 2 , UINT8_MAX - 2 ),
59
+ MIN (CMSIS_DAP_PACKET_MIN_SIZE - 2 , UINT8_MAX - 2 ),
58
60
"BOARD_VENDOR string is too long." );
59
61
BUILD_ASSERT (sizeof (CONFIG_CMSIS_DAP_BOARD_NAME ) <=
60
- MIN (CONFIG_CMSIS_DAP_PACKET_SIZE - 2 , UINT8_MAX - 2 ),
62
+ MIN (CMSIS_DAP_PACKET_MIN_SIZE - 2 , UINT8_MAX - 2 ),
61
63
"BOARD_NAME string is too long." );
62
64
BUILD_ASSERT (sizeof (CONFIG_CMSIS_DAP_DEVICE_VENDOR ) <=
63
- MIN (CONFIG_CMSIS_DAP_PACKET_SIZE - 2 , UINT8_MAX - 2 ),
65
+ MIN (CMSIS_DAP_PACKET_MIN_SIZE - 2 , UINT8_MAX - 2 ),
64
66
"DEVICE_VENDOR string is too long." );
65
67
BUILD_ASSERT (sizeof (CONFIG_CMSIS_DAP_DEVICE_NAME ) <=
66
- MIN (CONFIG_CMSIS_DAP_PACKET_SIZE - 2 , UINT8_MAX - 2 ),
68
+ MIN (CMSIS_DAP_PACKET_MIN_SIZE - 2 , UINT8_MAX - 2 ),
67
69
"DEVICE_NAME string is too long." );
68
70
69
71
/* Get DAP Information */
@@ -1037,6 +1039,12 @@ uint32_t dap_execute_cmd(const uint8_t *request,
1037
1039
return dap_process_cmd (& dap_ctx [0 ], request , response );
1038
1040
}
1039
1041
1042
+ void dap_update_pkt_size (const uint16_t pkt_size )
1043
+ {
1044
+ dap_ctx [0 ].pkt_size = pkt_size ;
1045
+ LOG_INF ("New packet size %u" , dap_ctx [0 ].pkt_size );
1046
+ }
1047
+
1040
1048
int dap_setup (const struct device * const dev )
1041
1049
{
1042
1050
dap_ctx [0 ].swdp_dev = (void * )dev ;
@@ -1047,7 +1055,7 @@ int dap_setup(const struct device *const dev)
1047
1055
}
1048
1056
1049
1057
/* Default settings */
1050
- dap_ctx [0 ].pkt_size = CONFIG_CMSIS_DAP_PACKET_SIZE ;
1058
+ dap_ctx [0 ].pkt_size = CMSIS_DAP_PACKET_MIN_SIZE ;
1051
1059
dap_ctx [0 ].debug_port = 0U ;
1052
1060
dap_ctx [0 ].transfer .idle_cycles = 0U ;
1053
1061
dap_ctx [0 ].transfer .retry_count = 100U ;
0 commit comments