ptme access wip

This commit is contained in:
Jakob Meier 2021-05-17 13:47:10 +02:00
parent fbad470836
commit 9c0045dbd9
2 changed files with 31 additions and 1 deletions

View File

@ -56,6 +56,7 @@ ReturnValue_t CCSDSIPCoreBridge::handleTm() {
ReturnValue_t CCSDSIPCoreBridge::sendTm(const uint8_t * data, size_t dataLen) {
if(pollPapbSignal() == RETURN_OK) {
ptmeBufferEmpty();
startPacketTransfer();
}
@ -72,6 +73,7 @@ ReturnValue_t CCSDSIPCoreBridge::sendTm(const uint8_t * data, size_t dataLen) {
}
if(pollPapbSignal() == RETURN_OK) {
ptmeBufferEmpty();
endPacketTransfer();
}
return RETURN_OK;
@ -103,3 +105,24 @@ ReturnValue_t CCSDSIPCoreBridge::pollPapbSignal() {
return RETURN_OK;
}
void CCSDSIPCoreBridge::ptmeBufferEmpty() {
ReturnValue_t result = RETURN_OK;
int papbEmptyState = 1;
result = gpioComIF->readGpio(papbEmptyId, &papbEmptyState);
if (result != RETURN_OK) {
sif::debug << "CCSDSIPCoreBridge::ptmeBufferEmpty: Failed to read papb empty signal"
<< std::endl;
return;
}
if (papbEmptyState == 1) {
sif::debug << "CCSDSIPCoreBridge::ptmeBufferEmpty: Buffer is empty" << std::endl;
}
else {
sif::debug << "CCSDSIPCoreBridge::ptmeBufferEmpty: Buffer is not empty" << std::endl;
}
return;
}

View File

@ -53,7 +53,8 @@ private:
/** Size of mapped address space. 4k (minimal size of pl device) */
static const int MAP_SIZE = 0xFA0;
// static const int MAP_SIZE = 0xFA0;
static const int MAP_SIZE = 0x1000;
/**
* Configuration bits:
@ -111,6 +112,12 @@ private:
* @return RETURN_OK when ready to receive data else PAPB_BUSY.
*/
ReturnValue_t pollPapbSignal();
/**
* @brief This function can be used for debugging to check wheter there are packets in
* the packet buffer of the PTME or not.
*/
void ptmeBufferEmpty();
};
#endif /* MISSION_OBC_CCSDSIPCOREBRIDGE_H_ */