|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, [& I+ w& m; e5 [! ~ S% k9 V+ l- [code]EDMA sample test application2 r/ O3 @8 Y7 i( d' }& x
- /*( u& y. g% ` D2 ], r1 W8 u
- * edma_test.c
8 ~) |, l- m8 }7 p, V- a- x - *
! u9 b+ S5 O& O7 W' C: D - * brief EDMA3 Test Application! P: Z* O0 ?" Q; w: @
- *
. _; {+ z, k4 }! D# x - * This file contains EDMA3 Test code.
4 I; j* ]$ j$ J. O8 _# X2 j* p - *: n+ @' G5 L, t2 }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ E4 z& z% `: Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 `" w; Z n% l! o/ e - * TO CHANGE. w1 X. E0 j' C2 f
- *2 u( C- P9 ?3 \( p: g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 W- t+ \' D3 T0 d, G; g( \ i( S) g; ] Q - *
" @( u* p. J9 x! n: Z' ^ - * This program is free software; you can redistribute it and/or
$ L" `' D. }7 |9 | - * modify it under the terms of the GNU General Public License as* p, ]. Q5 z8 m0 d- v/ A; o
- * published by the Free Software Foundation version 2.
2 T- p) G- L; i, M8 I - *
p6 K7 Y8 D0 U% M" n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 B, S5 M% A* ^
- * kind, whether express or implied; without even the implied warranty
. K2 O" B1 }0 y8 c7 [+ ?+ A$ J; \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& \- ~* v( ?' _" l3 d9 D - * GNU General Public License for more details.
- o1 ^! y: r- V - */5 @0 ^: y1 Y2 Y3 z
- , a; t+ B- X& p7 |$ q
- #include <linux/module.h>
2 `' C, ^% J o+ L3 d4 O - #include <linux/init.h>: D' ]2 E2 g; ^9 Q
- #include <linux/errno.h> y; f7 P2 K. s5 Q2 J. k
- #include <linux/types.h>
& \) [& G0 I: R# @ - #include <linux/interrupt.h>9 H/ W" J# p! m1 V c& h2 \' C |; [
- #include <asm/io.h>6 O" s* i! g8 i$ Y2 w) L+ H5 r6 G
- #include <linux/moduleparam.h>! w" d @, W) g* Z3 }
- #include <linux/sysctl.h>4 Q: F. K r% c; O3 ?; i
- #include <linux/mm.h>
t& j. S8 ]+ K( g - #include <linux/dma-mapping.h>0 c0 B( ~1 G, V. ]3 o1 x% b$ ]
; U0 Z" s. g1 W U- #include <mach/memory.h>
* l5 `" }! K" J0 Z7 D d5 L% O - #include <mach/hardware.h>; W. u7 g( F: v6 F* R" {
- #include <mach/irqs.h>
# r9 K7 h0 X) u4 T9 y* U3 v$ ` - #include <asm/hardware/edma.h>2 O" \& G' Q) b" [5 y7 [* d
* {' X! ] a$ n3 L# |+ \& d) G+ Q- #undef EDMA3_DEBUG
8 T' S: r F" A: w - /*#define EDMA3_DEBUG*/
. {$ Y# }! H& N9 ~ - @. `9 q E ~) Y7 i6 D
- #ifdef EDMA3_DEBUG
% g/ `' j* @! z8 K; P0 b# K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 `: C& P9 B" n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 H: q" r' x+ e; H. w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, M3 ? L& ?, }2 V - #else8 f+ L7 H% |6 F" D* v- f. K
- #define DMA_PRINTK( x... )& \4 r+ f7 j1 X$ k
- #define DMA_FN_IN- s7 h; L$ }0 X5 o- y/ A5 G
- #define DMA_FN_OUT
! ^- _# s' {5 V0 g' h - #endif
5 V- v9 C7 ^9 E% f' w7 |0 W - 1 d3 n+ V+ N0 [: K" d1 ^. B9 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 R0 ]1 Q5 i& I$ ]* T1 F
- #define STATIC_SHIFT 3
- p3 N$ P, F. ?* Y" f. Z' o - #define TCINTEN_SHIFT 206 I7 U% ]9 b# f2 k: W) H7 Z
- #define ITCINTEN_SHIFT 214 S! `: ^' A3 c P2 V. }! c
- #define TCCHEN_SHIFT 22
! r. {- T0 p8 v8 S& U8 n: z - #define ITCCHEN_SHIFT 23
* x: _9 S( V9 p) M" t4 I3 c0 Z6 E - : ]* Y' r3 e* l4 c9 {% {& K+ i0 [: n
- static volatile int irqraised1 = 0;8 P/ e) m. n; u% U, F1 I
- static volatile int irqraised2 = 0;
' }! O9 g6 ~2 {4 H W
0 c/ R7 F, {" s" u" H6 Z3 S+ T0 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" a3 k' n4 x; f0 _1 X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: k% r% |4 l5 Z4 h5 C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- J# A/ l1 C% M# P) m
- 7 V$ R' U' \$ p& h( C+ |$ e8 W
- dma_addr_t dmaphyssrc1 = 0;
" I: ~% R1 i. m+ K' I8 P - dma_addr_t dmaphyssrc2 = 0;* M! t0 n( O# m3 K
- dma_addr_t dmaphysdest1 = 0;
: k: f7 T$ Y/ W+ ]- V - dma_addr_t dmaphysdest2 = 0;
" G t! p6 Z% s- ~0 L0 ~
. q; i6 R8 a0 \" q9 q- char *dmabufsrc1 = NULL;
- ~0 U5 s$ b7 t! {" o( n/ I - char *dmabufsrc2 = NULL;& K9 X6 H! b! s) e+ q8 Q
- char *dmabufdest1 = NULL;8 z" X" B, I& F' B# u+ n4 _2 i7 `
- char *dmabufdest2 = NULL;2 o% d6 U+ e. i A9 @
- . y0 ]- \4 T( p. e( [' h! Z
- static int acnt = 512;5 p' _3 T7 ^7 G. T/ K$ Z" p! a ]" c* B
- static int bcnt = 8;, J9 s ?0 R9 n/ d0 A+ p$ u% R
- static int ccnt = 8;* E+ m E0 w7 r, ]" {
- $ `# A1 O# k0 t& i2 X: c+ G
- module_param(acnt, int, S_IRUGO);
6 ?! i" U' s& q- P0 f - module_param(bcnt, int, S_IRUGO);2 h- c) i1 Z: d' X+ q
- module_param(ccnt, int, S_IRUGO);
复制代码 4 f3 Q% ?8 L* ~4 D" p F! A
, ~7 d* e J2 o6 i2 u' ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ~' @2 b2 ]) _( Barm-none-linux-gnueabi-gcc -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 S" b/ y# V4 W& h+ M' | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; E7 T3 W; C( {( T) A: I# v
3 N( N) I1 g+ t }4 X, G8 r
" \& E0 m6 n' ^" n4 V |
|