#ifndef _Dma_H_
#define _Dma_H_
//----------------------------------------------------------------------------
///
/// \brief  Dma
///
///         See implementation files for further information.
//
/// \date   20150117
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


//---Includes-----------------------------------------------------------------


//---Own------------------------------

#include <biwak/biwak.h>
#include <biwak/gpio.hpp>


//---Defines------------------------------------------------------------------


#if defined (MCU_PLATFORM_STM32)
   #define DMA_HANDLE_TYPE    DMA_HandleTypeDef
   #define DMA_TYPE           DMA_TypeDef
   #include <HALWrapper/stm32_dma.h>
#else
   #define DMA_HANDLE_TYPE    void
   #define DMA_TYPE           void
#endif



//---Declaration--------------------------------------------------------------


enum EDma
{
   eDma1
};

enum EDmaChannel
{
   eDma1Channel1,
   eDma1Channel2,
   eDma1Channel3,
   eDma1Channel4,
   eDma1Channel5,
   eDma1Channel6,
   eDma1Channel7,

   eDma1ChannelMax,
};

class CDmaChannel;

struct SDmaConfig
{

};

class CDma
{
   friend class CDmaChannel;

   private:
      DMA_TYPE *m_dma;

   public:

      CDma( const SDmaConfig &dmaConfig );
      void init();
};

class CDmaChannel
{

   private:
      DMA_HANDLE_TYPE *m_pHandler;
      EDmaChannel eDmaChannel;
      CDma &m_dma;

   public:
      CDmaChannel( EDmaChannel _eDmaChannel, CDma &dma);
      void init();
      ~CDmaChannel();

      DMA_HANDLE_TYPE *getDmaHandler()
      {
         return(m_pHandler);
      }
      void restart();
      EDmaChannel channel(){return(eDmaChannel);};

};


//---fin----------------------------------------------------------------------
#endif // ? ! _Dma_H_
