1 /* $OpenBSD: edmavar.h,v 1.4 2015/01/22 14:33:01 krw Exp $ */ 2 /* 3 * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 #ifndef __EDMAVAR_H__ 19 #define __EDMAVAR_H__ 20 21 typedef void (*edma_intr_cb_t)(void *); 22 23 /* 24 * EDMA PaRAM dma descriptors 25 */ 26 struct edma_param{ 27 uint32_t opt; /* Option */ 28 uint32_t src; /* Ch source */ 29 uint16_t acnt; /* 1st dim count */ 30 uint16_t bcnt; /* 2nd dim count */ 31 uint32_t dst; /* Chan dst addr */ 32 int16_t srcbidx; /* Src b index */ 33 int16_t dstbidx; /* Dst b index */ 34 uint16_t link; /* Link addr */ 35 uint16_t bcntrld; /* BCNT reload */ 36 int16_t srccidx; /* Source C index */ 37 int16_t dstcidx; /* Dest C index */ 38 uint16_t ccnt; /* 3rd dim count */ 39 uint16_t res; /* Reserved */ 40 } __attribute__((__packed__)); 41 42 int edma_intr_dma_en(uint32_t, edma_intr_cb_t, void *); /* en it for chan */ 43 int edma_intr_dma_dis(uint32_t); /* disable intr for chan */ 44 int edma_trig_xfer_man(uint32_t); /* trig a dma xfer */ 45 int edma_trig_xfer_by_dev(uint32_t); /* dma xfer trig by dev */ 46 void edma_param_write(uint32_t, struct edma_param *); 47 void edma_param_read(uint32_t, struct edma_param *); 48 49 #endif /* __EDMAVAR_H__ */ 50