|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 x& \4 \1 u6 `5 `* k
- [code]EDMA sample test application6 p9 B( q' ]3 _5 w! K$ v
- /*
$ t- Z4 G6 F* b - * edma_test.c( v4 c# V q; K$ [6 g( B7 f% h' q
- *( l& n' x; P* d. G* A/ M
- * brief EDMA3 Test Application( ? K9 @9 R& a2 K1 b1 P# e4 |/ c. i
- *
; n- X) U* c; O* ^ - * This file contains EDMA3 Test code.
9 a. j# c6 f( x$ b" W6 M - *6 @# s7 c! q; R2 V4 `8 U) d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& p# O/ v# I0 C( i D" v# r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' D$ d6 v6 m! c; G4 A- j
- * TO CHANGE.
8 l q+ l: L( w5 d - *
2 p1 f7 {( G# Q- j8 c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ k- S$ r# L1 R- D
- *
- a: U, f7 e0 l+ m - * This program is free software; you can redistribute it and/or
. q( v0 ~# L+ s: ` F6 }5 o1 O - * modify it under the terms of the GNU General Public License as8 i* t0 t; { A o* j5 |
- * published by the Free Software Foundation version 2.5 o: M2 i$ E' _0 h
- */ ^- W- n9 `6 A8 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 q' c& z* k: I& j - * kind, whether express or implied; without even the implied warranty) B; \: j' G9 y- C$ `$ @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 v F- s. Y$ E% w; ]/ V) |2 d0 g3 z - * GNU General Public License for more details.$ W, {, s' ^) j; t# t5 F' ^
- */
) t$ C. P9 n, b" h - / f2 v, O0 I. p9 }# B
- #include <linux/module.h>
* @7 l% E, F5 G6 k9 O# i/ D - #include <linux/init.h>
. K( A9 c( w- U6 ~- q2 G# O - #include <linux/errno.h>( L+ m; C' s0 h0 v& {
- #include <linux/types.h>* d% s7 t7 M. d4 L
- #include <linux/interrupt.h>
4 y$ m# w0 r! W% c' U - #include <asm/io.h>
9 ]$ ?! B5 ]- T+ f/ {+ z - #include <linux/moduleparam.h>
* ^. ?/ }+ S8 \' Q/ ~ - #include <linux/sysctl.h>
+ a% w" ~* E7 N) b; D4 k" D - #include <linux/mm.h>+ s9 j- ]5 k. F* R& |! {0 V9 a" M
- #include <linux/dma-mapping.h>
9 \! o" P, y7 o' u( D - z1 S: S, J: N# N+ }7 [. q! x. Z
- #include <mach/memory.h># z/ O1 f& [) ~! ~+ f
- #include <mach/hardware.h>
3 O4 s* `8 I2 X3 \9 B+ R - #include <mach/irqs.h>5 _# A6 D3 ^6 O% R7 Y5 I8 {
- #include <asm/hardware/edma.h>
' }' _ |, a% q3 h0 m
+ r- I8 D' C$ @: @: v% o! x- #undef EDMA3_DEBUG5 w; ~8 ]% Q4 u+ i2 u8 U
- /*#define EDMA3_DEBUG*// W o1 g" D6 O
- 5 p) V' H6 K; j3 _# b
- #ifdef EDMA3_DEBUG
- Q! u x( }! e' w& l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 D: s1 E: D! {0 ?' x9 D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 } D# N" [: b+ ~1 k- k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ Q- I9 N: B6 Q6 g
- #else
7 H! A( a9 S) p& q - #define DMA_PRINTK( x... )/ h7 K1 j; M: y; r- e5 T
- #define DMA_FN_IN0 n- T' q6 a- S4 ^
- #define DMA_FN_OUT7 U) g* ` R% b7 }+ J$ g( r8 B
- #endif
4 j+ T+ @ E: x5 i - ! y, j& q$ X, q( v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 t! t6 G: Z- \% T" ?3 s& w0 N/ q - #define STATIC_SHIFT 3
: N1 B" O2 m8 K. R' Z# W. ^' Y - #define TCINTEN_SHIFT 205 u- c7 C( e1 J' [. ~
- #define ITCINTEN_SHIFT 21/ v, h3 o" n0 m+ c3 }
- #define TCCHEN_SHIFT 22
+ B, a7 R1 E: B) l8 ?2 i! L - #define ITCCHEN_SHIFT 23
( [4 P( x: P; g3 P7 F$ j& O
% P+ t8 f; `# B# r# |) ]* c- static volatile int irqraised1 = 0;
$ X+ q" j3 p9 d! q/ J - static volatile int irqraised2 = 0;- n, P8 U6 c" S4 n- z% X
8 d# Y9 `4 [3 w( I$ d# p2 L4 a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 U# u/ N( S3 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% t1 B; p6 k8 q5 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Q4 h* \) ~- H$ s5 h4 u
% b" \2 h0 X; Z2 D) x- dma_addr_t dmaphyssrc1 = 0;0 e! S& ]. V( u8 @8 q+ m# y1 v" A- L
- dma_addr_t dmaphyssrc2 = 0;
- p3 o3 i8 a4 Q, H5 C D1 G) _# | - dma_addr_t dmaphysdest1 = 0;3 ~1 A. U- [; ]- P
- dma_addr_t dmaphysdest2 = 0;! Z( {! S& t8 y
3 e9 }. K& U' b7 O m3 L3 d! E- char *dmabufsrc1 = NULL;
7 t' l( E( u. S4 C8 | - char *dmabufsrc2 = NULL;2 @& z# f7 \5 J2 T4 R7 R: g- D5 W
- char *dmabufdest1 = NULL;1 o+ q# p1 B! [* j9 I
- char *dmabufdest2 = NULL;
?7 ~. m1 o! I8 g0 @ - 0 E9 l! N& M' B6 k; n9 a' U
- static int acnt = 512;* M8 r6 ~7 _! s" H% v8 u" ~
- static int bcnt = 8;. @+ r! }) d. |- U
- static int ccnt = 8;8 U7 A1 u5 Z; g# t6 L
- 0 I% C( v# o) e+ R1 C
- module_param(acnt, int, S_IRUGO);& Y1 m( Y% ]$ r3 g* m
- module_param(bcnt, int, S_IRUGO);6 b2 r) M, D' h2 _. H
- module_param(ccnt, int, S_IRUGO);
复制代码
( ?3 Y" i' \3 o* |& I$ h4 E3 Q8 K. C$ k0 g1 E' B2 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# O4 j; ]- P8 z* P5 x! H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* c& D8 h, ^' l1 P* X4 d- n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ~7 e: E) p8 |
( Y. h3 R% k% D3 }: \7 m
# J. G. f$ E% {8 l2 t |
|