|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . j8 _8 o+ X0 o+ J- E x* j
- [code]EDMA sample test application! B {; \: {, l5 E& X' u& X7 Q
- /*+ f2 K# F& }6 c A8 M/ V
- * edma_test.c
+ q7 C6 P; O1 b" U+ ]6 j - *% W, [' g2 c3 [4 C& Y
- * brief EDMA3 Test Application
3 v* T7 @. T) F. R! ^; E8 w9 _ - */ g0 }" q5 i1 I, e* Y4 D: v" u x
- * This file contains EDMA3 Test code.* `7 x \: d( P
- *& t l# m, Q! y" y$ j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! g9 z+ [ _& ~; g0 p; B9 i8 q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# S2 [% k- o, g4 C8 I/ J v - * TO CHANGE.
5 _/ @7 e2 ?) r' M: R9 F( H H - *
* Y" |$ h1 w3 b7 B$ b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, ]4 H& `* F- t* `. A) b
- *$ F; `) U) i. k& o _; T
- * This program is free software; you can redistribute it and/or" X3 ~0 d, @9 m, z% H: b1 C
- * modify it under the terms of the GNU General Public License as
2 e/ t6 c' H9 O8 ?2 v1 j" } - * published by the Free Software Foundation version 2.4 |; _6 }) V: @
- *( L4 j3 V* q* _; m! V1 y+ N8 U' q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 H; s, a/ K4 O - * kind, whether express or implied; without even the implied warranty. L9 v( b2 p J+ E! \; |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 _6 \( |3 q- n, l7 ~
- * GNU General Public License for more details.6 s/ _( N+ s: g9 e& J$ {
- */
" M( p0 T" B- i* m! G. T8 O - # T T: C* Q: h4 m" h- Z
- #include <linux/module.h>( u* K& B" ]) Q2 j7 |) N
- #include <linux/init.h>! b' n7 q( f4 s( v# X1 ?' F/ i
- #include <linux/errno.h>& y1 H2 F3 Y% p' G5 F
- #include <linux/types.h> n. V3 j* h; m, u" V' E6 j
- #include <linux/interrupt.h>( A. c n: i! t, w |7 U
- #include <asm/io.h>% b. \" ]6 P' P' O; ?
- #include <linux/moduleparam.h>* A* w; I" }" s/ q
- #include <linux/sysctl.h>( L/ o i' h/ {: G
- #include <linux/mm.h>
9 |% q* S: g4 \1 b - #include <linux/dma-mapping.h>
5 D1 |0 f0 S& h3 n( E5 e# D - - a; K# n8 z# ?! E" i! B2 s
- #include <mach/memory.h>% x, R5 [. f. b, p" Z0 P! N, o, ~- `* c
- #include <mach/hardware.h>
, k$ Z5 m7 p. b$ g - #include <mach/irqs.h>* m L+ {7 z: x9 P. s$ X) i
- #include <asm/hardware/edma.h>
6 M ?( f# M! s
9 O2 E# A5 O, b2 T- #undef EDMA3_DEBUG# R! r: a7 V6 g6 x2 z3 Q" u4 X
- /*#define EDMA3_DEBUG*/
3 l/ u+ `6 a$ }: _% @0 k - . S! Q, U5 P& t# I
- #ifdef EDMA3_DEBUG
5 b' O* c& Y! g1 X) y/ z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. G" W4 U7 {5 i9 c' v4 t$ y' f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ v" }3 x( s( U( G/ ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* V6 a' d8 h- f* @, L
- #else
9 I# ]& P, F2 d& q - #define DMA_PRINTK( x... ), ]! [. {1 W, C9 L! b' z! D
- #define DMA_FN_IN! x* P+ Z3 q1 V4 J3 z
- #define DMA_FN_OUT6 n6 M( N' p. c: ~
- #endif
# n$ w" t5 Y4 z - # ?8 B: H9 N# Q* l, i4 Q; `# z7 V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% g% [0 z$ k) ]1 S: `
- #define STATIC_SHIFT 3( P5 p! g) y5 `: i$ R# w& U
- #define TCINTEN_SHIFT 20
' A7 m# i1 L* _ ] - #define ITCINTEN_SHIFT 215 K5 C' }7 f' V) _! v+ ?
- #define TCCHEN_SHIFT 22
- }6 T( C; J2 t3 O4 b& z0 G - #define ITCCHEN_SHIFT 23; Q H4 @3 T* e/ t
- - u# L6 V$ M/ r, e! p9 w- \
- static volatile int irqraised1 = 0;" e! |0 H* q; M/ L4 [8 K
- static volatile int irqraised2 = 0;8 B9 z$ A1 A0 D3 N& Y0 c, W: a
) d. b* Z6 i; t* t2 b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% a# A9 O6 V( \3 T+ n; m+ j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" @) f. F. B. X" B/ _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G) [4 Q$ U" a! |# M# h5 [
- : m [& k3 q$ u8 |. }$ }+ }
- dma_addr_t dmaphyssrc1 = 0;- Z v* @7 j `$ j
- dma_addr_t dmaphyssrc2 = 0;; w) d$ q7 x& G
- dma_addr_t dmaphysdest1 = 0;7 A7 O0 `4 A. w& S' c/ t
- dma_addr_t dmaphysdest2 = 0;' ^6 B/ w! I7 n+ C6 d1 j, w8 [! I
5 m3 k8 M2 p- G) Y: {- char *dmabufsrc1 = NULL;
4 N* E) ]' @+ H, n. M; v5 d - char *dmabufsrc2 = NULL;1 C& m p Y. a3 I. w5 @, a
- char *dmabufdest1 = NULL;+ C( y: i' B S3 ^& g- x/ ^: h
- char *dmabufdest2 = NULL;9 w5 R+ r0 E+ K; r
% o" P* A. Y$ [; q$ O' Z- static int acnt = 512;' R2 C0 Q- V% ~2 }2 ]6 h. u
- static int bcnt = 8;
1 o. I1 U m- n W4 p - static int ccnt = 8;6 _. r/ c* C" w9 G( t4 t
- ! J/ M; L+ }6 V5 p/ G" ?
- module_param(acnt, int, S_IRUGO);7 Y- I# U8 s- |. I
- module_param(bcnt, int, S_IRUGO);
: i0 y4 a, x5 e- a - module_param(ccnt, int, S_IRUGO);
复制代码
, i8 c' y& i$ `5 w) r
; U c, R+ W- H# J0 b+ Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 P9 M p( t" d: \3 s
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 k( `0 `, _# B# ~0 m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* C9 S& k4 O) q. K1 }. u$ o1 i1 Q. ^% Y J$ m9 w
$ y2 q9 A& q# A* Z/ V0 d
|
|