|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 a2 B k* C$ F' \. U3 f3 Q- [code]EDMA sample test application" A, e( R2 D& L7 E- F
- /*
1 E8 I0 D: C. I - * edma_test.c
' t5 O( j+ c3 r4 W- z; B0 q* A - *& o$ k) \" z4 O! B
- * brief EDMA3 Test Application
! Q, \' m3 S0 [9 ^ - *
. @# r% z6 }) G: X - * This file contains EDMA3 Test code.( X Q8 \+ i7 V$ G$ }! |7 E
- * {5 M* E5 q! A+ ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* ^- V; L7 G4 ~1 S5 v2 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; `; Z; m, z. Z% V+ {' N - * TO CHANGE.
1 v" i- g6 m+ d% { - *
- ?) i' p( M9 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# d2 c( y6 i9 G1 ?5 L4 W% R - *- c* {) o- R1 w2 H! Y
- * This program is free software; you can redistribute it and/or+ v9 A9 ? d3 }9 v
- * modify it under the terms of the GNU General Public License as# M: K5 t5 {& s& I; r( u
- * published by the Free Software Foundation version 2.
6 t% h. b3 S6 b# N* y+ ~ - *
0 P$ R2 T% ?! y9 A6 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ g1 f5 e' o' E2 I - * kind, whether express or implied; without even the implied warranty
# X+ N* O# V, P% V, F! u5 X) {$ [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ L% j. L0 Z0 w( U Q' q
- * GNU General Public License for more details.
( F( ]! w) D" n. m4 @0 H - */3 g' U, R& t+ B1 J
7 g7 y5 R3 j/ u6 f+ t/ E! L! E- #include <linux/module.h>, X: h5 }* j; |
- #include <linux/init.h>
3 G2 z4 D0 n: O3 F# O! O ? - #include <linux/errno.h>5 v) g3 g8 W8 F7 N/ [2 D; r }
- #include <linux/types.h>
6 y/ x; g4 z* l! x- A - #include <linux/interrupt.h>
4 Q, E4 [* w. Q' a - #include <asm/io.h>2 t3 |0 x8 F. l) N
- #include <linux/moduleparam.h>% M O5 a5 n. B& S( W0 L) c" \ X
- #include <linux/sysctl.h>
+ ?* ?" w! K: j8 o3 [' H, M - #include <linux/mm.h>
7 g8 V6 u4 L! c4 [0 M* n - #include <linux/dma-mapping.h>
6 E: I% h- M' s! `/ O - / }% x3 W/ P: P i8 _
- #include <mach/memory.h>) q5 }, w' d6 `% q7 c4 L
- #include <mach/hardware.h>. b6 R! O4 ?% ~, \, i7 W3 u
- #include <mach/irqs.h>
; k. N$ ~, g. g* V' \ - #include <asm/hardware/edma.h>
, J: I- ~ w' _% R/ R - 1 A. Q( u5 d8 ]& n! l. x1 d! B
- #undef EDMA3_DEBUG
1 l- T4 t* G7 u - /*#define EDMA3_DEBUG*/- |+ a+ i/ ]: Z+ r/ ]
- $ d* [* e" X4 V
- #ifdef EDMA3_DEBUG1 N/ p. K: e1 p6 W+ j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 G' N6 G8 l i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 S( ~- a" ], d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& m' m }* k S3 o' i7 N5 |; G
- #else; O# P) ?1 U9 Q9 e7 H
- #define DMA_PRINTK( x... )
8 h* ^" X" W+ n( ` s - #define DMA_FN_IN# l \& z p+ u; _1 w8 q
- #define DMA_FN_OUT3 J4 p* ~+ c' j s$ l1 j8 E
- #endif# w: L* ]! o! N, F
- + T9 o# I8 [8 E! C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" P k; b; c' W( ]9 B
- #define STATIC_SHIFT 3
( C2 @; u! e8 @/ Q6 @6 @ - #define TCINTEN_SHIFT 20
0 ]) K. I; I0 f( ~7 ` - #define ITCINTEN_SHIFT 21
. N4 _& p' A; F* s% l - #define TCCHEN_SHIFT 22+ O5 r5 C$ `7 z1 i4 \
- #define ITCCHEN_SHIFT 23* v; k( V0 _9 a0 ]
( C8 Z( \+ J9 f9 P |& n- static volatile int irqraised1 = 0;+ F* Q0 q0 u6 d4 B
- static volatile int irqraised2 = 0;
7 E' L0 B+ F3 k( R1 k" d - & ^& E1 i% F5 G, @. T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# s8 ^1 L2 c+ }7 h9 p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L0 J# n. U! ^: N# u) Z+ h- F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, d1 r% Q' |/ u2 {3 k; |4 W
; q) q' h: O- Q6 `9 y; p" T3 f- dma_addr_t dmaphyssrc1 = 0;
0 e, Y3 b$ B! _+ e9 k6 _$ f - dma_addr_t dmaphyssrc2 = 0;6 }9 i, q7 d4 C: H g+ ^6 e6 e
- dma_addr_t dmaphysdest1 = 0;! E: Z* }" K1 V7 i, c8 b5 \
- dma_addr_t dmaphysdest2 = 0;
3 L9 a p( U2 n1 ~' C1 S% m
; \& I3 o2 t( s* e- char *dmabufsrc1 = NULL;# F4 g! H1 w' ~! e# @( ]6 ]
- char *dmabufsrc2 = NULL;
. `, Q8 M$ o* i( c5 X7 H! ^' L4 `- O - char *dmabufdest1 = NULL;
6 U0 e" X" {$ S+ |: v6 W4 F - char *dmabufdest2 = NULL;2 p( A0 R+ O# Q9 o6 c
- $ x2 s' y0 O5 z5 c. e4 Y
- static int acnt = 512;7 U. ~" X" \, P6 l: r
- static int bcnt = 8;6 O0 L9 \2 P! p! L( b0 @) L: W
- static int ccnt = 8;
- o% A! p: [; i - U/ [; V/ o# o: |1 ]) M6 ?. P7 H
- module_param(acnt, int, S_IRUGO);$ N' ~# N) u6 `1 N& |8 N
- module_param(bcnt, int, S_IRUGO);6 G+ V5 i9 T' V
- module_param(ccnt, int, S_IRUGO);
复制代码 ' O) _# @' d: I: U9 T+ |3 C
2 `5 |' h7 i3 z/ n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 N; Q1 ~' Z) b' D! c1 e7 o8 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 u) T! q1 e q' d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- D% k6 G: ]$ v+ p J' y( D
6 x& X" H; l8 `0 L5 \: t# H, {) {" J7 ]% b
|
|