2022-09-10 21:40:24 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
|
|
|
// for Raspberry Pi
|
|
|
|
//
|
|
|
|
// Powered by XM6 TypeG Technology.
|
|
|
|
// Copyright (C) 2016-2020 GIMONS
|
|
|
|
// Copyright (C) 2022 akuker
|
|
|
|
//
|
|
|
|
// [ High resolution timer ]
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-11-10 06:44:06 +00:00
|
|
|
#include "shared/config.h"
|
|
|
|
#include "shared/scsi.h"
|
2022-09-10 21:40:24 +00:00
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// System timer
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
class SysTimer
|
|
|
|
{
|
2022-11-09 07:40:26 +00:00
|
|
|
public:
|
|
|
|
static void Init(uint32_t *syst, uint32_t *armt);
|
|
|
|
// Initialization
|
|
|
|
static uint32_t GetTimerLow();
|
|
|
|
// Get system timer low byte
|
|
|
|
static uint32_t GetTimerHigh();
|
|
|
|
// Get system timer high byte
|
|
|
|
static void SleepNsec(uint32_t nsec);
|
|
|
|
// Sleep for N nanoseconds
|
|
|
|
static void SleepUsec(uint32_t usec);
|
|
|
|
// Sleep for N microseconds
|
2022-09-10 21:40:24 +00:00
|
|
|
|
2022-11-09 07:40:26 +00:00
|
|
|
private:
|
|
|
|
static volatile uint32_t *systaddr;
|
|
|
|
// System timer address
|
|
|
|
static volatile uint32_t *armtaddr;
|
|
|
|
// ARM timer address
|
|
|
|
static volatile uint32_t corefreq;
|
|
|
|
// Core frequency
|
2022-09-10 21:40:24 +00:00
|
|
|
};
|