Path: blob/main/sys/arm/broadcom/bcm2835/bcm2835_dma.h
39566 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2013 Daisuke Aoyama <[email protected]>4* Copyright (c) 2013 Oleksandr Tymoshenko <[email protected]>5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728#ifndef _BCM2835_DMA_H_29#define _BCM2835_DMA_H_3031#define BCM_DMA_BLOCK_SIZE 5123233/* DMA0-DMA15 but DMA15 is special */34#define BCM_DMA_CH_MAX 123536/* request CH for any nubmer */37#define BCM_DMA_CH_INVALID (-1)38#define BCM_DMA_CH_ANY (-1)3940/* Peripheral DREQ Signals (4.2.1.3) */41#define BCM_DMA_DREQ_NONE 042/*43* XXX This doesn't seem to work for the Raspberry Pi 4, but the peripheral44* documentation still lists it at 11.45*/46#define BCM_DMA_DREQ_EMMC 1147#define BCM_DMA_DREQ_SDHOST 134849#define BCM_DMA_SAME_ADDR 050#define BCM_DMA_INC_ADDR 15152#define BCM_DMA_32BIT 053#define BCM_DMA_128BIT 15455int bcm_dma_allocate(int req_ch);56int bcm_dma_free(int ch);57int bcm_dma_setup_intr(int ch, void (*func)(int, void *), void *arg);58int bcm_dma_setup_src(int ch, int dreq, int inc_addr, int width);59int bcm_dma_setup_dst(int ch, int dreq, int inc_addr, int width);60int bcm_dma_start(int ch, vm_paddr_t src, vm_paddr_t dst, int len);61uint32_t bcm_dma_length(int ch);6263#endif /* _BCM2835_DMA_H_ */646566