|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2018 [email protected]
4: //
5:
6: #include "sysclk.h"
7: #include "mpu.h"
8:
9: SysClkDevice::SysClkDevice()
10: {
11: logname = "sysclk";
12: devname = "SystemClock";
13: devaddr = 0x63000000;
14:
15: event.dev = this;
16: event.func = (DeviceCallback_t)&SysClkDevice::Callback;
17: event.code = 0;
18: event.time = 16.666667_msec;
1.1.1.2 root 19: event.SetName("System Clock");
1.1 root 20: }
21:
22: SysClkDevice::~SysClkDevice()
23: {
24: }
25:
26: bool
27: SysClkDevice::PowerOn()
28: {
29: // 電源オンですぐ起動
1.1.1.3 ! root 30: event.Start();
1.1 root 31: return true;
32: }
33:
34: uint64
1.1.1.3 ! root 35: SysClkDevice::Read(uint32 addr)
1.1 root 36: {
1.1.1.3 ! root 37: // 1 ポートしかない
! 38: return GetInt();
! 39: }
1.1 root 40:
1.1.1.3 ! root 41: uint64
! 42: SysClkDevice::Write(uint32 addr, uint32 data)
! 43: {
! 44: // 何か書き込まれたら、フラグをクリア
! 45: sysint = false;
! 46: putlog(1, "システムクロック割り込みクリア");
! 47: return 0;
1.1 root 48: }
49:
50: uint64
1.1.1.3 ! root 51: SysClkDevice::Peek(uint32 addr)
1.1 root 52: {
1.1.1.3 ! root 53: return GetInt();
! 54: }
! 55:
! 56: // 割り込み状態を取得(?)
! 57: uint8
! 58: SysClkDevice::GetInt() const
! 59: {
! 60: uint8 data = 0;
1.1 root 61:
1.1.1.3 ! root 62: if (sysint) {
! 63: data |= 0x80;
1.1 root 64: }
1.1.1.3 ! root 65: return data;
1.1 root 66: }
67:
68: // イベントハンドラ
69: void
70: SysClkDevice::Callback(int arg)
71: {
72: putlog(3, "システムクロック割り込み発生");
73: sysint = true;
74: gMPU->Interrupt(5);
1.1.1.3 ! root 75: event.Start();
1.1 root 76: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.