41using namespace std::placeholders;
194 std::bind(&
Rw11CntlRL11::RdmaPreExecCB, this, _1, _2, _3, _4),
195 std::bind(&
Rw11CntlRL11::RdmaPostExecCB, this, _1, _2, _3, _4))
198 for (
size_t i=0; i<
NUnit(); i++) {
231 "Bad state: started, no lam, not enable, not found");
259 uint16_t(1)<<
fLam,
this);
278 if (unit.
Type() ==
"rl02")
301 uint16_t& aload, uint16_t& astart)
303 uint16_t kBOOT_START = 02000;
304 uint16_t bootcode[] = {
306 0012706, kBOOT_START,
307 0012700, uint16_t(unit),
311 0012761, 0000013, 0000004,
332 0012761, 0177000, 0000006,
341 0012704, uint16_t(kBOOT_START+020),
347 code.insert(code.end(), std::begin(bootcode), std::end(bootcode));
349 astart = kBOOT_START+2;
360 os << bl << (text?text:
"--") <<
"Rw11CntlRL11 @ " <<
this << endl;
378 fRdma.
Dump(os, ind+2,
"fRdma: ", detail);
402 uint32_t addr = uint32_t(bae)<<16 | uint32_t(rlba);
408 uint32_t nwrd = (~uint32_t(wc)&0xffff) + 1;
412 throw Rexception(
"Rw11CntlRL11::AttnHandler",
"Bad state: ds > NUnit()");
418 uint32_t lba = unit.
Chs2Lba(ca,hs,sa);
425 ovr = sa + nblk > unit.
NSector();
431 static const char* fumnemo[8] = {
"no",
"wc",
"gs",
"se",
"rh",
"w ",
"r ",
"rn"};
432 lmsg <<
"-I " <<
Name() <<
":"
436 <<
" fu=" << fumnemo[fu&0x7]
443 if (nwrd==65536) lmsg <<
" (0)";
else lmsg <<
RosPrintf(nwrd,
"d",4);
444 if (ovr) lmsg <<
"!";
450 lmsg <<
"-E " <<
Name() <<
": err"
485 uint16_t buf[2] = {pos, 0};
486 uint16_t crc =
CalcCrc(2, buf);
498 if (san >= unit.
NSector()) san = 0;
510 lmsg <<
"-I " <<
Name() <<
":"
523 bool poserr = sa >= unit.
NSector();
527 poserr |= pos_ch != rlda_ch;
529 if (
true && poserr) {
590 if (nwcok != ndone) {
600 if (clist.
Size() > ncmd) {
601 uint8_t ccode = clist[ncmd].Command();
602 uint16_t cdata = clist[ncmd].Data();
604 throw Rexception(
"Rw11CntlRL11::RdmaPostExecCB",
605 "Bad state: Labo not found or missed abort");
606 if (cdata == 0)
return;
622 lmsg <<
"-E " <<
Name() <<
":"
623 <<
" err=" <<
RosPrintBvi(rlerr,2,5) <<
" ERROR ABORT";
672 lmsg <<
"-I " <<
Name() <<
": err"
695 uint16_t ba = addr & 0177776;
696 uint16_t bae = (addr>>16) & 03;
698 uint16_t da =
fRd_rlda+uint16_t(nblk);
700 uint16_t rlmp =
fRd_rlmp + uint16_t(ndone);
718 if (sa >= unit.
NSector()) sa = 0;
730 lmsg <<
"-I " <<
Name() << (rlerr==0 ?
": ok" :
": err")
735 if (rlerr) lmsg <<
" err=" <<
RosPrintBvi(rlerr,2,5);
752 for (
size_t i = 0; i < size; i++) {
753 uint32_t d = *data++;
755 for (
size_t j = 0; j < 16; j++) {
756 crc = (crc & ~01) | ((crc & 01) ^ (d & 01));
757 crc = (crc & 01) ? (crc >> 1) ^ 0120001 : crc >> 1;
size_t AddAttn()
FIXME_docs.
size_t Size() const
FIXME_docs.
size_t AddLabo()
FIXME_docs.
static const uint8_t kCmdLabo
command code list abort
void AddAttnHandler(attnhdl_t &&attnhdl, uint16_t mask, void *cdata=nullptr)
FIXME_docs.
void GetAttnInfo(AttnArgs &args, RlinkCommandList &clist)
FIXME_docs.
bool Exec(RlinkCommandList &clist, RerrMsg &emsg)
FIXME_docs.
I/O appicator to generate fill characters.
void Inc(size_t ind, double val=1.)
FIXME_docs.
void Define(size_t ind, const std::string &name, const std::string &text)
FIXME_docs.
Implemenation (inline) of Rw11CntlBase.
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
virtual size_t NUnit() const
FIXME_docs.
std::shared_ptr< Rw11UnitRL11 > fspUnit[NU]
static const uint16_t kMPREM_M_SEQ
uint16_t fRd_fu
Rdma: request fu code.
static const uint16_t kRLDA_SE_M_HS
static const uint16_t kMPLOC_STA
static const uint16_t kSTA_M_HO
uint16_t fRd_rlda
Rdma: request rlda.
static const bool kProbeRem
probr rem active
static const uint16_t kSTA_M_WL
static const uint16_t kMPREM_S_MP
bool fRd_ovr
Rdma: overrun condition found.
static const uint16_t kMPREM_SEQ_MPSTAPOS
~Rw11CntlRL11()
Destructor.
static const uint16_t kERR_HCRC
static const uint16_t kFUNC_READ
void RdmaPreExecCB(int stat, size_t nwdone, size_t nwnext, RlinkCommandList &clist)
FIXME_docs.
virtual bool BootCode(size_t unit, std::vector< uint16_t > &code, uint16_t &aload, uint16_t &astart)
FIXME_docs ????
size_t fPC_imp
PrimClist: imp index.
uint16_t fRd_rlcs
Rdma: request rlcs.
uint16_t fRd_rlmp
Rdma: request rlmp (~wc)
static const uint16_t kRLCS_M_CRDY
static const uint16_t kSTA_M_STO
void AddNormalExit(RlinkCommandList &clist, size_t ndone, uint16_t rlerr=0)
FIXME_docs.
static const uint16_t kRLDA_GS_X_VAL
static const uint16_t kRLDA_RW_B_CA
static const uint16_t kRLDA_SE_B_DF
Rw11RdmaDisk fRdma
Rdma controller.
static const uint16_t kRLCS_M_IE
static const uint16_t kIbaddr
RL11 default address.
static const uint16_t kMPREM_M_MAP
static const uint16_t kST_LOAD
static const int kLam
RL11 default lam.
static const uint16_t kRFUNC_WCS
static const uint16_t kERR_NXM
static const uint16_t kRLDA_RW_V_CA
size_t fPC_rlcs
PrimClist: rlcs index.
static const uint16_t kFUNC_WCHK
static const uint16_t kRLCS_M_BAE
static const uint16_t kRLCS_V_FUNC
static const uint16_t kProbeOff
probe address offset (rlcs)
uint16_t CalcCrc(size_t size, const uint16_t *data)
FIXME_docs.
static const uint16_t kMPREM_CRC
void LogRler(uint16_t rlerr)
FIXME_docs ????
static const uint16_t kRLCS_B_MPLOC
size_t fPC_pos
PrimClist: pos index.
void AddSetPosition(RlinkCommandList &clist, size_t ind, uint16_t pos)
FIXME_docs.
uint32_t fRd_addr
Rdma: current addr.
static const uint16_t kST_BRUSH
static const uint16_t kRLCS_ENA_MPLOC
static const uint16_t kRLDA_GS_X_MSK
static const uint16_t kMPREM_S_STA
void RdmaPostExecCB(int stat, size_t ndone, RlinkCommandList &clist, size_t ncmd)
FIXME_docs.
static const uint16_t kMPREM_S_POS
int AttnHandler(RlinkServer::AttnArgs &args)
FIXME_docs.
static const uint16_t kRLDA
RLDA reg offset.
static const uint16_t kSTA_M_HS
uint32_t fRd_lba
Rdma: current lba.
static const uint16_t kMPLOC_ZERO
static const uint16_t kRLDA_SE_M_DIR
size_t fPC_sta
PrimClist: sta index.
static const uint16_t kMPLOC_CRC
static const uint16_t kERR_WCHK
static const uint16_t kRLCS_ENA_MPREM
static const uint16_t kRLDA_RW_M_CA
void Config(const std::string &name, uint16_t base, int lam)
FIXME_docs.
void AddSetStatus(RlinkCommandList &clist, size_t ind, uint16_t sta)
FIXME_docs.
static const uint16_t kRLDA_RW_B_HS
static const uint16_t kRLBA
RLBA reg offset.
static const uint16_t kRLCS_M_DE
static const uint16_t kRLDA_SE_M_DF
static const uint16_t kST_SEEK
static const uint16_t kRLCS_B_E
static const uint16_t kSTA_M_VCE
static const bool kProbeInt
probe int active
static const uint16_t kSTA_M_CHE
uint16_t fRd_pos
Rdma: initial drive position.
static const uint16_t kFUNC_WRITE
static const uint16_t kSTA_M_DSE
static const uint16_t kERR_HNFND
static const uint16_t kST_DOWN
static const uint16_t kRLCS
RLCS reg offset.
static const uint16_t kFUNC_RNHC
static const uint16_t kRLCS_V_DS
static const uint16_t kERR_OPI
size_t fPC_rlba
PrimClist: rlba index.
static const uint16_t kRLCS_M_ERR
static const uint16_t kFUNC_RHDR
static const uint16_t kSTA_M_WDE
static const uint16_t kRLDA_SE_V_DF
static const uint16_t kRLDA_SE_X_MSK
Rw11CntlRL11()
Default constructor.
static const uint16_t kST_HLOAD
static const uint16_t kERR_M_DE
size_t fPC_wc
PrimClist: wc index.
static const uint16_t kRLDA_RW_V_HS
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
static const uint16_t kMPLOC_POS
static const uint16_t kSTA_B_ST
size_t fPC_rlda
PrimClist: rlda index.
static const uint16_t kSTA_M_WGE
static const uint16_t kMPLOC_MP
static const uint16_t kRLDA_GS_M_RST
static const uint16_t kSTA_M_SPE
static const uint16_t kRLCS_M_DRDY
static const uint16_t kRLCS_B_BAE
static const uint16_t kRLCS_B_FUNC
static const uint16_t kMPREM_POS
static const uint16_t kRLCS_V_MPREM
uint16_t fRd_sta
Rdma: initial drive status.
static const uint16_t kFUNC_GS
static const uint16_t kRLCS_V_BAE
static const uint16_t kRFUNC_WMP
static const uint16_t kMPREM_MP
static const uint16_t kRLDA_RW_B_SA
virtual void Start()
FIXME_docs.
static const uint16_t kRLCS_V_E
static const uint16_t kFUNC_SEEK
static const uint16_t kFUNC_NOOP
void AddErrorExit(RlinkCommandList &clist, uint16_t rlerr)
FIXME_docs.
static const uint16_t kRLDA_SE_X_VAL
static const uint16_t kST_LOCK
static const uint16_t kST_UNL
static const uint16_t kSTA_M_DT
static const uint16_t kST_SPIN
static const uint16_t kRLMP
RLMP reg offset.
static const uint16_t kRLCS_V_MPLOC
static const uint16_t kMPREM_STA
uint32_t fRd_nwrd
Rdma: current nwrd.
static const uint16_t kSTA_M_BH
virtual void UnitSetup(size_t ind)
FIXME_docs.
static const uint16_t kRLCS_B_MPREM
static const uint16_t kRLDA_RW_M_HS
static const uint16_t kERR_DLATE
static const uint16_t kRLCS_B_DS
static const uint16_t kSTA_M_CO
int fLam
attn bit number (-1 of none)
uint32_t fTraceLevel
trace level; 0=off;1=cntl
RlinkCommandList fPrimClist
clist for attn primary info
uint16_t Base() const
FIXME_docs.
Rw11Probe fProbe
controller probe context
Rw11Cpu & Cpu() const
FIXME_docs.
void ConfigCntl(const std::string &name, uint16_t base, int lam, uint16_t probeoff, bool probeint, bool proberem)
FIXME_docs.
bool fStarted
true if Start() called
RlinkServer & Server() const
FIXME_docs.
const std::string & Name() const
FIXME_docs.
RlogFile & LogFile() const
FIXME_docs.
virtual void UnitSetupAll()
FIXME_docs.
uint16_t fBase
controller base address
void AllIAddrMapInsert(const std::string &name, uint16_t ibaddr)
FIXME_docs.
int AddWibr(RlinkCommandList &clist, uint16_t ibaddr, uint16_t data)
FIXME_docs.
int AddRibr(RlinkCommandList &clist, uint16_t ibaddr)
FIXME_docs.
static const uint16_t kCPAH_M_UBM22
ubmap+22bit
void QueueDiskWrite(uint32_t addr, size_t size, uint16_t mode, uint32_t lba, Rw11UnitDisk *punit)
FIXME_docs.
void QueueDiskWriteCheck(uint32_t addr, size_t size, uint16_t mode, uint32_t lba, Rw11UnitDisk *punit)
FIXME_docs.
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
size_t WriteCheck(size_t nwdone)
FIXME_docs.
void QueueDiskRead(uint32_t addr, size_t size, uint16_t mode, uint32_t lba, Rw11UnitDisk *punit)
FIXME_docs.
bool IsActive() const
FIXME_docs.
@ kStatusBusyLast
last chunk to come
@ kStatusFailRdma
last rdma transfer failed
@ kStatusBusy
more chunks to come
bool WProt() const
FIXME_docs.
const std::string & Type() const
FIXME_docs.
uint32_t Chs2Lba(uint16_t cy, uint16_t hd, uint16_t se)
FIXME_docs.
size_t NSector() const
FIXME_docs.
size_t BlockSize() const
FIXME_docs.
uint32_t Nwrd2Nblk(uint32_t nwrd)
FIXME_docs.
void SetRlsta(uint16_t rlsta)
FIXME_docs.
bool HasVirt() const
FIXME_docs.
RosPrintfS< bool > RosPrintf(bool value, const char *form=0, int width=0, int prec=0)
Creates a print object for the formatted output of a bool value.
Declaration of class ReventLoop.
bool Found() const
FIXME_docs.