• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load(
16    "//pw_build:pigweed.bzl",
17    "host_backend_alias",
18    "pw_facade",
19)
20
21package(default_visibility = ["//visibility:public"])
22
23licenses(["notice"])
24
25constraint_setting(
26    name = "backend_constraint_setting",
27    default_constraint_value = "unspecified",
28)
29
30constraint_value(
31    name = "unspecified",
32    constraint_setting = ":backend_constraint_setting",
33)
34
35# TODO: pwbug.dev/328679085 - Remove this alias once no-one uses it.
36alias(
37    name = "facade",
38    actual = ":pw_sys_io.facade",
39)
40
41pw_facade(
42    name = "pw_sys_io",
43    hdrs = ["public/pw_sys_io/sys_io.h"],
44    backend = ":backend",
45    includes = ["public"],
46    deps = [
47        "//pw_bytes",
48        "//pw_status",
49    ],
50)
51
52label_flag(
53    name = "backend",
54    build_setting_default = ":backend_multiplexer",
55)
56
57cc_library(
58    name = "default_putget_bytes",
59    srcs = ["sys_io.cc"],
60    deps = [
61        ":facade",
62        "//pw_span",
63        "//pw_status",
64    ],
65)
66
67alias(
68    name = "backend_multiplexer",
69    actual = select({
70        "//pw_sys_io_arduino:backend": "@pigweed//pw_sys_io_arduino",
71        "//pw_sys_io_baremetal_lm3s6965evb:backend": "@pigweed//pw_sys_io_baremetal_lm3s6965evb",
72        "//pw_sys_io_baremetal_stm32f429:backend": "@pigweed//pw_sys_io_baremetal_stm32f429",
73        "//pw_sys_io_emcraft_sf2:backend": "@pigweed//pw_sys_io_emcraft_sf2",
74        "//pw_sys_io_mcuxpresso:backend": "@pigweed//pw_sys_io_mcuxpresso",
75        "//pw_sys_io_rp2040:backend": "@pigweed//pw_sys_io_rp2040",
76        "//pw_sys_io_stdio:backend": "@pigweed//pw_sys_io_stdio",
77        "//pw_sys_io_stm32cube:backend": "@pigweed//pw_sys_io_stm32cube",
78        ":unspecified": ":unspecified_backend",
79        "//conditions:default": ":unspecified_backend",
80    }),
81    visibility = ["@pigweed//targets:__pkg__"],
82)
83
84host_backend_alias(
85    name = "unspecified_backend",
86    backend = "@pigweed//pw_sys_io_stdio",
87)
88