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.
Fork of OmniWheels by
flash_set.cpp
00001 /* 00002 * mbed Microcontroller Library 00003 * Copyright (c) 2006-2016 ARM Limited 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 */ 00018 00019 /** @file flash_set.cpp Test tool to set flash to some data 00020 */ 00021 00022 #include "mbed.h" 00023 #include "cfstore_config.h" 00024 #include "Driver_Common.h" 00025 #include "cfstore_debug.h" 00026 #include "cfstore_test.h" 00027 #include "configuration_store.h" 00028 #include "utest/utest.h" 00029 #include "unity/unity.h" 00030 #include "greentea-client/test_env.h" 00031 #include "cfstore_utest.h" 00032 #ifdef YOTTA_CFG_CFSTORE_UVISOR 00033 #include "uvisor-lib/uvisor-lib.h" 00034 #include "cfstore_uvisor.h" 00035 #endif /* YOTTA_CFG_CFSTORE_UVISOR */ 00036 00037 #include <stdio.h> 00038 #include <stdlib.h> 00039 #include <string.h> 00040 #include <inttypes.h> 00041 00042 using namespace utest::v1; 00043 00044 #ifdef YOTTA_CFG_CFSTORE_UVISOR 00045 /* Create the main box ACL list for the application. 00046 * The main ACL gets inherited by all the other boxes 00047 */ 00048 CFSTORE_UVISOR_MAIN_ACL(cfstore_acl_uvisor_box_flash_set_g); 00049 00050 /* Enable uVisor. */ 00051 UVISOR_SET_MODE_ACL(UVISOR_ENABLED, cfstore_acl_uvisor_box_flash_set_g); 00052 #endif /* YOTTA_CFG_CFSTORE_UVISOR */ 00053 00054 00055 00056 /** 00057 * @brief add ~50 KVs and store them in flash 00058 * 00059 * @return on success returns CaseNext to continue to next test case, otherwise will assert on errors. 00060 */ 00061 static control_t cfstore_flash_set_test_01_end(const size_t call_count) 00062 { 00063 int32_t ret = ARM_DRIVER_ERROR; 00064 ARM_CFSTORE_FMODE flags; 00065 ARM_CFSTORE_DRIVER* drv = &cfstore_driver; 00066 ARM_CFSTORE_CAPABILITIES caps = cfstore_driver.GetCapabilities(); 00067 00068 CFSTORE_FENTRYLOG("%s:entered\n", __func__); 00069 (void) call_count; 00070 memset(&flags, 0, sizeof(flags)); 00071 00072 CFSTORE_LOG("caps.asynchronous_ops : %d\n", (int) caps.asynchronous_ops); 00073 ret = cfstore_test_init_1(); 00074 if(ret < ARM_DRIVER_OK){ 00075 CFSTORE_ERRLOG("%s:Error: failed to write data to falsh.", __func__); 00076 } 00077 ret = drv->Flush(); 00078 if(ret < ARM_DRIVER_OK){ 00079 CFSTORE_ERRLOG("%s:Flush() call failed (ret=%d).\r\n", __func__, (int) ret); 00080 } 00081 #ifdef CFSTORE_DEBUG 00082 ret = cfstore_test_dump(); 00083 if(ret < ARM_DRIVER_OK){ 00084 CFSTORE_ERRLOG("Error: failed to dump CFSTORE contents%s", "\n"); 00085 } 00086 #endif /* CFSTORE_DEBUG */ 00087 ret = drv->Uninitialize(); 00088 if(ret < ARM_DRIVER_OK){ 00089 CFSTORE_ERRLOG("Error: failed to Uninitialize() CFSTORE%s", "\n"); 00090 } 00091 return CaseNext; 00092 } 00093 00094 /// @cond CFSTORE_DOXYGEN_DISABLE 00095 utest::v1::status_t greentea_setup(const size_t number_of_cases) 00096 { 00097 GREENTEA_SETUP(100, "default_auto"); 00098 return greentea_test_setup_handler(number_of_cases); 00099 } 00100 00101 Case cases[] = { 00102 /* 1 2 3 4 5 6 7 */ 00103 /* 1234567890123456789012345678901234567890123456789012345678901234567890 */ 00104 Case("FLASH_SET_test_01_start", cfstore_utest_default_start), 00105 Case("FLASH_SET_test_01_end", cfstore_flash_set_test_01_end), 00106 }; 00107 00108 00109 /* Declare your test specification with a custom setup handler */ 00110 Specification specification(greentea_setup, cases); 00111 00112 int main() 00113 { 00114 return !Harness::run(specification); 00115 } 00116 /// @endcond
Generated on Fri Jul 22 2022 04:53:49 by
