|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 N: E, f0 |% s* O2 I1 S- [code]EDMA sample test application. j$ q# @7 P2 q
- /*' S) W/ p- @9 b+ d1 W
- * edma_test.c/ d: P9 m6 Q( b/ d. K$ {
- *
5 F, y" x* H4 m - * brief EDMA3 Test Application
( C- N" V* h; l/ m- f - *
; r$ C' {# m5 Q' k: X - * This file contains EDMA3 Test code.
4 \6 o8 A& p! Z- I - *( z8 F9 c' T0 P7 k( i+ ~3 y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& M% @6 }: o8 _7 Z# J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ u. f6 q1 j, ~+ b J" M9 ] - * TO CHANGE.( L2 ] t3 q+ V- ]
- *
- p. @! @3 [' ]4 X. ]' R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; D. p1 |0 i8 r2 e( y% L0 w( Q - *3 _+ J) m% W; V. U T& d
- * This program is free software; you can redistribute it and/or
+ z; e S6 v, t% Z+ b - * modify it under the terms of the GNU General Public License as
7 X; Y1 Y) t$ I9 f) M( G/ l - * published by the Free Software Foundation version 2.
1 ` T/ h/ Q* V( q - *" _' n# _+ `! H, n- a2 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; i8 c$ H! E+ o7 |" u - * kind, whether express or implied; without even the implied warranty
/ @; ^5 [8 k/ Z$ T0 J+ _2 g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& y! I& {3 [2 [( U - * GNU General Public License for more details.% Q" d0 J7 T5 w! j% k; h) I/ l
- */# m, S6 H+ d% X: b
- u1 o7 d9 i/ D1 B# n% |+ K
- #include <linux/module.h>
V' A8 Y6 ^7 Y7 u - #include <linux/init.h># q" N' R9 v1 j
- #include <linux/errno.h>* N- i0 \$ i2 g' t/ H
- #include <linux/types.h>
' y* T' Q( V' X0 j# k- q - #include <linux/interrupt.h>
2 L# b& \0 h/ A# Y8 ` - #include <asm/io.h>, ^9 Z: D! H$ C
- #include <linux/moduleparam.h> A1 o* d, f5 q" z: t1 |9 V9 ~; S( Q/ d) W
- #include <linux/sysctl.h>/ d2 c6 y; c! k, c+ N' R! ^ _
- #include <linux/mm.h>
8 X( u" G( T) M) f7 d4 l7 h$ ^: _ - #include <linux/dma-mapping.h>
* G4 e4 y$ `+ A) F8 `! m% F
+ b, D+ l, ^- ~; @- #include <mach/memory.h>
. U' J" x. b- Q; X) N8 x" b - #include <mach/hardware.h>5 r5 p" j' z2 d; ?% U4 l
- #include <mach/irqs.h>& Q# h& P# _9 S
- #include <asm/hardware/edma.h>
2 I. s2 g5 S3 t% P- s$ P K
4 M Q5 B X: `- #undef EDMA3_DEBUG! g2 V) m4 b. N$ ~9 q
- /*#define EDMA3_DEBUG*/
- {+ E5 u( ]' `. D2 h0 D - ; X% j+ ]$ D# J, X
- #ifdef EDMA3_DEBUG
8 X+ [0 t8 u; G# \) w/ h- V" ]. o: F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% B1 x- _' u/ w: ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% e7 A) \" B( v* N0 p) R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) W U+ L9 y' k, l( l( D9 h - #else
. ]! ~/ q2 ?2 x4 @ - #define DMA_PRINTK( x... )
3 Q9 i: Z# {7 `0 j, z/ M- p - #define DMA_FN_IN
) k" Y5 }/ n4 ]3 v1 Z; C/ L4 y - #define DMA_FN_OUT) q% i; u; |* a& \5 t" b
- #endif
2 s+ v1 [3 o4 c2 D2 j, ~0 l5 \& Z% r - & g1 U- \9 c; H$ Z* k6 [' d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) j5 C2 l( C3 I
- #define STATIC_SHIFT 3
. @3 I8 k! W9 |1 \ - #define TCINTEN_SHIFT 20
( B1 o4 ]$ ]( F" ^ - #define ITCINTEN_SHIFT 21
3 {# ^- b5 V" D0 o; y4 ]. V; G - #define TCCHEN_SHIFT 22* n" R2 f' a* s- O( |
- #define ITCCHEN_SHIFT 233 [* O! _1 o3 b% y
2 c: [( q4 _1 B; g9 m; |- static volatile int irqraised1 = 0;
$ y. k: B- t& s4 P0 H9 |7 ~4 T - static volatile int irqraised2 = 0;
8 u c( |' C4 d7 f
9 j( C9 r, H0 W8 a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) u4 Y. t! N! z' I( H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" O/ i8 ~. ]- u4 b- [- B: B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N( p! s/ F* Z+ F1 F$ c7 I
) b1 G7 I. C$ i9 }$ v- dma_addr_t dmaphyssrc1 = 0;8 X2 U( Y9 H$ a: Z1 x2 w. j8 f
- dma_addr_t dmaphyssrc2 = 0;
! A# E E+ L# K3 N. m- J - dma_addr_t dmaphysdest1 = 0;* G" a+ E0 A, Q1 N, o. ^
- dma_addr_t dmaphysdest2 = 0;$ E7 `6 R0 B+ E3 _1 |
6 s; j5 r2 y6 r* g- char *dmabufsrc1 = NULL;
# g z6 k9 Q6 D7 R - char *dmabufsrc2 = NULL;
' K7 E T+ J% Y( D9 h5 X - char *dmabufdest1 = NULL;* s0 w5 e2 J5 u
- char *dmabufdest2 = NULL;- Q% }* l) X3 S( c J
# \8 G6 F, U1 A. u" |* ~3 h) r- static int acnt = 512;
! J! t% T3 y2 r P' T) F8 D: Y5 o - static int bcnt = 8;
1 J$ |" B7 p( U2 x - static int ccnt = 8;/ b3 d" |* d) i, {5 e/ a, e. e
- . M$ V' P6 v, {
- module_param(acnt, int, S_IRUGO);
, J2 p9 } f+ r% b/ O3 J3 E" X - module_param(bcnt, int, S_IRUGO);
1 b- v; a8 q. |4 y - module_param(ccnt, int, S_IRUGO);
复制代码
5 T3 q7 f4 |% X' J: q( N2 z# p8 ~% j1 C; H' h2 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ X7 J/ F) h8 L9 W7 Z" x" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 M1 S/ H0 n! `+ ]* O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 p6 ]0 X8 H0 ^* C* d W+ q: N
# w* ]* [: b; }! y$ x4 c2 F8 G3 l. G) d
|
|