Beispiel #1
0
int32_t cfstore_flush3_start(void)
{
	int32_t status = ARM_DRIVER_OK;
	int32_t cfsStatus;
	ARM_CFSTORE_DRIVER *cfstoreDriver = &cfstore_driver;
	ARM_CFSTORE_CAPABILITIES caps;

	CFSTORE_DBGLOG("%s:IN\n", __func__);

	/* Initialize configuration store */
	cfsStatus = cfstoreDriver->Initialize(NULL, NULL);
    if(cfsStatus < ARM_DRIVER_OK){
        CFSTORE_DBGLOG("CFStore Initialization failed (err %lu)\n", cfsStatus);
        return ARM_DRIVER_ERROR;
    }
	/* Get capabilities */
	memset(&caps, 0, sizeof(caps));
	caps = cfstoreDriver->GetCapabilities();
    if(caps.asynchronous_ops == true){
        CFSTORE_DBGLOG("%s:Please configure CFstore to work in synchronous mode. This can be change in config.json file.\n", __func__);
        status = ARM_DRIVER_ERROR;
        goto out;
    }
	CFSTORE_DBGLOG("%s:OUT: returning ARM_DRIVER_OK\n", __func__);
	return ARM_DRIVER_OK; /* init succeeded */

out:
	/* init failed */
	(void) cfstore_flush3_end();
    CFSTORE_DBGLOG("%s:OUT: status=%d\n", __func__, (int) status);
	return status;
}
Beispiel #2
0
/* @brief   test startup code to reset flash
 */
int32_t cfstore_test_startup(void)
{
    ARM_CFSTORE_CAPABILITIES caps = cfstore_driver.GetCapabilities();
    CFSTORE_EX5_LOG("INITIALIZING: caps.asynchronous_ops=%d\n", (int) caps.asynchronous_ops);

#ifdef CFSTORE_CONFIG_BACKEND_FLASH_ENABLED
    int32_t ret = ARM_DRIVER_ERROR;
    static FlashJournal_t jrnl;
    extern ARM_DRIVER_STORAGE ARM_Driver_Storage_MTD_K64F;
    const ARM_DRIVER_STORAGE *drv = &ARM_Driver_Storage_MTD_K64F;

    ret = FlashJournal_initialize(&jrnl, drv, &FLASH_JOURNAL_STRATEGY_SEQUENTIAL, NULL);
    CFSTORE_EX5_TEST_ASSERT_MSG(ret >= JOURNAL_STATUS_OK, "%s:Error: FlashJournal_initialize() failed (ret=%d)\r\n", __func__, (int) ret);

    ret = FlashJournal_reset(&jrnl);
    CFSTORE_EX5_TEST_ASSERT_MSG(ret >= JOURNAL_STATUS_OK, "%s:Error: FlashJournal_reset() failed (ret=%d)\r\n", __func__, (int) ret);
#endif /*  CFSTORE_CONFIG_BACKEND_FLASH_ENABLED */

    return ARM_DRIVER_OK;
}
Beispiel #3
0
static control_t cfstore_flush3_test_00(const size_t call_count)
{
    int32_t ret = ARM_DRIVER_ERROR;
    ARM_CFSTORE_CAPABILITIES caps;;
    ARM_CFSTORE_DRIVER* drv = &cfstore_driver;

    (void) call_count;

    /* initialise the context */
    caps = drv->GetCapabilities();
    CFSTORE_LOG("%s:INITIALIZING: caps.asynchronous_ops=%lu\n", __func__, caps.asynchronous_ops);
    if(caps.asynchronous_ops == 1){
        /* This is a sync mode only test. If this test is not built for sync mode, then skip testing return true
         * This means the test will conveniently pass when run in CI as part of async mode testing */
        CFSTORE_LOG("*** Skipping test as binary built for flash journal async mode, and this test is sync-only%s", "\n");
        return CaseNext;
    }
    ret = cfstore_test_startup();
    CFSTORE_TEST_UTEST_MESSAGE(cfstore_flush3_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to perform test startup (ret=%d).\n", __func__, (int) ret);
    TEST_ASSERT_MESSAGE(ret >= ARM_DRIVER_OK, cfstore_flush3_utest_msg_g);
    return CaseNext;
}