Stub DMA driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14190 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
bee30522c4
commit
ecd271056a
|
@ -0,0 +1,2 @@
|
|||
PLATFORMSRC += $(CHIBIOS)/os/hal/ports/RP/LLD/DMAv1/rp_dma.c
|
||||
PLATFORMINC += $(CHIBIOS)/os/hal/ports/RP/LLD/DMAv1
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file DMAv1/rp_dma.c
|
||||
* @brief DMA helper driver code.
|
||||
*
|
||||
* @addtogroup RP_DMA
|
||||
* @details DMA sharing helper driver. In RP2 the DMA channels are a
|
||||
* shared resource, this driver allows to allocate and free DMA
|
||||
* channels at runtime in order to allow all the other device
|
||||
* drivers to coordinate the access to the resource.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "hal.h"
|
||||
|
||||
/* The following macro is only defined if some driver requiring DMA services
|
||||
has been enabled.*/
|
||||
#if defined(RP_DMA_REQUIRED) || defined(__DOXYGEN__)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local variables and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief DMA helper initialization.
|
||||
*
|
||||
* @init
|
||||
*/
|
||||
void dmaInit(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Allocates a DMA channel.
|
||||
*
|
||||
* @param[in] id numeric identifiers of a specific channel or:
|
||||
* - @p RP_DMA_CHANNEL_ID_ANY for any channel.
|
||||
* .
|
||||
* @param[in] func handling function pointer, can be @p NULL
|
||||
* @param[in] param a parameter to be passed to the handling function
|
||||
* @return Pointer to the allocated @p rp_dma_channel_t
|
||||
* structure.
|
||||
* @retval NULL if a/the channel is not available.
|
||||
*
|
||||
* @iclass
|
||||
*/
|
||||
const rp_dma_channel_t *dmaStreamAllocI(uint32_t id,
|
||||
rp_dmaisr_t func,
|
||||
void *param) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Allocates a DMA channel.
|
||||
* @details The channel is allocated and, if required, the DMA clock enabled.
|
||||
* The function also enables the IRQ vector associated to the channel
|
||||
* and initializes its priority.
|
||||
*
|
||||
* @param[in] id numeric identifiers of a specific channel or:
|
||||
* - @p RP_DMA_CHANNEL_ID_ANY for any channel.
|
||||
* .
|
||||
* @param[in] func handling function pointer, can be @p NULL
|
||||
* @param[in] param a parameter to be passed to the handling function
|
||||
* @return Pointer to the allocated @p rp_dma_channel_t
|
||||
* structure.
|
||||
* @retval NULL if a/the channel is not available.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
const rp_dma_channel_t *dmaStreamAlloc(uint32_t id,
|
||||
uint32_t priority,
|
||||
rp_dmaisr_t func,
|
||||
void *param) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Releases a DMA channel.
|
||||
*
|
||||
* @param[in] dmachp pointer to a rp_dma_channel_t structure
|
||||
*
|
||||
* @iclass
|
||||
*/
|
||||
void dmaStreamFreeI(const rp_dma_channel_t *dmachp) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Releases a DMA channel.
|
||||
*
|
||||
* @param[in] dmachp pointer to a rp_dma_channel_t structure
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
void dmaStreamFree(const rp_dma_channel_t *dmachp) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Serves a DMA IRQ.
|
||||
*
|
||||
* @param[in] dmachp pointer to a rp_dma_channel_t structure
|
||||
*
|
||||
* @special
|
||||
*/
|
||||
void dmaServeInterrupt(const rp_dma_channel_t *dmachp) {
|
||||
}
|
||||
|
||||
#endif /* RP_DMA_REQUIRED */
|
||||
|
||||
/** @} */
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file DMAv1/rp_dma.h
|
||||
* @brief DMA helper driver header.
|
||||
*
|
||||
* @addtogroup RP_DMA
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef RP_DMA_H
|
||||
#define RP_DMA_H
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Total number of DMA channels.
|
||||
*/
|
||||
#define RP_DMA_CHANNELS 12U
|
||||
|
||||
/**
|
||||
* @brief Checks if a DMA channels id is within the valid range.
|
||||
*
|
||||
* @param[in] id DMA channels id
|
||||
* @retval The check result.
|
||||
* @retval false invalid DMA channel.
|
||||
* @retval true correct DMA channel.
|
||||
*/
|
||||
#define RP_DMA_IS_VALID_CHANNEL(chn) (((chn) >= 0U) && \
|
||||
((id) <= (RP_DMA_CHANNELS + 1U)))
|
||||
|
||||
/**
|
||||
* @name Special stream identifiers
|
||||
* @{
|
||||
*/
|
||||
#define RP_DMA_STREAM_ID_ANY RP_DMA_CHANNELS
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Type of a DMA callback.
|
||||
*
|
||||
* @param[in] p parameter for the registered function
|
||||
* @param[in] flags pre-shifted content of the ISR register, the bits
|
||||
* are aligned to bit zero
|
||||
*/
|
||||
typedef void (*rp_dmaisr_t)(void *p, uint32_t flags);
|
||||
|
||||
/**
|
||||
* @brief RP DMA stream descriptor structure.
|
||||
*/
|
||||
typedef struct {
|
||||
DMA_TypeDef *dma; /**< @brief Associated DMA. */
|
||||
} rp_dma_channel_t;
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver macros. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @name Macro Functions
|
||||
* @{
|
||||
*/
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if !defined(__DOXYGEN__)
|
||||
extern const stm32_dma_stream_t _stm32_dma_streams[STM32_DMA_STREAMS];
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void dmaInit(void);
|
||||
const rp_dma_channel_t *dmaStreamAllocI(uint32_t id,
|
||||
rp_dmaisr_t func,
|
||||
void *param);
|
||||
const rp_dma_channel_t *dmaStreamAlloc(uint32_t id,
|
||||
rp_dmaisr_t func,
|
||||
void *param);
|
||||
void dmaStreamFreeI(const rp_dma_channel_t *dmachp);
|
||||
void dmaStreamFree(const rp_dma_channel_t *dmachp);
|
||||
void dmaServeInterrupt(const rp_dma_channel_t *dmachp);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* RP_DMA_H */
|
||||
|
||||
/** @} */
|
Loading…
Reference in New Issue