|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 M H; E% t4 q2 N+ _" v' @6 N
- [code]EDMA sample test application8 V: f2 L3 X. }1 i& }+ O
- /*( M3 [, J( j: }6 w1 x C
- * edma_test.c$ r, z' j) k* l6 H, @! r
- *
; p8 `% _4 E+ V/ m3 [. ? - * brief EDMA3 Test Application+ _4 \; R# {) }7 B; ]
- *0 s/ V6 y( n; P5 F6 L- h
- * This file contains EDMA3 Test code." o! {: Q; h0 D- O
- */ ?5 c: D$ W) ?1 Y& E! N( b: X0 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ g* i* `+ t' j7 C$ t* u- `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 U c1 N, Z) e1 t - * TO CHANGE.8 F3 e0 i" j5 H5 i, a& }+ q- B8 @
- *$ G$ X& @, Q6 \# h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- U3 d P" L5 y2 l" \& S, | - *' Y. o( k4 f8 R" {4 q3 T
- * This program is free software; you can redistribute it and/or
) N+ y+ N' P/ P. b- L3 J# [4 E - * modify it under the terms of the GNU General Public License as5 Q+ Y3 A) j% t/ a+ p; s
- * published by the Free Software Foundation version 2.8 q7 a4 H% I8 @! I, o2 }0 G
- *
( ~5 P+ n, T* ^' h( u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ }, q' _+ ~ c+ a, f
- * kind, whether express or implied; without even the implied warranty( X7 }- W/ Z, l% u8 y5 \ ?7 }6 C, e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: k7 M- C- d* n& N4 {+ L/ r9 j - * GNU General Public License for more details.( }" I7 ^! K6 n. z1 s$ _2 {) e
- */5 C' g" e* o! C5 s* E3 M; {
- - s, x/ H; B5 g! O2 M
- #include <linux/module.h>$ s; \' d1 J& M
- #include <linux/init.h>8 h. H) S. u# ~$ _6 X
- #include <linux/errno.h>
' ]) R, @. M+ A9 q - #include <linux/types.h>
( l- M3 Q e0 m5 l( ~+ F - #include <linux/interrupt.h>
Y, S4 n( Y' I+ k - #include <asm/io.h>
) R3 J! A; _- E6 e; p2 @. y - #include <linux/moduleparam.h>
, r- E) C6 f# p: J$ z3 C* C5 P1 _ - #include <linux/sysctl.h>
) _2 L8 s) [0 `0 a! ]1 } e - #include <linux/mm.h>
! s' M) L# h) P. P4 m - #include <linux/dma-mapping.h>+ }0 v# l3 L' l* C1 R: r
- 2 `3 D& L F# ^7 j* o
- #include <mach/memory.h>3 i' |/ l& R+ d, O# H
- #include <mach/hardware.h>
8 M3 F3 v; y$ m* k K/ t5 w' q - #include <mach/irqs.h>& }5 V% E+ A5 j2 D3 h( X
- #include <asm/hardware/edma.h>+ K: d! O& D" ^0 L4 u$ a# D( v
- 9 f$ w: ?8 B8 z$ m% w7 E4 ^7 n
- #undef EDMA3_DEBUG
6 @8 n0 t* [. Y0 _ - /*#define EDMA3_DEBUG*/
7 y0 J# N8 D( w" {: J - ; y; x$ B) g% `$ W! v2 L( T+ r# @
- #ifdef EDMA3_DEBUG/ @3 Q4 [) S- u( G3 r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 s5 u) w1 I* P8 u l* W/ O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 t5 E8 ]) |+ h" p" @! w0 A# x( {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& c# {8 y" C% Z [! K6 p - #else+ C9 r# ]5 F3 y
- #define DMA_PRINTK( x... )
7 E/ A# a: A4 z: u0 S( t: T9 ?. x% m - #define DMA_FN_IN$ a' C. b" U+ ?) s c# I0 {
- #define DMA_FN_OUT
9 N: m: K Q! ]( \ - #endif" }3 [& A7 I$ t8 q& \
0 U$ t0 e w# [/ L& J3 t- {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ a5 d3 x @3 C4 F2 C' v8 f
- #define STATIC_SHIFT 3
: Q' m! N$ S3 Y# k7 Z - #define TCINTEN_SHIFT 20
9 c% o% i4 u; B& v" K0 | _% q' R; q - #define ITCINTEN_SHIFT 21
. Q6 K( o7 f+ l$ `# \' \3 U - #define TCCHEN_SHIFT 22
5 \) L2 | V& y, v- t$ M+ j - #define ITCCHEN_SHIFT 230 e- F% K9 Q. P5 O5 }
- ( j5 r: h" ^! s1 R a
- static volatile int irqraised1 = 0;8 @, }5 Z9 |3 h2 _. {) P
- static volatile int irqraised2 = 0;! S0 A) U& W8 A: a
, b- p2 D) ]7 `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 i, Y7 J9 Z' z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, g# P9 i' K* p0 F8 K6 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); a, Y7 L/ X" n$ U
0 K; g( r9 F9 F- dma_addr_t dmaphyssrc1 = 0;
9 E, L4 a5 _- g# E - dma_addr_t dmaphyssrc2 = 0;. _- J; N$ U. W3 i
- dma_addr_t dmaphysdest1 = 0;! c: L+ Z0 ?, j2 r# r
- dma_addr_t dmaphysdest2 = 0; r( e/ x0 M* k
( @9 ~6 {0 N" V! I5 p) g/ Q- char *dmabufsrc1 = NULL;
+ ]' H% B$ ]6 u& ~/ x" P - char *dmabufsrc2 = NULL;
* v# U2 {# V. b+ F+ M8 C - char *dmabufdest1 = NULL;& H- w- d3 A; o% L$ l, B2 d$ d
- char *dmabufdest2 = NULL;& ~/ L' V! g1 H& p& A, P
6 e/ E. b: z! v- static int acnt = 512;
+ N# D2 N. }) B - static int bcnt = 8;
- s" B; u$ \1 J' r( y. { - static int ccnt = 8;! C8 }4 X% M0 `" C# U
- % ^4 Q ~# z. g# y6 [" O
- module_param(acnt, int, S_IRUGO);: H8 e7 c ]5 x) e
- module_param(bcnt, int, S_IRUGO);
9 M: v1 s6 E- z& j4 J& @ - module_param(ccnt, int, S_IRUGO);
复制代码
/ B# o& J: _1 C; [2 P: V' p4 k0 L7 ]. J! Y! i, k/ o' ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 D5 B4 ]& ~* o6 O Y2 I; E" P7 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. d+ k2 h! M! ^# d6 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 T6 X/ N, m; S( h, e8 C- }# ^( C
& R E0 @( k" g* q
0 R# c% w/ f8 L, E
|
|