|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* {- d3 d: g: J0 g& U- [code]EDMA sample test application
! Z; f$ m, L6 V7 g- J - /*" D% m* x: X5 D" x
- * edma_test.c
& \( n/ @8 ^0 m- `: L) o - *# o8 _9 D X: J$ `# r. e1 b* V G2 ]
- * brief EDMA3 Test Application
* Y6 _' p, C; `" u6 I0 X - *
2 U2 x' p( s1 N+ c ~ - * This file contains EDMA3 Test code.
% o1 k! n& o" Z, j - *8 n+ {% X; G# H; ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 m: O/ s1 [; H# b, B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ k* g, c4 _: w" r; [/ { - * TO CHANGE.
. K5 Q4 ~+ c0 F" A# |" C; L - *- A. U, m; W. G) L5 [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, `- F+ W ~% Q: {) X: J% O% y5 P3 W - *- X! n }. r h3 H1 Y6 T* Z
- * This program is free software; you can redistribute it and/or2 C/ D5 s, p# }+ ]6 z4 r
- * modify it under the terms of the GNU General Public License as, \2 t; {: I# F, Y/ v. [2 W0 C' z ~
- * published by the Free Software Foundation version 2./ H9 G/ J, \- M7 _
- *
' v: G+ R+ R4 g3 } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& W; K' P) v7 Z! z& b) ?. V
- * kind, whether express or implied; without even the implied warranty+ W9 Q' U4 h% k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 z- O. C+ h& u( A a
- * GNU General Public License for more details.
$ B9 A6 v: m8 c8 u* g. h, f - */. }% `; o5 _# S* ?6 l( b* l
- + L+ _/ K: V. }2 r; ^# i' z
- #include <linux/module.h>$ @9 o+ r" \- @, s2 I; H( I- I
- #include <linux/init.h>
, n a0 F' m0 V) Y" ~; q% t - #include <linux/errno.h>
$ p4 F2 L1 M, p5 {- ? - #include <linux/types.h>& h9 J# r \1 q
- #include <linux/interrupt.h>" `9 B5 P* Q& O* Z- A0 B
- #include <asm/io.h># W7 X! y3 {/ k$ h2 a9 Y
- #include <linux/moduleparam.h>9 l7 v) D' @8 P8 Z, N$ @4 V
- #include <linux/sysctl.h>4 @% @, ]# @5 B2 E) A: D0 A
- #include <linux/mm.h>
! Y% _' b7 Z% V0 _3 I) | - #include <linux/dma-mapping.h>
$ N( B4 \0 l u; ~0 X - 3 w0 W# G7 w8 Z7 c' D- X
- #include <mach/memory.h>" D. R) g1 p) {+ y0 Y j0 e
- #include <mach/hardware.h>
+ k7 t6 K8 s5 g - #include <mach/irqs.h>5 v2 g! r0 a6 B" T! f- B- Y5 a
- #include <asm/hardware/edma.h>) O7 D! d) c1 @3 f
u, p% @ K. V; ^* z8 h- #undef EDMA3_DEBUG% J+ g* o! e$ q7 Y4 n* B: [0 c
- /*#define EDMA3_DEBUG*/
@ J9 N2 S7 j- g) [2 i8 Y' G - 0 p% U0 y) b2 J- W" N) B1 D
- #ifdef EDMA3_DEBUG" {3 y/ A9 A3 s8 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) L S) x: u: w7 T- Z9 w8 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 h7 M2 [; C+ I( c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ v3 u! j$ t" g6 s
- #else; l \. X# f: R
- #define DMA_PRINTK( x... ) h, z9 A+ L N0 m0 S% ^) Y
- #define DMA_FN_IN
' F# a6 a# G) Q1 w* [0 a* q - #define DMA_FN_OUT
; D0 L5 {+ I6 \' _ - #endif' {6 ~. x3 d0 ]* V8 v |
- " e9 J5 T; @6 [/ K7 x8 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 `. f5 c5 T2 P5 @ - #define STATIC_SHIFT 3
) |8 E3 P) d# O - #define TCINTEN_SHIFT 20
1 G7 u* n8 C* G% P7 [: I - #define ITCINTEN_SHIFT 21
/ a' t% r3 t+ q' ~ - #define TCCHEN_SHIFT 22
x9 S6 f/ B( O9 w) D& t, |% N - #define ITCCHEN_SHIFT 23+ A: B. T( m6 n" j; g- \% N$ E
- % y1 t3 x' C' P
- static volatile int irqraised1 = 0;0 ^" {5 _/ Y4 D* q! S
- static volatile int irqraised2 = 0;5 K$ `* ?1 N# L% Z% K
# m6 Z M, S* e) f; y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( M6 Y. A" h. Q b- z* g% d" ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 e4 |) `7 d" M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 E2 Z0 u( W; e% m$ K ~" T( O: U. f
( c9 o$ m% Y1 L) I7 w, @2 E- dma_addr_t dmaphyssrc1 = 0;0 T0 \( l* R- K& j7 Q: i4 {
- dma_addr_t dmaphyssrc2 = 0;
Y' a* m" d1 J+ b! O1 W - dma_addr_t dmaphysdest1 = 0;% C) o2 c4 H+ V. @
- dma_addr_t dmaphysdest2 = 0;
9 @1 ? E( p; Q8 r/ |7 w - * a+ D4 g8 }8 M" r5 q
- char *dmabufsrc1 = NULL;2 d' P, H \$ |* h2 k0 p+ x$ k4 P
- char *dmabufsrc2 = NULL;
" A: o* x4 L- M5 x/ s5 T - char *dmabufdest1 = NULL;
/ n7 g7 [# U' q5 l0 o" z - char *dmabufdest2 = NULL;4 Q& F: ?+ K' j: T. ^1 q
0 |; x* `( C" _" O- L$ ?% z1 s8 F: Y- static int acnt = 512;
' F4 A5 j8 ^* E9 T' Z( q3 R, a9 i. i - static int bcnt = 8;* e: C( [0 E! B5 Y, ]' ^/ N
- static int ccnt = 8;
( T- f5 e' s! `: m
. n$ p2 j$ z# F/ Y7 D- module_param(acnt, int, S_IRUGO);# d# M$ q( `0 Y) k7 J
- module_param(bcnt, int, S_IRUGO);
7 P7 R# c8 S0 R5 L* O K0 y+ U% I - module_param(ccnt, int, S_IRUGO);
复制代码
4 Q7 b' g$ W6 Q* m* O- m( {
! s2 A9 A6 d6 }4 |3 D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 o5 _9 e( J1 e; A1 V O1 s- o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 F# H5 T9 z O& p: G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 R6 I$ v h. u0 R8 N9 K
, }0 j" V$ t- D) M5 v+ y
7 T8 k' N7 ]) w* T, g1 i |
|