|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 |1 L* o1 b, Y
- [code]EDMA sample test application) w& D2 G9 c( a1 j3 }7 ^- B
- /*7 E2 w& k) P) r5 `: O
- * edma_test.c
2 M$ |! c0 n% Y- T! ]- D! q4 v - *1 f2 t3 S5 D' j2 i2 e
- * brief EDMA3 Test Application; A! O; C; G9 \- c% {8 O1 S! ]
- *2 Z3 U' r: J f5 r H7 w: o8 G
- * This file contains EDMA3 Test code.
3 E7 g9 m! ~: E7 U, _/ e' o# h - *
& w" h' }4 d* q1 F) t2 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! B s, _3 u& c& X; b( D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 c6 g7 H T( w/ ^. X/ u
- * TO CHANGE.4 \ n) F) m8 l) J' E7 o% o# ]
- ** L( Q2 P! }' a5 n1 X" B7 m3 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: O/ U# n; [* |# N' V+ f: N - *
) x& A0 Y6 ~+ ^0 J - * This program is free software; you can redistribute it and/or
4 L3 T4 Y6 ~. P, U) l. e- S' N, l - * modify it under the terms of the GNU General Public License as/ h8 o$ L0 ^4 X1 S6 v x7 c& \3 J2 Z
- * published by the Free Software Foundation version 2.) |6 [) R2 O U6 e* \3 G
- *! r! v/ U6 m% x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ n& y: \. G, f5 Z
- * kind, whether express or implied; without even the implied warranty( u v' G7 i1 r0 |: Y( L9 L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 O; L4 h# d( p% R
- * GNU General Public License for more details.1 B) g/ ~! J) d _5 _0 n
- */% |' m+ B* D5 n+ c; n9 g
- 3 X4 A& K7 z" c) W+ E/ S
- #include <linux/module.h>
- |8 E w. a9 V: f - #include <linux/init.h>
+ b% n8 n* \% P7 [$ t. @ - #include <linux/errno.h>
2 v" T; B, F/ J2 K# A7 v5 Y2 A, a - #include <linux/types.h>/ L/ S, |' R6 Z; h
- #include <linux/interrupt.h>/ H$ D$ q: y& ?9 S; v3 S
- #include <asm/io.h>5 B) W; L2 L! q8 }
- #include <linux/moduleparam.h>
: ]+ W& B& W5 R. q - #include <linux/sysctl.h>2 h I$ e0 P1 `. a. z6 I9 X: O0 q
- #include <linux/mm.h>( ^& n8 D4 x) ]5 d, ?, {8 N% T
- #include <linux/dma-mapping.h>
5 @, g) M9 ]0 T2 Q* f4 m - 7 V7 t* `5 G3 L+ f% ^
- #include <mach/memory.h>
7 s$ e1 m- a3 k# N* U# `! a - #include <mach/hardware.h>- c: ^3 R( `9 ], k+ a- k4 J
- #include <mach/irqs.h>5 E" N! N+ Y+ { _9 F
- #include <asm/hardware/edma.h>
' k3 i& x: U3 p
4 F) P, d, Z/ D5 G4 u- #undef EDMA3_DEBUG
' i4 t t( q$ E7 K - /*#define EDMA3_DEBUG*/
' ~ \. A2 ]/ L' P4 e - 8 a% l: I$ _: G3 _& X
- #ifdef EDMA3_DEBUG( D5 n w: I( Z6 i0 y( I) n# x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ S) S L+ y6 A6 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 S" B1 ?/ g* }# d5 K ^! Q' H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. o7 f# R- V* v2 f: }8 Q - #else
/ ?3 {+ Q8 i. D) D* j, q - #define DMA_PRINTK( x... )
# h% k! ?, i" e% R! ] - #define DMA_FN_IN8 c, d* |3 L- D/ B
- #define DMA_FN_OUT" a1 E! g" L; F7 _+ y( S* v3 T- W
- #endif* M0 D" q b6 I" p2 j+ z
- , n+ P T, _$ `7 p9 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ s4 P8 }+ c- K. o; t
- #define STATIC_SHIFT 35 i' {" Z% b7 Z" [ J( i
- #define TCINTEN_SHIFT 20; @) X) |" |" |
- #define ITCINTEN_SHIFT 21
* a6 F' t9 C+ ^# Q. `5 ^ - #define TCCHEN_SHIFT 22% }, e5 g0 h" M7 W- B
- #define ITCCHEN_SHIFT 232 X7 O) r# C3 T+ g
# _* ?$ z2 |5 F, q Q- static volatile int irqraised1 = 0;$ @! X7 ]! X. r: J- ~9 r
- static volatile int irqraised2 = 0;
) Y, J E4 t4 ~; y* u# s
@2 F3 w/ b# H2 g7 K% l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. I- d' y( S; h" ~& t ^- Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 K; |3 y( M5 h: ^) @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- E2 d2 A1 |, h! g8 }" f* ~
0 ]1 V t: r( a n+ d- dma_addr_t dmaphyssrc1 = 0;, m8 U% T/ j( ]. d7 G1 p
- dma_addr_t dmaphyssrc2 = 0;7 L: W1 }0 x5 c1 j; Q
- dma_addr_t dmaphysdest1 = 0;0 e/ E' Q# ^! c# z
- dma_addr_t dmaphysdest2 = 0;
+ P* f E; J U7 W" h
6 S) Y9 P% j, h/ H3 Z7 l* X- char *dmabufsrc1 = NULL;# | j! d$ K4 u8 W0 |, }( c$ ]
- char *dmabufsrc2 = NULL;
! L5 f+ R, ^. b1 A - char *dmabufdest1 = NULL;
# x5 Y5 m ]: { - char *dmabufdest2 = NULL;' `, A q/ R \: ?% B2 ]& S$ B
- 1 z2 y; v& a, c; e! A
- static int acnt = 512;
) h0 d; p7 T8 k* f - static int bcnt = 8;
3 E9 v: Q% O+ b+ g, ^* L3 s3 v" } - static int ccnt = 8;
( `; J* m! |: x/ Y
( _& L% z/ B+ G+ X- module_param(acnt, int, S_IRUGO);. L7 L O( C/ I5 j" o- |
- module_param(bcnt, int, S_IRUGO);
" W' }# X( x% E& M( J' e - module_param(ccnt, int, S_IRUGO);
复制代码
5 l" f; i8 E* ~) N; S" s/ s# E. J
; m0 a: [5 k9 y \9 _% o! B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ R( C" C" L; m$ Y# a3 e; o8 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 S3 |6 h l/ o0 Q' T+ }0 x0 _0 J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 p$ L$ v) T/ A; ^ F- P! P) b! O* a5 d% l6 Z P
. I7 p. f' N4 C- ~, S/ x6 t8 A
|
|