|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; k- x/ I" H$ k. t8 W: I- [code]EDMA sample test application+ X8 r8 w6 U4 O9 I6 V
- /*
8 u! w- r. L: n5 D! S. P - * edma_test.c6 i, S7 H" \1 @6 F
- *
, w/ J- e/ H$ Z1 M! f3 o0 T- k- J - * brief EDMA3 Test Application7 p9 v z( V) [) e! V
- *
6 |- ^2 s/ E: ^0 m5 M, r - * This file contains EDMA3 Test code.9 g; y6 N; }1 s
- *
1 X/ b! ]7 [# l I' E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% h6 W0 {4 N& G' S& m# M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 ?% N ~& r6 o6 F2 }9 X* \
- * TO CHANGE.. r* q6 T. P+ n: h7 J) }: | |# t
- *
1 J9 b8 W4 X9 L, ^- { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 s- T d0 W, K/ y
- *
! ], ]8 A6 x' x9 X' O5 X9 k$ q - * This program is free software; you can redistribute it and/or
0 {0 b; T/ W- ?) P6 y, Z! O - * modify it under the terms of the GNU General Public License as+ E, _9 c4 ^* H& A" p9 |
- * published by the Free Software Foundation version 2.; {" Z* `5 D/ B
- *9 X, E. p& c, p& ?0 T6 n% H5 y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 D* S& U; Q* Y - * kind, whether express or implied; without even the implied warranty9 W9 S* F+ }6 {3 t; T0 b2 l4 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, O. H" [, i: Z+ [9 l
- * GNU General Public License for more details.
& \+ q) r6 z# Y8 l7 Q; \3 r - */$ Z5 I, @0 w! G4 S
1 e' X/ E) U' r( E; C$ L- #include <linux/module.h>- E: f( d! K1 @
- #include <linux/init.h>* J; j" a6 {) x- E' j) K: y+ z. f
- #include <linux/errno.h>- u3 L7 E' Q' v) O% k
- #include <linux/types.h>
; x9 i% V, [/ t8 T - #include <linux/interrupt.h>
' [9 u& v9 _2 I$ X3 q; `" G - #include <asm/io.h>
6 A( t i- ]3 J$ Q3 q - #include <linux/moduleparam.h>
0 e2 n0 s3 O+ ^% J5 w0 l - #include <linux/sysctl.h>( t% I; n: F6 h3 U- v% F
- #include <linux/mm.h>+ N5 P9 I) Y( X
- #include <linux/dma-mapping.h>
) o. s" b7 z* B
( L4 D a' ?7 j2 q3 G- #include <mach/memory.h>0 z7 B$ A$ _1 c
- #include <mach/hardware.h>) I0 h: {1 V! N4 J$ h
- #include <mach/irqs.h># Z) s4 `; a1 P5 t$ y4 I
- #include <asm/hardware/edma.h>
/ ?! T4 ~4 K: k+ [/ G# }8 J( O2 O
5 \. F. L, A2 v, y; _( A2 P8 n- f- #undef EDMA3_DEBUG7 O4 h% D. y- a
- /*#define EDMA3_DEBUG*/& A1 y. ~2 l+ |7 _
1 I2 Q; C- g& F8 M7 ]5 H1 \7 \- #ifdef EDMA3_DEBUG& W+ [- l1 @: |! m6 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 N; H0 W! G! E1 k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ ^8 @7 ]# C' }: h2 e: [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- u6 k2 @& L! N) s - #else$ ]/ }1 ~. K( g& x* ~ L
- #define DMA_PRINTK( x... )
6 Q7 [' K% Y. l6 t( u& Y/ \ - #define DMA_FN_IN
% `% J5 z" K* v2 x2 `# d - #define DMA_FN_OUT3 \8 f$ j* V" v0 N+ h: K
- #endif) ]* c3 {3 K: g' K# \
- ( Y1 D3 F. c* Z* k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, m3 i, E1 j* ~& s* L - #define STATIC_SHIFT 3
; D+ h/ ~: [5 s! s" m/ a7 ] - #define TCINTEN_SHIFT 207 u! ?6 R C* v7 ?
- #define ITCINTEN_SHIFT 21+ _5 O" ^. c& _- x+ X: m8 }$ c" C
- #define TCCHEN_SHIFT 220 ?: M7 k, [8 w+ D: {7 v& B* r( |2 \( D
- #define ITCCHEN_SHIFT 23: z+ {$ y( F: `2 G! V J0 d7 B
- . R2 i8 t! M* i0 g, w
- static volatile int irqraised1 = 0;
! n/ b$ Q& O3 [1 M7 ~1 h - static volatile int irqraised2 = 0;
) M5 Y' T8 [/ | - 5 P5 U7 `6 x5 w. z/ u' m8 L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 S% q! J& R ? s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 G/ b: @/ b/ M( D7 f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, E. K4 u6 z# T& y8 r - & w0 a4 u p, }4 u
- dma_addr_t dmaphyssrc1 = 0;6 f; g3 `+ f6 a( e4 S) L
- dma_addr_t dmaphyssrc2 = 0;0 L2 G! y9 b' r6 n+ C- g
- dma_addr_t dmaphysdest1 = 0;( z' a" e# w3 s: h0 v& h
- dma_addr_t dmaphysdest2 = 0;
* F& f# F6 q2 r5 B: ^+ ` [2 H% O - ) ?: O# Z& p( n
- char *dmabufsrc1 = NULL;* W- R6 G5 C% Y
- char *dmabufsrc2 = NULL;
! u. }3 ^& G1 |0 L9 F8 l - char *dmabufdest1 = NULL;
+ ^& {' Z# f. z: R - char *dmabufdest2 = NULL;# r6 o2 x4 }0 t+ P4 z9 h' F9 d! Y
- $ l# N" I h* j A# c% h; e
- static int acnt = 512;
?) \( _; A$ w# P1 |1 p3 c - static int bcnt = 8;
: i2 |* |$ \" u6 ^ - static int ccnt = 8;
% x6 B& u4 B% M j' c" C - : s1 k) I M2 p' Z1 j- D( O8 c' g
- module_param(acnt, int, S_IRUGO);
) b% i; x/ L( S) [ - module_param(bcnt, int, S_IRUGO);: s3 A5 r, w+ b; z
- module_param(ccnt, int, S_IRUGO);
复制代码 4 ~. W' k7 ], x! m6 |; H
/ _, i, @5 ?/ p- E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 j$ [7 @+ `. B( p$ F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; ]7 V( R* ^7 u$ D8 X1 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* y( H5 p' U, C/ V* s! d- ]- ^1 p
! B+ K! g; x- Z- t) c, e3 c; w/ C: s |
|