|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 F9 o% ?- v/ |& k& q3 J1 G& p
- [code]EDMA sample test application
! P& p( o5 X8 ^. {; H- \ - /*
4 j# `" j7 E. w7 ?$ m) w3 |) g - * edma_test.c2 B6 U$ Q. T/ x# A" s; x
- *5 Y$ ?# `4 l. {$ t; e
- * brief EDMA3 Test Application
- C/ l. G- o0 {, M. i( T - *
8 F( x3 ?3 T$ e. ?- x1 s - * This file contains EDMA3 Test code.
- E& Z* D7 b& U5 F - *9 Z$ h3 s+ A3 `2 }+ j0 p3 s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. l$ w4 o4 I" _! J; Y6 }% i" x# W5 G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% k. F' M0 t$ ^# ~4 L8 k/ W - * TO CHANGE.( z6 s8 w) P- Z
- *' R' O; F. X* \7 ^, P9 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 S+ K7 p2 q& x1 D2 E - *) J; k8 X# v& w4 g9 i
- * This program is free software; you can redistribute it and/or9 }0 M4 S" V P2 C
- * modify it under the terms of the GNU General Public License as" g1 @) B& f$ b7 |4 g+ F8 |
- * published by the Free Software Foundation version 2.
{/ x) {( z1 P9 g* F - *) k- |; m# E0 y8 m! d4 {. v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 a- f: \0 \5 y
- * kind, whether express or implied; without even the implied warranty7 X4 o6 o4 p$ \/ e1 J3 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& \9 t% Q2 |, E$ s - * GNU General Public License for more details.4 f0 F$ `' W2 G) a9 Y/ `
- */
7 e3 L+ R1 g) h: x& v6 B
2 r+ f; F/ t3 O8 z' E, B! i- #include <linux/module.h>
+ V$ \2 y& e7 Y2 y - #include <linux/init.h># c4 r3 v: Q# ]: t: ~
- #include <linux/errno.h>
1 i( O# X% _7 X4 W( }% d - #include <linux/types.h>5 k, g$ j5 p+ I/ f2 V
- #include <linux/interrupt.h>+ B) L1 O" A' J' u/ l1 a
- #include <asm/io.h>* N" M/ k% s; |5 @) d$ S" g, g
- #include <linux/moduleparam.h>
* d) ?( p/ K# [$ t/ {. K0 a - #include <linux/sysctl.h>) H2 B9 ~- J/ y. z# p
- #include <linux/mm.h>
( F: g3 d4 B( a4 y) c' Z5 W( w2 i% X - #include <linux/dma-mapping.h>
( O* I/ N! B, e- @5 ^ - , m, j" G8 m+ K, j* s. h' n
- #include <mach/memory.h>
5 q4 ^& h6 P+ Y/ n# E- r E - #include <mach/hardware.h>- v0 A( u% @& s3 v( y- q4 k
- #include <mach/irqs.h>
* I- t$ B& A7 l2 W6 u- I9 y: X* @ - #include <asm/hardware/edma.h>
) y& e4 }5 {1 _4 r - % u$ P& Q# n1 N& |) q( ]2 W7 l
- #undef EDMA3_DEBUG% @4 W7 \3 D8 B* V
- /*#define EDMA3_DEBUG*/
, F" a- f F- n: s
K" }& r4 V) S0 i- #ifdef EDMA3_DEBUG
) h7 C% @. p0 B2 d# S9 E' _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, a: Q6 ?% r3 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# V1 c6 v0 ]) f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' h+ D& k# [+ ~$ @
- #else" {2 ^3 ~6 \/ t+ @+ Z
- #define DMA_PRINTK( x... )) Y/ \% c v2 X7 I U2 i
- #define DMA_FN_IN7 `! }1 K9 q! T# e$ M n
- #define DMA_FN_OUT7 P! W, r! |; D, Y% l8 M
- #endif( J" W3 R A& D
# d# ^) I0 N( ?3 C2 a* u4 T2 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) V: {. }( s' P7 f/ b
- #define STATIC_SHIFT 3' H4 P) F* `; F! F7 u/ E# i
- #define TCINTEN_SHIFT 20
" V3 N9 D% X0 p$ i- N V - #define ITCINTEN_SHIFT 21
/ a# Y2 E U. [1 D& ^" h - #define TCCHEN_SHIFT 22
' T9 q' u( K9 L' o; g - #define ITCCHEN_SHIFT 23
7 z) [ d- \! L
: C* Z4 N6 x2 e, a d2 G6 x- static volatile int irqraised1 = 0;- ]7 v+ S, Q9 e+ R8 C: H
- static volatile int irqraised2 = 0;
. f# }6 t$ i/ R - 6 j# S8 Q) M( J, e! F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 q9 ^" k) I% }: @7 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' T$ Q9 T+ y. C/ ?7 C& | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% N1 D+ T9 f+ E/ a, b' S8 Z* }
* v* S. B, @" g5 l- dma_addr_t dmaphyssrc1 = 0;3 _6 e- a/ f, R; i. v' k
- dma_addr_t dmaphyssrc2 = 0;" t _ R5 e- ]3 z
- dma_addr_t dmaphysdest1 = 0;
8 l6 d. B8 h, i i r8 Q3 e - dma_addr_t dmaphysdest2 = 0;% d, \; q2 i d- H
( ~9 u: ?+ H% T2 q6 B4 @- char *dmabufsrc1 = NULL;
1 S+ Q4 f; E! R8 N - char *dmabufsrc2 = NULL;
+ p$ V. W" q. Q; {" \: Q - char *dmabufdest1 = NULL;# `( ~8 k, b* A7 J _
- char *dmabufdest2 = NULL;
7 y/ `& m- I- P" ]+ c+ d4 C+ {: z- e - + f& p4 x% g+ g1 e! G$ t
- static int acnt = 512;5 k/ _+ p! ?# Y( V% F/ d0 n
- static int bcnt = 8;( ^3 Z& y+ c# W5 y+ ]
- static int ccnt = 8;
7 S/ @" `1 r; S8 V" \3 Q - 2 X5 b" @. U4 N7 t- `( [& I3 f1 ]
- module_param(acnt, int, S_IRUGO);8 I7 q; p2 W2 ^: p4 g9 Z
- module_param(bcnt, int, S_IRUGO);
- M1 h. r/ ]8 s% [) i7 l: m - module_param(ccnt, int, S_IRUGO);
复制代码 # z* v4 {. @" ]% Q: @8 N
$ f3 b, M/ f' J; b' C2 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- x; @ Z4 J( O. k* ^" {# b; P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( q/ f4 }. z7 Z. Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% {2 ^' A! T! X4 d
: b( h- ^6 V& d7 ?7 b. l( I0 K1 v6 D! }( |; b$ z, Z& C
|
|