|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; s3 ^" _9 }0 p% U8 J- [code]EDMA sample test application
% o3 [& c( S. k! r; C1 d - /*" s3 C" t4 h8 B/ ~
- * edma_test.c
$ T' y% V7 V- @$ n H - *8 {7 R. S X/ b7 t1 v1 T
- * brief EDMA3 Test Application
; C* \! a3 C% \ - *: E5 q4 ^4 S4 M
- * This file contains EDMA3 Test code.3 w+ n# s/ r H; T0 d c% G
- *8 {/ a* ^) V/ h" O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 @& _% Y" x5 v% t6 k- d2 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 F$ F% ~$ Z+ a |4 ^ - * TO CHANGE.$ @. K2 {5 t' N+ z% o2 v# {
- *
6 O- K0 m- B, C0 E& O7 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ y' {! r; h: D& \' p+ f
- *4 B! O+ G+ }( D$ ?0 Y. v
- * This program is free software; you can redistribute it and/or9 z- E8 @& Y2 ]" ?. X) j
- * modify it under the terms of the GNU General Public License as' a$ Y- C% j& P" b
- * published by the Free Software Foundation version 2.
" C/ g U" t+ B, e1 U - *
. ~+ i. b( E9 O5 i n5 _: A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any }) c/ }7 ?6 b
- * kind, whether express or implied; without even the implied warranty
# K# y. N" [6 i- s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, m+ S1 H7 i' `& K. p5 [4 ^
- * GNU General Public License for more details.
4 u. b8 s$ @ P4 W/ ] - *// O" H* C3 {2 V, a! w& x
- * q6 X1 N& _! Z* a% Y
- #include <linux/module.h>% _3 K0 @( J4 y6 |$ D1 J
- #include <linux/init.h>
; ?" @$ Z% p. ^2 Q - #include <linux/errno.h>
. n! w0 A0 p( y5 `# G9 E* m - #include <linux/types.h>+ F. z0 }; M+ L) o7 e6 I! _4 w
- #include <linux/interrupt.h>
( \- a# F) _$ M - #include <asm/io.h>
7 K1 l) h( N0 Z6 N - #include <linux/moduleparam.h>
8 e$ p$ _! b' S9 f8 | - #include <linux/sysctl.h>
8 I1 V! a/ e2 T; D. d2 e3 u - #include <linux/mm.h>
% P" p9 c: v# R/ B3 @ - #include <linux/dma-mapping.h>
% T! R1 J/ H' ^9 V' G/ \: f: U. z - ; a; G3 {1 A* A( O" \) ?* n
- #include <mach/memory.h>$ N* j( Y0 j$ O
- #include <mach/hardware.h>' M+ A- e/ O, m. O/ f7 m
- #include <mach/irqs.h>2 I6 i1 f$ q! T' Y$ \7 v
- #include <asm/hardware/edma.h># K* G- c: ^* h f. A
$ R" T9 d0 k, ]# o6 R- #undef EDMA3_DEBUG7 z, _, U( P5 Y' y
- /*#define EDMA3_DEBUG*/+ c; g5 M: M; t& H# C, P
- ' r' L4 q0 @4 f; t$ W% U7 V
- #ifdef EDMA3_DEBUG7 M0 L6 [) s3 {9 r, | v% C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 @' v* o& Y$ a) S. Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 d, x, x+ a. a0 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 @+ K* s& [* \0 E) C0 h
- #else# B5 _. R8 T; y! n# X1 J6 a0 G+ p
- #define DMA_PRINTK( x... )6 M6 k$ p7 A* X. X+ }" U* U
- #define DMA_FN_IN7 ]( H; Y1 h9 w/ \" q' x6 K. k
- #define DMA_FN_OUT) Z) j! R2 D, U7 l/ i) J/ {+ V6 s
- #endif
4 ~0 V, G$ @ r4 N4 \' a t, P
$ G, h6 U: P; M) k8 J" y# J" M8 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! V% s( {( \" F+ j - #define STATIC_SHIFT 3( l' k' ]4 M" h: f d# N7 A, ^
- #define TCINTEN_SHIFT 20
, S. W: ?' W# s; w - #define ITCINTEN_SHIFT 215 h1 V- f: m. M* C; o- [
- #define TCCHEN_SHIFT 228 i' K7 ?$ A9 s: C. c
- #define ITCCHEN_SHIFT 23
' Y1 T4 L! m( R - - K- ^, y' C7 B" E* T$ z
- static volatile int irqraised1 = 0;
Y, ]! x- ?5 u( \ - static volatile int irqraised2 = 0;
z: p: `% c- ]2 a - ( g' p0 j( L1 `9 Y) n' s0 o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 X5 g( v9 C! U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D9 K7 @4 V7 s2 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
k/ B/ k3 O# z& v- k7 y% d" G
. R- [+ T. s/ u) m- dma_addr_t dmaphyssrc1 = 0;: `5 g" a t! l! V: N/ v8 s5 u
- dma_addr_t dmaphyssrc2 = 0;
6 ^4 ~0 D( B' o3 _/ o - dma_addr_t dmaphysdest1 = 0;
6 F: W9 |* Y6 i - dma_addr_t dmaphysdest2 = 0; J1 R9 `; Z! m5 i
- ( w/ M5 B8 J1 ~( p
- char *dmabufsrc1 = NULL;6 L1 G$ a6 w, X1 \3 X" x
- char *dmabufsrc2 = NULL;
; ?) x3 r+ ]6 ^7 n$ P5 h1 j - char *dmabufdest1 = NULL;
+ J7 A" Z) l/ V9 }* \ - char *dmabufdest2 = NULL;
+ M& Q+ A4 O' [
9 I% N. p1 ]7 V- static int acnt = 512;
y, p, J; n' u, q1 K - static int bcnt = 8;/ ?# ?3 {& P* B4 ~
- static int ccnt = 8;6 K9 l5 l( U0 i( }
- * e( W/ O2 r1 u, B. U. }' f
- module_param(acnt, int, S_IRUGO);8 i7 d) |" j. Z+ c* T
- module_param(bcnt, int, S_IRUGO);; _$ u+ x( V9 I/ c M
- module_param(ccnt, int, S_IRUGO);
复制代码
) r, {' O3 {) ~' m {+ U* S, R
2 Y, }! r8 A, l2 f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 s0 h/ }* J' f, O9 v9 ~2 Z
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 Q( Q8 n* J) L7 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 r+ r- b$ w( C
; L! V' |% y# Q8 w
5 l& d# K; L& K2 @9 D8 ^0 }* q |
|