|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; l% D r$ [% K7 m6 f( j$ W6 k0 t- [code]EDMA sample test application
1 [' ]- \# v. y c5 ? - /*
8 F# p5 {- n9 C6 M4 t6 f. A1 d - * edma_test.c
! ]% N6 V! m& q/ T* G - *
. K, |4 [- |$ n7 c& w - * brief EDMA3 Test Application
5 E/ T' ^2 D0 P/ [3 x Y* _ - *
6 H( s/ a8 ?4 g d% C7 w- J - * This file contains EDMA3 Test code.0 e" N0 _ X5 Y" E+ \/ s
- *% O# |2 I- I9 a1 o T' Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* t, q3 _3 E% z5 c4 F3 V s) p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 m# n. j; r+ ]; X" v$ d: ? - * TO CHANGE.
4 [3 b7 a+ C) [% B3 _$ w - ** j. u2 R5 S% K8 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 }8 u: @( h8 q1 ` - *& s, y0 C( m5 X% z; I; {( c
- * This program is free software; you can redistribute it and/or1 u0 \1 ?1 _2 _/ @; N; u( |- s
- * modify it under the terms of the GNU General Public License as) s' z3 s6 n- Y) R
- * published by the Free Software Foundation version 2.( w7 A4 U5 c0 F _
- *2 u1 \, k5 A3 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% C" D4 @% V2 o9 ^ - * kind, whether express or implied; without even the implied warranty$ S: `9 K& x) `/ m8 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* y. [* k1 d+ c. V- B% M
- * GNU General Public License for more details.
' ?" @7 x' G% R7 P: h A& u. B0 H2 F - */
0 x6 r! p5 m2 J7 Z2 e1 J' q
2 V: W- @2 C6 `* W2 J5 a3 z- #include <linux/module.h>
; w ^4 A1 G3 D, Z3 H - #include <linux/init.h>
& v0 u) ?! {. ~+ v - #include <linux/errno.h>" e- S9 x8 B+ |- C2 B- C- ^; N
- #include <linux/types.h>6 {0 `# \ s4 _& n
- #include <linux/interrupt.h>+ G D: b5 F+ [; I, M* l
- #include <asm/io.h>! I* q! n4 K0 k; Y6 h8 W2 n
- #include <linux/moduleparam.h>, n" g9 M+ B" R
- #include <linux/sysctl.h>; f; G, Q; h1 l& o7 M3 q
- #include <linux/mm.h>
! ?' A( i: @4 y - #include <linux/dma-mapping.h>* \( K" x# L" ^: [) Z% R" k4 |
- 2 G5 K* V/ i6 w+ l/ T% Z9 E
- #include <mach/memory.h>/ U! o4 h( f" h" o5 Z) V' ]
- #include <mach/hardware.h>
% Z) U/ D3 K- O8 x4 v) c - #include <mach/irqs.h>0 c4 Q+ b- [% b7 f6 z
- #include <asm/hardware/edma.h>
" J* i' ^, S( p% ]+ p9 @2 V6 y( s4 {
. ?" ]$ c7 E" v. T2 i4 Q$ W, L- #undef EDMA3_DEBUG
+ j `- d! s7 b8 v7 L - /*#define EDMA3_DEBUG*/9 [ b4 {6 o, @4 i1 q) X# e
- 9 q/ v% O* q6 Y& G
- #ifdef EDMA3_DEBUG
# \) ~; F2 d3 E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& a, Z4 L/ V2 x% L$ d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). c5 m, z! i6 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" h h* j# ?. \& i9 n" U
- #else
6 ^) I& m) M5 z) ^3 q( X2 {& p - #define DMA_PRINTK( x... )
. a. i; H# ]! D; ^2 { - #define DMA_FN_IN
6 K: P) V7 b% |1 W! Y6 E - #define DMA_FN_OUT/ V: U8 ]* u0 g
- #endif' o" a7 w& H5 g# y- I
- $ H% U% L" _7 N, _/ C: H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 U1 [* g( j3 \3 ~* g$ ?
- #define STATIC_SHIFT 3/ ]! {6 Z( j9 L6 Q6 C! M6 i4 t
- #define TCINTEN_SHIFT 20
9 ?9 _2 d4 a% h - #define ITCINTEN_SHIFT 21
0 C% h, ]% B( k/ d0 _3 t! a: { - #define TCCHEN_SHIFT 22
' e( D. E# b# H, F - #define ITCCHEN_SHIFT 23% \3 ]2 T8 `& g$ h
1 [" ]; J- s9 c$ F( G0 h9 ?2 Y4 x- static volatile int irqraised1 = 0;3 J2 c: c& n# b: c7 W. A0 u
- static volatile int irqraised2 = 0;: r4 V% U* A2 d5 I& D0 \& c
8 q. s B6 j" }+ h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" I5 h" c) [; C0 r; B& P: W! ^- }- M, T$ R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% b4 Q8 l' i- P. I5 J. x4 Q! E" } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V: e% J# m) i% G" X
9 _2 `1 t+ b+ w3 J, G! X- dma_addr_t dmaphyssrc1 = 0;. j& g* W+ n9 z0 C; g
- dma_addr_t dmaphyssrc2 = 0;; q0 l! T& M5 |& Q4 H* o/ i% ? ~
- dma_addr_t dmaphysdest1 = 0;! n: T( e" }' S/ Y0 F
- dma_addr_t dmaphysdest2 = 0;
) X+ O8 v* t9 g0 Y" X y
7 v' b6 M: ]0 W P4 y# S, t8 w- char *dmabufsrc1 = NULL;" D% Z8 O3 I3 V! p0 ]# A
- char *dmabufsrc2 = NULL;
% E# q9 n* }8 a - char *dmabufdest1 = NULL;' X% |, b* z4 M4 i; Z
- char *dmabufdest2 = NULL;1 N! t [- {) T
H3 u4 s# u0 w0 R% R2 r- static int acnt = 512;( W: e& u1 r( z" l
- static int bcnt = 8;
3 v/ j5 k9 `# n3 m3 i - static int ccnt = 8;" r( m4 F9 F2 d( Q' i+ g8 h8 A
- % e# e" w& f' k3 z, |
- module_param(acnt, int, S_IRUGO);
% E( I; O8 `$ _ - module_param(bcnt, int, S_IRUGO);- `: b: _$ E/ F! @' N" d- b
- module_param(ccnt, int, S_IRUGO);
复制代码
. t. y3 C9 Z# z: M1 z/ |! b4 z2 K' ?. v( v* \5 _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* w- _% B* N( B, G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 J p- `) \; i6 W. B2 X. g) I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 e( I7 H6 l4 x7 c3 T
7 p- ^6 g& W7 {. q9 Z6 i0 R8 X$ ^% s% `
|
|