54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
/*
|
|
* CGenericDelayQueue.h
|
|
*
|
|
*
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifndef CGENERIC_DELAY_QUEUE_H_
|
|
#define CGENERIC_DELAY_QUEUE_H_
|
|
|
|
#include "generic_delay_queue.h"
|
|
#include "CGenericDelayQueueAuto.h"
|
|
|
|
class CGenericDelayQueue : public CGenericDelayQueueAuto
|
|
{
|
|
private:
|
|
typedef uint32_t t_CtrlMode;
|
|
|
|
enum CtrlMode: t_CtrlMode
|
|
{
|
|
DISABLED = 0,
|
|
BYPASS = 1,
|
|
CPU = 2,
|
|
NORMAL_STREAM = 3
|
|
};
|
|
|
|
public:
|
|
// Constructor. Create register objects relative to the passed in base address
|
|
CGenericDelayQueue(uint32_t* csrBaseAddr) : CGenericDelayQueueAuto(csrBaseAddr)
|
|
{
|
|
|
|
};
|
|
|
|
inline void disableQueue () {p_ctrlMode->SetCtrlMode((uint32_t)DISABLED);};
|
|
inline void bypassQueue () {p_ctrlMode->SetCtrlMode((uint32_t)BYPASS);};
|
|
inline void cpuControlQueue () {p_ctrlMode->SetCtrlMode((uint32_t)CPU);};
|
|
inline void normalQueue () {p_ctrlMode->SetCtrlMode((uint32_t)NORMAL_STREAM);};
|
|
inline void streamingQueue () {normalQueue();};
|
|
|
|
inline void setCpuQueueValue(const uint32_t data, const uint32_t delay)
|
|
{
|
|
uint32_t delayWidth = p_config->GetDelayWidth();
|
|
uint32_t dataWidth = p_config->GetDataWidth();
|
|
|
|
uint32_t val = (data & ((1 << dataWidth)-1)) | ((delay & ((1 << delayWidth)-1)) << dataWidth);
|
|
|
|
cpuControlQueue();
|
|
p_data->SetData(val);
|
|
}
|
|
|
|
};
|
|
|
|
#endif /* CGENERIC_DELAY_QUEUE__H_ */
|