|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 K" |% }# y& A% q6 N- [code]EDMA sample test application- _2 j3 \! ` M5 H9 A. T. P6 t
- /*
0 x6 h ]4 m2 k& v9 P - * edma_test.c
* B" G. V/ Y3 A+ y2 ?* B - *
: d; j% V: L/ G7 u6 B. q. Z) k r - * brief EDMA3 Test Application
, h, F; D! V2 I1 m* ]2 P - *4 Y% h" c+ g0 O# s
- * This file contains EDMA3 Test code.2 t- [0 R! Z& K. `, p& X8 s; V4 h
- *( C+ `. Q; w5 l! E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 g4 A6 i" [$ _$ p, }$ |+ ?; t) `2 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# b, D) e" t; X6 Z7 O
- * TO CHANGE.2 \, C& e' @0 ^7 y
- *
- x* K; `/ O; S) C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% P6 k, I# p0 g4 D% D
- *
( x/ r; R. P2 N7 r- r( K' h+ k& B - * This program is free software; you can redistribute it and/or' K" ]5 j! q: K+ I2 j
- * modify it under the terms of the GNU General Public License as
8 _# K6 [% a% _) m2 L - * published by the Free Software Foundation version 2.
. f+ l$ w' b6 z7 R' f - *
* j h! y- T& {' W- J X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 ?$ j4 R0 a- a3 g# o7 V( u. S - * kind, whether express or implied; without even the implied warranty9 Q5 }% u+ k& V9 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the S% \% L0 P2 B9 } z3 x2 E
- * GNU General Public License for more details.
: B1 S) M9 {3 D4 ?4 c$ o( z - */
8 H' n0 j' O+ p$ _$ g# J9 K/ p$ ^, y
- {+ x& [8 ~. k# S$ o, K* A- #include <linux/module.h>5 w4 b9 b1 ? h# `" X8 Q
- #include <linux/init.h>/ E5 c* m- ~+ G5 _( ^; ] l" p
- #include <linux/errno.h>
3 i- [4 Q) b, y) W. |3 M - #include <linux/types.h>3 K" C4 ~* ~7 J9 [ v
- #include <linux/interrupt.h> s1 o- r7 I6 u
- #include <asm/io.h>! [# |; D" q, |7 K8 O+ k4 V: O& w
- #include <linux/moduleparam.h>
) P5 K" i0 {1 T8 K! ? - #include <linux/sysctl.h>
5 ]4 a7 R4 `7 }3 H- t! u - #include <linux/mm.h>
, y0 C! Q7 \# D% z - #include <linux/dma-mapping.h>4 \, O) r, e3 i: K& l6 m* B( `! J
5 F0 o) [6 s; {! o4 m0 L- #include <mach/memory.h>5 n5 R! b; |" t8 s# a. `
- #include <mach/hardware.h>
' J) Q, S" P+ v1 V/ _/ V - #include <mach/irqs.h>
6 Q! L' {2 N' h) o N: f - #include <asm/hardware/edma.h>
0 _" J, R7 e4 W4 d* r2 ~
; N3 L4 M' e0 j, k. t- A/ P, O- #undef EDMA3_DEBUG
6 [7 O4 v, V8 Y( u( @2 n - /*#define EDMA3_DEBUG*/' f+ I- b8 o0 m( q
- ' p: \7 [# B% j& j# w' K$ \. t
- #ifdef EDMA3_DEBUG
0 T. X- h6 H: J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ Y8 k' z9 J+ p6 e: ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) c7 r5 y' ~. R3 ?; x* w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) S( C* H- k) k5 L7 J - #else# P J( D' ~9 a" Z( Z! z% g
- #define DMA_PRINTK( x... )) h: h! m1 c' G
- #define DMA_FN_IN) o$ i. ~" O, ]1 a2 g9 a# h: n9 o
- #define DMA_FN_OUT+ J, L1 S/ S1 A0 K% S0 q$ e' D
- #endif3 J5 ]4 X% T: Z: I
- ( s3 f2 m5 b S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% d. o3 v# y" U# @1 l5 I - #define STATIC_SHIFT 3: | x m; s0 b. O+ }
- #define TCINTEN_SHIFT 20
5 Z3 Y/ i* i7 ~- z' x$ e - #define ITCINTEN_SHIFT 219 p6 a7 P! }9 \( T( ] R; L$ S0 M
- #define TCCHEN_SHIFT 22
5 B# m9 ^; _' U3 | b, s% D, B - #define ITCCHEN_SHIFT 23) ]) m9 _$ ~' C7 y- S: c% s5 k* |
2 u4 R* ]+ u( C5 C) A- static volatile int irqraised1 = 0;4 I c/ Z) S, a8 T, y3 V& a# ]( ^, Z( H
- static volatile int irqraised2 = 0;
; L; A, Y& x+ s& v3 b0 E; g
& {9 V( B$ S0 |3 ]3 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: t9 W+ q: M7 I, @* @5 R0 a6 N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 G9 Z# n0 ]; F' K+ T5 I# ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 }; d# @1 b J# U5 t* m3 u: ]! s: d
& T Z5 m& Z' Z, Z. J* d: s- dma_addr_t dmaphyssrc1 = 0;" i4 m+ o$ a8 {# i0 j
- dma_addr_t dmaphyssrc2 = 0;" e, w# r9 p+ `$ r6 B+ P8 x
- dma_addr_t dmaphysdest1 = 0; Y" c4 _) F4 |( m2 }& o. M
- dma_addr_t dmaphysdest2 = 0;( ]: l6 r" n' H. T. B
- 4 n6 t* Z K7 K5 b
- char *dmabufsrc1 = NULL;1 C, V _& ]" @1 K
- char *dmabufsrc2 = NULL;
+ S9 E/ ^' U, p }! K& s8 S - char *dmabufdest1 = NULL;2 G" ]1 i7 z9 l& ?! i7 K
- char *dmabufdest2 = NULL;, g b- b! h5 {) C0 o) g
/ G1 U8 }7 u' J, {: j- static int acnt = 512;% n3 ?" n- f. F+ @+ e0 G
- static int bcnt = 8;5 m2 d/ D2 S5 Q- G# E
- static int ccnt = 8;" ?% U: l1 y A7 M; K7 I
0 f1 @4 f5 e( s, a2 ~1 X- module_param(acnt, int, S_IRUGO);
7 e0 }; i% C" ? |! V# m - module_param(bcnt, int, S_IRUGO);
0 o+ N- d i/ x) [: M5 D; s& q - module_param(ccnt, int, S_IRUGO);
复制代码 + d" z$ p4 g6 G0 k+ r' O- X/ z
, c0 Q, t2 t* t* Y x# w; b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' V$ o# W: |# U7 Z0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 t) \: \8 ]& i* J, B# | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 m I1 O0 H* a, b
' z+ }4 `. r& {4 @3 E' q5 E" h. l! _4 `! w; ^, r& F/ y6 h- z
|
|