|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 \, i6 e5 f# _3 k7 w' k
- [code]EDMA sample test application
5 Z" f, R; w: [0 g M u$ c( B& } - /*
4 v. [+ F2 W1 [' e! B - * edma_test.c
. _4 v) L3 N7 A5 S+ r - *. a! O2 d: Z8 Y) R
- * brief EDMA3 Test Application
5 A8 ^( t- y3 C- l5 t - *# T, W0 U6 g: ]; P/ b& M! W, L
- * This file contains EDMA3 Test code.
3 C, Y0 m/ O' p, i, h8 G - *9 f! n7 A6 X; R) b0 r: c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. Y1 L: e% d8 C% }1 F4 f1 T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" V5 R+ ~& {: M3 P1 G; `- q - * TO CHANGE.
0 q( h9 q L" t5 b - *
% T7 ?+ E4 q, ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) p/ v* ]+ x d2 }* b( ^0 u0 b
- *
+ R* f) s5 q0 o- D# s5 j - * This program is free software; you can redistribute it and/or5 }3 X: Z9 v* I$ U9 N
- * modify it under the terms of the GNU General Public License as4 q) {% X& G+ f) I( {
- * published by the Free Software Foundation version 2./ @" R2 g: n& a5 n2 [6 C
- *9 R* z+ o6 M. n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 d7 O4 p+ d( B/ p* E
- * kind, whether express or implied; without even the implied warranty
9 A6 m: J/ m d0 `! T/ v0 A7 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% i3 T6 U5 b6 u" ]( L
- * GNU General Public License for more details.1 K1 o3 t; y" A
- */
8 m$ ]8 H4 B1 ?- g: s6 Y - 0 t* K3 T3 [! \! s9 {7 c* a4 N
- #include <linux/module.h>
+ M3 { L5 s( [! y2 \5 z - #include <linux/init.h>2 r' g1 U% m4 d9 v! k; @! N1 j* [
- #include <linux/errno.h>1 ^0 ^3 H- [; \# D" i
- #include <linux/types.h>
# t1 U5 U( K) p8 |% A - #include <linux/interrupt.h>- _) }; z, |+ e4 R3 B, M- r, b# W4 H. i' b
- #include <asm/io.h>
+ Z) o6 ~# R9 ]1 p" R9 S& O - #include <linux/moduleparam.h>* y) D6 S# J7 Q. b
- #include <linux/sysctl.h>
$ I8 [; v* f* l% ^ - #include <linux/mm.h>
8 q" U( N9 k- c# ]* a# _ - #include <linux/dma-mapping.h>+ E: h' Z% ]! Y3 C
- " Z9 y, `( y+ J n" B: i8 [
- #include <mach/memory.h>
. P$ K8 T( H3 ^ - #include <mach/hardware.h>
- u) C( P L( _. `8 c7 b - #include <mach/irqs.h>; {5 A& g* t0 {5 p6 M
- #include <asm/hardware/edma.h>! u$ s) O$ a* S3 s" Y0 j
- . G! ~2 V4 y6 R) f: o
- #undef EDMA3_DEBUG% ~. k; K5 q. q, b2 N9 }! K4 U; w! V
- /*#define EDMA3_DEBUG*/. p7 F2 m$ j( S' a: Y; q
- Q% Z4 r1 @7 L0 \% m! ~
- #ifdef EDMA3_DEBUG
. A! T& X5 x& [+ G1 H, Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 X2 Y& m1 g. y( O: ?+ M$ r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), C4 x4 ?5 a7 K: |/ V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 E1 E$ Q9 x% @+ \( C8 P3 ~ - #else9 }( F- o9 x" K- ^# T
- #define DMA_PRINTK( x... )
) [3 t: w4 v5 n8 G9 M3 Z5 K - #define DMA_FN_IN. u* K9 n5 j: M
- #define DMA_FN_OUT* ~* n# s" ]7 t; W" g
- #endif+ D# t; M6 x/ s* |+ P
) ]0 D8 f5 r! ^0 I; `" B3 Z4 {* k0 _/ S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 h# K, a$ @" t1 t- \5 |2 n - #define STATIC_SHIFT 3
: v6 S2 H- K2 z! d$ c - #define TCINTEN_SHIFT 20
/ v" A. ?) R a8 N5 C( s - #define ITCINTEN_SHIFT 21
! q/ ?4 G! Y" C- F) g - #define TCCHEN_SHIFT 22
, D9 k' s# Q9 F! ]6 J - #define ITCCHEN_SHIFT 23
( a5 m s% F8 `% d8 W
2 I9 p- K6 L" i1 Q5 @# u+ l- static volatile int irqraised1 = 0;( `! c6 e% y" S
- static volatile int irqraised2 = 0;+ Z& l B: h+ [
% \) u7 q7 K5 v: \5 ]! S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ]. x3 i) \0 V7 Y2 N( I' F# A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 D/ X8 V/ L- r6 O/ k2 D# w6 M* P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ p3 ?, |6 X- |) {' M0 U, m- K, | - 9 o, `" Y- I; v2 Q
- dma_addr_t dmaphyssrc1 = 0;
- Q" B. e# a: u6 m% K: |, ] - dma_addr_t dmaphyssrc2 = 0;# Q3 d0 X9 ^- [& J& x# p
- dma_addr_t dmaphysdest1 = 0;
/ Y, H4 o( P4 I - dma_addr_t dmaphysdest2 = 0;
7 |* S7 p1 d! A( g8 P - 1 Z$ L5 G7 r$ g1 | C J
- char *dmabufsrc1 = NULL;
, q+ H; `1 B; T/ u - char *dmabufsrc2 = NULL;. R2 `9 @5 j' ~! K* u7 y
- char *dmabufdest1 = NULL;
0 E4 D: j& _7 l4 @1 y7 p+ `$ T, U M - char *dmabufdest2 = NULL;1 g' W3 _5 }( o) G* y1 z6 o
- * V4 h5 }, D) ]( h6 Y% d
- static int acnt = 512;
2 g$ Q% ]+ f# S+ D. f' P - static int bcnt = 8;% z6 Z M( M* W/ ~/ {7 E
- static int ccnt = 8;- p9 E% h9 P- M& q' X
* }2 {4 G# t0 x0 }- J# T- module_param(acnt, int, S_IRUGO);$ X" i3 M9 K" V& `+ m, X
- module_param(bcnt, int, S_IRUGO);
+ d# ]7 E' ]0 N6 Q. k$ U/ @1 d - module_param(ccnt, int, S_IRUGO);
复制代码
2 L, E6 I p9 e* f. g- R1 b! Y) |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 a) a$ U/ E$ a6 K0 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 {3 ^. M9 L' X" V7 V0 P5 m- @$ `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) r7 v# W9 R% O& n% N- b! O7 R3 Q% }7 ?+ p. ~! m& y3 s9 u) O% V
5 l7 E* g5 B5 @( b2 b# Q
|
|