Line 1... |
Line 1... |
// $Id: RlinkCommand.hpp 495 2013-03-06 17:13:48Z mueller $
|
// $Id: RlinkCommand.hpp 609 2014-12-07 19:35:25Z mueller $
|
//
|
//
|
// Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
// Copyright 2011-2014 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
//
|
//
|
// This program is free software; you may redistribute and/or modify it under
|
// This program is free software; you may redistribute and/or modify it under
|
// the terms of the GNU General Public License as published by the Free
|
// the terms of the GNU General Public License as published by the Free
|
// Software Foundation, either version 2, or at your option any later version.
|
// Software Foundation, either version 2, or at your option any later version.
|
//
|
//
|
Line 11... |
Line 11... |
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// for complete details.
|
// for complete details.
|
//
|
//
|
// Revision History:
|
// Revision History:
|
// Date Rev Version Comment
|
// Date Rev Version Comment
|
|
// 2014-12-06 609 1.2 new rlink v4 iface
|
// 2013-05-06 495 1.0.1 add RlinkContext to Print() args; drop oper<<()
|
// 2013-05-06 495 1.0.1 add RlinkContext to Print() args; drop oper<<()
|
// 2011-03-27 374 1.0 Initial version
|
// 2011-03-27 374 1.0 Initial version
|
// 2011-01-09 354 0.1 First draft
|
// 2011-01-09 354 0.1 First draft
|
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
|
|
|
|
/*!
|
/*!
|
\file
|
\file
|
\version $Id: RlinkCommand.hpp 495 2013-03-06 17:13:48Z mueller $
|
\version $Id: RlinkCommand.hpp 609 2014-12-07 19:35:25Z mueller $
|
\brief Declaration of class RlinkCommand.
|
\brief Declaration of class RlinkCommand.
|
*/
|
*/
|
|
|
#ifndef included_Retro_RlinkCommand
|
#ifndef included_Retro_RlinkCommand
|
#define included_Retro_RlinkCommand 1
|
#define included_Retro_RlinkCommand 1
|
Line 53... |
Line 54... |
void CmdRblk(uint16_t addr, size_t size);
|
void CmdRblk(uint16_t addr, size_t size);
|
void CmdRblk(uint16_t addr, uint16_t* pblock, size_t size);
|
void CmdRblk(uint16_t addr, uint16_t* pblock, size_t size);
|
void CmdWreg(uint16_t addr, uint16_t data);
|
void CmdWreg(uint16_t addr, uint16_t data);
|
void CmdWblk(uint16_t addr, const std::vector<uint16_t>& block);
|
void CmdWblk(uint16_t addr, const std::vector<uint16_t>& block);
|
void CmdWblk(uint16_t addr, const uint16_t* pblock, size_t size);
|
void CmdWblk(uint16_t addr, const uint16_t* pblock, size_t size);
|
void CmdStat();
|
void CmdLabo();
|
void CmdAttn();
|
void CmdAttn();
|
void CmdInit(uint16_t addr, uint16_t data);
|
void CmdInit(uint16_t addr, uint16_t data);
|
|
|
void SetCommand(uint8_t cmd, uint16_t addr=0, uint16_t data=0);
|
void SetCommand(uint8_t cmd, uint16_t addr=0, uint16_t data=0);
|
void SetSeqNumber(uint8_t snum);
|
void SetSeqNumber(uint8_t snum);
|
void SetAddress(uint16_t addr);
|
void SetAddress(uint16_t addr);
|
void SetData(uint16_t data);
|
void SetData(uint16_t data);
|
void SetBlockWrite(const std::vector<uint16_t>& block);
|
void SetBlockWrite(const std::vector<uint16_t>& block);
|
void SetBlockRead(size_t size) ;
|
void SetBlockRead(size_t size) ;
|
void SetBlockExt(uint16_t* pblock, size_t size);
|
void SetBlockExt(uint16_t* pblock, size_t size);
|
void SetStatRequest(uint8_t ccmd);
|
void SetBlockDone(uint16_t dcnt);
|
void SetStatus(uint8_t stat);
|
void SetStatus(uint8_t stat);
|
void SetFlagBit(uint32_t mask);
|
void SetFlagBit(uint32_t mask);
|
void ClearFlagBit(uint32_t mask);
|
void ClearFlagBit(uint32_t mask);
|
void SetRcvSize(size_t rsize);
|
void SetRcvSize(size_t rsize);
|
void SetExpect(RlinkCommandExpect* pexp);
|
void SetExpect(RlinkCommandExpect* pexp);
|
Line 81... |
Line 82... |
const std::vector<uint16_t>& Block() const;
|
const std::vector<uint16_t>& Block() const;
|
bool IsBlockExt() const;
|
bool IsBlockExt() const;
|
uint16_t* BlockPointer();
|
uint16_t* BlockPointer();
|
const uint16_t* BlockPointer() const;
|
const uint16_t* BlockPointer() const;
|
size_t BlockSize() const;
|
size_t BlockSize() const;
|
uint8_t StatRequest() const;
|
size_t BlockDone() const;
|
uint8_t Status() const;
|
uint8_t Status() const;
|
uint32_t Flags() const;
|
uint32_t Flags() const;
|
bool TestFlagAny(uint32_t mask) const;
|
bool TestFlagAny(uint32_t mask) const;
|
bool TestFlagAll(uint32_t mask) const;
|
bool TestFlagAll(uint32_t mask) const;
|
size_t RcvSize() const;
|
size_t RcvSize() const;
|
Line 104... |
Line 105... |
// some constants (also defined in cpp)
|
// some constants (also defined in cpp)
|
static const uint8_t kCmdRreg = 0; //!< command code read register
|
static const uint8_t kCmdRreg = 0; //!< command code read register
|
static const uint8_t kCmdRblk = 1; //!< command code read block
|
static const uint8_t kCmdRblk = 1; //!< command code read block
|
static const uint8_t kCmdWreg = 2; //!< command code write register
|
static const uint8_t kCmdWreg = 2; //!< command code write register
|
static const uint8_t kCmdWblk = 3; //!< command code write block
|
static const uint8_t kCmdWblk = 3; //!< command code write block
|
static const uint8_t kCmdStat = 4; //!< command code get status
|
static const uint8_t kCmdLabo = 4; //!< command code list abort
|
static const uint8_t kCmdAttn = 5; //!< command code get attention
|
static const uint8_t kCmdAttn = 5; //!< command code get attention
|
static const uint8_t kCmdInit = 6; //!< command code send initialize
|
static const uint8_t kCmdInit = 6; //!< command code send initialize
|
|
|
static const uint32_t kFlagInit = 1u<<0; //!< cmd,addr,data setup
|
static const uint32_t kFlagInit = 1u<<0; //!< cmd,addr,data setup
|
static const uint32_t kFlagSend = 1u<<1; //!< command send
|
static const uint32_t kFlagSend = 1u<<1; //!< command send
|
static const uint32_t kFlagDone = 1u<<2; //!< command done
|
static const uint32_t kFlagDone = 1u<<2; //!< command done
|
|
static const uint32_t kFlagLabo = 1u<<3; //!< command labo'ed
|
|
|
static const uint32_t kFlagPktBeg = 1u<<4; //!< command first in packet
|
static const uint32_t kFlagPktBeg = 1u<<4; //!< command first in packet
|
static const uint32_t kFlagPktEnd = 1u<<5; //!< command last in packet
|
static const uint32_t kFlagPktEnd = 1u<<5; //!< command last in packet
|
static const uint32_t kFlagRecov = 1u<<6; //!< command stat recovered
|
|
static const uint32_t kFlagResend = 1u<<7; //!< command resend recovered
|
|
|
|
static const uint32_t kFlagErrNak = 1u<<8; //!< error: nak abort
|
static const uint32_t kFlagErrNak = 1u<<8; //!< error: nak abort
|
static const uint32_t kFlagErrMiss= 1u<<9; //!< error: missing data
|
static const uint32_t kFlagErrDec = 1u<<9; //!< error: decode error
|
static const uint32_t kFlagErrCmd = 1u<<10; //!< error: cmd or nblk check
|
|
static const uint32_t kFlagErrCrc = 1u<<11; //!< error: crc check
|
|
|
|
static const uint32_t kFlagChkStat= 1u<<12; //!< stat expect check failed
|
static const uint32_t kFlagChkStat= 1u<<12; //!< stat expect check failed
|
static const uint32_t kFlagChkData= 1u<<13; //!< data expect check failed
|
static const uint32_t kFlagChkData= 1u<<13; //!< data expect check failed
|
|
|
static const uint32_t kFlagVol = 1u<<16; //!< volatile
|
static const uint8_t kStat_M_Stat = 0xf0; //!< stat: external stat bits
|
|
static const uint8_t kStat_V_Stat = 4;
|
static const uint8_t kStat_M_Stat = 0xe0; //!< stat: external stat bits
|
static const uint8_t kStat_B_Stat = 0x0f;
|
static const uint8_t kStat_V_Stat = 5;
|
static const uint8_t kStat_M_Attn = kBBit03;//!< stat: attn flags set
|
static const uint8_t kStat_B_Stat = 0x07;
|
|
static const uint8_t kStat_M_Attn = kBBit04;//!< stat: attn flags set
|
|
static const uint8_t kStat_M_Cerr = kBBit03;//!< stat: attn flags set
|
|
static const uint8_t kStat_M_Derr = kBBit02;//!< stat: attn flags set
|
|
static const uint8_t kStat_M_RbNak = kBBit01;//!< stat: attn flags set
|
static const uint8_t kStat_M_RbNak = kBBit01;//!< stat: attn flags set
|
static const uint8_t kStat_M_RbErr = kBBit00;//!< stat: attn flags set
|
static const uint8_t kStat_M_RbErr = kBBit00;//!< stat: attn flags set
|
|
|
static const uint16_t kRbaddr_IInt = 0xff; //!< iint: rbus address
|
|
static const uint16_t kIInt_M_AnEna = kWBit15;//!< iint: attn notify
|
|
static const uint16_t kIInt_M_ItoEna= kWBit14;//!< iint: attn/idle timeout
|
|
static const uint16_t kIInt_M_ItoVal= 0x00ff; //!< iint: attn/idle timeout
|
|
|
|
protected:
|
protected:
|
void SetCmdSimple(uint8_t cmd, uint16_t addr, uint16_t data);
|
void SetCmdSimple(uint8_t cmd, uint16_t addr, uint16_t data);
|
|
|
protected:
|
protected:
|
uint8_t fRequest; //!< rlink request (cmd+seqnum)
|
uint8_t fRequest; //!< rlink request (cmd+seqnum)
|
uint16_t fAddress; //!< rbus address
|
uint16_t fAddress; //!< rbus address
|
uint16_t fData; //!< data
|
uint16_t fData; //!< data
|
std::vector<uint16_t> fBlock; //!< data vector for blk commands
|
std::vector<uint16_t> fBlock; //!< data vector for blk commands
|
uint16_t* fpBlockExt; //!< external data for blk commands
|
uint16_t* fpBlockExt; //!< external data for blk commands
|
size_t fBlockExtSize; //!< transfer size if data external
|
size_t fBlockExtSize; //!< transfer size if data external
|
uint8_t fStatRequest; //!< stat command ccmd return field
|
size_t fBlockDone; //!< valid transfer count
|
uint8_t fStatus; //!< rlink command status
|
uint8_t fStatus; //!< rlink command status
|
uint32_t fFlags; //!< state bits
|
uint32_t fFlags; //!< state bits
|
size_t fRcvSize; //!< receive size for command
|
size_t fRcvSize; //!< receive size for command
|
RlinkCommandExpect* fpExpect; //!< pointer to expect container
|
RlinkCommandExpect* fpExpect; //!< pointer to expect container
|
};
|
};
|