|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * |. u. N0 ]% e# i
- [code]EDMA sample test application8 D8 e: R3 {2 W9 L- m" n" b
- /*
9 u/ `8 }9 c7 t1 }8 {2 ` - * edma_test.c$ K* a0 c! e4 }/ e6 G: c4 v; Y
- */ |/ K. ]6 ^8 \7 h
- * brief EDMA3 Test Application+ z h2 {2 t. r8 ~! [1 Y$ T, w
- *' X# e% X' C$ ?- c2 P2 M5 n
- * This file contains EDMA3 Test code.
" t# }& k2 S* G7 Q4 c/ W1 Y - * Y4 ~6 h8 n: p( ^7 M9 P9 I4 [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) U# g5 @% g$ K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 X7 @4 V: V+ a% G8 b
- * TO CHANGE.
0 I4 f! z% E2 \! n# X" \7 q3 a2 L( a - *
4 i; o# }* i5 O+ L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 A+ b! v, Y7 f4 A1 R Q - *9 y) { P% D2 e6 R- H: ?) Z6 z
- * This program is free software; you can redistribute it and/or
8 I. E0 Y, B4 r( E" l - * modify it under the terms of the GNU General Public License as
# ]6 p$ R9 a$ ?5 h- Z( x2 j1 n! s - * published by the Free Software Foundation version 2.3 M, O0 n, q6 g" R+ g2 K
- *7 j0 [2 n( c1 l! j' L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- q8 J8 q: X1 g- G# o8 R: w - * kind, whether express or implied; without even the implied warranty0 }7 B+ u' Y1 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 R2 T" V% \6 J2 ?) A! H+ R - * GNU General Public License for more details.
0 ]) n8 h' W, w6 ]% m" n$ [; v( J - */
1 s' |+ T) r$ C1 V9 o" S9 d" P( _ - $ e" C# a- G5 P% X. V
- #include <linux/module.h>6 }& J; @, \ i- J7 {6 K* R- @
- #include <linux/init.h>
$ s, O$ y( A$ j: x' u! ] - #include <linux/errno.h>
0 P8 z* t O. { - #include <linux/types.h>7 s" i7 v9 U7 o% B0 C. S
- #include <linux/interrupt.h>0 {7 C4 b8 Q" F, j4 d
- #include <asm/io.h>% x/ A& e$ X9 k2 p+ ^7 a8 W# K
- #include <linux/moduleparam.h>; \% e; Q w' }8 f9 r5 L/ R% v
- #include <linux/sysctl.h>, ^& `5 O4 |: t; A8 R
- #include <linux/mm.h>
! [6 Q2 |# D& Z0 N6 O9 z7 T - #include <linux/dma-mapping.h>
- B$ O& }, t* G" i p; d- H
3 n* R5 G6 F' z* t0 I- #include <mach/memory.h>
8 o6 Y9 k! ^2 c4 V - #include <mach/hardware.h>
@* Y" `3 ^7 J1 n3 U - #include <mach/irqs.h>$ d4 z! y! y0 N6 ^! ^! _+ z, Z
- #include <asm/hardware/edma.h>1 ^) d% f. g2 \( ~6 N+ z
& Z8 {$ I) b* V/ R8 F& e- #undef EDMA3_DEBUG1 _1 a0 p7 Z b5 _8 [6 |
- /*#define EDMA3_DEBUG*/
- e: N3 Q7 o$ ]/ n - 3 @9 h& q1 ~9 w4 o
- #ifdef EDMA3_DEBUG* E; ^5 `0 F3 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" C7 f( {2 K# p# j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 ?0 ]( E$ d2 g l, h+ _7 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# ]0 o0 L7 G* Z5 ` - #else) `7 f& K }/ I, j+ H
- #define DMA_PRINTK( x... )
( g; |( ~, _6 M2 U - #define DMA_FN_IN
# S" E: K, |, `8 h& { - #define DMA_FN_OUT, z" C9 @) V7 B( G, o" `7 E1 P
- #endif/ {2 T' s# X( _$ d
" e9 ]" h* [0 U; l2 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 q+ a" T9 v% Z2 G4 d
- #define STATIC_SHIFT 3
7 Y( z9 Z8 _4 k& u% S - #define TCINTEN_SHIFT 20
- v3 F4 f) W, R) \) S( @ - #define ITCINTEN_SHIFT 21, F, `, m1 I2 [8 R. M1 }
- #define TCCHEN_SHIFT 224 q% x# n$ ^( ]0 i: `3 _
- #define ITCCHEN_SHIFT 23
6 _! g- l6 I# r7 S3 o
: M4 f. @! |# H/ n# w- static volatile int irqraised1 = 0;+ N3 |8 j! l1 I, B2 z
- static volatile int irqraised2 = 0;2 }# {4 n: X5 j% }& k
- 5 F- ^4 i3 S: F) j* K5 p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. k8 w$ |$ p; U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* G$ x) L) U! k9 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; {6 A' u' r3 u& y - o& @% X$ n, [' ^6 k
- dma_addr_t dmaphyssrc1 = 0;- Z& I3 H: Y6 I
- dma_addr_t dmaphyssrc2 = 0;& H% l+ |5 l( m4 S( T* c& b
- dma_addr_t dmaphysdest1 = 0;" T# B9 i0 n. B2 [
- dma_addr_t dmaphysdest2 = 0;
9 @1 ]9 y0 u1 F0 O
) G4 E' i0 N6 Y2 c# E; n0 ?3 t- char *dmabufsrc1 = NULL;
$ M: b5 S# H- }" | - char *dmabufsrc2 = NULL;
5 n/ @# k8 r9 H/ I$ A1 w - char *dmabufdest1 = NULL;- |% P/ ]( Y8 s. W$ R G+ k4 P
- char *dmabufdest2 = NULL;/ W0 j3 I) H4 ?. M
- 7 k5 |* o3 b% B$ [! T8 t) A
- static int acnt = 512;. q- Y1 T6 C, V) z0 ?/ Q( `
- static int bcnt = 8;, ~# i m/ I& ~2 R
- static int ccnt = 8;$ [9 g7 q1 b. l
* i1 \: g8 c7 m! U' u- module_param(acnt, int, S_IRUGO);# w8 h: X m/ n4 j
- module_param(bcnt, int, S_IRUGO);$ U0 R8 f3 U# G" V8 i3 _
- module_param(ccnt, int, S_IRUGO);
复制代码
6 I; L4 r4 x. _: y/ d p
j! [/ O: R7 j8 y9 } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: s' `1 Q, L8 v4 c2 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 W3 H- r ~% v2 s7 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( L; ]* u% B5 f9 \; O* R
0 u6 @0 W& _- @
& U, M! X& C. Z9 v$ O; S |
|