|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( U( q( f) F' H1 G3 ]- [code]EDMA sample test application
, S5 F m$ {# w, M. @2 W+ S [ - /*' ~- {" e+ }0 m& a- h2 b3 @3 [
- * edma_test.c- m) \6 m& C+ {6 ?# |
- *% V: X! C$ h: P; q6 \0 L
- * brief EDMA3 Test Application: Z, D0 O6 R& _, h# @( ^' C
- *. R3 h5 i$ ^6 g- s# E# `% d
- * This file contains EDMA3 Test code.
' O4 B# `7 ^$ t8 L& t - *6 g6 y7 e' Y0 P# ]/ P3 p8 i3 ?4 [: }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 W. K0 A1 U r! |- v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& y+ `6 _/ p& O1 l* r - * TO CHANGE.
* |+ ]9 g4 {: q) D; r! i - *- r/ D% ]. Z& }' U: m, C2 g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 s7 C1 A; l2 y4 ]1 Z - * G; I' j5 W. c0 q6 Y
- * This program is free software; you can redistribute it and/or& b% B/ Z, C9 ?3 X) F: l6 C5 C2 i% f7 ~
- * modify it under the terms of the GNU General Public License as# t# `$ s0 A' W/ Y, @
- * published by the Free Software Foundation version 2.
+ l$ [, \2 g& d - *
- Z! q$ J2 r# E0 a5 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 r9 T8 y, R c; y9 V- z& d - * kind, whether express or implied; without even the implied warranty
0 \: M2 ?6 D/ ^$ C1 |9 W) ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ E7 T# |' ^( b6 D- z
- * GNU General Public License for more details.
0 Y. z; I' u. Y; d' a( ~ - */3 O( `5 ^1 u+ s6 ~$ N( u0 ^8 u) r
1 W8 ^& h" O% z; V/ v! d( S- #include <linux/module.h>
- S) o, f( z0 l1 J. y+ m/ R* i' S8 | - #include <linux/init.h>
* {" {6 \# K9 m3 E7 J - #include <linux/errno.h>* c) o+ o, @7 H/ [, L" w1 S
- #include <linux/types.h>
7 F% v, n6 H: c0 U* t; r' F - #include <linux/interrupt.h>
# Y/ \/ n2 F1 s( y1 { - #include <asm/io.h>. S7 [) _% s2 A5 f1 }# Y9 \- _) v
- #include <linux/moduleparam.h>0 @/ W& e2 X9 j, @. P, d
- #include <linux/sysctl.h>
6 |9 }9 {5 I' \* {! p- S0 p7 C - #include <linux/mm.h>" L5 `: [* P$ t2 O! [ n' k
- #include <linux/dma-mapping.h>
- F" t) E7 Z( Y$ _1 A7 ?
9 z# L2 e# A [. Y- #include <mach/memory.h>
- T& p( z; P. l1 z2 C& Z8 b, e - #include <mach/hardware.h>* K# d$ V6 X, E& e* S* y
- #include <mach/irqs.h>
; T0 U$ o8 P8 w; w( _1 n - #include <asm/hardware/edma.h>3 t2 o: k6 U, C& W, n4 |
/ S7 c9 i; [2 ?7 R/ P. C7 z- #undef EDMA3_DEBUG
: j% @, z. O# r& C# t* E - /*#define EDMA3_DEBUG*/$ \; a, R( y! ]! D3 U
- . D5 Y# t6 B8 ]0 y2 ~1 X5 }: ^% Z
- #ifdef EDMA3_DEBUG
' M- Z% A8 F' H" d8 M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# b5 d. ~9 m- W, T, }; j: U$ |8 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ P2 N6 @! b1 n2 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ W( ?$ f9 X: @6 G$ _3 S
- #else
: f1 N8 \0 U: f3 n# \- g - #define DMA_PRINTK( x... ): U. y+ k) k/ j1 w
- #define DMA_FN_IN# ]. H: ^- ~. e+ S
- #define DMA_FN_OUT2 m' F8 ^2 B( \0 [, O6 ]- u
- #endif, |* J' I1 ^8 F; v
- / |0 X, t' S! P# H5 l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ _ U9 ?' a" |
- #define STATIC_SHIFT 3
. m! u9 G4 V' T; T3 N3 O% [ - #define TCINTEN_SHIFT 20
( q: T. b' l* k9 s0 _; S8 w - #define ITCINTEN_SHIFT 21. r3 `4 m1 a4 l) h' m0 i: s
- #define TCCHEN_SHIFT 22
( J; S( v. {. R2 F5 T% D. p9 Z2 p - #define ITCCHEN_SHIFT 236 |& G! p& T0 L4 ~, Z, b
! U2 K( D; L: ^3 V, K7 ?3 u+ s- static volatile int irqraised1 = 0;
! P' n; I; n1 v8 t2 s, X: q% O - static volatile int irqraised2 = 0;
, J1 B) Q ~4 L( B8 b/ ]: m - $ w1 U! Y% F; m- \& G! Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 U7 @( m4 h8 L/ A: S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Z, b0 X% Y7 |, Y( w9 s3 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* a) Q/ l8 j( P% I$ h" m - * J1 p+ C/ a' b$ W- Z
- dma_addr_t dmaphyssrc1 = 0;
8 }0 M& u. ^% c - dma_addr_t dmaphyssrc2 = 0;
+ a) X1 {2 e; \! e% x& K, o' I- I2 X - dma_addr_t dmaphysdest1 = 0;/ c; d% r ^& C7 {" \
- dma_addr_t dmaphysdest2 = 0;
/ ?# O1 _+ u% Y3 f- G" v - 8 ]8 |- g- d/ O+ [$ }6 t5 _$ K9 U
- char *dmabufsrc1 = NULL;
' w0 k y- t" B - char *dmabufsrc2 = NULL;0 h2 g: W) q) y
- char *dmabufdest1 = NULL;4 a0 E( F4 b! ]
- char *dmabufdest2 = NULL;
' W; j3 b5 F$ }) k ~) M8 g/ E/ `
- {6 i* M; R: ~+ n# U0 J+ ?- static int acnt = 512;
8 X1 l6 z- [3 c7 s0 @ - static int bcnt = 8;' ^) _ r$ x/ z1 Y
- static int ccnt = 8;
& ]. e9 B+ ?$ w1 e' U- ]5 j$ q - - r! K3 k) C+ v2 _# ?
- module_param(acnt, int, S_IRUGO);
9 y6 I7 B. P5 I4 L' S: b2 x- I( `# ~ - module_param(bcnt, int, S_IRUGO);1 n% n% @$ U( `
- module_param(ccnt, int, S_IRUGO);
复制代码
/ N9 s5 }9 `8 I t. M5 K$ d' s' R8 a8 \, M5 C2 P9 O3 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) E H: l0 r+ ]! x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: A% n3 l- e, @: V. O2 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ?/ E( H. O2 E# p' F; n" W* d8 N1 |# p! f8 }
% l4 S1 W# a9 _+ N, \6 P |
|