forked

Committer:
Kojto
Date:
Thu Aug 03 13:13:39 2017 +0100
Revision:
170:19eb464bc2be
Parent:
168:9672193075cf
This updates the lib to the mbed lib v 148

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 167:e84263d55307 1 /* mbed Microcontroller Library
AnnaBridge 167:e84263d55307 2 * Copyright (c) 2013-2016 Realtek Semiconductor Corp.
AnnaBridge 167:e84263d55307 3 *
AnnaBridge 167:e84263d55307 4 * Licensed under the Apache License, Version 2.0 (the "License");
AnnaBridge 167:e84263d55307 5 * you may not use this file except in compliance with the License.
AnnaBridge 167:e84263d55307 6 * You may obtain a copy of the License at
AnnaBridge 167:e84263d55307 7 *
AnnaBridge 167:e84263d55307 8 * http://www.apache.org/licenses/LICENSE-2.0
AnnaBridge 167:e84263d55307 9 *
AnnaBridge 167:e84263d55307 10 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 167:e84263d55307 11 * distributed under the License is distributed on an "AS IS" BASIS,
AnnaBridge 167:e84263d55307 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 167:e84263d55307 13 * See the License for the specific language governing permissions and
AnnaBridge 167:e84263d55307 14 * limitations under the License.
AnnaBridge 167:e84263d55307 15 */
AnnaBridge 168:9672193075cf 16 #include "flash_ext.h"
AnnaBridge 167:e84263d55307 17
AnnaBridge 168:9672193075cf 18 int32_t flash_init(flash_t *obj)
AnnaBridge 167:e84263d55307 19 {
AnnaBridge 168:9672193075cf 20 __flash_ext_turnon();
AnnaBridge 167:e84263d55307 21
AnnaBridge 168:9672193075cf 22 return 0;
AnnaBridge 167:e84263d55307 23 }
AnnaBridge 167:e84263d55307 24
AnnaBridge 168:9672193075cf 25 int32_t flash_free(flash_t *obj)
AnnaBridge 167:e84263d55307 26 {
AnnaBridge 168:9672193075cf 27 __flash_ext_turnoff();
AnnaBridge 167:e84263d55307 28
AnnaBridge 168:9672193075cf 29 return 0;
AnnaBridge 167:e84263d55307 30 }
AnnaBridge 167:e84263d55307 31
AnnaBridge 168:9672193075cf 32 int32_t flash_erase_sector(flash_t *obj, uint32_t address)
AnnaBridge 167:e84263d55307 33 {
Kojto 170:19eb464bc2be 34 flash_ext_erase_sector(obj, address);
AnnaBridge 167:e84263d55307 35
AnnaBridge 168:9672193075cf 36 return 0;
AnnaBridge 167:e84263d55307 37 }
AnnaBridge 167:e84263d55307 38
Kojto 170:19eb464bc2be 39 int32_t flash_read(flash_t *obj, uint32_t address, uint8_t *data, uint32_t size)
Kojto 170:19eb464bc2be 40 {
Kojto 170:19eb464bc2be 41 return flash_ext_stream_read(obj, address, size, data);;
Kojto 170:19eb464bc2be 42 }
Kojto 170:19eb464bc2be 43
AnnaBridge 168:9672193075cf 44 int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size)
AnnaBridge 167:e84263d55307 45 {
Kojto 170:19eb464bc2be 46 return flash_ext_stream_write(obj, address, size, data);
AnnaBridge 168:9672193075cf 47 }
AnnaBridge 167:e84263d55307 48
AnnaBridge 168:9672193075cf 49 uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
AnnaBridge 168:9672193075cf 50 {
Kojto 170:19eb464bc2be 51 if (address >= FLASH_OFS_END)
Kojto 170:19eb464bc2be 52 return MBED_FLASH_INVALID_SIZE;
AnnaBridge 167:e84263d55307 53
AnnaBridge 168:9672193075cf 54 return FLASH_SECTOR_SIZE;
AnnaBridge 167:e84263d55307 55 }
AnnaBridge 167:e84263d55307 56
AnnaBridge 168:9672193075cf 57 uint32_t flash_get_page_size(const flash_t *obj)
AnnaBridge 167:e84263d55307 58 {
AnnaBridge 168:9672193075cf 59 return FLASH_PAGE_SIZE;
AnnaBridge 167:e84263d55307 60 }
AnnaBridge 167:e84263d55307 61
AnnaBridge 168:9672193075cf 62 uint32_t flash_get_start_address(const flash_t *obj)
AnnaBridge 167:e84263d55307 63 {
Kojto 170:19eb464bc2be 64 return FLASH_OFS_START;
AnnaBridge 167:e84263d55307 65 }
AnnaBridge 167:e84263d55307 66
AnnaBridge 168:9672193075cf 67 uint32_t flash_get_size(const flash_t *obj)
AnnaBridge 167:e84263d55307 68 {
AnnaBridge 168:9672193075cf 69 return FLASH_SIZE;
AnnaBridge 167:e84263d55307 70 }
AnnaBridge 167:e84263d55307 71