Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time library, clock process, Sleep() function #3

Merged
merged 14 commits into from
Nov 28, 2023
Merged
Prev Previous commit
Next Next commit
move time->clock
  • Loading branch information
Joshua MacDonald committed Nov 26, 2023
commit eae164673f144416b920b218b9f0dcce9c03172b
2 changes: 1 addition & 1 deletion examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cc_binary(
"//lib/initproc",
"//lib/log/daemon",
"//lib/rpmsg",
"//lib/time",
"//lib/time/clock",
"//tools/toolchain/am335x",
],
)
Expand Down
2 changes: 1 addition & 1 deletion examples/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "lib/log/daemon/daemon.h"
#include "lib/pinmap/pinmap.h"
#include "lib/rpmsg/rpmsg.h"
#include "lib/time/time.h"
#include "lib/time/clock/clock.h"

#define NUM_RESOURCES 1

Expand Down
12 changes: 6 additions & 6 deletions lib/time/BUILD → lib/time/clock/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ package(default_visibility = ["//visibility:public"])
cc_library(
name = "defs",
hdrs = [
"time-defs.h",
"clock-defs.h",
],
deps = [
"//lib/soc",
],
)

cc_library(
name = "time",
name = "clock",
srcs = [
"time.c",
"clock.c",
],
hdrs = [
"time.h",
"clock.h",
],
deps = [
":defs",
"//lib/coroutine",
] + select({
"//tools/toolchain:am335x": ["//lib/time/am335x"],
"//conditions:default": ["//lib/time/test32"],
"//tools/toolchain:am335x": ["//lib/time/clock/am335x"],
"//conditions:default": ["//lib/time/clock/test32"],
}),
)
6 changes: 3 additions & 3 deletions lib/time/am335x/BUILD → lib/time/clock/am335x/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ package(default_visibility = ["//visibility:public"])
cc_library(
name = "am335x",
hdrs = [
"time-am335x.h",
"clock-am335x.h",
],
srcs = [
"time-am335x.c",
"clock-am335x.c",
],
deps = [
"//lib/thread",
"//lib/time:defs",
"//lib/time/clock:defs",
"//tools/toolchain/am335x",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stdint.h>

#include "external/ti-pru-support/include/am335x/pru_iep.h"
#include "lib/time/time-defs.h"
#include "lib/time/clock/clock-defs.h"

Timestamp __clock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifndef LIB_TIME_AM335X_TIME_H
#define LIB_TIME_AM335X_TIME_H

#include "lib/time/time-defs.h"
#include "lib/time/clock/clock-defs.h"

#ifdef __cplusplus
extern "C" {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/time/time.c → lib/time/clock/clock.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Joshua MacDonald
// SPDX-License-Identifier: MIT

#include "lib/time/time.h"
#include "lib/time/clock/clock.h"
#include "lib/coroutine/coroutine.h"
#include "lib/thread/thread.h"

Expand Down
6 changes: 3 additions & 3 deletions lib/time/time.h → lib/time/clock/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
extern "C" {
#endif

#include "lib/time/time-defs.h"
#include "lib/time/clock/clock-defs.h"

#if defined(SUPRUGLUE_AM335X)
#include "lib/time/am335x/time-am335x.h"
#include "lib/time/clock/am335x/clock-am335x.h"
#elif defined(SUPRUGLUE_TEST32)
#include "lib/time/test32/time-test32.h"
#include "lib/time/clock/test32/clock-test32.h"
#endif

void Sleep(uint32_t nanos);
Expand Down
12 changes: 6 additions & 6 deletions lib/time/test32/BUILD → lib/time/clock/test32/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ package(default_visibility = ["//visibility:public"])
cc_library(
name = "test32",
srcs = [
"time-test32.cc",
"clock-test32.cc",
],
hdrs = [
"time-test32.h",
"clock-test32.h",
],
deps = [
"//lib/thread",
"//lib/time:defs",
"//lib/time/clock:defs",
],
)

cc_test(
name = "time_test",
srcs = ["time_test.cc"],
name = "clock_test",
srcs = ["clock_test.cc"],
deps = [
"//lib/time",
"//lib/time/clock",
"@com_google_googletest//:gtest_main",
],
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright Joshua MacDonald
// SPDX-License-Identifier: MIT

#include "lib/time/time-defs.h"
#include "lib/time/clock/clock-defs.h"
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
extern "C" {
#endif

#include "lib/time/time-defs.h"
#include "lib/time/clock/clock-defs.h"

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright Joshua MacDonald
// SPDX-License-Identifier: MIT

#include "time.h"
#include "clock-test32.h"