Skip to content

Commit

Permalink
Add Thread network HAL client
Browse files Browse the repository at this point in the history
Bug: b/203492431
Test: Build and run the otbr-agent in Android emulator.
Change-Id: Iecb70d1c7c2f58ee13229c0e1304b9e4f62f6f38
  • Loading branch information
zhanglongxia committed Feb 13, 2023
1 parent 32f5dde commit 8abd3d9
Show file tree
Hide file tree
Showing 5 changed files with 737 additions and 8 deletions.
123 changes: 115 additions & 8 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ soong_config_module_type {

soong_config_string_variable {
name: "rcp_bus",
values: ["spi", "uart"],
values: ["spi", "uart", "hal"],
}

ot_config_cc_defaults {
Expand All @@ -122,10 +122,9 @@ ot_config_cc_defaults {
spi: {
cflags: ["-DOPENTHREAD_POSIX_CONFIG_RCP_BUS=OT_POSIX_RCP_BUS_SPI"]
},
uart: {
hal: {
cflags: [
"-DOPENTHREAD_POSIX_CONFIG_RCP_BUS=OT_POSIX_RCP_BUS_UART",
"-DOPENTHREAD_POSIX_CONFIG_RCP_PTY_ENABLE=1",
"-DOPENTHREAD_POSIX_CONFIG_RCP_BUS=OT_POSIX_RCP_BUS_VENDOR",
]
},
conditions_default: {
Expand All @@ -146,6 +145,7 @@ cc_library_static {
local_include_dirs: [
"include",
"src",
"src/android/thread_network_hal",
"src/cli",
"src/core",
"src/ncp",
Expand Down Expand Up @@ -173,6 +173,8 @@ cc_library_static {
],

srcs: [
"src/android/thread_network_hal/hal_interface.cpp",
"src/android/thread_network_hal/vendor_interface.cpp",
"src/core/api/backbone_router_api.cpp",
"src/core/api/backbone_router_ftd_api.cpp",
"src/core/api/border_agent_api.cpp",
Expand Down Expand Up @@ -556,6 +558,7 @@ cc_defaults {
"src/cli",
"src/core",
"src/ncp",
"src/lib/hdlc",
"third_party",
"third_party/mbedtls",
"third_party/mbedtls/repo/include",
Expand Down Expand Up @@ -586,6 +589,7 @@ cc_defaults {

cc_library_static {
name: "openthread-simulation",
vendor: true,

defaults: [
"ot_rcp_cflags_defaults",
Expand All @@ -606,13 +610,10 @@ cc_library_static {
"examples/platforms/simulation/system.c",
"examples/platforms/simulation/trel.c",
"examples/platforms/simulation/uart.c",

"examples/platforms/utils/link_metrics.cpp",
"examples/platforms/utils/mac_frame.cpp",
"examples/platforms/utils/soft_source_match_table.c",

"src/lib/platform/exit_code.c",

"third_party/mbedtls/repo/library/aes.c",
"third_party/mbedtls/repo/library/asn1parse.c",
"third_party/mbedtls/repo/library/asn1write.c",
Expand Down Expand Up @@ -643,13 +644,17 @@ cc_library_static {

cc_library_static {
name: "openthread-radio",
vendor: true,

defaults: [
"ot_rcp_cflags_defaults",
"ot_simulation_cflags_defaults",
],

generated_headers: ["ot_version_header"],
shared_libs: [
"libcutils",
],

srcs: [
"src/core/api/diags_api.cpp",
Expand Down Expand Up @@ -688,23 +693,71 @@ cc_library_static {

cc_library_static {
name: "openthread-hdlc",
vendor: true,
defaults: [
"ot_rcp_cflags_defaults",
"ot_simulation_cflags_defaults",
],
export_include_dirs: [
"include",
"src",
],
srcs: [
"src/lib/hdlc/hdlc.cpp",
],
}

cc_library_static {
name: "openthread-url",
vendor: true,
local_include_dirs: [
"include",
"src",
"src/core",
"src/lib/url",
],
export_include_dirs: [
"include",
"src",
],
srcs: [
"src/lib/url/url.cpp",
],
}

cc_library_static {
name: "openthread-platform",
vendor: true,
local_include_dirs: [
"include",
"src",
"src/core",
"src/lib/platform",
],
export_include_dirs: [
"include",
"src",
],
srcs: [
"src/lib/platform/exit_code.c",
],
}


cc_library_static {
name: "openthread-spinel-rcp",
vendor: true,

defaults: [
"ot_rcp_cflags_defaults",
"ot_simulation_cflags_defaults",
],

export_include_dirs: [
"include",
"src",
],

srcs: [
"src/lib/spinel/spinel.c",
"src/lib/spinel/spinel_buffer.cpp",
Expand All @@ -715,6 +768,7 @@ cc_library_static {

cc_library_static {
name: "openthread-rcp",
vendor: true,

defaults: [
"ot_rcp_cflags_defaults",
Expand All @@ -733,7 +787,7 @@ cc_library_static {

cc_binary {
name: "ot-rcp",

vendor: true,
defaults: [
"ot_rcp_cflags_defaults",
"ot_simulation_cflags_defaults",
Expand All @@ -760,3 +814,56 @@ cc_binary {
],
}

cc_library_static {
name: "openthread-posix",
vendor: true,
local_include_dirs: [
"include",
"src",
"src/core",
"src/lib/platform",
"src/posix/platform",
"src/posix/platform/include",
],
export_include_dirs: [
"include",
"src/core",
"src/posix/platform",
"src/posix/platform/include",
],

cflags: [
"-DOPENTHREAD_POSIX_CONFIG_RCP_BUS=OT_POSIX_RCP_BUS_UART",
"-DOPENTHREAD_OSIX_CONFIG_RCP_PTY_ENABLE=1",
],

cppflags: [
"-Wno-non-virtual-dtor",
],

srcs: [
"src/posix/platform/alarm.cpp",
"src/posix/platform/mainloop.cpp",
"src/posix/platform/hdlc_interface.cpp",
],
}

cc_library_static {
name: "openthread-common",
vendor: true,
local_include_dirs: [
"include",
"src",
"src/core",
],

export_include_dirs: [
"include",
"src/core",
],

srcs: [
"src/core/common/error.cpp",
"src/core/api/error_api.cpp",
],
}
Loading

0 comments on commit 8abd3d9

Please sign in to comment.