|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 t4 C' O6 _: v. T1 L- [code]EDMA sample test application- M+ j+ | S: `* I% n0 w
- /*
. s* a6 L$ _! W) y/ x8 n! R$ b - * edma_test.c& `0 X/ @. c' ~
- *) {0 m/ N. v- m" K( |5 A
- * brief EDMA3 Test Application
W% O; G. e- W. x/ Z: h - *
, h5 K4 @# ]( D0 t: p2 y6 q4 S - * This file contains EDMA3 Test code.
( {5 x1 _& L0 P2 X - *1 j: `7 P9 ?' S# g3 `- G9 U# I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- _) k7 D8 o' F2 R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 K+ }* l* C8 w, Z9 }7 ]/ I: j
- * TO CHANGE.
8 B% U. e- j# h- L [& ~3 E- [ - *
% P% ]* H) \+ W( I' _4 k9 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 |! [) P$ r2 }
- *1 ~. V, ~6 ~! q$ Z* o
- * This program is free software; you can redistribute it and/or
$ B$ L, [9 z3 ]1 [ - * modify it under the terms of the GNU General Public License as9 W4 }' k0 W8 \
- * published by the Free Software Foundation version 2.) ]0 L0 n/ k4 g( F$ L4 A; {
- *7 B1 _2 [1 t9 ]# b/ f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' _% |. H; R* L/ P) C, m# [. V
- * kind, whether express or implied; without even the implied warranty
6 o6 ^# ^+ q0 c; u* z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 i- Q) ^+ ~& I - * GNU General Public License for more details.
! F }" u9 T1 a3 } - */
2 E; G/ @0 n; ^. _5 \( x/ s
4 a$ l4 ?% ~/ @- #include <linux/module.h>
6 x* m* { d) r: T# `8 d - #include <linux/init.h>: C R* H3 J4 O" g
- #include <linux/errno.h>: \# n) P* P0 _7 h, t
- #include <linux/types.h>) X3 M- r/ Z$ z
- #include <linux/interrupt.h>$ t Z/ [% H6 a( c6 }! g. ]& O/ ~
- #include <asm/io.h>
5 r8 H0 [! \0 w( {) I; j - #include <linux/moduleparam.h>
n4 d$ S( {4 _3 l0 A! N - #include <linux/sysctl.h>; T1 B1 R: b$ P# U9 S
- #include <linux/mm.h>9 m3 `# {( b# B) [% s
- #include <linux/dma-mapping.h>/ ~5 T' ^! Y- |) b5 L' O
% E4 e/ ~! t9 r6 ~1 Z$ B2 `- #include <mach/memory.h>) H6 f( u2 @" P1 i0 c* b$ {1 d
- #include <mach/hardware.h>
, |. ` q( i1 V( |/ z - #include <mach/irqs.h>
% h5 v/ W* R* _4 U( }( ? - #include <asm/hardware/edma.h>: u' h& m5 b" G! X9 f
- . B& q, l4 H i9 t. _1 D
- #undef EDMA3_DEBUG
3 ~" D! l6 g m5 b6 ]- H }; ^ - /*#define EDMA3_DEBUG*/* r1 v4 }6 N# c7 b1 ]+ F' e' _* m! a
1 e1 }! D$ s$ X( l) G- #ifdef EDMA3_DEBUG
& x6 }$ }6 ]) @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" D) @3 ]2 L8 a# p: y% e$ g) \) B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) p6 O# X' m/ v6 z; h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 Z- i2 X1 _; I: ~3 P
- #else
5 }3 w! |- a0 N. f% }6 [) `/ t4 r - #define DMA_PRINTK( x... )+ H% B& F6 i5 j, {/ p$ j
- #define DMA_FN_IN- h8 w) N7 B; M ^! c
- #define DMA_FN_OUT+ @5 o, Z9 g' A2 Z+ @
- #endif
, p# n V# U: J5 b
4 V- p% w! H! M: K5 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768): K1 x* [1 {( q! H; H9 |$ h7 o) ?
- #define STATIC_SHIFT 3
9 E* b! k. Y9 S4 G - #define TCINTEN_SHIFT 208 M8 ]% _8 {2 t0 P- S. L
- #define ITCINTEN_SHIFT 21
4 z; @: F) z, A( f. n. ]3 j - #define TCCHEN_SHIFT 22' L! w+ G1 M1 Q6 i
- #define ITCCHEN_SHIFT 23 }1 |/ ]9 d7 u, }- ^9 q% i1 I% v
% ]0 b' ^! f' [) m0 z# g- static volatile int irqraised1 = 0;+ d" z+ l# Y8 w: h7 e! F
- static volatile int irqraised2 = 0;. w6 T3 J/ V, h! t( [
7 `& d/ G$ o* u' W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y. v. p) F* z: V- v9 r$ B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( n2 E$ H% c. W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. g# I# a% v- x- A( W7 Y5 Q
8 t5 Y/ x m( F* @ w" H5 a, E- dma_addr_t dmaphyssrc1 = 0;
5 h: l! L( K) {* @+ f: _( `3 ^ - dma_addr_t dmaphyssrc2 = 0;
) |- o/ \1 E* _5 D4 n& S - dma_addr_t dmaphysdest1 = 0;
. V# t) t6 f/ ]7 k - dma_addr_t dmaphysdest2 = 0;
) L( p/ G2 d4 m% o, V; z$ I, _ - 6 k5 o9 P/ I; }4 j" w
- char *dmabufsrc1 = NULL;* q2 u) m8 G/ S. A7 L: [9 h, A1 F
- char *dmabufsrc2 = NULL;
0 M1 C6 b$ x1 t! x9 A H - char *dmabufdest1 = NULL;
6 J* u# S/ H T: u/ u1 S& Y - char *dmabufdest2 = NULL;/ c* R* ?6 H! l- P4 f9 g
- $ q+ N! N7 r; z" f5 [( w( N
- static int acnt = 512;
- w: [+ F& J: O& Y+ j& U - static int bcnt = 8;
: R) U/ T* b; c3 s3 N k - static int ccnt = 8;4 u: q5 Z: \4 Y9 k( n% _% n
- # P! l& v% k. K) k
- module_param(acnt, int, S_IRUGO);
7 |6 [3 Y4 D+ ~5 l1 |$ P - module_param(bcnt, int, S_IRUGO);
, t/ y7 w' V4 D/ u* |* X6 ` - module_param(ccnt, int, S_IRUGO);
复制代码
0 ?# b, I! q& _+ t7 l' z% i/ V0 O$ O( k4 l9 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# ?3 G* ^5 Z% `) U( q2 m! Z; ?. T Xarm-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 z* Z& E; f& P2 b& b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 s3 x% w) t( Q' E! `; s0 E1 R" y. |: S6 Z* B' c Z K1 U& J
& t, Y# p) F- ], A+ R
|
|