8000 usb_config: Add option to disable drag-n-drop from interface projects · ARMmbed/DAPLink@a01286a · GitHub
[go: up one dir, main page]

Skip to content

Commit a01286a

Browse files
mbrossardmathias-arm
authored andcommitted
usb_config: Add option to disable drag-n-drop from interface projects
1 parent 650ba8e commit a01286a

File tree

19 files changed

+61
-23
lines changed

19 files changed

+61
-23
lines changed

source/board/microbitv2/microbitv2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include "gpio_extra.h"
4545
#include "board_id.h"
4646

47-
#ifdef DRAG_N_DROP_SUPPORT
47+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
4848
#include "flash_intf.h"
4949
#endif
5050

@@ -155,7 +155,7 @@ static void reset_power_led_state()
155155
// Handle the reset button behavior, this function is called in the main task every 30ms
156156
void handle_reset_button()
157157
{
158-
#ifdef DRAG_N_DROP_SUPPORT
158+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
159159
if (!flash_intf_target->flash_busy()) //added checking if flashing on target is in progress
160160
#endif
161161
{

source/daplink/cmsis-dap/DAP_vendor.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
#include "uart.h"
3838
#include "settings.h"
3939
#include "target_family.h"
40-
#include "flash_manager.h"
4140
#include <string.h>
4241
#include "daplink_vendor_commands.h"
4342

44-
#ifdef DRAG_N_DROP_SUPPORT
43+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
4544
#include "file_stream.h"
45+
#include "flash_manager.h"
4646
#endif
4747

4848
//**************************************************************************************************
@@ -147,7 +147,7 @@ uint32_t DAP_ProcessVendorCommand(const uint8_t *request, uint8_t *response) {
147147
num += 1;
148148
break;
149149
}
150 10000 -
#ifdef DRAG_N_DROP_SUPPORT
150+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
151151
case ID_DAP_MSD_Open: {
152152
// open mass storage device stream
153153
*response = stream_open((stream_type_t)(*request));
@@ -169,7 +169,6 @@ uint32_t DAP_ProcessVendorCommand(const uint8_t *request, uint8_t *response) {
169169
num += ((write_len + 1) << 16) | 1;
170170
break;
171171
}
172-
#endif
173172
case ID_DAP_SelectEraseMode: {
174173
// switching between chip erase and page erase
175174
// COMMAND(OUT Packet)
@@ -189,6 +188,7 @@ uint32_t DAP_ProcessVendorCommand(const uint8_t *request, uint8_t *response) {
189188
num += (1U << 16) | 1U; // increment request and response count each by 1
190189
break;
191190
}
191+
#endif
192192
case ID_DAP_Vendor14: break;
193193
case ID_DAP_Vendor15: break;
194194
case ID_DAP_Vendor16: break;

source/daplink/drag-n-drop/file_stream.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* limitations under the License.
2020
*/
2121

22+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
23+
2224
#include <string.h>
2325

2426
#include "file_stream.h"
@@ -364,3 +366,5 @@ static error_t close_hex(void *state)
364366
status = flash_decoder_close();
365367
return status;
366368
}
369+
370+
#endif

source/daplink/drag-n-drop/flash_decoder.c

Lines changed: 5 additions & 1 deletion
57A6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* limitations under the License.
2020
*/
2121

22+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
23+
2224
#include <string.h>
2325

2426
#include "flash_decoder.h"
@@ -292,7 +294,7 @@ error_t flash_decoder_write(uint32_t addr, const uint8_t *data, uint32_t size)
292294
state = DECODER_STATE_ERROR;
293295
return status;
294296
}
295-
297+
296298
// Validate incompatible target image file
297299
if (config_get_detect_incompatible_target()){
298300
status = flash_decoder_validate_target_image(flash_type, flash_buf, flash_buf_pos);
@@ -423,3 +425,5 @@ static bool flash_decoder_is_at_end(uint32_t addr, const uint8_t *data, uint32_t
423425
return false;
424426
}
425427
}
428+
429+
#endif

source/daplink/drag-n-drop/flash_intf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
* limitations under the License.
2020
*/
2121

22+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
23+
2224
#include "flash_intf.h"
2325
#include "compiler.h"
2426

2527
__WEAK const flash_intf_t *const flash_intf_iap_protected = 0;
2628
__WEAK const flash_intf_t *const flash_intf_target = 0;
2729
__WEAK const flash_intf_t *const flash_intf_target_custom = 0;
30+
31+
#endif

source/daplink/drag-n-drop/flash_manager.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* DAPLink Interface Firmware
66
* Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
7-
* Copyright 2019, Cypress Semiconductor Corporation
7+
* Copyright 2019, Cypress Semiconductor Corporation
88
* or a subsidiary of Cypress Semiconductor Corporation.
99
* SPDX-License-Identifier: Apache-2.0
1010
*
@@ -21,6 +21,8 @@
2121
* limitations under the License.
2222
*/
2323

24+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
25+
2426
#include "flash_manager.h"
2527
#include "util.h"
2628
#include "error.h"
@@ -348,3 +350,4 @@ static error_t setup_next_sector(uint32_t addr)
348350
current_write_block_size, current_sector_size, min_prog_size);
349351
return ERROR_SUCCESS;
350352
}
353+
#endif

source/daplink/drag-n-drop/iap_flash_intf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* limitations under the License.
2020
*/
2121

22+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
23+
2224
#include <string.h>
2325

2426
#include "daplink.h"
@@ -505,3 +507,5 @@ static error_t critical_erase_and_program(uint32_t addr, const uint8_t *data, ui
505507
static uint8_t target_flash_busy(void){
506508
return (state == STATE_OPEN);
507509
}
510+
511+
#endif

source/daplink/drag-n-drop/intelhex.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* limitations under the License.
2020
*/
2121

22+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
23+
2224
#include <string.h>
2325

2426
#include "intelhex.h"
@@ -276,3 +278,5 @@ hexfile_parse_status_t parse_hex_blob(const uint8_t *hex_blob, const uint32_t he
276278
#elif defined(__GNUC__) && !defined(__ARMCC_VERSION)
277279
#pragma GCC pop_options
278280
#endif
281+
282+
#endif

source/daplink/drag-n-drop/vfs_manager.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* limitations under the License.
2020
*/
2121

22+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
23+
2224
#include <ctype.h>
2325

2426
#include "daplink.h"
@@ -845,3 +847,5 @@ static void transfer_update_state(error_t status)
845847
vfs_mngr_fs_remount();
846848
}
847849
}
850+
851+
#endif

source/daplink/drag-n-drop/vfs_user.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* limitations under the License.
2222
*/
2323

24+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
25+
2426
#include <stdbool.h>
2527
#include <ctype.h>
2628
#include <string.h>
@@ -700,3 +702,5 @@ static void erase_target(void)
700702
flash_intf_target->erase_chip();
701703
flash_intf_target->uninit();
702704
}
705+
706+
#endif

0 commit comments

Comments
 (0)
0