Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 1 | # Copyright 2020 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 | |
| 15 | load( |
| 16 | "//pw_build:pigweed.bzl", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 17 | "pw_cc_facade", |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 18 | "pw_cc_library", |
| 19 | "pw_cc_test", |
| 20 | ) |
| 21 | |
| 22 | package(default_visibility = ["//visibility:public"]) |
| 23 | |
| 24 | licenses(["notice"]) # Apache License 2.0 |
| 25 | |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 26 | pw_cc_library( |
| 27 | name = "epoch", |
| 28 | hdrs = [ |
| 29 | "public/pw_chrono/epoch.h", |
| 30 | ], |
| 31 | includes = ["public"], |
| 32 | ) |
| 33 | |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 34 | pw_cc_facade( |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 35 | name = "system_clock_facade", |
| 36 | hdrs = [ |
Ewout van Bekkum | 830d5d1 | 2021-01-28 18:58:03 -0800 | [diff] [blame] | 37 | "public/pw_chrono/internal/system_clock_macros.h", |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 38 | "public/pw_chrono/system_clock.h", |
| 39 | ], |
| 40 | includes = ["public"], |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 41 | deps = [ |
| 42 | ":epoch", |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 43 | "//pw_preprocessor", |
| 44 | ], |
| 45 | ) |
| 46 | |
| 47 | pw_cc_library( |
| 48 | name = "system_clock", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 49 | srcs = [ |
| 50 | "system_clock.cc", |
| 51 | ], |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 52 | deps = [ |
| 53 | ":system_clock_facade", |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 54 | "@pigweed_config//:pw_chrono_backend", |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 55 | ], |
| 56 | ) |
| 57 | |
| 58 | pw_cc_library( |
Nathaniel Brough | c2d5781 | 2021-04-18 22:52:00 +0800 | [diff] [blame] | 59 | name = "backend_multiplexer", |
| 60 | visibility = ["@pigweed_config//:__pkg__"], |
| 61 | deps = select({ |
| 62 | "//pw_build/constraints/rtos:freertos": ["//pw_chrono_freertos:system_clock"], |
| 63 | "//pw_build/constraints/rtos:embos": ["//pw_chrono_embos:system_clock"], |
| 64 | "//pw_build/constraints/rtos:threadx": ["//pw_chrono_threadx:system_clock"], |
| 65 | "//conditions:default": ["//pw_chrono_stl:system_clock"], |
| 66 | }), |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 67 | ) |
| 68 | |
| 69 | pw_cc_library( |
| 70 | name = "simulated_system_clock", |
| 71 | hdrs = [ |
| 72 | "public/pw_chrono/simulated_system_clock.h", |
| 73 | ], |
| 74 | deps = [ |
| 75 | ":system_clock", |
Ewout van Bekkum | da2a62d | 2021-03-12 11:34:47 -0800 | [diff] [blame] | 76 | "//pw_sync:interrupt_spin_lock", |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 77 | ], |
| 78 | ) |
| 79 | |
| 80 | pw_cc_test( |
| 81 | name = "simulated_system_clock_test", |
| 82 | srcs = [ |
| 83 | "simulated_system_clock_test.cc", |
| 84 | ], |
| 85 | deps = [ |
| 86 | ":simulated_system_clock", |
| 87 | "//pw_unit_test", |
| 88 | ], |
| 89 | ) |
| 90 | |
| 91 | pw_cc_test( |
| 92 | name = "system_clock_facade_test", |
| 93 | srcs = [ |
| 94 | "system_clock_facade_test.cc", |
| 95 | "system_clock_facade_test_c.c", |
| 96 | ], |
| 97 | deps = [ |
| 98 | ":system_clock", |
| 99 | "//pw_preprocessor", |
| 100 | "//pw_unit_test", |
| 101 | ], |
| 102 | ) |