|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' \ j }: @, U0 z; U4 u- [code]EDMA sample test application1 t( U( U1 d8 p' z
- /*5 M' f6 M+ l# f; q/ P% ?( e$ {
- * edma_test.c' X) d; z4 z9 s+ X' S
- *
9 b8 \; m, Y8 ?, }$ i/ |, C+ { - * brief EDMA3 Test Application
1 R2 D; S( X" V% O0 Y; J - *) [: n1 |- A! t
- * This file contains EDMA3 Test code.
" _% J, f1 Z0 u7 @! J5 N - *
0 q3 }# z' X4 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ q, ^1 W; i+ n- g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: Y& W$ k# w2 j3 [. R9 A8 i
- * TO CHANGE.. R T. `$ \9 N. s
- *9 z0 [- g% p' L+ v. ^* F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: T+ B0 B8 y9 ~! Q) b! { - *) Y. J6 h1 N3 r \* \+ T/ d/ ]
- * This program is free software; you can redistribute it and/or4 Y; @7 t% ]' d
- * modify it under the terms of the GNU General Public License as5 T7 N" y: a4 F9 I
- * published by the Free Software Foundation version 2.5 ?/ [6 g0 q* [7 `* @4 d) W
- *
5 |' u9 E3 I9 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: t! K+ O. @" G/ Z" N
- * kind, whether express or implied; without even the implied warranty9 d7 t( c# N1 Y, S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! ~1 P$ h' s( d& i7 A& X; \ - * GNU General Public License for more details.7 s9 H- B# Y. k& A' B1 I1 }
- */- ~/ W" w/ }! ~* j
& K5 C* L( b! s( ?+ v7 L9 D- #include <linux/module.h>9 J+ u$ U& y/ z* c
- #include <linux/init.h>' ]& y/ I& J4 I+ C6 E/ x: _
- #include <linux/errno.h>$ u6 Q0 B3 f8 }+ {
- #include <linux/types.h>
5 c" Z! w; G* _+ ] - #include <linux/interrupt.h>
( l9 s( c0 l5 L6 f4 h0 Q8 k - #include <asm/io.h>/ E) L: k" n4 j' D& Y4 U
- #include <linux/moduleparam.h>
+ m/ J& L h' `9 U$ A. }, J9 T* Q - #include <linux/sysctl.h>
6 b* C) v. ]2 [; E9 e - #include <linux/mm.h>' k, e; |* s/ t4 ?) j0 \) B
- #include <linux/dma-mapping.h>
; B' h3 X' c+ F% G6 S5 d1 R - # O. r& C, B4 N. p- {8 y! b3 \
- #include <mach/memory.h>
# G+ @. y5 p) X/ ? - #include <mach/hardware.h>
2 Q+ y+ h7 |2 E: b5 n$ h- ? - #include <mach/irqs.h>
3 k8 k- Z7 ]9 g& s& S- Z - #include <asm/hardware/edma.h>2 \# h5 E1 w( d8 ^. F: U
- * E8 q9 }- [0 m4 Z1 B0 B, \2 [
- #undef EDMA3_DEBUG5 y( K2 ]" g3 F
- /*#define EDMA3_DEBUG*/
; ^+ s; `5 ~4 p. m - : z: |6 q$ H- X3 [, J* n9 r
- #ifdef EDMA3_DEBUG
: }* e4 c4 d! A7 r+ s4 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 K9 b, B0 f- m2 d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
b5 o1 }3 J0 A4 A0 B% t& G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 b" H+ d. t3 b, }8 k
- #else
$ o7 Z. G, J- @# p/ \" }: ` - #define DMA_PRINTK( x... )
& _( O# \8 D: B% @5 j - #define DMA_FN_IN$ ^* B' Y# T8 q' [, `
- #define DMA_FN_OUT
/ E' |: c7 L+ R& P' } - #endif$ H, [$ W" S0 U) D A# M
- . l0 N* @2 ?* S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 e' I- Y6 Z. v2 e9 n# x6 u
- #define STATIC_SHIFT 3
, k2 _# C3 P- J% e5 H - #define TCINTEN_SHIFT 20
5 V3 y" w9 m( y$ _5 u; U z - #define ITCINTEN_SHIFT 21
# w% M! }- W- Y. {3 n - #define TCCHEN_SHIFT 22& F* m8 G7 J* Y; a7 F. K
- #define ITCCHEN_SHIFT 23
3 r. u, F: e w7 @
( h4 I5 d1 f( i* l0 B9 o: k: q- static volatile int irqraised1 = 0;' k& c8 m3 R$ a w, X5 }# D1 m" G
- static volatile int irqraised2 = 0;
7 b+ {0 ?2 N# C# ^7 z/ j - " f) w+ x: a2 n5 i/ y1 s: w- s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Z9 j: s; @" A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ F; t7 L+ I; J$ F$ v/ m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Z: S( z' h4 s7 w, o# E
$ H1 g9 |5 D i+ {( b; u, J* B- dma_addr_t dmaphyssrc1 = 0;
Q' L; X6 l) v - dma_addr_t dmaphyssrc2 = 0;
: d4 ~5 p" z5 E5 s4 } - dma_addr_t dmaphysdest1 = 0;
S7 f9 M- P$ O! E2 E - dma_addr_t dmaphysdest2 = 0; U- P( B; D7 V D. {" [3 Y* Y4 N
- , F1 P i- E! Q* a$ c* ]9 _
- char *dmabufsrc1 = NULL;% `1 O2 L8 g* T; N* @, B
- char *dmabufsrc2 = NULL;' y! n4 @5 m# u6 _& G+ t! N) i9 X
- char *dmabufdest1 = NULL;
9 w8 a, j0 J; p# j! R$ v - char *dmabufdest2 = NULL;
; G; k8 h) A8 u* v' }* {: g3 ?
, R, U" W4 @0 _5 D) `3 ^- static int acnt = 512;
2 {( O5 l" u3 ?3 Q - static int bcnt = 8;7 U2 c" \( i" g; u- K
- static int ccnt = 8;3 ~0 \! f# Z$ ]# c# f7 ~& k
+ L( T- u0 D2 G8 c3 M$ V6 H) e2 d- module_param(acnt, int, S_IRUGO);
- Y7 X# }3 W$ o* I, G" V d0 p - module_param(bcnt, int, S_IRUGO);
! `2 r1 [3 {. ^6 O5 X) V - module_param(ccnt, int, S_IRUGO);
复制代码 ' o8 }4 a6 i2 u; A5 e8 ~
6 k2 I: `$ f D: |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 s6 A% j0 `: x- {6 G- W) U Y9 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Z/ ~8 E7 R- n3 j% s# m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 e1 z4 V9 f" {" }
/ p& Y7 R1 t" u) O
1 S" L$ l9 s& N( ^: X n2 w |
|