Bitstream Interpretation Library (BIL)
0.1
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
packetprocessor
V5CMDRegister.cpp
Go to the documentation of this file.
1
6
#include <
exception/Exception.hpp
>
7
#include <
packetprocessor/V5CMDRegister.hpp
>
8
#include <
packetprocessor/V5CRCRegister.hpp
>
9
#include <
packetprocessor/V5RegisterAddress.hpp
>
10
11
using namespace
bil;
12
13
14
V5CMDRegister::V5CMDRegister
(
V5CRCRegister
& crcReg):
15
Register
(V5RegisterAddress::
CMD
, V5RegisterAddress::
CMD_STRING
, true, true),
16
m_command(V5CommandCode::
NULLCMD
),
17
m_crcReg(crcReg)
18
{
19
20
}
21
22
23
void
V5CMDRegister::write
(
const
boost::uint32_t* words,
size_t
wordCount)
24
{
25
Register::write
(words, wordCount);
26
27
// word count has to be 1
28
if
(1 != wordCount)
throw
Exception
();
29
// set command and execute
30
commandCode
(*words);
31
execute
();
32
}
33
34
35
void
V5CMDRegister::read
(boost::uint32_t* words,
size_t
wordCount)
const
36
{
37
Register::read
(words, wordCount);
38
39
// word count has to be 1
40
if
(1 != wordCount)
throw
Exception
();
41
// return current command code
42
*words = m_command;
43
}
44
45
46
void
V5CMDRegister::commandCode
(
V5CommandCode::command_t
code)
47
{
48
// ensure that only valid command codes are loaded into register
49
switch
(code) {
50
case
V5CommandCode::NULLCMD
:
51
case
V5CommandCode::WCFG
:
52
case
V5CommandCode::MFW
:
53
case
V5CommandCode::LFRM
:
54
case
V5CommandCode::RCFG
:
55
case
V5CommandCode::START
:
56
case
V5CommandCode::RCAP
:
57
case
V5CommandCode::RCRC
:
58
case
V5CommandCode::AGHIGH
:
59
case
V5CommandCode::SWITCH
:
60
case
V5CommandCode::GRESTORE
:
61
case
V5CommandCode::SHUTDOWN
:
62
case
V5CommandCode::GCAPTURE
:
63
case
V5CommandCode::DESYNCH
:
64
case
V5CommandCode::IPROG
:
65
case
V5CommandCode::CRCC
:
66
case
V5CommandCode::LTIMER
: m_command = code;
break
;
67
default
:
throw
Exception
();
68
}
69
}
70
71
72
V5CommandCode::command_t
V5CMDRegister::commandCode
()
const
73
{
74
return
m_command;
75
}
76
77
78
void
V5CMDRegister::execute
()
const
79
{
80
// only implemented command code at the moment is RCRC
81
if
(
V5CommandCode::RCRC
== m_command) m_crcReg.
reset
();
82
}
83
84
85
V5CRCRegister
&
V5CMDRegister::crcRegister
()
const
86
{
87
return
m_crcReg;
88
}
Generated on Wed Aug 8 2012 21:57:40 for Bitstream Interpretation Library (BIL) by
1.8.1.1