|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 h# g, S( I2 C$ l; [( J- [code]EDMA sample test application
7 r% s: f2 f! I# W+ u - /*" v9 |9 v. e8 V* g0 r$ D
- * edma_test.c& T( Z- c# d3 n; s7 p- K8 i
- *
v" p7 \7 f1 m! W - * brief EDMA3 Test Application, L5 ^0 I& Q3 M5 Y: ~
- *
& q3 b4 _# ]* s' l: U( L% X, X - * This file contains EDMA3 Test code.
( b, Y( k$ q _: d - *
4 S7 l) a" ^$ p4 d" B& g9 {) _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 Z! z$ w& I5 [! b' |! N& [: @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* F$ \! Y/ s6 j& a6 x* o( z - * TO CHANGE.' `8 Y+ H7 e1 u5 \% r/ J# h7 P/ H
- *7 i& S5 s" G8 f- X/ a2 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- d6 x+ a% \1 U {; W
- *
; N8 M2 A: k/ y' O, r/ [ j/ Y+ u - * This program is free software; you can redistribute it and/or
! U. T$ q3 o- M+ U - * modify it under the terms of the GNU General Public License as9 k3 H R" R9 l( A
- * published by the Free Software Foundation version 2.4 M# x$ w9 U$ ?' |) a: Y
- *5 ^. ^9 K, i- y c) W2 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% Y" X% ]/ h; w+ c - * kind, whether express or implied; without even the implied warranty$ g* F& {5 [5 M+ l, C4 K5 r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& [" n% q7 d6 _0 _0 X( Y- B; }- b5 ] - * GNU General Public License for more details.
! ^0 d8 J8 _9 r. \ - */
* t$ o8 m/ z" i% B6 t
2 a/ ^3 @4 A7 S# i% v- #include <linux/module.h>, v$ Z3 X4 z/ U# u3 Q
- #include <linux/init.h>- T" y. j" I6 [
- #include <linux/errno.h>
7 j& w) P' c4 @/ j. [; C - #include <linux/types.h>; F5 k* Q' J- s7 ]
- #include <linux/interrupt.h>
/ ?. h/ H. Q, \, v4 W9 l/ ?9 B - #include <asm/io.h>
; p; v' V) l) Z4 A! ?" m1 |5 t - #include <linux/moduleparam.h>) F$ r3 H% x2 m" ?5 R
- #include <linux/sysctl.h>
* ]$ [) q( I1 U; L - #include <linux/mm.h>
( L+ g" g( ^: C: v - #include <linux/dma-mapping.h>
# ~- P2 S5 _, d& _$ c' B: s2 j& M/ [1 D
+ q1 |! o W4 y, ?- #include <mach/memory.h>
* q7 F1 [' o9 b - #include <mach/hardware.h>
7 ?' Y: V0 v5 ?) r8 Z - #include <mach/irqs.h>8 }/ [. k- [4 k: X- C W
- #include <asm/hardware/edma.h>
\- B3 P# p2 b9 i. S - ( r; Q# @7 K7 r! e f( }( n
- #undef EDMA3_DEBUG& O4 W/ m3 R. r8 P5 R
- /*#define EDMA3_DEBUG*/5 p9 H( c" J4 |1 _- X
+ y6 Z, \; ?; I* I- #ifdef EDMA3_DEBUG
; u7 K8 P1 W& M! J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). o1 i; D1 Z: H+ X& `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 t7 w. X7 j& G" G9 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ Q1 b. M. s9 S3 D5 d - #else% \6 R5 w) Y' m8 m( N
- #define DMA_PRINTK( x... )
# Q! `2 n+ p( s - #define DMA_FN_IN
. r% f/ w$ u9 k& W: | ]5 [" U - #define DMA_FN_OUT
1 x* N0 m3 p/ u( \/ ` - #endif
. M( |! K1 M8 S& ^
7 s1 L/ g, a: X, X" }# A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# M: T L5 j6 H1 h2 y8 L5 `
- #define STATIC_SHIFT 3
) H" V& i4 R6 M( o" T: o - #define TCINTEN_SHIFT 200 g/ P, B+ t% z9 ]: G
- #define ITCINTEN_SHIFT 21
9 G3 l$ x/ T4 l7 R! i; _ - #define TCCHEN_SHIFT 22
4 q' Y3 a+ @" C1 _ - #define ITCCHEN_SHIFT 238 b. r! z' m% F2 {5 v4 ~2 A4 t
- % x) }5 S, O# t5 ]0 f
- static volatile int irqraised1 = 0;5 @9 K0 ^) r; I$ P7 I
- static volatile int irqraised2 = 0;& M3 h ]" {1 R6 g2 ^- L0 d. y. B2 {
- / o: O9 M) h2 @4 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# c0 }2 F4 F* [& `/ m" x8 |1 p2 J$ ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 O8 j9 R0 k6 q; I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! B% E, u: R( v3 Q* i) E - ) G& r9 y9 X6 H4 [0 J9 x0 W
- dma_addr_t dmaphyssrc1 = 0;
) H$ i) B# ?( N0 F$ f) Q - dma_addr_t dmaphyssrc2 = 0;
4 c+ S/ o3 D7 B' E4 q. |) q' P - dma_addr_t dmaphysdest1 = 0;
0 S$ _( b# W) q/ y - dma_addr_t dmaphysdest2 = 0;7 O* V9 G1 @. ~0 U
- , ^3 G0 }, o% `& W
- char *dmabufsrc1 = NULL;
^7 |# {9 S7 N. V0 s( f- K - char *dmabufsrc2 = NULL;
: q) r8 G9 @" t+ o5 Z' `; M - char *dmabufdest1 = NULL;
9 h' e3 ^+ b+ B; ^. ^! Z2 J - char *dmabufdest2 = NULL;
2 g4 @& Y& J2 k' T) C+ N" b3 }
% E1 Q6 ~# g a+ Z: | `) ^7 a- static int acnt = 512;
* ?" _( z& n# [1 G3 K- D - static int bcnt = 8;
# Y+ K( a; {8 j& C& w" M) \ - static int ccnt = 8; G* y. M% [/ ]
- - Q5 K6 T1 n! F% h! [
- module_param(acnt, int, S_IRUGO);5 p6 i4 B( l/ L4 X. }& A& @8 P
- module_param(bcnt, int, S_IRUGO); d% I8 q9 I O$ D ?% R
- module_param(ccnt, int, S_IRUGO);
复制代码
5 N# X5 a+ l5 H
* B1 V. [5 z- ^; r, I4 w; N/ s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 W$ O, t9 o) I) a _4 ?+ V( A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! ]7 i4 S1 B5 J9 D6 P" Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 B9 B, i, d2 I* H- N/ A8 v
) ^- r5 C6 n) [: `, S0 N; j9 x
* k5 M/ I8 s% F3 v |
|