|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 S% Z( E. g; a: x! q' l
- [code]EDMA sample test application+ k; m, p# n! f. H/ L& U9 v, q
- /*
' S S6 V6 n9 \# n1 g - * edma_test.c! z; Y9 G* J3 u6 D( K. D c
- *. F" Z b U9 m, Z( E2 T; c
- * brief EDMA3 Test Application4 V8 {5 R8 S& R7 w" w/ d9 }5 [
- *
! ?% f+ ]5 Z5 `" L3 \) W! |- p - * This file contains EDMA3 Test code. z9 Y. T; x0 ^
- *# U1 }9 j; Y" l( y& m8 u- [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ?7 c0 Y( g1 C- M5 v& |' \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 n7 ~9 C- Y2 X2 v- S/ z; f
- * TO CHANGE.
1 e* l3 R" t/ T0 \, l& l# I, ] - *
9 c& ?, C# E$ `7 _; V( c, ~. w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 G7 b' g8 Y8 }, R ?) @1 X - *$ ]6 o) l+ x7 I- t; ^
- * This program is free software; you can redistribute it and/or" A3 e5 w ~4 R C [' Z
- * modify it under the terms of the GNU General Public License as# d0 R" L# L9 ~6 f0 T
- * published by the Free Software Foundation version 2.( u. Q9 G( d+ E" f$ M
- * p- R' o, G* v/ {! v9 @) R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 R/ k x+ q% l6 B - * kind, whether express or implied; without even the implied warranty
5 W& b$ m0 ^- m: u: U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ U% K. S4 C! k$ c( G) q K
- * GNU General Public License for more details.) B' {) v# O; j; `- X
- */: D1 p: c0 s# S) B5 ~( R7 s$ \) o
( K) [& ^( m" S/ }& }$ o9 i- E- #include <linux/module.h>
% ^+ J& V& |" r% @ - #include <linux/init.h>
+ q# X& m8 z* f3 B- b; ]; H - #include <linux/errno.h>
, g( s" {" b. x [ - #include <linux/types.h>
4 Y+ F- f) q3 q1 y. p - #include <linux/interrupt.h> I7 ^3 c% P0 A. v6 w
- #include <asm/io.h>; J6 A5 z4 \! ^7 m( u: X, O
- #include <linux/moduleparam.h>" j& x& t i* H& Y1 Q
- #include <linux/sysctl.h>$ h" f3 {( C8 C& x( D, @ r, H' d
- #include <linux/mm.h>+ ^& O7 s3 I& I }
- #include <linux/dma-mapping.h>
% \# j" G3 O- h8 o: ^& k) }. @
9 L+ r h7 W0 L, \8 }- #include <mach/memory.h>; j2 p' h1 @1 _7 N
- #include <mach/hardware.h>
) x) m9 Y6 K$ m; i& R+ Q+ _ - #include <mach/irqs.h>
8 u- b1 ^9 } h$ l5 y - #include <asm/hardware/edma.h>
+ `& o- @# r& g; l - ( d* b4 M# f) h' k1 V% i' L
- #undef EDMA3_DEBUG, @* H; Q( o7 n
- /*#define EDMA3_DEBUG*/ E8 r- `. q3 N+ H, I
- " m9 n; \+ S7 ?
- #ifdef EDMA3_DEBUG
; C) @& J. h9 H3 f6 n/ d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 x' }& f. u3 ?; e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% W' \/ G9 p7 t4 A* a6 W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 ?( J. W4 n( m% l7 A- t - #else) q% L* ]/ p" h' G$ G2 e4 N; G0 P
- #define DMA_PRINTK( x... )/ p% B g$ s5 ~
- #define DMA_FN_IN6 c: u& Z6 c2 P0 F
- #define DMA_FN_OUT0 u" }' s4 k# j6 {
- #endif3 D" L3 T" N/ I5 s/ U; s3 l! I8 @
7 k# z: W3 e3 h2 ?6 f) _# \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# i& ^9 U* q1 H/ j. U
- #define STATIC_SHIFT 3
- D+ r* f; M- P j% Y5 @- I l! d - #define TCINTEN_SHIFT 208 A3 K5 l+ D& m4 [
- #define ITCINTEN_SHIFT 21
& _" m4 \9 g2 {; f& { - #define TCCHEN_SHIFT 22
8 ]0 _( {+ o( u, Z# V - #define ITCCHEN_SHIFT 23
/ q3 z8 G1 x) ~3 j" |$ [
0 F/ r$ s: w5 ^, P- static volatile int irqraised1 = 0;
" H; m/ p' D a1 Y2 m - static volatile int irqraised2 = 0;; \; L) F- P2 k* I# b
! A4 r; v8 d9 N" G2 w6 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 H6 W1 `2 s- d0 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F! l+ \. z n( w( I* U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); O0 V8 t3 U; r; G. \
- 4 n* l; B. n9 N5 M: L% G P
- dma_addr_t dmaphyssrc1 = 0;9 o ^5 x6 B9 [3 w
- dma_addr_t dmaphyssrc2 = 0;
% f: }# m6 h4 C4 W - dma_addr_t dmaphysdest1 = 0;$ h: I* Y. X1 E0 b! x1 s5 g# s
- dma_addr_t dmaphysdest2 = 0;
, {; h/ z/ t. z O9 W7 K3 @* v - 9 K& a1 v# p0 Z* m
- char *dmabufsrc1 = NULL;
" ~. ]1 r. n+ |* q - char *dmabufsrc2 = NULL;
: U8 Y B, s& l& O Z - char *dmabufdest1 = NULL;- [9 ?7 `- C, E( E4 x$ c- _
- char *dmabufdest2 = NULL;+ \& o' n5 c6 p: O
- & C* I. c* b' G& n- G+ ?
- static int acnt = 512;( l1 U. c; `8 F. ]9 g
- static int bcnt = 8;+ N2 L& K0 y3 w# I1 r" L) u; i4 z
- static int ccnt = 8;* h7 ]! u \# m# g: x9 q% }
+ T( E0 g, |" U7 D* g( u- module_param(acnt, int, S_IRUGO);
7 h* ~$ h- J& r) T& X4 W* _ - module_param(bcnt, int, S_IRUGO);
$ g5 c# }* c+ c* p - module_param(ccnt, int, S_IRUGO);
复制代码 " V7 ~2 B$ b7 `+ V# M
( Q4 X8 x6 H* b8 C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: Q e1 o5 M1 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 `$ t4 B. H+ X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 u; }7 n0 w9 X4 k1 S `4 [
' |' n" F5 y2 d/ I0 n6 l& S
5 @" [ i( A! ? |
|