|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 N8 s- b7 X* U. x7 {4 L- [code]EDMA sample test application1 c% U& h: E4 J1 `
- /*
- L! }8 V8 W" b! \3 m+ E8 g' _ - * edma_test.c
4 z7 V, Y' y! ]* k& C7 N0 e - * I- q" K* [8 z
- * brief EDMA3 Test Application
5 p2 `3 M( o: J+ ^! { - *8 O( V/ X$ X+ W, _# W# U0 _
- * This file contains EDMA3 Test code., X5 a* [, y9 E: a& h" x
- *+ i* ?- b5 i# f" @7 i- b/ I8 C8 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: z6 H5 H( c4 }* j" ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 a. Z$ E ]7 ]4 [$ D% L
- * TO CHANGE.
" P6 H4 s }: b D" j9 B - *, P* m2 Y, `( y: c& J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. C( Q$ o6 Z7 M% m
- *
4 h( D6 \% W9 p' \7 b0 c% Z: w - * This program is free software; you can redistribute it and/or
, c0 D) K2 K G! Q) U: T* j - * modify it under the terms of the GNU General Public License as4 F W$ d6 e s+ O% F+ ]6 |
- * published by the Free Software Foundation version 2.7 c4 E) }: L k6 m$ o
- *
* m, z$ |0 S4 Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 r5 Q X2 @7 V6 I - * kind, whether express or implied; without even the implied warranty; S9 N j' L4 ?; V4 Q/ R" M4 i( |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 `" S% E- Q; Q3 n
- * GNU General Public License for more details.
2 u9 X& O! _3 \1 j8 t - */
) `, k1 {/ i; j: R. v8 U2 x6 _ - : |/ O% [+ s* \
- #include <linux/module.h>5 q3 n4 k+ H+ D
- #include <linux/init.h>
% R7 W& M" H7 Z - #include <linux/errno.h>
; }' I9 K; |7 v9 s - #include <linux/types.h>
$ `* f8 n* L: @* ^6 [1 r - #include <linux/interrupt.h>
/ g9 q2 J, U+ A+ k6 v& F0 i. C - #include <asm/io.h>/ T- Y; S. {- `" {* y7 }' {
- #include <linux/moduleparam.h>" A) w8 x3 k; { ^& L
- #include <linux/sysctl.h>7 D$ c7 Z: D& S" `+ N
- #include <linux/mm.h>! N, Z1 T9 u$ \2 n* i
- #include <linux/dma-mapping.h>$ e+ C7 Y( N4 u! f0 h6 d" w
- - z+ U0 l l- e4 L( d
- #include <mach/memory.h>* p) Z& ~, {7 M) r5 _. `
- #include <mach/hardware.h>; s' [3 p% n9 E$ e
- #include <mach/irqs.h>
' J& X7 e% _& X$ j% O1 } - #include <asm/hardware/edma.h>. k5 w. d' h. @) I1 } ^4 B
! d$ x9 x- p0 l6 B- D4 z8 J- #undef EDMA3_DEBUG
& E5 A5 V/ o# A* |3 r - /*#define EDMA3_DEBUG*/5 L, w+ V4 E" F
- ) X0 k# A& G) s
- #ifdef EDMA3_DEBUG t2 R V. b; I4 K% w- m5 @9 c. N2 ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 W4 i/ n( h! d$ ?3 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 D" j- S3 C* x+ p- ^5 C1 N" s7 r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" |1 r! x* q* L8 m% a; r - #else
; P1 `" s0 `5 }( o* c. h0 \2 R - #define DMA_PRINTK( x... ), A/ x8 A Z* r b, V0 d# r& _* E
- #define DMA_FN_IN9 E; f5 V E1 C# a5 J& [
- #define DMA_FN_OUT
- _+ h1 ~( Y+ }& @' E( Y* k - #endif; I! b% u3 P# h: z& d5 |0 r
# W- P5 p: K$ U% ^9 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 n- f& K' F1 p) ?' H7 K0 B - #define STATIC_SHIFT 3: R6 R$ _( \3 v" l& ` ~7 h9 w
- #define TCINTEN_SHIFT 20
& |# `4 Z; O9 m6 z! X( A$ t - #define ITCINTEN_SHIFT 218 N" X; E5 }0 m" ]$ S6 `8 q, g
- #define TCCHEN_SHIFT 22
5 f: g6 N/ z) ^% }7 u6 V9 m2 S - #define ITCCHEN_SHIFT 231 e _4 R; \* g& \! |4 U, h8 P+ |
- . a8 W$ \' `: e* ^' U/ X( t$ N
- static volatile int irqraised1 = 0;
9 B6 ~/ o5 E3 m2 i- {/ b5 f0 h K - static volatile int irqraised2 = 0;
$ G& L3 L- Y$ F
" C5 d, L$ x% W$ S7 i! m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
]2 J* N' l/ @ _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 I) H/ ~' a! L) L/ F2 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 P- _" w) J8 P7 a
- - }' {7 ]! g8 Q7 t+ Q
- dma_addr_t dmaphyssrc1 = 0;
4 o( A4 \, [: [) R/ @ - dma_addr_t dmaphyssrc2 = 0;( m& l0 w: T* x2 h0 F, G' ~; N$ }
- dma_addr_t dmaphysdest1 = 0;
* s1 K! a/ W4 h: S - dma_addr_t dmaphysdest2 = 0;( l; T7 z" W8 s7 @. ]3 ?
* Y$ y1 S0 `0 i. `' x" j; d# l; l- char *dmabufsrc1 = NULL;
8 f4 h0 x% O* ?$ ]; X - char *dmabufsrc2 = NULL;, Y& W. q6 F4 K7 X, K
- char *dmabufdest1 = NULL;* a$ ^1 `; K1 s0 v! Z d
- char *dmabufdest2 = NULL;
5 p; i* P9 C- u, T - % g, ?, o; D6 w: R+ }- N
- static int acnt = 512;
2 _) b# X- t9 k( }3 ^* Z( q - static int bcnt = 8;
4 G3 y- G, ]& E+ Z: V, W - static int ccnt = 8;
$ t* B1 d1 }/ g8 u - " `2 M6 q# W/ O) B) k$ E
- module_param(acnt, int, S_IRUGO);' z$ ?" f% u2 Y
- module_param(bcnt, int, S_IRUGO);% ~1 D9 q S' m5 q7 [% {+ ~
- module_param(ccnt, int, S_IRUGO);
复制代码 9 W- j5 Z4 N! R0 P7 N$ U
7 `( n2 ?& K3 Z4 d7 C, B' ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 U8 w5 e9 H* i+ h6 G" q( F; |9 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! h, F& |2 |6 c4 O* X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 C: O! o- G! N* m! s
8 o1 M) `- H% s- ~3 a
2 z! m( ^; h$ j |
|