|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ n0 `6 D2 Z$ e6 A* h R, t; Y; ?$ ]- [code]EDMA sample test application
6 f3 H# R* m4 u& E$ J - /*& Y& z& U/ h; |
- * edma_test.c* k% a! |$ T- z5 o3 @0 G U& J
- *2 p% j! [/ S3 B0 ?
- * brief EDMA3 Test Application
6 `9 L) i9 J/ a4 x8 } - *! U/ N4 H R0 n+ A& e# O
- * This file contains EDMA3 Test code.1 p# u6 |1 A& P! i- d% u8 w
- *; S1 Q% v' F! b7 t9 Z' F; e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 M. |6 y4 a- r% t- w& e" w* `( D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ A1 G% G/ `; d
- * TO CHANGE. |/ U; g& W! k. [9 r- |+ C
- *$ Z" |2 v% T& B0 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* {1 i5 Q' F5 r- X- I- f
- *
6 U% d0 v0 \) i( ^9 n - * This program is free software; you can redistribute it and/or4 n4 p$ X; F4 Z6 G
- * modify it under the terms of the GNU General Public License as2 w* p' }6 L+ w% B
- * published by the Free Software Foundation version 2.- {; V; Q' d% W# Y
- *! _* ]8 ?' F; K1 O; B* }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, t" ^! ^1 \) e% }7 F! o+ t5 l - * kind, whether express or implied; without even the implied warranty
% A/ ]1 M, [' m( y% x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& d0 |& _$ Z9 J P% \1 }
- * GNU General Public License for more details.
5 h6 t5 H8 V' y - */
( Y, {( k' ^. P8 F% @( x( w$ } - * y+ }! ^0 g) O! y& l
- #include <linux/module.h>: ^% [. D5 L1 \9 ^
- #include <linux/init.h>
1 A$ r( Q: r! R( C+ n - #include <linux/errno.h>5 q9 C) c2 C( i+ d: J" O
- #include <linux/types.h>6 q! E' j ^2 R0 S
- #include <linux/interrupt.h>8 o) k+ c; W# y. p3 L- Y
- #include <asm/io.h>: z! D K( s( A- N! f1 t
- #include <linux/moduleparam.h>, u4 O6 v8 |& @- ~
- #include <linux/sysctl.h>0 x3 C9 j0 s3 b
- #include <linux/mm.h>) E! ]$ z, Q5 r: U a4 j
- #include <linux/dma-mapping.h>
+ n$ @# C4 J% a$ {6 k. K1 b5 D" q* R
1 [! |9 p, i1 F% Q- #include <mach/memory.h>: p9 m7 ?# N' O, U, j0 C/ V
- #include <mach/hardware.h>0 j, r1 T1 t% y1 U5 \3 w4 D1 `* _9 e
- #include <mach/irqs.h>" N9 p4 S, C- C# k
- #include <asm/hardware/edma.h>& A _6 [# B: r( A
) q3 Z" s1 Y: r% C) m% e- #undef EDMA3_DEBUG* |; J; K2 Z9 t P2 Q m. p& m8 f0 n
- /*#define EDMA3_DEBUG*/1 t! q! z8 V9 S+ `
- % b9 y6 Y0 {& y; g, y0 A
- #ifdef EDMA3_DEBUG
$ u. K' b1 J3 z: [" ]% W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), a, Z* q6 J: V* B7 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* k6 i! V N) C0 f# k/ L) v; s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 g' l, @: ~ M/ ~2 [3 \, G - #else8 U& a' C% T8 F# I7 W3 f) I' b* m
- #define DMA_PRINTK( x... )! P3 Q- Y; L5 S c
- #define DMA_FN_IN
" p- K) A& M5 w% l3 A- B: S - #define DMA_FN_OUT
8 m% W( s3 j; H3 f+ h( y: o - #endif6 t: P. d' r5 I z
1 I, R6 Q! x- J/ t$ t& i% \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' z) g3 v5 t& V# v8 Z" R# W1 ^
- #define STATIC_SHIFT 3
9 ?! ?' M" w( d6 w- ?& m - #define TCINTEN_SHIFT 209 A0 x# ]0 z! w% V$ p+ B8 i
- #define ITCINTEN_SHIFT 21: v! d+ d }) m1 ?
- #define TCCHEN_SHIFT 22. K. I* |5 n* {7 @ u4 j: L5 W
- #define ITCCHEN_SHIFT 230 A6 X e& q4 `
- , s7 A/ c5 j$ ]% ?0 j
- static volatile int irqraised1 = 0;
' U1 [7 J" g$ Q/ z5 q& l - static volatile int irqraised2 = 0;1 u$ ^: h& F9 G+ z- u
- ! ?; r7 w' D" o% d- o. p2 d8 x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& F1 `3 s) { I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* d% C2 g/ }* A( V j1 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" r0 G' s: H8 Y t8 r9 W9 ?$ X
' E7 L6 P/ u9 }0 D- dma_addr_t dmaphyssrc1 = 0;
- p% [4 F# ^, T) A) u - dma_addr_t dmaphyssrc2 = 0;
/ c4 I" F# r o! _. h- V1 t - dma_addr_t dmaphysdest1 = 0;1 ^) c$ }( [9 T
- dma_addr_t dmaphysdest2 = 0;
7 E) g5 B: k) h8 z
0 X8 t) }. {$ l! X# t% r+ f! m- char *dmabufsrc1 = NULL;
' }( j7 I5 N" k" ^# @' | - char *dmabufsrc2 = NULL;
$ ^7 Z2 j% ?) ^ m - char *dmabufdest1 = NULL;( Y/ X' H: M2 i! L; V: K- E% W
- char *dmabufdest2 = NULL;3 z k9 c$ |8 v* ?: F6 Y& V
. a7 m8 x4 }" {# s* r1 ]4 }- static int acnt = 512;$ G/ E3 H1 j) d' D5 a7 b7 M8 c9 t
- static int bcnt = 8;* c/ M) @* T$ t: P
- static int ccnt = 8;1 { {1 O; e) l6 N# p* a: x
& l( `3 H1 _; o2 V4 k0 ?9 \- module_param(acnt, int, S_IRUGO);* Y- o; x. ?& ^% i2 \! X
- module_param(bcnt, int, S_IRUGO);
/ m& _6 b4 T+ Y - module_param(ccnt, int, S_IRUGO);
复制代码
( s. o- ~4 d$ a V4 O. w5 q& U
2 P' c& w7 e' T( _, P/ B9 q" d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 V# a0 g. v( @- {) C8 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 H* `; }' T3 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 }3 o+ e0 n3 @; b$ W
( h6 ?3 C6 B, S- G3 Y/ L% p
2 y$ i' v+ T$ \& a1 q |
|