コード例 #1
0
ファイル: DeviceKey.cpp プロジェクト: toyowata/mbed
DeviceKey::DeviceKey()
{

    int ret = kv_init_storage_config();
    if (ret != MBED_SUCCESS) {
        tr_error("DeviceKey: Fail to initialize KvStore configuration.");
    }
#if defined(MBEDTLS_PLATFORM_C)
    ret = mbedtls_platform_setup(NULL);
    if (ret != MBED_SUCCESS) {
        tr_error("DeviceKey: Fail in mbedtls_platform_setup.");
    }
#endif /* MBEDTLS_PLATFORM_C */
    return;
}
コード例 #2
0
ファイル: its_partition.c プロジェクト: pan-/mbed
void its_entry(void *ptr)
{
    uint32_t signals = 0;
    psa_msg_t msg = {0};

    while (1) {
#if defined(TARGET_MBED_SPM)
        signals = psa_wait_any(PSA_BLOCK);
#else
        signals = psa_wait(ITS_WAIT_ANY_SID_MSK, PSA_BLOCK);
#endif

        // KVStore initiation:
        // - Must be done after the psa_wait_any() call since only now we know OS initialization is done
        // - Repeating calls has no effect
        int kv_status = kv_init_storage_config();
        if (kv_status != MBED_SUCCESS) {
            SPM_PANIC("KVStore initiation failed with status %d!", kv_status);
        }

        if ((signals & PSA_ITS_SET_MSK) != 0) {
            psa_get(PSA_ITS_SET_MSK, &msg);
            message_handler(&msg, storage_set);
        }
        if ((signals & PSA_ITS_GET_MSK) != 0) {
            psa_get(PSA_ITS_GET_MSK, &msg);
            message_handler(&msg, storage_get);
        }
        if ((signals & PSA_ITS_INFO_MSK) != 0) {
            psa_get(PSA_ITS_INFO_MSK, &msg);
            message_handler(&msg, storage_info);
        }
        if ((signals & PSA_ITS_REMOVE_MSK) != 0) {
            psa_get(PSA_ITS_REMOVE_MSK, &msg);
            message_handler(&msg, storage_remove);
        }
        if ((signals & PSA_ITS_RESET_MSK) != 0) {
            psa_get(PSA_ITS_RESET_MSK, &msg);
            message_handler(&msg, storage_reset);
        }

    }
}