|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ h9 S ?# ]/ R) h
- [code]EDMA sample test application0 }/ g+ p& [! F0 M& S" h# Z. I
- /*
0 V- t' p# a$ d! |2 L1 ?% S( P - * edma_test.c8 K+ g! e1 b8 p
- *) r x; E9 F3 z; V5 R1 s0 ^; z5 I- E& n) j
- * brief EDMA3 Test Application y9 y: O: D8 s( d$ ~
- *9 B3 q+ q# D4 J+ k) K2 z
- * This file contains EDMA3 Test code.
# E# A/ D h7 O* ^+ ^( u - *# _$ c. {5 a* X- Q9 S/ Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' F- h$ a3 I- e+ B( y7 z% M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% l; I# G& B# y) f - * TO CHANGE.
; X2 [1 k. _) p* Y' j8 D* ^! P i8 s - *
$ q# p" {7 p% x6 t- D$ B/ n, r5 c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- P& ]5 @( |6 v" m U8 }. @
- *
" y5 }% n( g# v1 a) E" Y9 k, h - * This program is free software; you can redistribute it and/or4 ~1 [3 X* f- N3 J3 O% L7 {
- * modify it under the terms of the GNU General Public License as
7 j: Q! z9 o$ N% y - * published by the Free Software Foundation version 2.5 l) J( Z. ]' I2 X
- *" b0 u. C$ G1 j# f, R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 `' I* Y" R a6 G - * kind, whether express or implied; without even the implied warranty
& K# |+ I o+ D4 N7 D6 B% K6 ?5 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! r9 U; A! g5 |; S2 Y, O3 ]# } - * GNU General Public License for more details.
1 _! H+ ]8 t) C% Y - */- ]4 l9 z) h9 N4 F' e
8 E8 P1 i# I L- {; s! ]- #include <linux/module.h>' k7 C, J4 R) W
- #include <linux/init.h>
* k; ^/ u! a" Q0 ~ - #include <linux/errno.h>, e6 ]8 g; k, s9 N
- #include <linux/types.h>
: l7 y/ t1 @7 v/ h9 D7 |/ o - #include <linux/interrupt.h>9 `3 [& v3 T9 \0 f) |
- #include <asm/io.h>
. k F% e0 A- z9 B - #include <linux/moduleparam.h>
' |: R8 n1 O1 \ E - #include <linux/sysctl.h>
7 K7 y' ` E) ?& |0 h0 C - #include <linux/mm.h>* J% V& X" s4 `' ^% |
- #include <linux/dma-mapping.h>. ]3 b, D3 s$ n/ N
6 W) e( F( M! X: k! a9 W- #include <mach/memory.h>( z) Y0 r0 F& w1 {8 ?2 [0 A+ C
- #include <mach/hardware.h>, ]( {5 w( t4 A* ]1 U: `( P/ r
- #include <mach/irqs.h>
& f( O8 j. C5 Q" `% E - #include <asm/hardware/edma.h>
% {# m o" g7 A# L" w* ` - 7 B- o3 z3 ^0 [& x& K
- #undef EDMA3_DEBUG
* S; {- j3 G! i" [' R9 [% ^8 O - /*#define EDMA3_DEBUG*/' M$ Q+ B* j3 r/ w/ V! T( q; Q8 L
- 5 m0 E- Z& \+ Q: E% ? I
- #ifdef EDMA3_DEBUG
* q: j, r* M3 w3 d8 g T2 {$ k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. H4 G. h. `/ _2 t5 @* d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! @' t1 @/ c$ W' t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* ]2 j6 X3 G, S4 Q8 N* V
- #else: p0 V/ _) H( {4 |, r, ~
- #define DMA_PRINTK( x... )
5 T+ x/ Y! U0 p) Z" ?# o4 [* o - #define DMA_FN_IN ~# N7 S6 n @9 ~, G% M& I1 Z: b# X
- #define DMA_FN_OUT
) V% |0 p: n+ p$ e: R$ h7 \ - #endif3 d, w3 A' R" ~6 d" L5 @5 u& Z" {
& x+ {% ?2 L, V3 r! g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 }4 P7 G( |% u2 g7 [! ?
- #define STATIC_SHIFT 3
) V6 s. S- X% |% Z3 m - #define TCINTEN_SHIFT 207 Y1 n9 ?7 T/ A; \5 r& U5 X W* J: C
- #define ITCINTEN_SHIFT 21
* r- i; M4 p1 |3 d) n' n& K! ? - #define TCCHEN_SHIFT 22- s7 C u( H$ h5 O
- #define ITCCHEN_SHIFT 23, E/ ?( M' |$ V& L; b
; N* m) J# T+ y& s/ w- static volatile int irqraised1 = 0;
; r, S9 M2 p& U$ i4 U: {. O( K - static volatile int irqraised2 = 0;6 |7 U$ @* C! ^9 b
- / H; i. w7 I9 c6 X$ s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ N" F: Z4 @: z4 B O' w% D% O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r$ E8 ?( y! T) j ?$ ]4 H2 C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% t+ f. b# v7 G - 1 N9 C& l/ [% m! H, p
- dma_addr_t dmaphyssrc1 = 0;
+ i9 c8 f) A2 X! ~ - dma_addr_t dmaphyssrc2 = 0;: V- l0 s2 }! s9 m/ v. @
- dma_addr_t dmaphysdest1 = 0;% c, y2 Q/ @* V# T7 O
- dma_addr_t dmaphysdest2 = 0;
; U$ ^7 D9 i) R+ T9 x
] F' G: @9 p: G- char *dmabufsrc1 = NULL;! A5 o' X) L" P- r- e- K
- char *dmabufsrc2 = NULL;, u: ]5 a! \9 d- p R0 q v6 b' P
- char *dmabufdest1 = NULL;' j% }$ L1 u) h- t. k% S* {
- char *dmabufdest2 = NULL;
) d' t% B0 h: f: |+ P - / i. \, u$ V* U4 n6 l. k
- static int acnt = 512;
2 k L2 r; k% F' j( P9 C1 A+ K6 l- ] - static int bcnt = 8;1 I5 s% I* H$ ^; |
- static int ccnt = 8;
K/ i' K+ `$ x( j - - d( f+ P* j' G, I- ^ w( P$ z4 S
- module_param(acnt, int, S_IRUGO);, v* e: R' U% d2 t' V. }
- module_param(bcnt, int, S_IRUGO);
, Q3 \# d+ i/ ?. a8 J, e - module_param(ccnt, int, S_IRUGO);
复制代码 1 q" E0 B, T% }. T& r1 m: f
7 b4 E1 {, P$ c4 P6 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 O& P: h; j' x! i9 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: |, F. {% j0 ~5 V& d, i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ s* J* X$ P* d4 w
, G4 w, v' c: v6 j
6 j+ B) E [+ `- A |
|