Bitstream Interpretation Library (BIL)
0.1
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
packetprocessor
V5IDCODERegister.cpp
Go to the documentation of this file.
1
6
#include <
configuration/V5AddressLayoutRegistry.hpp
>
7
#include <
exception/Exception.hpp
>
8
#include <
packetprocessor/V5FDRIRegister.hpp
>
9
#include <
packetprocessor/V5IDCODERegister.hpp
>
10
#include <
packetprocessor/V5RegisterAddress.hpp
>
11
12
using namespace
bil;
13
14
15
V5IDCODERegister::V5IDCODERegister
(
V5FDRIRegister
& fdriReg,
const
V5AddressLayoutRegistry
& registry):
16
Register
(V5RegisterAddress::
IDCODE
, V5RegisterAddress::
IDCODE_STRING
, true, true),
17
m_idCode(),
18
m_fdriRegister(fdriReg),
19
m_addressLayoutRegistry(registry)
20
{
21
22
}
23
24
25
void
V5IDCODERegister::write
(
const
boost::uint32_t* words,
size_t
wordCount)
26
{
27
Register::write
(words, wordCount);
28
29
// word count has to be 1
30
if
(1 != wordCount)
throw
Exception
();
31
// set command and execute
32
idCode
(*words);
33
}
34
35
36
void
V5IDCODERegister::read
(boost::uint32_t* words,
size_t
wordCount)
const
37
{
38
Register::read
(words, wordCount);
39
40
// word count has to be 1
41
if
(1 != wordCount)
throw
Exception
();
42
// return current ID code
43
*words = m_idCode;
44
}
45
46
47
void
V5IDCODERegister::idCode
(
DeviceID::ID_t
id
)
48
{
49
// lookup address layout for that id
50
const
V5AddressLayout
* layout = m_addressLayoutRegistry.
lookup
(
id
);
51
if
(0 == layout)
throw
Exception
();
52
53
// copy address layout to FDRI
54
V5Configuration
& configuration = m_fdriRegister.
configuration
();
55
configuration.
addressLayout
(*layout);
56
57
// store new id code
58
m_idCode = id;
59
}
60
61
62
DeviceID::ID_t
V5IDCODERegister::idCode
()
const
63
{
64
return
m_idCode;
65
}
66
67
68
V5FDRIRegister
&
V5IDCODERegister::fdriRegister
()
const
69
{
70
return
m_fdriRegister;
71
}
72
73
74
const
V5AddressLayoutRegistry
&
V5IDCODERegister::layoutRegistry
()
const
75
{
76
return
m_addressLayoutRegistry;
77
}
Generated on Wed Aug 8 2012 21:57:40 for Bitstream Interpretation Library (BIL) by
1.8.1.1