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