-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frameworks/wasm: Add kvdb missing interface in frameworks
add kvdb interface, interface name property_set_buffer
- Loading branch information
1 parent
a16f2da
commit 75519c3
Showing
4 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# ############################################################################## | ||
# apps/frameworks/chre/CMakeLists.txt | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with this work for | ||
# additional information regarding copyright ownership. The ASF licenses this | ||
# file to you 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. | ||
# | ||
# ############################################################################## | ||
|
||
if(CONFIG_KVDB AND CONFIG_INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY) | ||
|
||
target_sources(apps PRIVATE kvdb.c) | ||
# register WAMR mod | ||
nuttx_add_wamrmod(MODS kvdb) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
############################################################################ | ||
# apps/frameworks/runtimes/wasm/chre/Make.defs | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. The | ||
# ASF licenses this file to you 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. | ||
# | ||
############################################################################ | ||
|
||
ifeq ($(CONFIG_KVDB)$(CONFIG_INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY),yy) | ||
CONFIGURED_APPS += $(APPDIR)/frameworks/runtimes/wasm/kvdb | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
############################################################################ | ||
# apps/frameworks/wasm/chre/Makefile | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. The | ||
# ASF licenses this file to you 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 $(APPDIR)/Make.defs | ||
|
||
CSRCS += kvdb.c | ||
|
||
# To delete the Kconfig file, an empty preconfig needs to be added. | ||
preconfig:: | ||
|
||
# Set WAMR_MODULE_NAME and include Module.mk to add this module to the list of | ||
# builtin modules for the WAMR runtime. WAMR_MODULE_NAME must be unique across all | ||
# modules in system. | ||
|
||
WAMR_MODULE_NAME = kvdb | ||
|
||
include $(APPDIR)/interpreters/wamr/Module.mk | ||
include $(APPDIR)/Application.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (C) 2024 Xiaomi Corperation | ||
* | ||
* 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. | ||
*/ | ||
|
||
/**************************************************************************** | ||
* Included Files | ||
****************************************************************************/ | ||
|
||
#include <stdint.h> | ||
#include <sys/param.h> | ||
|
||
#include "kvdb.h" | ||
#include "wasm_export.h" | ||
|
||
/**************************************************************************** | ||
* Private Functions | ||
****************************************************************************/ | ||
|
||
static int property_set_buffer_wrapper(wasm_exec_env_t env, | ||
const char* key, | ||
const void* value, | ||
size_t size) | ||
{ | ||
return property_set_buffer(key, value, size); | ||
} | ||
|
||
static NativeSymbol g_kvdb_symbols[] = { | ||
EXPORT_WASM_API_WITH_SIG2(property_set_buffer, "($*i)i"), | ||
}; | ||
|
||
/**************************************************************************** | ||
* Public Functions | ||
****************************************************************************/ | ||
|
||
bool wamr_module_kvdb_register(void) | ||
{ | ||
/* Add frameworks section init hook here */ | ||
|
||
return wasm_runtime_register_natives("env", g_kvdb_symbols, | ||
nitems(g_kvdb_symbols)); | ||
} |