-
-
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.
- Loading branch information
Showing
37 changed files
with
436 additions
and
99 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1704725179; | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1707838977; |
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 |
---|---|---|
@@ -1 +1 @@ | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1706294736; | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1707839019; |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1702811913; | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1707839032; |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1702811915; | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1707839045; |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
// Generated do 14 sep 2023 12:39:45 CEST | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1694687985; | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1707839069; |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
// Generated do 14 sep 2023 12:39:46 CEST | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1694687986; | ||
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1707839082; |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @file e131controller.cpp | ||
* | ||
*/ | ||
/* Copyright (C) 2020-2023 by Arjan van Vught mailto:[email protected] | ||
/* Copyright (C) 2020-2024 by Arjan van Vught mailto:[email protected] | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @file hardware.h | ||
* | ||
*/ | ||
/* Copyright (C) 2021-2023 by Arjan van Vught mailto:[email protected] | ||
/* Copyright (C) 2021-2024 by Arjan van Vught mailto:[email protected] | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -67,7 +67,9 @@ class Hardware { | |
return 0; // FIXME GetReleaseId | ||
} | ||
|
||
void GetUuid(uuid_t out); | ||
void GetUuid(uuid_t out) { | ||
memcpy(out, m_uuid, sizeof(uuid_t)); | ||
} | ||
|
||
uint32_t Millis() { | ||
extern volatile uint32_t s_nSysTickMillis; | ||
|
@@ -83,12 +85,12 @@ class Hardware { | |
} | ||
|
||
bool SetTime(__attribute__((unused)) const struct tm *pTime) { | ||
#if !defined(DISABLE_RTC) | ||
#if !defined(DISABLE_RTC) | ||
m_HwClock.Set(pTime); | ||
return true; | ||
#else | ||
#else | ||
return false; | ||
#endif | ||
#endif | ||
} | ||
|
||
void GetTime(struct tm *pTime) { | ||
|
@@ -108,22 +110,22 @@ class Hardware { | |
} | ||
#endif | ||
|
||
const char *GetBoardName(uint8_t &nLength) { | ||
const char *GetBoardName(uint8_t& nLength) { | ||
nLength = sizeof(GD32_BOARD_NAME) - 1U; | ||
return GD32_BOARD_NAME; | ||
} | ||
|
||
const char *GetSysName(uint8_t &nLength) { | ||
const char* GetSysName(uint8_t& nLength) { | ||
nLength = 8; | ||
return "Embedded"; | ||
} | ||
|
||
const char *GetSocName(uint8_t &nLength) { | ||
nLength = 5; | ||
return "GD32F"; | ||
const char* GetSocName(uint8_t& nLength) { | ||
nLength = 4; | ||
return "GD32"; | ||
} | ||
|
||
const char *GetCpuName(uint8_t &nLength) { | ||
const char *GetCpuName(uint8_t& nLength) { | ||
nLength = sizeof(GD32_MCU_NAME) - 1U; | ||
return GD32_MCU_NAME; | ||
} | ||
|
@@ -137,8 +139,8 @@ class Hardware { | |
} | ||
|
||
void WatchdogInit() { | ||
const auto status = fwdgt_config(0xFFFF, FWDGT_PSC_DIV16); | ||
m_bIsWatchdog = (SUCCESS == status); | ||
m_bIsWatchdog = (SUCCESS == fwdgt_config(0xFFFF, FWDGT_PSC_DIV16)); | ||
|
||
if (m_bIsWatchdog) { | ||
fwdgt_enable(); | ||
} | ||
|
@@ -262,6 +264,7 @@ class Hardware { | |
#if !defined(DISABLE_RTC) | ||
HwClock m_HwClock; | ||
#endif | ||
uuid_t m_uuid; | ||
bool m_bIsWatchdog { false }; | ||
hardware::ledblink::Mode m_Mode { hardware::ledblink::Mode::UNKNOWN }; | ||
bool m_doLock { false }; | ||
|
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @file hardware.h | ||
* | ||
*/ | ||
/* Copyright (C) 2020-2023 by Arjan van Vught mailto:[email protected] | ||
/* Copyright (C) 2020-2024 by Arjan van Vught mailto:[email protected] | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -27,6 +27,8 @@ | |
#define HARDWARE_H_ | ||
|
||
#include <cstdint> | ||
#include <cstring> | ||
#include <uuid/uuid.h> | ||
|
||
namespace hardware { | ||
enum class BootDevice { | ||
|
@@ -42,8 +44,6 @@ namespace ledblink { | |
enum class Mode { | ||
OFF_OFF, OFF_ON, NORMAL, DATA, FAST, REBOOT, UNKNOWN | ||
}; | ||
|
||
void display(const uint32_t nState); | ||
} // namespace ledblink | ||
} // namespace hardware | ||
|
||
|
@@ -56,7 +56,11 @@ void display(const uint32_t nState); | |
# include "rpi/hardware.h" | ||
# endif | ||
#else | ||
# include "linux/hardware.h" | ||
# if defined (CONFIG_HAL_USE_MINIMUM) | ||
# include "linux/minimum/hardware.h" | ||
# else | ||
# include "linux/hardware.h" | ||
# endif | ||
#endif | ||
|
||
#endif /* HARDWARE_H_ */ |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @file utc.h | ||
* | ||
*/ | ||
/* Copyright (C) 2019-2020 by Arjan van Vught mailto:[email protected] | ||
/* Copyright (C) 2019-2024 by Arjan van Vught mailto:[email protected] | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -26,14 +26,13 @@ | |
|
||
#include <cstdint> | ||
|
||
enum TUtcOffset { | ||
namespace hal { | ||
enum class UtcOffset { | ||
UTC_OFFSET_MIN = -12, | ||
UTC_OFFSET_MAX = 14 | ||
}; | ||
|
||
class Utc { | ||
public: | ||
static int32_t Validate(float fOffset); | ||
}; | ||
int32_t utc_validate(const float fOffset); | ||
} // namespace hal | ||
|
||
#endif /* UTC_H_ */ |
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
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,58 @@ | ||
/** | ||
* @file uuid.cpp | ||
* | ||
*/ | ||
/* Copyright (C) 2024 by Arjan van Vught mailto:[email protected] | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of thnDmxDataDirecte Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
#include <cstdint> | ||
#include <cstring> | ||
#include <uuid/uuid.h> | ||
|
||
#include "gd32.h" | ||
|
||
namespace hal { | ||
typedef union pcast32 { | ||
uuid_t uuid; | ||
uint32_t u32[4]; | ||
} _pcast32; | ||
|
||
void uuid_init(uuid_t out) { | ||
_pcast32 cast; | ||
|
||
#if defined (GD32H7XX) | ||
cast.u32[0] = REG32(0x1FF0F7E8); | ||
cast.u32[1] = REG32(0x1FF0F7EC); | ||
cast.u32[2] = REG32(0x1FF0F7F0); | ||
#elif defined (GD32F4XX) | ||
cast.u32[0] = REG32(0x1FFF7A10); | ||
cast.u32[1] = REG32(0x1FFF7A14); | ||
cast.u32[2] = REG32(0x1FFF7A18); | ||
#else | ||
cast.u32[0] = REG32(0x1FFFF7E8); | ||
cast.u32[1] = REG32(0x1FFFF7EC); | ||
cast.u32[2] = REG32(0x1FFFF7F0); | ||
#endif | ||
cast.u32[3] = cast.u32[0] + cast.u32[1] + cast.u32[2]; | ||
|
||
memcpy(out, cast.uuid, sizeof(uuid_t)); | ||
} | ||
} // namespace hal |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @file hardware.cpp | ||
* | ||
*/ | ||
/* Copyright (C) 2023 by Arjan van Vught mailto:[email protected] | ||
/* Copyright (C) 2023-2024 by Arjan van Vught mailto:[email protected] | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -38,6 +38,7 @@ enum class FreqMode { | |
OFF_OFF = 0, NORMAL = 1, DATA = 3, FAST = 5, REBOOT = 8, OFF_ON = 255 | ||
}; | ||
|
||
#if !defined (CONFIG_HAL_USE_MINIMUM) | ||
void Hardware::SetModeWithLock(hardware::ledblink::Mode mode, bool doLock) { | ||
m_doLock = false; | ||
SetMode(mode); | ||
|
@@ -79,3 +80,4 @@ void Hardware::SetMode(hardware::ledblink::Mode mode) { | |
|
||
DEBUG_PRINTF("Mode=%d", static_cast<int>(m_Mode)); | ||
} | ||
#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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @file utc.cpp | ||
* | ||
*/ | ||
/* Copyright (C) 2019-2021 by Arjan van Vught mailto:[email protected] | ||
/* Copyright (C) 2019-2024 by Arjan van Vught mailto:[email protected] | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -27,9 +27,10 @@ | |
|
||
// https://en.wikipedia.org/wiki/List_of_UTC_time_offsets | ||
|
||
namespace hal { | ||
static const float s_ValidOffets[] = { -9.5, -3.5, 3.5, 4.5, 5.5, 5.75, 6.5, 8.75, 9.5, 10.5, 12.75 }; | ||
|
||
int32_t Utc::Validate(float fOffset) { | ||
int32_t utc_validate(const float fOffset) { | ||
auto nInt = static_cast<int32_t>(fOffset); | ||
|
||
if ((nInt >= -12) && (nInt <= 14)) { | ||
|
@@ -46,3 +47,4 @@ int32_t Utc::Validate(float fOffset) { | |
|
||
return 0; | ||
} | ||
} // namespace hal |
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
Oops, something went wrong.