|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + R- N! f7 C- D
- [code]EDMA sample test application6 \4 M0 O+ U0 A0 A5 N
- /*9 o4 J2 i& U4 [$ d
- * edma_test.c# |5 J5 [: u' ^& l7 ^7 _& _
- *8 l- `# t. k) R* Y' H1 i
- * brief EDMA3 Test Application
5 |; G1 K& ~' e1 C# J5 o - *
! s- j) X3 ]$ ?, @4 R" { - * This file contains EDMA3 Test code.
: R$ {7 r' H2 I" K* m) h# Z - *( b3 K- [7 `+ p+ h& u7 M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' v& }" d. O, N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& R, p2 p. W2 T
- * TO CHANGE.& t) u R9 Q2 B) P
- *2 M6 h- P1 p; K) P- @& D: Y- p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 O N/ F1 H: f- b" ` - *! p; C: J+ J, q- E% Q
- * This program is free software; you can redistribute it and/or( R! B0 {- R- [6 T+ J- S
- * modify it under the terms of the GNU General Public License as& b' C5 K; P, z; q/ W: M
- * published by the Free Software Foundation version 2.: @! s4 [* ^5 E; b Y
- *
4 C0 \% Q( ?; [( M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 b. |6 r. ^3 s% }- c* I - * kind, whether express or implied; without even the implied warranty
/ a) E% t3 L) | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% M" E! a1 H& ~% v - * GNU General Public License for more details.
5 n% d3 r; w% q7 i J) X. v - */) V6 `! E1 |- u; Y: N" K/ n
; N; {# J9 ^- w4 Z( P5 B9 {- #include <linux/module.h>
0 m- d* B( u4 k8 n+ p2 y B - #include <linux/init.h>( e- U( w1 D; r( z2 I |6 m
- #include <linux/errno.h>+ ^. |5 N/ L: |6 ]8 ^
- #include <linux/types.h>
2 W# p$ }, ?4 b' g1 m, x - #include <linux/interrupt.h>
( j/ Q" _. o0 ~# j$ p* L+ G - #include <asm/io.h>
/ u" V0 T) d% e' i - #include <linux/moduleparam.h>/ Z9 n8 |! [4 Y, @) o+ x
- #include <linux/sysctl.h>
, U8 m, @: S& A* u7 W9 S, L$ e5 H0 M - #include <linux/mm.h>" H/ A# h L2 i
- #include <linux/dma-mapping.h>
' z! h7 A6 f6 C& a9 |, I) a @
! N; `* X$ w) ^8 b1 y- #include <mach/memory.h>4 \( e4 w) |2 `6 N
- #include <mach/hardware.h>
. S$ ~6 S1 l4 h) o3 @# [1 g1 V - #include <mach/irqs.h>
' ^. _6 v; A( _! s5 f - #include <asm/hardware/edma.h>
$ T3 X: S& S7 b$ g
9 Z J4 h: `; B _2 W8 c* b- #undef EDMA3_DEBUG
# b1 P8 E) z; p+ c - /*#define EDMA3_DEBUG*/
- `( D9 f+ z. m0 t% T7 j! |5 S - 3 Q7 O9 u: f# _( S/ h
- #ifdef EDMA3_DEBUG# l6 b; N4 b% |; ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: a: h- D. U( H' h! @5 B# w! u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), d8 o# U& `7 \* Q& q4 N, P7 J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 j- ]& ~2 a6 [0 {$ M6 U3 x
- #else
! N! \! N( V! [ m+ W5 d) }/ t - #define DMA_PRINTK( x... )) v" {' f) ?2 d- x- G8 a
- #define DMA_FN_IN8 q/ j3 h, m6 E
- #define DMA_FN_OUT3 V4 o5 r+ @' r% j+ m; G. c
- #endif
4 Q. g v4 q5 G) Y% @ - " u6 v$ k. u7 {' ~$ }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 b7 o, A9 m+ I7 H% P/ z
- #define STATIC_SHIFT 3+ O+ V" k# B$ k
- #define TCINTEN_SHIFT 20, N0 M8 U! e: v- {" U5 R
- #define ITCINTEN_SHIFT 21; u( ?( s" D/ r
- #define TCCHEN_SHIFT 22
8 G' L5 ~- {5 n/ x- r% n1 C - #define ITCCHEN_SHIFT 23
' `, |' | ]/ x2 u
; m M1 z2 |5 p- Z- static volatile int irqraised1 = 0;+ V) V& x. H% d: F, s& Z& \$ Q
- static volatile int irqraised2 = 0;
4 c2 M S% u# k3 @: r2 {: x
+ v/ o! d* p2 h a1 O: R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* W; S$ n" f s- _! C; j& T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ `+ ]; h: W$ e! P2 F, i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ j8 i7 q2 Y: @3 q6 m
V- y- A5 l0 ?7 D& f: p# q- dma_addr_t dmaphyssrc1 = 0;, z7 r1 O+ Q- t. N
- dma_addr_t dmaphyssrc2 = 0;
# E+ h& B% ?& f( q- q0 C7 D" A - dma_addr_t dmaphysdest1 = 0;% {# G" ~ f, C5 D
- dma_addr_t dmaphysdest2 = 0;! ?% Z0 ^6 Y" K7 Y$ o" t
- 2 R5 ~6 n/ E) h/ T, b
- char *dmabufsrc1 = NULL;0 L6 h$ n& Z4 U% }: k
- char *dmabufsrc2 = NULL;
- S* K" n8 U* g# k+ H* ~" s - char *dmabufdest1 = NULL;
/ T& ^ y1 S. V0 @ d - char *dmabufdest2 = NULL;
) o; b6 R2 V, p' y0 H - , d/ Z0 F/ Q ?; D0 ?1 E, }' K
- static int acnt = 512;
* I. X7 w0 b% f) P$ t) } - static int bcnt = 8;2 v6 V6 z0 B8 S8 d
- static int ccnt = 8;6 F+ E. K: O0 z# a
2 q& r- _5 z& k% p- ~* o) o- module_param(acnt, int, S_IRUGO);
) |7 }! ?- X* t) _ - module_param(bcnt, int, S_IRUGO);# h3 ^ j4 Z- _" _' A
- module_param(ccnt, int, S_IRUGO);
复制代码 $ J% C! [3 q; n0 S* |2 l {+ O; E
$ g3 S! ^5 e j W$ p3 m6 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) |7 u; K7 J# l1 S) k6 t. N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 l0 m& M3 ?3 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! {/ e1 }3 Z. ^8 F# v& R; m$ w& J
$ O5 r$ ^% q- H7 p' z% Z& r6 x. C1 w0 ~
|
|