37 lines
768 B
C++
37 lines
768 B
C++
#ifndef _DRV_OMAP35X_GPT_HH_
|
|
#define _DRV_OMAP35X_GPT_HH_
|
|
|
|
#include <cstdint>
|
|
#include <memory>
|
|
|
|
#include "omap35x_intc.hh"
|
|
|
|
#define USTIMER_PER_US 26
|
|
#define TICKTIMER_MS 10
|
|
|
|
class OMAP35x_GPT_impl;
|
|
|
|
class OMAP35x_GPT {
|
|
public:
|
|
// Initialize a General-Purpose Timer
|
|
OMAP35x_GPT(uintptr_t base, int irq);
|
|
~OMAP35x_GPT();
|
|
|
|
// Configure the GPT as the system tick timer (10 ms)
|
|
// The GPT must be GPTIMER1, GPTIMER2 or GPTIMER10 because the 1ms-Tick functionality is needed
|
|
void ticktimer(int_handler_t handler);
|
|
|
|
uint32_t getTicks() const;
|
|
|
|
// Configure the GPT as the system microsecond timer
|
|
// The GPT counts up at USTIMER_PER_US counts/us
|
|
void ustimer();
|
|
|
|
uint32_t getCounter();
|
|
|
|
private:
|
|
std::unique_ptr<OMAP35x_GPT_impl> impl_;
|
|
};
|
|
|
|
#endif
|