~aleteoryx/muditaos

ref: c1391090c67428aeaffcef5a7a71a6d2ed69ccc9 muditaos/module-bsp/board/rt1051/common/audio.hpp -rw-r--r-- 871 bytes
c1391090 — Mateusz Piesta [BH-1389] Catch2 unit tests optimization 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "drivers/pll/DriverPLL.hpp"
#include "drivers/dmamux/DriverDMAMux.hpp"
#include "drivers/dma/DriverDMA.hpp"

#include "fsl_sai_edma.h"

#include <memory>
#include <cstdint>

namespace bsp::audio
{
    void init(std::uint32_t sampleRate);
    void deinit();

    struct AudioConfig
    {
        sai_config_t config;
        std::uint32_t mclkSourceClockHz;

        std::shared_ptr<drivers::DriverPLL> pllAudio;
        std::shared_ptr<drivers::DriverDMAMux> dmamux;
        std::shared_ptr<drivers::DriverDMA> dma;
        std::unique_ptr<drivers::DriverDMAHandle> rxDMAHandle;
        std::unique_ptr<drivers::DriverDMAHandle> txDMAHandle;

        static AudioConfig *get();
    };
}; // namespace bsp::audio