Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_uc_pal_blockdevice_mbed.cpp Source File

arm_uc_pal_blockdevice_mbed.cpp

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2017-2018 ARM Ltd.
00003 //
00004 // SPDX-License-Identifier: Apache-2.0
00005 //
00006 // Licensed under the Apache License, Version 2.0 (the "License");
00007 // you may not use this file except in compliance with the License.
00008 // You may obtain a copy of the License at
00009 //
00010 //     http://www.apache.org/licenses/LICENSE-2.0
00011 //
00012 // Unless required by applicable law or agreed to in writing, software
00013 // distributed under the License is distributed on an "AS IS" BASIS,
00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 // See the License for the specific language governing permissions and
00016 // limitations under the License.
00017 // ----------------------------------------------------------------------------
00018 
00019 #include "arm_uc_config.h"
00020 #if defined(ARM_UC_FEATURE_PAL_BLOCKDEVICE) && (ARM_UC_FEATURE_PAL_BLOCKDEVICE == 1)
00021 #if defined(TARGET_LIKE_MBED)
00022 
00023 #include "update-client-pal-blockdevice/arm_uc_pal_blockdevice_platform.h"
00024 #include "mbed.h"
00025 
00026 BlockDevice* arm_uc_blockdevice_ext = BlockDevice::get_default_instance();
00027 
00028 int32_t arm_uc_blockdevice_init(void)
00029 {
00030     return arm_uc_blockdevice_ext->init();
00031 }
00032 
00033 uint32_t arm_uc_blockdevice_get_program_size(void)
00034 {
00035     return arm_uc_blockdevice_ext->get_program_size();
00036 }
00037 
00038 uint32_t arm_uc_blockdevice_get_erase_size(void)
00039 {
00040     return arm_uc_blockdevice_ext->get_erase_size();
00041 }
00042 
00043 int32_t arm_uc_blockdevice_erase(uint64_t address, uint64_t size)
00044 {
00045     return arm_uc_blockdevice_ext->erase(address, size);
00046 }
00047 
00048 int32_t arm_uc_blockdevice_program(const uint8_t *buffer,
00049                                    uint64_t address,
00050                                    uint32_t size)
00051 {
00052     return arm_uc_blockdevice_ext->program(buffer, address, size);
00053 }
00054 
00055 int32_t arm_uc_blockdevice_read(uint8_t *buffer,
00056                                 uint64_t address,
00057                                 uint32_t size)
00058 {
00059     return arm_uc_blockdevice_ext->read(buffer, address, size);
00060 }
00061 
00062 #endif /* #if defined(TARGET_LIKE_MBED) */
00063 #endif /* defined(ARM_UC_FEATURE_PAL_BLOCKDEVICE) */