|
4 | 4 | * |
5 | 5 | * DAPLink Interface Firmware |
6 | 6 | * Copyright (c) 2009-2020, ARM Limited, All Rights Reserved |
| 7 | + * Copyright 2019, Cypress Semiconductor Corporation |
| 8 | + * or a subsidiary of Cypress Semiconductor Corporation. |
7 | 9 | * SPDX-License-Identifier: Apache-2.0 |
8 | 10 | * |
9 | 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
|
35 | 37 | #include "flash_intf.h" // for flash_intf_target |
36 | 38 | #include "cortex_m.h" |
37 | 39 | #include "target_board.h" |
| 40 | +#include "flash_manager.h" |
38 | 41 |
|
39 | 42 | //! @brief Size in bytes of the virtual disk. |
40 | 43 | //! |
@@ -63,6 +66,8 @@ typedef enum _magic_file { |
63 | 66 | kOverflowOffConfigFile, //!< Disable UART overflow reporting. |
64 | 67 | kMSDOnConfigFile, //!< Enable USB MSC. Uh.... |
65 | 68 | kMSDOffConfigFile, //!< Disable USB MSC. |
| 69 | + kPageEraseActionFile, //!< Enable page programming and sector erase for drag and drop. |
| 70 | + kChipEraseActionFile, //!< Enable page programming and chip erase for drag and drop. |
66 | 71 | } magic_file_t; |
67 | 72 |
|
68 | 73 | //! @brief Mapping from filename string to magic file enum. |
@@ -105,6 +110,8 @@ static const magic_file_info_t s_magic_file_info[] = { |
105 | 110 | { "OVFL_OFFCFG", kOverflowOffConfigFile }, |
106 | 111 | { "MSD_ON CFG", kMSDOnConfigFile }, |
107 | 112 | { "MSD_OFF CFG", kMSDOffConfigFile }, |
| 113 | + { "PAGE_ON ACT", kPageEraseActionFile }, |
| 114 | + { "PAGE_OFFACT", kChipEraseActionFile }, |
108 | 115 | }; |
109 | 116 |
|
110 | 117 | static uint8_t file_buffer[VFS_SECTOR_SIZE]; |
@@ -261,6 +268,12 @@ void vfs_user_file_change_handler(const vfs_filename_t filename, vfs_file_change |
261 | 268 | case kMSDOffConfigFile: |
262 | 269 | config_ram_set_disable_msd(true); |
263 | 270 | break; |
| 271 | + case kPageEraseActionFile: |
| 272 | + config_ram_set_page_erase(true); |
| 273 | + break; |
| 274 | + case kChipEraseActionFile: |
| 275 | + config_ram_set_page_erase(false); |
| 276 | + break; |
264 | 277 | default: |
265 | 278 | util_assert(false); |
266 | 279 | } |
@@ -479,6 +492,9 @@ static uint32_t update_details_txt_file(uint8_t *data, uint32_t datasize) |
479 | 492 | pos += util_write_string(buf + pos, "Overflow detection: "); |
480 | 493 | pos += util_write_string(buf + pos, config_get_overflow_detect() ? "1" : "0"); |
481 | 494 | pos += util_write_string(buf + pos, "\r\n"); |
| 495 | + pos += util_write_string(buf + pos, "Page erasing: "); |
| 496 | + pos += util_write_string(buf + pos, config_ram_get_page_erase() ? "1" : "0"); |
| 497 | + pos += util_write_string(buf + pos, "\r\n"); |
482 | 498 | // Current mode |
483 | 499 | mode_str = daplink_is_bootloader() ? "Bootloader" : "Interface"; |
484 | 500 | pos += util_write_string(buf + pos, "Daplink Mode: "); |
|
0 commit comments