-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathclock_profile.hpp
52 lines (44 loc) · 2.18 KB
/
clock_profile.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#ifndef NO_CLOCK_PROFILE
//=========================================================================//
/*! @file
@brief RX621/RX62N グループ・クロック。プロファイル @n
クロックジェネレータで発生させる周波数の定義
@author 平松邦仁 ([email protected])
@copyright Copyright (C) 2022, 2024 Kunihito Hiramatsu @n
Released under the MIT license @n
https://github.com/hirakuni45/RX/blob/master/LICENSE
*/
//=========================================================================//
#include <cstdint>
namespace device {
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
/*!
@brief クロック・プロファイル・クラス @n
・選択出来ない値を指定すると、コンパイルエラーとなる @n
・詳細はハードウェアーマニュアル参照の事
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
class clock_profile {
public:
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
/*!
@brief 発信器タイプ
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
enum class OSC_TYPE : uint8_t {
XTAL, ///< クリスタル接続(8MHz ~ 14MHz)
EXT, ///< 外部クロック入力(8MHz ~ 14MHz)
};
static constexpr auto OSCT = OSC_TYPE::XTAL; ///< オシレーターの選択
static constexpr uint32_t BASE = 12'000'000; ///< 外部接続クリスタル
static constexpr bool TURN_SBC = false; ///< サブクロックを利用する場合「true」
static constexpr bool TURN_USB = true; ///< USB を使う場合「true」
static constexpr uint32_t ICLK = 96'000'000; ///< ICLK 周波数(最大 8~100MHz)
static constexpr uint32_t PCLK = 48'000'000; ///< PCLK 周波数(最大 8~50MHz)
static constexpr uint32_t BCLK = 48'000'000; ///< BCLK 周波数(最大 8~50MHz)
static constexpr uint32_t FCLK = PCLK; ///< FCLK 周波数(互換性の為設定)
static constexpr uint32_t DELAY_MS = (ICLK / 1'000'000 / 4) - 1; ///< ソフトウェアー遅延における定数(1マイクロ秒)
};
}
#endif