Adding Code for Linux

This commit is contained in:
2018-07-13 18:28:26 +02:00
parent db1f93a155
commit fd782b20c0
90 changed files with 2411 additions and 1497 deletions

View File

@ -21,16 +21,16 @@ MessageQueue::~MessageQueue() {
ReturnValue_t MessageQueue::sendMessage(MessageQueueId_t sendTo,
MessageQueueMessage* message, bool ignoreFault) {
return sendMessage(sendTo, message, this->getId(), ignoreFault);
return sendMessageFrom(sendTo, message, this->getId(), ignoreFault);
}
ReturnValue_t MessageQueue::sendToDefault(MessageQueueMessage* message) {
return sendToDefault(message, this->getId());
return sendToDefaultFrom(message, this->getId());
}
ReturnValue_t MessageQueue::reply(MessageQueueMessage* message) {
if (this->lastPartner != 0) {
return sendMessage(this->lastPartner, message, this->getId());
return sendMessageFrom(this->lastPartner, message, this->getId());
} else {
//TODO: Good returnCode
return HasReturnvaluesIF::RETURN_FAILED;
@ -49,8 +49,7 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessage* message) {
if (result == pdPASS){
return HasReturnvaluesIF::RETURN_OK;
} else {
//TODO Queue Empty
return HasReturnvaluesIF::RETURN_FAILED;
return MessageQueueIF::EMPTY;
}
}
@ -73,7 +72,7 @@ void MessageQueue::setDefaultDestination(MessageQueueId_t defaultDestination) {
this->defaultDestination = defaultDestination;
}
ReturnValue_t MessageQueue::sendMessage(MessageQueueId_t sendTo,
ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo,
MessageQueueMessage* message, MessageQueueId_t sentFrom,
bool ignoreFault) {
message->setSender(sentFrom);
@ -83,15 +82,14 @@ ReturnValue_t MessageQueue::sendMessage(MessageQueueId_t sendTo,
if (!ignoreFault) {
//TODO errr reporter
}
//TODO queue is full
return HasReturnvaluesIF::RETURN_FAILED;
return MessageQueueIF::FULL;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t MessageQueue::sendToDefault(MessageQueueMessage* message,
ReturnValue_t MessageQueue::sendToDefaultFrom(MessageQueueMessage* message,
MessageQueueId_t sentFrom, bool ignoreFault) {
return 0;
return sendMessageFrom(defaultDestination,message,sentFrom,ignoreFault);
}
MessageQueueId_t MessageQueue::getDefaultDestination() const {

View File

@ -117,7 +117,7 @@ public:
* This variable is set to zero by default.
* \param ignoreFault If set to true, the internal software fault counter is not incremented if queue is full.
*/
virtual ReturnValue_t sendMessage( MessageQueueId_t sendTo, MessageQueueMessage* message, MessageQueueId_t sentFrom = NO_QUEUE, bool ignoreFault = false );
virtual ReturnValue_t sendMessageFrom( MessageQueueId_t sendTo, MessageQueueMessage* message, MessageQueueId_t sentFrom = NO_QUEUE, bool ignoreFault = false );
/**
* \brief The sendToDefault method sends a queue message to the default destination.
* \details In all other aspects, it works identical to the sendMessage method.
@ -125,7 +125,7 @@ public:
* \param sentFrom The sentFrom information can be set to inject the sender's queue id into the message.
* This variable is set to zero by default.
*/
virtual ReturnValue_t sendToDefault( MessageQueueMessage* message, MessageQueueId_t sentFrom = NO_QUEUE, bool ignoreFault = false );
virtual ReturnValue_t sendToDefaultFrom( MessageQueueMessage* message, MessageQueueId_t sentFrom = NO_QUEUE, bool ignoreFault = false );
/**
* \brief This method is a simple setter for the default destination.
*/

View File

@ -1,31 +1,32 @@
//entry point into "bsp"
void init(void);
#include <FreeRTOS.h>
#include <FreeRTOSConfig.h>
#include "task.h"
void initTask(void *parameters) {
init();
}
int main(void) {
if ( pdPASS
!= xTaskCreate(initTask, "init", 512, NULL,
configMAX_PRIORITIES - 1, NULL)) {
//print_uart0("Could not create task1\r\n");
}
vTaskStartScheduler();
//Scheduler should never return
//print_uart0("This is bad\n");
for (;;)
;
return 0;
}
//TODO This can be done mission dependent and some low level calls before vTaskStartScheduler might be important
//void init(void);
//
//#include <FreeRTOS.h>
//#include <FreeRTOSConfig.h>
//#include "task.h"
//
//
//void initTask(void *parameters) {
// init();
//}
//
//int main(void) {
//
// if ( pdPASS
// != xTaskCreate(initTask, "init", 512, NULL,
// configMAX_PRIORITIES - 1, NULL)) {
// //print_uart0("Could not create task1\r\n");
// }
//
// vTaskStartScheduler();
//
// //Scheduler should never return
//
// //print_uart0("This is bad\n");
//
// for (;;)
// ;
//
// return 0;
//}