Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers flash_decoder.h Source File

flash_decoder.h

Go to the documentation of this file.
00001 /**
00002  * @file    flash_decoder.h
00003  * @brief   Steam handling of different image types that are supported
00004  *
00005  * DAPLink Interface Firmware
00006  * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
00007  * SPDX-License-Identifier: Apache-2.0
00008  *
00009  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00010  * not use this file except in compliance with the License.
00011  * You may obtain a copy of the License at
00012  *
00013  * http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  * Unless required by applicable law or agreed to in writing, software
00016  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00017  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 
00022 #ifndef FLASH_DECODER_H
00023 #define FLASH_DECODER_H
00024 
00025 #include <stdint.h>
00026 #include <stdbool.h>
00027 
00028 #include "flash_intf.h"
00029 #include "error.h"
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 // Enough space for 12 vectors
00036 #define FLASH_DECODER_MIN_SIZE      0x30
00037 
00038 typedef enum {
00039     FLASH_DECODER_TYPE_UNKNOWN,
00040     FLASH_DECODER_TYPE_BOOTLOADER,
00041     FLASH_DECODER_TYPE_INTERFACE,
00042     FLASH_DECODER_TYPE_TARGET,
00043 } flash_decoder_type_t;
00044 
00045 flash_decoder_type_t flash_decoder_detect_type(const uint8_t *data, uint32_t size, uint32_t addr, bool addr_valid);
00046 error_t flash_decoder_get_flash(flash_decoder_type_t type, uint32_t addr, bool addr_valid, uint32_t *start_addr, const flash_intf_t **flash_intf);
00047 
00048 error_t flash_decoder_open(void);
00049 error_t flash_decoder_write(uint32_t addr, const uint8_t *data, uint32_t size);
00050 error_t flash_decoder_close(void);
00051 
00052 #ifdef __cplusplus
00053 }
00054 #endif
00055 
00056 #endif