|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 v/ E6 |6 x$ A: G9 C9 [
- [code]EDMA sample test application
. W5 l8 D5 _+ ?0 c - /*
9 A/ F @" G( A6 P% j - * edma_test.c9 R( z( \0 B$ w7 k. m3 S* r$ F
- *# V9 ^1 \$ U6 p+ ~0 c
- * brief EDMA3 Test Application
0 s$ I: \& v. D - *- k5 p6 L, {* t* I- w @8 r' q
- * This file contains EDMA3 Test code.( b. X( v* x% D( I% ]1 B1 x# E
- *
1 x9 W9 D2 B. P- ]5 A3 Y3 q' q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ m& T& s) ^- h* m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT j7 Z: l% [2 B+ T
- * TO CHANGE.
) l0 _/ w2 B. z. [) I - *0 t( } \; m) s: c4 a3 P/ G( o: n% j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* k! a$ e( {4 @0 j - *! M8 t+ d, J" C6 L5 D1 ^4 T- d2 J' _
- * This program is free software; you can redistribute it and/or# }5 j) u1 x7 \# c* r3 ]9 y
- * modify it under the terms of the GNU General Public License as- T0 h/ W0 j" t$ y, j9 J$ \
- * published by the Free Software Foundation version 2.% P; q* Q. `1 O. G
- *
8 J1 ?: I% U$ @, s% m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ C2 i" |) S$ i9 w/ q& W% {1 Q
- * kind, whether express or implied; without even the implied warranty6 |# E9 ?: c7 G! D2 K9 b% g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" }$ E1 a1 X5 O4 u6 Y
- * GNU General Public License for more details.
F5 M$ `4 U; t- y/ Q) x - */
j+ j" E, H) K - / p8 `% c* T9 m. U' T' E! B
- #include <linux/module.h>
: y! A9 }/ G6 ?* U3 D! Y - #include <linux/init.h>) x- B8 t0 \: K& g/ E- a$ `
- #include <linux/errno.h>$ {& c: N, B1 M/ {
- #include <linux/types.h>) g. g3 a8 e/ Z, B! S
- #include <linux/interrupt.h>
7 _. l$ _ x: ^# |# s7 M - #include <asm/io.h>- }3 O/ S/ d* R1 n" k; _: g% j
- #include <linux/moduleparam.h>3 I3 b7 L. Z9 W$ u2 r& E4 X
- #include <linux/sysctl.h>
" l. F9 e/ K- n0 R( E - #include <linux/mm.h>" a+ ]" `1 |! M+ T o
- #include <linux/dma-mapping.h>7 Q" Y( t2 _% u- P1 k! F7 ]: ]
- 2 w0 s3 U- F8 `6 N* `
- #include <mach/memory.h>
( t5 b; L' ?1 X2 q5 U: O3 G# _ - #include <mach/hardware.h>4 Y; d, }) A8 {& Z9 }- Q
- #include <mach/irqs.h>& [- A# }+ [( l8 v0 M
- #include <asm/hardware/edma.h>
4 E6 ?$ c* F' b" F( s$ _ - , @) j9 D' i5 v4 n, m
- #undef EDMA3_DEBUG
! ]. ?; _- `! U& V - /*#define EDMA3_DEBUG*/
/ M* p. g" h4 e" t6 _) Q! x
2 a$ g# l6 w1 N- g- #ifdef EDMA3_DEBUG
$ u4 w5 y8 [9 L" `8 c: i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# V2 x# d/ r2 @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" W0 f; Q, t; p' e$ @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 c# t/ {0 R# z! Q8 | H - #else
y4 w; Z$ k/ p4 ^' f - #define DMA_PRINTK( x... )
& X/ e- L4 _/ f% s+ x% d - #define DMA_FN_IN) r5 F( W; Q1 I! c- z: k1 q
- #define DMA_FN_OUT: d: i5 m* i+ A2 O
- #endif+ R+ f/ n0 }' ]0 \: y6 p
- $ w- X6 R6 l% f" D$ ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, K# O$ q# F, n% l0 S: F$ E - #define STATIC_SHIFT 3' l! J3 [" z g& X# |6 e) v, T: |# _
- #define TCINTEN_SHIFT 20
- {' M7 ?% k* \7 e& k - #define ITCINTEN_SHIFT 21$ N* t/ E& e3 L" m$ _- E- ^" U5 |
- #define TCCHEN_SHIFT 22
3 X- \7 k* I5 O% o2 s - #define ITCCHEN_SHIFT 23( F8 }* q/ i9 Q. r
- 7 \# n8 W7 q S6 G/ [4 L8 @
- static volatile int irqraised1 = 0;
0 _# R- A c# Y- |6 s: s9 k+ x - static volatile int irqraised2 = 0;
o; P9 `7 W, n( H3 r
0 i! [0 F$ V7 g9 N1 f7 t% d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ `/ _$ Z5 A; z* Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Z1 M9 ?# S9 j- B: c/ [& v3 E" Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 B( v, |5 K0 W1 l& P
$ x l. u0 W1 Z% s- dma_addr_t dmaphyssrc1 = 0;
/ P% _) `5 l" _, p - dma_addr_t dmaphyssrc2 = 0;4 F' E/ p% U0 N; K
- dma_addr_t dmaphysdest1 = 0;' m( K$ I- H9 ~
- dma_addr_t dmaphysdest2 = 0;2 h* X7 B* {2 k
8 ]1 \) d$ c7 | w* c- t5 X- char *dmabufsrc1 = NULL;
8 e) A6 E, j o9 E( N% ^% w. U% ? - char *dmabufsrc2 = NULL;
, n. _ @$ a1 y/ l - char *dmabufdest1 = NULL;7 x! B' j9 x/ [; K' q
- char *dmabufdest2 = NULL;1 Z- l" U$ e2 E5 c2 |+ S
- , K/ G3 z5 S0 J, G* A
- static int acnt = 512;0 o8 x/ ^5 q! a
- static int bcnt = 8;" u3 v9 v8 }' O6 J4 a
- static int ccnt = 8;
5 T! t% H4 ^% B4 e) @ - % t C: J8 J$ M- y; I
- module_param(acnt, int, S_IRUGO);' h9 q! `% W. j+ q
- module_param(bcnt, int, S_IRUGO);
+ D/ V; ?6 n# F - module_param(ccnt, int, S_IRUGO);
复制代码 $ i) l% N% t* v4 k/ k+ ^
$ h8 r3 I5 J/ f' ] b& K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# p7 E: ]5 I ]4 q& O+ e3 B0 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. ]6 _; J) c: w. C1 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% @4 p N) [# T9 ~4 e ?
' l; b+ s% S" n3 m: s, Z4 u+ G9 S5 o0 r8 W9 R' p
|
|