Lines Matching +full:stm32 +full:- +full:dmamux
5 * SPDX-License-Identifier: Apache-2.0
9 * @brief Common part of DMAMUX drivers for stm32.
32 /* this is the configuration of one dmamux channel */
40 /* the table of all the dmamux channel */
47 /* this is the configuration of the dmamux IP */
99 if (dev_config->base == DT_REG_ADDR(DT_NODELABEL(dmamux1))) { in get_dma_fops()
105 if (dev_config->base == DT_REG_ADDR(DT_NODELABEL(dmamux2))) { in get_dma_fops()
110 __ASSERT(false, "Unknown dma base address %x", dev_config->base); in get_dma_fops()
117 /* device is the dmamux, id is the dmamux channel from 0 */ in dmamux_stm32_configure()
118 const struct dmamux_stm32_config *dev_config = dev->config; in dmamux_stm32_configure()
125 int request_id = config->dma_slot; in dmamux_stm32_configure()
127 if (request_id > dev_config->req_nb + dev_config->gen_nb) { in dmamux_stm32_configure()
129 return -EINVAL; in dmamux_stm32_configure()
133 if (id >= dev_config->channel_nb) { in dmamux_stm32_configure()
135 return -EINVAL; in dmamux_stm32_configure()
146 * This dmamux channel 'id' is now used for this peripheral request in dmamux_stm32_configure()
149 if (dma_device->configure(dev_config->mux_channels[id].dev_dma, in dmamux_stm32_configure()
150 dev_config->mux_channels[id].dma_id, config) != 0) { in dmamux_stm32_configure()
151 LOG_ERR("cannot configure the dmamux."); in dmamux_stm32_configure()
152 return -EINVAL; in dmamux_stm32_configure()
155 /* set the Request Line ID to this dmamux channel i */ in dmamux_stm32_configure()
156 DMAMUX_Channel_TypeDef *dmamux = in dmamux_stm32_configure() local
157 (DMAMUX_Channel_TypeDef *)dev_config->base; in dmamux_stm32_configure()
160 LL_DMAMUX_SetRequestID(dmamux, id, request_id); in dmamux_stm32_configure()
167 const struct dmamux_stm32_config *dev_config = dev->config; in dmamux_stm32_start()
171 if (id >= dev_config->channel_nb) { in dmamux_stm32_start()
173 return -EINVAL; in dmamux_stm32_start()
176 if (dma_device->start(dev_config->mux_channels[id].dev_dma, in dmamux_stm32_start()
177 dev_config->mux_channels[id].dma_id) != 0) { in dmamux_stm32_start()
178 LOG_ERR("cannot start the dmamux channel %d.", id); in dmamux_stm32_start()
179 return -EINVAL; in dmamux_stm32_start()
187 const struct dmamux_stm32_config *dev_config = dev->config; in dmamux_stm32_stop()
191 if (id >= dev_config->channel_nb) { in dmamux_stm32_stop()
193 return -EINVAL; in dmamux_stm32_stop()
196 if (dma_device->stop(dev_config->mux_channels[id].dev_dma, in dmamux_stm32_stop()
197 dev_config->mux_channels[id].dma_id) != 0) { in dmamux_stm32_stop()
198 LOG_ERR("cannot stop the dmamux channel %d.", id); in dmamux_stm32_stop()
199 return -EINVAL; in dmamux_stm32_stop()
208 const struct dmamux_stm32_config *dev_config = dev->config; in dmamux_stm32_reload()
212 if (id >= dev_config->channel_nb) { in dmamux_stm32_reload()
214 return -EINVAL; in dmamux_stm32_reload()
217 if (dma_device->reload(dev_config->mux_channels[id].dev_dma, in dmamux_stm32_reload()
218 dev_config->mux_channels[id].dma_id, in dmamux_stm32_reload()
220 LOG_ERR("cannot reload the dmamux channel %d.", id); in dmamux_stm32_reload()
221 return -EINVAL; in dmamux_stm32_reload()
230 const struct dmamux_stm32_config *dev_config = dev->config; in dmamux_stm32_get_status()
234 if (id >= dev_config->channel_nb) { in dmamux_stm32_get_status()
236 return -EINVAL; in dmamux_stm32_get_status()
239 if (dma_device->get_status(dev_config->mux_channels[id].dev_dma, in dmamux_stm32_get_status()
240 dev_config->mux_channels[id].dma_id, stat) != 0) { in dmamux_stm32_get_status()
241 LOG_ERR("cannot get the status of dmamux channel %d.", id); in dmamux_stm32_get_status()
242 return -EINVAL; in dmamux_stm32_get_status()
250 const struct dmamux_stm32_config *config = dev->config; in dmamux_stm32_init()
256 return -ENODEV; in dmamux_stm32_init()
260 (clock_control_subsys_t) &config->pclken) != 0) { in dmamux_stm32_init()
262 return -EIO; in dmamux_stm32_init()
268 if (config->base == DT_REG_ADDR(DT_NODELABEL(dmamux1))) { in dmamux_stm32_init()
269 /* DMAs assigned to DMAMUX channels at build time might not be ready. */ in dmamux_stm32_init()
272 return -ENODEV; in dmamux_stm32_init()
277 return -ENODEV; in dmamux_stm32_init()
284 if (config->base == DT_REG_ADDR(DT_NODELABEL(dmamux2))) { in dmamux_stm32_init()
286 return -ENODEV; in dmamux_stm32_init()
302 * Each dmamux channel is hardwired to one dma controllers dma channel.
304 * dmamux channel using the dma dt properties dma_offset and dma_requests,
307 * for a given dmamux channel, are currently valid for series having
338 (mux_channel + 1) : (mux_channel - DMA_2_BEGIN_DMAMUX_CHANNEL + 1))
349 * Note: Instance Number (or index) has no guarantee to which dmamux it refers