|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- X+ s% ]. L4 O( F! [ _1 c+ C- [code]EDMA sample test application, c9 h. `$ j! r
- /*
9 o2 O1 I6 y- B; h - * edma_test.c
- j* n8 Y6 L$ R* x& b6 P# h" l8 w - *
0 p2 K, Y' u, y" C. Y - * brief EDMA3 Test Application$ I/ W1 R( ^, a4 N. C& I; b! p
- *9 b: D+ u/ x* `* A; i
- * This file contains EDMA3 Test code.
- e' C% O% X: X4 A - *+ u( o% _+ h" ]0 M) f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 e1 u. J, x r7 v: s. W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ z. s* d. ]" A
- * TO CHANGE.
( C+ s0 O' [4 u: _ - *
% N5 j2 s" F; l* b, [- L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; @( J; C8 w" t: }( @) _3 t' @ - *1 V" Y' ?, K8 A& R
- * This program is free software; you can redistribute it and/or7 v& f& |% W7 x
- * modify it under the terms of the GNU General Public License as
/ y9 t# e; ~8 Y) v - * published by the Free Software Foundation version 2.6 n. [$ K6 q# N$ m1 q
- *
* P" a7 Y* i9 h6 K" B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; L* q) p% b4 u3 D - * kind, whether express or implied; without even the implied warranty
4 r, G* | p/ I3 L: J, l, K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 \% R4 {, L* S - * GNU General Public License for more details.! B/ ]2 {1 Z6 i; Q6 Y% @
- */* u: A, u# K3 A; f% T/ l3 C
6 @* C8 [3 `; n# J% X1 H7 R- #include <linux/module.h>7 Z2 T- O* j: V. k
- #include <linux/init.h>! t8 M! d, X. ?( ?0 D( F) [, e
- #include <linux/errno.h>1 q! D/ ~' x. k8 M6 E" d
- #include <linux/types.h>
- B. t) c- |3 t8 Q& r - #include <linux/interrupt.h>; _9 i) ^- [/ b x
- #include <asm/io.h>& y5 p P4 w" ?" e( K) K9 c
- #include <linux/moduleparam.h>
! A) ^) x2 }2 s - #include <linux/sysctl.h>3 a" N" B, A* ^$ H
- #include <linux/mm.h>& e$ u5 A, N* `6 W1 {% x- {
- #include <linux/dma-mapping.h>" `. T/ @7 ? t5 o3 ?( j
. A# B7 }" ]5 G9 H# N- #include <mach/memory.h>; {+ f! J/ I1 h0 O. @, r# [8 N
- #include <mach/hardware.h>
8 f/ {0 k6 o8 I6 ^' B$ ^ W7 x) x - #include <mach/irqs.h>
/ x. T: W9 o. Q% w v - #include <asm/hardware/edma.h>
' W/ N7 S) L- W4 B9 L5 G
0 C+ I! b1 S6 G& m3 y+ P: ~- #undef EDMA3_DEBUG8 Y r" S$ i, L+ s1 p
- /*#define EDMA3_DEBUG*/
# O7 Q/ [4 l& T0 C ?6 i; m; E
! F1 l9 U' O( r, Z- #ifdef EDMA3_DEBUG
, P2 h R" o- \8 N4 l& j6 U( n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) f' X5 u7 I0 d& i7 Y) O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! d1 P9 ]1 z& L6 e5 `: P+ { {, t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* p% X \$ d1 _, k* \2 |6 \" J9 A - #else
M* [2 D+ P2 A9 I$ |) \$ {4 ` - #define DMA_PRINTK( x... )1 K/ q( O( s6 J
- #define DMA_FN_IN. a; E `9 W# L" p
- #define DMA_FN_OUT* k# ?/ K. U: |, L. ^+ O
- #endif- z8 S2 j! e: s* e6 \8 [( Q
: D8 x( R, Q4 n& f5 N$ t9 S$ R' w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
G$ b1 G( h1 \9 f - #define STATIC_SHIFT 3" m/ ~ K, ~1 V* S2 h) r
- #define TCINTEN_SHIFT 20
; g, ^8 b# ?) i8 I/ T3 J8 S' W- ^ - #define ITCINTEN_SHIFT 21
9 @1 m' {* L7 W6 z - #define TCCHEN_SHIFT 22' J5 c* p/ ?7 n0 n, y
- #define ITCCHEN_SHIFT 23+ H$ [5 j4 L" ]
9 I5 ]* x, B+ w3 s. W* J- static volatile int irqraised1 = 0;
5 j6 Y( i- B0 L |2 u5 P! ~5 S - static volatile int irqraised2 = 0;
# D% ? ?; w8 r7 S0 s1 p6 q - , z' W( d J/ [2 B; }1 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 k7 f) s' j2 @- g3 u! Y0 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. E: t! \. |) o: S0 _, h6 Y, d+ I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 W- T( i2 T" T3 ?; F, o - + ^1 F+ `5 U9 @% C3 z
- dma_addr_t dmaphyssrc1 = 0;) l% }* c' j2 f3 ^* H: ], D
- dma_addr_t dmaphyssrc2 = 0;6 Z0 P1 C- S1 a1 G
- dma_addr_t dmaphysdest1 = 0;
9 S3 Z7 X9 q ` - dma_addr_t dmaphysdest2 = 0;
+ ]1 A# q$ ?+ v/ a" }: D - - R& X) j5 ?/ p
- char *dmabufsrc1 = NULL;
, p* {7 h# C+ b - char *dmabufsrc2 = NULL;7 U& M0 I+ @ D0 B+ R( G" I: t6 Y' z
- char *dmabufdest1 = NULL;# l* X _0 a1 c! b+ Y6 p1 e
- char *dmabufdest2 = NULL;3 O% V! O G& l, @* m, g C$ h* O
* x$ J2 j' @$ ~4 z5 }3 L3 u- static int acnt = 512;
5 [ M. c/ X% i: z - static int bcnt = 8;* U: t; `+ _+ H
- static int ccnt = 8;. E( C9 b& O" i( f7 @0 J
z/ i9 S) D8 O0 Y* ?- module_param(acnt, int, S_IRUGO);' j/ J: R0 r3 r6 ]( B& R
- module_param(bcnt, int, S_IRUGO);+ } S$ O: h2 f" ~2 ~
- module_param(ccnt, int, S_IRUGO);
复制代码
9 _4 l/ }+ [. k$ c& N) {2 s/ l6 F; K. k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 Z% a; y( p9 {0 w* H: P6 X$ H4 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- @8 w/ u o# K9 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ q) W0 Q4 t. k! _8 {+ t# c1 v
% h0 G. [' d& F$ m+ o! P
|
|