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

« Back to documentation index

Show/hide line numbers FlashOS.h Source File

FlashOS.h

Go to the documentation of this file.
00001 /**
00002  * @file    FlashOS.h
00003  * @brief
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 FLASHOS_H
00023 #define FLASHOS_H
00024 
00025 #include <stdint.h>
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 #define VERS        1       // Interface Version 1.01
00032 #define NAME_MAX    128     // Max size of the routine name
00033 #define PAGE_MAX    65536   // Max Page Size for Programming
00034 #define SECTOR_NUM  512     // Max Number of Sector Items
00035 #define SECTOR_END  0xFFFFFFFF, 0xFFFFFFFF
00036 
00037 // FlashDevice.devType interface mechanism
00038 #define UNKNOWN     0
00039 #define ONCHIP      1
00040 #define EXT8BIT     2
00041 #define EXT16BIT    3
00042 #define EXT32BIT    4
00043 #define EXTSPI      5
00044 
00045 /**
00046     @struct FlashSector
00047     @brief  A structure to describe the size and start address of a flash sector
00048  */
00049 struct FlashSector {
00050     uint32_t szSector ;      /*!< Sector Size in Bytes */
00051     uint32_t adrSector ;     /*!< Address of Sector */
00052 };
00053 
00054 /**
00055     @struct FlashDevice
00056     @brief  A structure to describe particulars of a flash memory sub-system
00057         and requirements of the driver
00058  */
00059 struct FlashDevice {
00060     uint16_t vers ;          /*!< Version Number and Architecture */
00061     char devName [NAME_MAX]; /*!< Device Name and Description */
00062     uint16_t devType ;       /*!< Device Type: ONCHIP, EXT8BIT, EXT16BIT, ... */
00063     uint32_t devAdr ;        /*!< Default Device Start Address */
00064     uint32_t szDev ;         /*!< Total Size of Device */
00065     uint32_t szPage ;        /*!< Programming Page Size */
00066     uint32_t res ;           /*!< Reserved for future Extension */
00067     uint8_t  valEmpty ;      /*!< Content of Erased Memory */
00068     uint32_t toProg ;        /*!< Time Out of Program Page Function */
00069     uint32_t toErase ;       /*!< Time Out of Erase Sector Function */
00070     struct FlashSector sectors [SECTOR_NUM]; /*!< Entries to describe flash memory layout */
00071 };
00072 
00073 #ifdef __cplusplus
00074 }
00075 #endif
00076 
00077 #endif