Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: SPIne CH_Communicatuin_Test CH_Communicatuin_Test2 MCP_SPIne ... more
Fork of mbed-dev-f303 by
targets/TARGET_Realtek/TARGET_AMEBA/flash_api.c
- Committer:
- benkatz
- Date:
- 2018-05-02
- Revision:
- 179:97f825502e2a
- Parent:
- 170:19eb464bc2be
File content as of revision 179:97f825502e2a:
/* mbed Microcontroller Library
* Copyright (c) 2013-2016 Realtek Semiconductor Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "flash_ext.h"
int32_t flash_init(flash_t *obj)
{
__flash_ext_turnon();
return 0;
}
int32_t flash_free(flash_t *obj)
{
__flash_ext_turnoff();
return 0;
}
int32_t flash_erase_sector(flash_t *obj, uint32_t address)
{
flash_ext_erase_sector(obj, address);
return 0;
}
int32_t flash_read(flash_t *obj, uint32_t address, uint8_t *data, uint32_t size)
{
return flash_ext_stream_read(obj, address, size, data);;
}
int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size)
{
return flash_ext_stream_write(obj, address, size, data);
}
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
{
if (address >= FLASH_OFS_END)
return MBED_FLASH_INVALID_SIZE;
return FLASH_SECTOR_SIZE;
}
uint32_t flash_get_page_size(const flash_t *obj)
{
return FLASH_PAGE_SIZE;
}
uint32_t flash_get_start_address(const flash_t *obj)
{
return FLASH_OFS_START;
}
uint32_t flash_get_size(const flash_t *obj)
{
return FLASH_SIZE;
}
