Update framework #6

Merged
meierj merged 67 commits from mueller/master into eive/develop 2021-07-23 18:26:40 +02:00
9 changed files with 70 additions and 10 deletions
Showing only changes of commit a65a184083 - Show all commits

View File

@ -3,10 +3,10 @@
#include "spiDefinitions.h"
#include "returnvalues/classIds.h"
#include "../../common/gpio/GpioIF.h"
#include "fsfw/hal/common/gpio/GpioIF.h"
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include "fsfw/devicehandlers/DeviceCommunicationIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include <vector>
#include <unordered_map>

View File

@ -5,7 +5,6 @@
#include "fsfw/devicehandlers/DeviceCommunicationIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/osal/freertos/BinarySemaphore.h"
#include "fsfw/hal/stm32h7/spi/spiDefinitions.h"
#include "stm32h7xx_hal_spi.h"
#include "stm32h743xx.h"
@ -14,6 +13,7 @@
#include <map>
class SpiCookie;
class BinarySemaphore;
/**
* @brief This communication interface allows using generic device handlers with using

View File

@ -9,7 +9,6 @@
#include "fsfw/tasks/TaskFactory.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "stm32h7xx_nucleo.h"
#include "stm32h7xx_hal_spi.h"
#include "stm32h7xx_hal_rcc.h"

View File

@ -2,12 +2,21 @@
#include "fsfw/hal/stm32h7/spi/SpiCookie.h"
#include "fsfw/tasks/SemaphoreFactory.h"
#include "fsfw/osal/freertos/TaskManagement.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiInterrupts.h"
#include "fsfw/hal/stm32h7/spi/mspInit.h"
#include "fsfw/hal/stm32h7/gpio/gpio.h"
// FreeRTOS required special Semaphore handling from an ISR. Therefore, we use the concrete
// instance here, because RTEMS and FreeRTOS are the only relevant OSALs currently
// and it is not trivial to add a releaseFromISR to the SemaphoreIF
#if defined FSFW_OSAL_RTEMS
#include "fsfw/osal/rtems/BinarySemaphore.h"
#elif defined FSFW_OSAL_FREERTOS
#include "fsfw/osal/freertos/TaskManagement.h"
#include "fsfw/osal/freertos/BinarySemaphore.h"
#endif
#include "stm32h7xx_hal_gpio.h"
SpiComIF::SpiComIF(object_id_t objectId): SystemObject(objectId) {
@ -421,10 +430,14 @@ void SpiComIF::genericIrqHandler(void *irqArgsVoid, spi::TransferStates targetSt
HAL_GPIO_WritePin(spiCookie->getChipSelectGpioPort(), spiCookie->getChipSelectGpioPin(),
GPIO_PIN_SET);
#if defined FSFW_OSAL_FREERTOS
// Release the task semaphore
BaseType_t taskWoken = pdFALSE;
ReturnValue_t result = BinarySemaphore::releaseFromISR(comIF->spiSemaphore->getSemaphore(),
&taskWoken);
#elif defined FSFW_OSAL_RTEMS
ReturnValue_t result = comIF->spiSemaphore->release();
#endif
if(result != HasReturnvaluesIF::RETURN_OK) {
// Configuration error
printf("SpiComIF::genericIrqHandler: Failure releasing Semaphore!\n");
@ -436,11 +449,13 @@ void SpiComIF::genericIrqHandler(void *irqArgsVoid, spi::TransferStates targetSt
SCB_InvalidateDCache_by_Addr ((uint32_t *) comIF->currentRecvPtr,
comIF->currentRecvBuffSize);
}
#if defined FSFW_OSAL_FREERTOS
/* Request a context switch if the SPI ComIF task was woken up and has a higher priority
than the currently running task */
if(taskWoken == pdTRUE) {
TaskManagement::requestContextSwitch(CallContext::ISR);
}
#endif
}
void SpiComIF::printCfgError(const char *const type) {

View File

@ -98,7 +98,7 @@ public:
* already available.
*/
static ReturnValue_t releaseFromISR(SemaphoreHandle_t semaphore,
BaseType_t * higherPriorityTaskWoken);
BaseType_t * higherPriorityTaskWoken) override;
protected:
SemaphoreHandle_t handle;

View File

@ -0,0 +1,21 @@
#ifndef FSFW_INC_FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_
#define FSFW_INC_FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_
#include "fsfw/tasks/SemaphoreIF.h"
class BinarySemaphore: public SemaphoreIF {
public:
BinarySemaphore();
virtual ~BinarySemaphore();
// Interface implementation
ReturnValue_t acquire(TimeoutType timeoutType =
TimeoutType::BLOCKING, uint32_t timeoutMs = 0) override;
ReturnValue_t release() override;
uint8_t getSemaphoreCounter() const override;
private:
};
#endif /* FSFW_INC_FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ */

View File

@ -1,9 +1,9 @@
#ifndef FSFW_OSAL_RTEMS_MESSAGEQUEUE_H_
#define FSFW_OSAL_RTEMS_MESSAGEQUEUE_H_
#include "../../internalError/InternalErrorReporterIF.h"
#include "../../ipc/MessageQueueIF.h"
#include "../../ipc/MessageQueueMessage.h"
#include "fsfw/internalerror/InternalErrorReporterIF.h"
#include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/ipc/MessageQueueMessage.h"
#include "RtemsBasic.h"
/**

View File

@ -0,0 +1,24 @@
#include "fsfw/osal/rtems/BinarySemaphore.h"
#include <rtems/rtems/sem.h>
BinarySemaphore::BinarySemaphore() {
}
BinarySemaphore::~BinarySemaphore() {
}
// Interface implementation
ReturnValue_t BinarySemaphore::acquire(TimeoutType timeoutType, uint32_t timeoutMs) {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t BinarySemaphore::release() {
return HasReturnvaluesIF::RETURN_OK;
}
uint8_t BinarySemaphore::getSemaphoreCounter() const {
return 0;
}

View File

@ -13,6 +13,7 @@ target_sources(${LIB_FSFW_NAME}
RtemsBasic.cpp
RTEMSTaskBase.cpp
TaskFactory.cpp
BinarySemaphore.cpp
)