|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 N1 t) s. j! d8 k' X1 [- n" @
- [code]EDMA sample test application* e/ L! i7 D: U! D( n' a3 u6 Z
- /*! v3 X+ y8 x3 O
- * edma_test.c
2 t$ I& C- F/ y3 O2 [7 o: S) w6 S - *
4 K ~: D! r! g% | - * brief EDMA3 Test Application
4 i, a) F7 f: O. A - *
3 f, m+ D- i Z/ t; v7 _$ @3 t2 A - * This file contains EDMA3 Test code.# `0 y8 v5 g/ _3 }" w% W! m! Q
- *$ q6 O& l; T5 Z% r8 N( p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 P) S$ v- K0 s0 h+ _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, f. ~& s+ C2 G - * TO CHANGE.
- w0 c$ |$ x: z; e0 K k" c# K6 H - *1 A% e$ N; t$ L( k6 L; J6 @' w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// p" V1 \( d5 t" w7 s% Z" ~
- *
& [' N3 Q, b/ |$ ?7 Z5 Y - * This program is free software; you can redistribute it and/or
. _8 n# w/ F' T7 f0 Q' ? ?& r - * modify it under the terms of the GNU General Public License as" j8 W& z- L6 M0 c8 s# s
- * published by the Free Software Foundation version 2.
; o% p& @& M! o - *0 m# L; r2 x" G* E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 _9 }- H- T) R& m: N - * kind, whether express or implied; without even the implied warranty
& [( p( s( k! D& v) }2 a* Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
{. L/ W6 P, V - * GNU General Public License for more details.$ y; ^9 d% E5 v6 t: x1 V2 G1 ~
- */
! w+ r6 ^" E1 _+ Y' l; R1 z( L/ l6 T - + [# ]+ m% x0 e+ Z1 K0 N
- #include <linux/module.h>9 ?; K% O+ C! q- D* r
- #include <linux/init.h>% f: F! m# e6 Z, c2 F
- #include <linux/errno.h>
c7 F/ ], Z; i. d - #include <linux/types.h>7 b0 u. N! a' {3 q0 n; f" c$ S
- #include <linux/interrupt.h>
9 o7 g; N; R: J) B) v: {( }( M9 j - #include <asm/io.h>
% t: f% @/ i Q! E2 A - #include <linux/moduleparam.h>
2 K2 w; p) J9 E* v - #include <linux/sysctl.h>: D/ @* u" C# k. H. L0 Q
- #include <linux/mm.h>
- s% n7 [/ u. z+ S! f! Y2 S8 a - #include <linux/dma-mapping.h>4 K( A+ q7 j; H! y( D' J0 Z, ]* K# {
- & g, C1 _+ Z: n# o
- #include <mach/memory.h>8 g; [2 G2 y) {4 i
- #include <mach/hardware.h>
7 c# c0 G! O1 s& j - #include <mach/irqs.h>
) v" J0 }9 M! M2 U" P - #include <asm/hardware/edma.h>
/ ^ E0 z, S4 T+ e2 A9 d- k - ' A7 b! e8 B2 ^4 L# k# t. l. _
- #undef EDMA3_DEBUG0 V- f. O/ l3 q* X" u8 W3 f
- /*#define EDMA3_DEBUG*/+ O; Z; R7 C. ], T0 r
- 1 ~7 \% r+ P" [0 T5 ^
- #ifdef EDMA3_DEBUG5 B2 z+ J) N! F4 `# N# J3 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 {7 Q' O1 D% p# Z! s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; C- f3 t& k, c! c. v x+ ]- J; Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 I3 h7 y5 Q% V! G& G- y/ g
- #else# R$ E+ ^9 |: R( b, \4 ~2 G
- #define DMA_PRINTK( x... )
( q3 b# R+ u0 w E1 j3 F5 Y: W! I. c - #define DMA_FN_IN* c: p q4 d# u
- #define DMA_FN_OUT1 P, F- }, o2 F
- #endif
; T. u6 Z* T5 {5 u, o
8 O: r2 }0 C& v! s. \/ e; V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ ?4 @! d J Z9 N1 Y' M' _. v% U
- #define STATIC_SHIFT 3 \* |+ p( v1 C! V
- #define TCINTEN_SHIFT 20
( T) J, d" D+ v* q; j P. _ - #define ITCINTEN_SHIFT 21 N" E. V% K; I* ]
- #define TCCHEN_SHIFT 22& } k, ?- F& _% ]6 ^1 Y1 M
- #define ITCCHEN_SHIFT 23
R& r+ t% P8 Q+ `( c) ?0 r% D
7 v8 l7 m1 K. `9 d s3 p- static volatile int irqraised1 = 0;
* ^! V$ F5 V! k$ f5 u/ E - static volatile int irqraised2 = 0;
3 ^4 y# U; {' T
) v$ {& {3 q& R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; b: H; A" Q4 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 E P1 {, _) H5 d8 k5 g1 n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L9 g Z6 k6 \) u- j1 i
' ?7 \* z# S% T: Z, p- dma_addr_t dmaphyssrc1 = 0;# K' T0 L+ E% N; f2 ]( ?! B- z
- dma_addr_t dmaphyssrc2 = 0;
% u' y3 I/ T0 E4 Z2 C - dma_addr_t dmaphysdest1 = 0;- d+ o9 {/ {5 i5 U6 F
- dma_addr_t dmaphysdest2 = 0;
) w }* ~3 B% t/ b
9 o3 ?. P/ l+ ]; r. H) z- char *dmabufsrc1 = NULL;
1 ~0 q6 x4 y8 W7 x) r - char *dmabufsrc2 = NULL;
5 i) I' R. b, B2 a3 c) S5 {7 @ - char *dmabufdest1 = NULL;' o+ i5 B) r- w0 I G, y# i
- char *dmabufdest2 = NULL;
' x4 |# G4 ?% A7 H* D6 g7 m4 l7 n - & d; e' g& F6 G' A) ?# B j% `
- static int acnt = 512;
% S# | u9 C) K8 p% w' ~, `% ~/ |# S - static int bcnt = 8;4 d% M; H9 U" p, f1 G2 i
- static int ccnt = 8;- u+ E# X1 d k7 G* n# N
$ U( E+ J, Z; J- E- module_param(acnt, int, S_IRUGO);) @8 S: g; z! B K
- module_param(bcnt, int, S_IRUGO);
- X" H, g: `! w - module_param(ccnt, int, S_IRUGO);
复制代码 # e- h% F% V+ |1 [* G
/ ^) W7 \3 w* H1 O9 f( p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* A }9 n: e; e- {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; z7 W6 J; f. L. s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% e$ C% b; C( m! l5 l4 U3 ?
) M2 t/ ? [1 D$ G" r, K! X7 i" \$ C/ }! d4 I1 Y4 y
|
|