|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 M# J& z5 V V7 y& A- [code]EDMA sample test application
8 e+ n2 G8 F8 k7 L - /*
0 e1 P9 P- D: L. Q - * edma_test.c
; U/ J3 v% f9 n i3 `$ J - */ i( F" S. T" k, ~2 b7 S: A) S. l2 r
- * brief EDMA3 Test Application
! N0 d. C( c+ c - *7 O: c6 F: \1 R* {) i* y1 K
- * This file contains EDMA3 Test code.
& @6 O. v- U3 `1 [3 k - *
. I1 L* b, }% t: _8 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& w9 }5 b) V& _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, e8 o+ ?+ j1 T2 ? - * TO CHANGE.5 }: e. U. B" H8 i
- *
6 j& ?. {. V& X4 L6 f0 ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% g& i' j+ y, A! g! m) w W& ?) B - *
4 T1 n4 B2 U2 b+ n# |/ Q/ I7 V. I - * This program is free software; you can redistribute it and/or
2 v* f: r+ Y3 l- n- H - * modify it under the terms of the GNU General Public License as
- g* L, m4 G/ K - * published by the Free Software Foundation version 2.* m) T+ X6 n/ N* I O5 L
- *8 r, N! v/ @' m7 u: {! D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any R0 A0 i! _. e
- * kind, whether express or implied; without even the implied warranty6 D- y) m1 p& h# l4 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* p0 N0 d6 u. [( F& ^ - * GNU General Public License for more details.8 i& o8 W. f7 N& C" Y1 Y8 o1 s& z$ V
- */
$ y5 M; E, i7 [# h! B( z% G - ( q* u+ `, |1 l8 h) m: @1 x: u
- #include <linux/module.h>
9 k# D9 ~' J2 e - #include <linux/init.h>" c5 p! I% }, F! W) i
- #include <linux/errno.h> |$ Z; A$ R' i
- #include <linux/types.h>
8 @/ w; \8 u* w- n - #include <linux/interrupt.h>
; @( m) N g- T D2 n* u+ L - #include <asm/io.h>
3 m/ s1 Q3 D. v! Z' Z- _ - #include <linux/moduleparam.h>
" l3 H' K9 m+ [: F, i { - #include <linux/sysctl.h>
+ v+ ?7 i1 F, ~ p - #include <linux/mm.h>+ W% w4 F. a& k6 z j: X
- #include <linux/dma-mapping.h>
: _% o0 k4 z- P- d
1 i, c0 Z+ ^* c- #include <mach/memory.h>
2 _, S$ `1 @) n( D9 o+ B, e - #include <mach/hardware.h>
, p( K7 P% C2 {1 ~$ R - #include <mach/irqs.h>
( ^/ ]: v' U0 A% o2 E5 X - #include <asm/hardware/edma.h>; ~9 ~# c3 S- B, O
- 3 n z; E9 G! y" J. F0 U4 t, `9 o
- #undef EDMA3_DEBUG$ v( c0 h% N$ y+ J& p$ ^& `+ \
- /*#define EDMA3_DEBUG*/
4 H: a( W! m( l - / J! P# D8 [* Z/ `- F5 F/ b- S
- #ifdef EDMA3_DEBUG8 Q3 l$ Z, C5 B7 g3 F! R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& g* p) i" {) M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ r+ i- i/ ?/ `: b& J8 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ K$ n+ T* u5 R4 F* i - #else j$ f% g& Y0 D6 I7 ?
- #define DMA_PRINTK( x... )
8 N- G9 I/ X; M, r Y - #define DMA_FN_IN \# F% I2 ~4 V4 {* n5 @
- #define DMA_FN_OUT
5 W8 N' l3 @% z$ q - #endif
6 l. O# G$ N- E2 Z$ B1 ? - 1 y `, x4 E. j! D o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" G4 g% b6 V+ D - #define STATIC_SHIFT 3* Z! v" [3 r9 v4 r) i
- #define TCINTEN_SHIFT 206 A/ e. _4 U# r' ^
- #define ITCINTEN_SHIFT 21
6 _; C! e& ?8 } f$ Z8 m. R - #define TCCHEN_SHIFT 22
2 H* L( I! B1 c* S& a: x - #define ITCCHEN_SHIFT 23
: O; o$ M0 A: L- ?5 B, H
; ?0 S3 G( E( J- static volatile int irqraised1 = 0;9 u; }% Z* b7 \0 h6 g4 Z
- static volatile int irqraised2 = 0;
1 b6 X' u( v# @: \: F - ! T! }/ x8 R$ j7 J/ U7 }! f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K4 S- I4 a4 a* u( Z& E' @6 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o8 d% m6 |; ]" K7 Y E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 G* p. q5 w* j2 }% P3 h. r& P; L: {
9 X; u& v# D- B! h" v( t( R1 p- dma_addr_t dmaphyssrc1 = 0;
2 z* |; {: R( c - dma_addr_t dmaphyssrc2 = 0;* @( E) P4 e( d. w6 K [
- dma_addr_t dmaphysdest1 = 0;
1 T6 A- Z& |* o' I, b - dma_addr_t dmaphysdest2 = 0;
a* w, u( }) w" T: y p
0 S5 m" \* g- f3 s: _1 h- char *dmabufsrc1 = NULL;) U& m7 U4 m; b( B* q
- char *dmabufsrc2 = NULL;! G* Z$ z4 o- R
- char *dmabufdest1 = NULL;
. D/ t- w n7 P# o1 t - char *dmabufdest2 = NULL;1 ^; S, d% o. H, G9 t
- " d0 H* Z7 d* n2 `9 T1 g/ }0 T
- static int acnt = 512;* F! ^/ r) [0 ?% I/ f! |$ X
- static int bcnt = 8;1 p% w* D6 O) v, `$ B$ C
- static int ccnt = 8;
. M1 ~+ z. @3 e& y$ I9 [+ B - ' Z4 B: B# U1 ?1 \) V- E
- module_param(acnt, int, S_IRUGO);. [( z. f2 ~$ p' F7 D( G
- module_param(bcnt, int, S_IRUGO);7 h. R2 ^/ R7 H" J2 {3 b
- module_param(ccnt, int, S_IRUGO);
复制代码 & \6 k+ Q# h3 h5 K% c, K
7 D% M( a) ~# k( x, c5 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
D& ~' X P1 Q, L% ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- s- ?' o1 M! f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" A* @; Q* }7 B% `% i% v4 {+ A6 m P+ I3 v4 Q$ }) K) [
+ Y5 ?/ U0 k, e% G
|
|