meier/ptme #129
@ -10,29 +10,10 @@ Ptme::Ptme(object_id_t objectId) : SystemObject(objectId) {}
|
|||||||
Ptme::~Ptme() {}
|
Ptme::~Ptme() {}
|
||||||
|
|
||||||
ReturnValue_t Ptme::initialize() {
|
ReturnValue_t Ptme::initialize() {
|
||||||
int fd = open(PtmeConfig::UIO_DEVICE_FILE, O_RDWR);
|
|
||||||
if (fd < 1) {
|
|
||||||
sif::warning << "Ptme::initialize: Invalid UIO device file" << std::endl;
|
|
||||||
return RETURN_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Map uio device in virtual address space
|
|
||||||
* PROT_WRITE: Map uio device in writable only mode
|
|
||||||
*/
|
|
||||||
ptmeBaseAddress = static_cast<uint32_t*>(mmap(NULL, MAP_SIZE, PROT_WRITE, MAP_SHARED, fd,
|
|
||||||
0 * getpagesize()));
|
|
||||||
|
|
||||||
if (ptmeBaseAddress == MAP_FAILED) {
|
|
||||||
sif::error << "Ptme::initialize: Failed to map uio address" << std::endl;
|
|
||||||
return RETURN_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
VcInterfaceMapIter iter;
|
VcInterfaceMapIter iter;
|
||||||
for (iter = vcInterfaceMap.begin(); iter != vcInterfaceMap.end(); iter++) {
|
for (iter = vcInterfaceMap.begin(); iter != vcInterfaceMap.end(); iter++) {
|
||||||
iter->second->initialize();
|
iter->second->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,14 +44,6 @@ class Ptme : public PtmeIF, public SystemObject, public HasReturnvaluesIF {
|
|||||||
|
|
||||||
static const ReturnValue_t UNKNOWN_VC_ID = MAKE_RETURN_CODE(0xA0);
|
static const ReturnValue_t UNKNOWN_VC_ID = MAKE_RETURN_CODE(0xA0);
|
||||||
|
|
||||||
#if BOARD_TE0720 == 1
|
|
||||||
/** Size of mapped address space */
|
|
||||||
static const int MAP_SIZE = 0x40000;
|
|
||||||
#else
|
|
||||||
/** Size of mapped address space */
|
|
||||||
static const int MAP_SIZE = 0x1000;
|
|
||||||
#endif /* BOARD_TE0720 == 1 */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration bits:
|
* Configuration bits:
|
||||||
* bit[1:0]: Size of data (1,2,3 or 4 bytes). 1 Byte <=> b00
|
* bit[1:0]: Size of data (1,2,3 or 4 bytes). 1 Byte <=> b00
|
||||||
|
Loading…
Reference in New Issue
Block a user