Skip to content

Commit f6aece3

Browse files
0xc0170c1728p9
authored andcommitted
hal: add flash hal api
4 functions that are covered - init, free, program_page and erase_sector.
1 parent aa6d673 commit f6aece3

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

hal/flash_api.h

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/** \addtogroup hal */
2+
/** @{*/
3+
4+
/* mbed Microcontroller Library
5+
* Copyright (c) 2006-2013 ARM Limited
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
#ifndef MBED_FLASH_API_H
20+
#define MBED_FLASH_API_H
21+
22+
#include "device.h"
23+
#include "stdint.h"
24+
25+
#if DEVICE_FLASH
26+
27+
typedef struct flash_s flash_t;
28+
29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
33+
// maps to FlashAlgo Init
34+
int32_t flash_init(flash_t *obj);
35+
36+
// maps to FlashAlgo UnInit
37+
int32_t flash_free(flash_t *obj);
38+
39+
// maps to FlashAlgo EraseSector
40+
int32_t flash_erase_sector(flash_t *obj, uint32_t address);
41+
42+
// maps FlashAlgo to ProgramPage
43+
int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size);
44+
45+
#ifdef __cplusplus
46+
}
47+
#endif
48+
49+
#endif
50+
51+
#endif
52+
53+
/** @}*/

0 commit comments

Comments
 (0)