|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 b+ a9 |- F" s% l/ a- [code]EDMA sample test application8 E+ I# x7 \3 }8 T8 A- h5 s+ o
- /*
* d9 T9 p1 r+ ?7 U) ?( ` - * edma_test.c7 W3 \- M: I# S$ w( d6 s
- *
/ j5 o- C7 u: A6 E) y0 i5 N9 k# V - * brief EDMA3 Test Application) a0 R: ?8 z2 v& g% P
- *
8 ]9 M0 O9 Z( b- u' O - * This file contains EDMA3 Test code.
! A! `, p' V1 R/ e - *, w9 r( L6 r0 @2 Y! u0 g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' w" [ H- ^6 o7 r! d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% o! i3 ?/ B- G7 h' U7 `
- * TO CHANGE.6 i1 S$ W8 i: W _
- *
' [4 H) r& t, {/ g" M' y/ l; q* }. G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 J2 y" x9 a% |% r. a - *
) p( t" L5 F; \# ~! y) a! d# C - * This program is free software; you can redistribute it and/or
+ c* V) C. K1 w( w5 F, ] - * modify it under the terms of the GNU General Public License as
2 [* D/ r" }2 P+ X5 e5 \! s9 C - * published by the Free Software Foundation version 2.( p2 I9 L5 h; t
- *; E2 w: e N7 A0 k- M2 K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; k* R; o1 D7 m! _
- * kind, whether express or implied; without even the implied warranty6 s# }6 Z4 m6 r7 M/ B/ f6 F3 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 b: E9 a9 t& l8 p& ?
- * GNU General Public License for more details.7 ~5 x" M: q8 ]; k3 x
- */9 G% B5 ]( ?$ O1 g
; h9 {- \6 V. O% ^: |- #include <linux/module.h>5 J8 H2 K0 F( D9 U
- #include <linux/init.h>
$ u8 [+ E; l2 D7 v- d2 d - #include <linux/errno.h>
$ O N/ H. J- y9 L. T - #include <linux/types.h>
6 U, F. u5 k- J, ]; }. [: \ - #include <linux/interrupt.h>
+ R) ?# R0 c' a' N& q* o3 m: ` - #include <asm/io.h>- I% h t+ O2 c8 ?' [; r Z% r
- #include <linux/moduleparam.h>" H4 ^$ k2 L" z' ~+ I! m1 Y J
- #include <linux/sysctl.h>" g! ?3 n+ @+ s% n' W
- #include <linux/mm.h>2 A, n7 i+ a1 T* h% a6 ~9 Y, Y/ x
- #include <linux/dma-mapping.h>, P; F8 @. I M5 F8 P( Z$ n
0 G3 s- f" K/ s- #include <mach/memory.h>
- ~0 E1 A# q* K* [ - #include <mach/hardware.h> y( ? i- n$ @( S. L" h
- #include <mach/irqs.h>1 F; N% Y! \+ C7 A' j
- #include <asm/hardware/edma.h>. V, d) q/ ]* I v% v) J
5 r, G4 [4 ^ G- #undef EDMA3_DEBUG
, q" F. S# [4 E$ z+ e8 Y8 P" w4 { - /*#define EDMA3_DEBUG*/* e& ?! x1 ]! ~6 C9 W
. c) A8 B+ @7 M B% w- #ifdef EDMA3_DEBUG
- v* u% U& A. V0 S( y& c* ~# N; d! G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ V9 ^4 y/ y1 V7 T) o8 B$ R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% _" Z' N) B: a2 e' U+ A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ Z& w' G. y) k9 ~! y* s - #else8 E c: G; J3 o8 V. v4 a. W! r+ d
- #define DMA_PRINTK( x... ) W; E0 Y0 E | a z
- #define DMA_FN_IN
. `- J& @3 U6 o3 z: x3 p; W$ W - #define DMA_FN_OUT, ^; c& A; J" W9 {2 w
- #endif e' Q& f( e& Y. Y& S
- # y" P# B4 Q% `: K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 E2 J7 u2 \3 S) {, _' x+ r5 v/ R
- #define STATIC_SHIFT 3
" [* ?& C/ q# m* X - #define TCINTEN_SHIFT 20: t" ?8 I& I$ z- W0 @/ O
- #define ITCINTEN_SHIFT 21: P( U6 f- J$ R/ x+ h, ?$ Y/ q- s
- #define TCCHEN_SHIFT 22- e9 K0 p% }1 `: l
- #define ITCCHEN_SHIFT 23
/ B, }* i( D. h% t: v U$ n2 U - " N: L$ P% x$ z) q4 i4 _
- static volatile int irqraised1 = 0;
4 X z% W( o6 ?; ]- _2 L - static volatile int irqraised2 = 0;& m. u: b3 k2 C: }$ N# W, M* {
- / c+ J- s$ l$ e# B7 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o8 N6 `" e; ]: s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P4 ^+ N0 ~* z0 _6 o2 O& V& |' P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 I6 o3 k3 V3 |. ]* c
/ {- \) r) a4 ~1 G2 j, }- dma_addr_t dmaphyssrc1 = 0;: i) `! M9 D% a
- dma_addr_t dmaphyssrc2 = 0;
( G t N& |& M& W1 P - dma_addr_t dmaphysdest1 = 0;
0 @+ g" {. c1 d* @ - dma_addr_t dmaphysdest2 = 0;9 H, V" `6 Y" j- J
- ^' e; O: x: }8 V- char *dmabufsrc1 = NULL; j( f+ w0 y! _, L! [
- char *dmabufsrc2 = NULL;0 U, O! \" O/ @2 G1 _! K: \% |, r* a) g
- char *dmabufdest1 = NULL;6 B6 ?2 i/ t5 J& E
- char *dmabufdest2 = NULL;
4 \9 e1 {& c. v, |2 W3 b$ p - - a6 k; E( N+ @9 R; E! J [
- static int acnt = 512;
7 f A/ T; E, H1 j: J - static int bcnt = 8;
$ U, Z# [8 p/ M ^! F! d1 h" ^ - static int ccnt = 8;( w0 M# ^) K1 U- F( J
+ Z* Z, B1 \' \ }6 G9 O/ ^- module_param(acnt, int, S_IRUGO);
0 @! P! w7 ~: Z* C% g( Z - module_param(bcnt, int, S_IRUGO);
3 @ L$ M8 q7 H m0 \+ I - module_param(ccnt, int, S_IRUGO);
复制代码
, P7 H3 a& t! S0 p) u
' _5 d4 k2 a; d) {: [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& _! b# b) g& E% u; t9 c+ o- L7 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; _: T6 `3 Q% L; j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
o) D! f; ?+ U; ]1 G* s7 ?0 n
1 p0 [+ a# h1 l9 f! m9 Z" I3 ]
- `: m' a2 h8 i4 y |
|