|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 }# r4 l! t# N2 L- [code]EDMA sample test application$ A( [5 Y! i) s9 H* P4 o6 I9 y
- /*% e7 h: k/ p1 T' u: o" |
- * edma_test.c
+ d: s9 v3 N) t% D% V' q - *& |0 M- l- c# b9 K8 k* I
- * brief EDMA3 Test Application0 Y$ F9 u0 \3 ~! t) B( e
- *
/ Y7 U: _7 B( H! M - * This file contains EDMA3 Test code.- q+ w0 P! W% _9 ]
- *
1 J' I$ }/ k& I$ J4 |" A) z. h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' j4 D* B5 T, r8 _) x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# J. H% L3 D _6 o7 ?1 t6 g
- * TO CHANGE.* Y/ v4 h6 F& [8 M7 j7 {/ [% o
- *
0 |) F& p5 ~ R+ l! w( D8 p- R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% Y, G- I0 e% @7 ^$ t; o1 I4 S - *
\ r& f+ R# E0 ]6 b3 a - * This program is free software; you can redistribute it and/or4 d; L, y0 m5 s
- * modify it under the terms of the GNU General Public License as1 O# p: e7 Z0 h( ^
- * published by the Free Software Foundation version 2.
* c5 W& @- C9 m( G* i9 i - *
' f) t: f) P+ n+ M4 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! f; k p1 [2 }! d! ?
- * kind, whether express or implied; without even the implied warranty! M: r- c% k1 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 W! N' w0 Q- q8 M+ S
- * GNU General Public License for more details.
& V# D( C( t2 x: d# L6 r" G/ H( g - */
0 @, `; r& ^+ R
/ d+ F, P! o' l. n/ E+ Y8 U- #include <linux/module.h>
- ?* p$ n, S) g- M1 T1 Z - #include <linux/init.h>
4 j- [' l) S$ o2 i: d - #include <linux/errno.h>
+ i4 C) l( J. j( b - #include <linux/types.h>
; C! X' {: P, Q- n. u - #include <linux/interrupt.h>: j/ t7 `0 U" ^1 k' Q8 A
- #include <asm/io.h>
6 l) v; r4 x2 l" J+ D - #include <linux/moduleparam.h>
, y! T1 g; K: H - #include <linux/sysctl.h>
1 u2 r# X/ [0 a: } - #include <linux/mm.h>7 t0 d3 ]$ E5 J4 g, @) v
- #include <linux/dma-mapping.h>
' R: M1 H. E8 y* t1 v0 \+ ?; q( \- W
$ n+ e+ Z5 b6 k+ ^% x$ O! D- #include <mach/memory.h># g3 v. y' n, t3 \* |& _+ a
- #include <mach/hardware.h>
$ {0 F( ~, F, X4 w8 g, ] - #include <mach/irqs.h>: V" A5 J$ v- x
- #include <asm/hardware/edma.h>( C/ q L! B3 Z T4 C
- ! Q0 ]! H4 i; q% S9 R" y4 V
- #undef EDMA3_DEBUG: S g! f8 E' Q
- /*#define EDMA3_DEBUG*/
' ^5 C8 k" E# O+ i$ ^) X
" s: A7 N1 I5 p- #ifdef EDMA3_DEBUG
( P4 K/ x: W+ M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 }+ _0 b9 D; c" g& d/ a) t0 c. O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 ]1 K5 C( \. ?9 ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 W8 B( B% s& M, G# I) v, I* p - #else8 [ H9 Z7 K! H; d
- #define DMA_PRINTK( x... )
~9 @9 p9 `" \! l7 I2 g7 E# L - #define DMA_FN_IN
! a9 }8 U7 n z9 f - #define DMA_FN_OUT; b* u, U& c2 x! i
- #endif
7 Q% P. E! O: W; Q - 4 j* p& _5 S5 L7 W5 D2 E: h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ q, v \; }$ p' ~$ ^& D
- #define STATIC_SHIFT 38 B9 x( W3 v- Z( @0 c7 ?& E
- #define TCINTEN_SHIFT 20
# Q6 z& @0 u& _. z, ]/ O! w% z - #define ITCINTEN_SHIFT 21
& ~+ f; D- W9 a2 R0 X2 A2 [% N/ ]: r1 } - #define TCCHEN_SHIFT 22
- @. [$ e$ o1 D, Y2 K$ ^* Z - #define ITCCHEN_SHIFT 23) J) l; `/ Z r( L" r
- 3 q: o7 S& V2 p3 }3 a
- static volatile int irqraised1 = 0;4 j9 x/ v& |' G* X ]+ }
- static volatile int irqraised2 = 0;
6 U% Q# n2 i; a - & K. R3 P) v3 ^0 Q* A7 Q( g; U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# L1 `6 r& S$ A9 f! S8 f0 c! C2 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; E! E" x# |; `: q* l h! q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ R: x0 C$ E/ ? v, U0 {1 c4 P( m - 1 d3 F5 }6 Y X
- dma_addr_t dmaphyssrc1 = 0;( W! B8 n7 L6 g
- dma_addr_t dmaphyssrc2 = 0;
P" ~3 ?1 D- {) n - dma_addr_t dmaphysdest1 = 0;
( L2 i- _4 e) X - dma_addr_t dmaphysdest2 = 0;
; }: Q7 S- x+ F% B/ l7 m - 3 [6 D, X* E. ]' D/ |
- char *dmabufsrc1 = NULL;6 W& `' E y+ g4 \' C3 X V
- char *dmabufsrc2 = NULL;- f7 H- E. \$ a* V9 d7 F
- char *dmabufdest1 = NULL;
3 p5 q2 c2 Y; T5 I, f! m - char *dmabufdest2 = NULL;
' M4 v( a6 E3 C0 v3 ~ - ' q! U8 n( j4 E2 z$ V- `4 Z
- static int acnt = 512;
* `* V) M9 x' Q7 q$ n3 T; q - static int bcnt = 8;+ J) o+ Z; ~9 I4 y
- static int ccnt = 8;
8 e0 X1 q ], u D- O9 d: o% ?7 ]! N - ! ^+ R+ c) A6 W9 b4 _* O5 z
- module_param(acnt, int, S_IRUGO);
: X; u# `5 Q5 }8 @6 D& J# Y - module_param(bcnt, int, S_IRUGO);
5 n+ ]& C. f3 f9 e( J1 D& Y - module_param(ccnt, int, S_IRUGO);
复制代码
1 K9 {9 m! v! p2 Q% K- ^* F$ `) A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 v9 K# V' n# e0 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 u$ d: z; M" ^' W2 P% Z; V8 P9 q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) z3 ]0 h& S3 ?
! `" Y* b- S$ f) @7 p6 I5 O
3 z5 {2 }. X# c- v" W0 y |
|