mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-29 16:49:55 +00:00
52c2aa474f
* Rebrand project to PiSCSI - rascsi ->piscsi - rasctl -> scsictl - rasdump -> scsidump - ras* -> piscsi* (rasutil -> piscsi_util, etc.) * Refined the formatting and wording of the app startup banner * Kept some references to rascsi and rasctl where backwards compatibility is concerned * Point to the new github repo URL Co-authored-by: nucleogenic <nr@nucleogenic.com> Co-authored-by: Uwe Seimet <Uwe.Seimet@seimet.de>
65 lines
1.6 KiB
C++
65 lines
1.6 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Powered by XM6 TypeG Technology.
|
|
// Copyright (C) 2016-2020 GIMONS
|
|
// Copyright (C) 2022 akuker
|
|
//
|
|
// [ High resolution timer ]
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <stdint.h>
|
|
|
|
#include "shared/scsi.h"
|
|
|
|
class PlatformSpecificTimer
|
|
{
|
|
public:
|
|
// Default constructor
|
|
PlatformSpecificTimer() = default;
|
|
// Default destructor
|
|
virtual ~PlatformSpecificTimer() = default;
|
|
// Initialization
|
|
virtual void Init() = 0;
|
|
// Get system timer low byte
|
|
virtual uint32_t GetTimerLow() = 0;
|
|
// Get system timer high byte
|
|
virtual uint32_t GetTimerHigh() = 0;
|
|
// Sleep for N nanoseconds
|
|
virtual void SleepNsec(uint32_t nsec) = 0;
|
|
// Sleep for N microseconds
|
|
virtual void SleepUsec(uint32_t usec) = 0;
|
|
};
|
|
|
|
//===========================================================================
|
|
//
|
|
// System timer
|
|
//
|
|
//===========================================================================
|
|
class SysTimer
|
|
{
|
|
public:
|
|
static void Init();
|
|
// Get system timer low byte
|
|
static uint32_t GetTimerLow();
|
|
// Get system timer high byte
|
|
static uint32_t GetTimerHigh();
|
|
// Sleep for N nanoseconds
|
|
static void SleepNsec(uint32_t nsec);
|
|
// Sleep for N microseconds
|
|
static void SleepUsec(uint32_t usec);
|
|
|
|
private:
|
|
static bool initialized;
|
|
static bool is_allwinnner;
|
|
static bool is_raspberry;
|
|
|
|
static std::unique_ptr<PlatformSpecificTimer> systimer_ptr;
|
|
};
|