mirror of
https://github.com/mudita/MuditaOS.git
synced 2025-12-30 17:38:05 -05:00
Refactor audio data path to fix several synchronization issues and excessive copy operations on large memory blocks. Introduce audio::Stream data structure to allow connecting audio source and sink with a zero-copy capability. Introduce system mechanisms: - critical section guard lock needed for stream synchronization - non-cacheable memory allocator to allocate memory for DMA safe buffers Update the Googletest CMake template to match the capabilities of the Catch2 template. Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com> Signed-off-by: Hubert Chrzaniuk <hubert.chrzaniuk@mudita.com>
35 lines
660 B
C++
35 lines
660 B
C++
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "CriticalSectionGuard.hpp"
|
|
|
|
#include <macros.h>
|
|
|
|
extern "C"
|
|
{
|
|
#include <FreeRTOS.h>
|
|
#include <portmacro.h>
|
|
}
|
|
|
|
using namespace cpp_freertos;
|
|
|
|
CriticalSectionGuard::CriticalSectionGuard()
|
|
{
|
|
if (isIRQ()) {
|
|
savedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
|
}
|
|
else {
|
|
vPortEnterCritical();
|
|
}
|
|
}
|
|
|
|
CriticalSectionGuard::~CriticalSectionGuard()
|
|
{
|
|
if (isIRQ()) {
|
|
portCLEAR_INTERRUPT_MASK_FROM_ISR(savedInterruptStatus);
|
|
}
|
|
else {
|
|
vPortExitCritical();
|
|
}
|
|
}
|