|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , J7 {9 v& N8 r3 r% C! s
- [code]EDMA sample test application( {, a! P% {# d$ X5 C$ N
- /*% j A" K7 N) X
- * edma_test.c& @9 z4 K% d8 }, L# |+ ~( A
- *
$ P% M9 ~4 n# E; L! c! T$ {& d! R - * brief EDMA3 Test Application- y" _( W2 i1 [( q
- *- [+ w5 p0 z! Z0 N, i
- * This file contains EDMA3 Test code.
' {$ k1 q# z/ m8 K - *
/ G x3 m9 o3 O! s1 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( c4 C) [7 N4 C s7 C" u" @% R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ o: C$ E6 B7 n) H y
- * TO CHANGE.
9 n/ h$ I$ j/ @8 T - *% b: P) Z& o0 `2 k5 D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# j/ P1 m, G6 d6 k; _* M& Q0 A - *4 \+ M! q2 Y$ {3 k2 ~& x( E5 w
- * This program is free software; you can redistribute it and/or
) U# Y4 w! A6 k0 i G. z9 c( p - * modify it under the terms of the GNU General Public License as
3 e4 o/ M& T; x: Z8 i - * published by the Free Software Foundation version 2.6 R& K& P" s [+ y. @
- *3 k: p* Q2 w* g5 ^% [. G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* N' D- T5 b6 D% F+ a - * kind, whether express or implied; without even the implied warranty4 i; O* E5 O" ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. A4 d1 M$ b0 e4 ?" f# z. L/ l - * GNU General Public License for more details.( I2 U! h% D7 U$ {
- */
0 @# L* I; s \) L9 O& C( Y% h5 F - % d2 a5 H [, s- s9 X
- #include <linux/module.h>" \3 x( `; Z" b! z8 e) K9 C
- #include <linux/init.h>
2 K6 n$ u/ Z2 G4 r9 c" r$ f& J( N1 S - #include <linux/errno.h>
& r+ U$ s! D5 D& S - #include <linux/types.h>6 @1 v; P5 z* J0 W7 {
- #include <linux/interrupt.h>. d! ^! B6 t# Z7 m1 ?- \. ~) K) G
- #include <asm/io.h>$ I3 S! m" b* H
- #include <linux/moduleparam.h>
, g, Z& R: L8 V+ o - #include <linux/sysctl.h>1 M# p z/ m7 x# W8 e6 U6 _
- #include <linux/mm.h>
8 R) ~5 o. L' m% C3 e! } - #include <linux/dma-mapping.h>
3 f. E% E) X7 Z6 a* I; f7 S6 z - / [) w* O' ^: G3 t/ L( v
- #include <mach/memory.h>, S) o' C2 P8 d- v2 n) }' {
- #include <mach/hardware.h>/ B, u7 r) q% R# I& S# r. s. d) y/ y
- #include <mach/irqs.h>! `+ ~+ m1 K; H6 L
- #include <asm/hardware/edma.h>0 k6 W$ L |% w1 r9 B% t& I
" q9 Z# m! G. D, p/ N3 l5 R+ Q- #undef EDMA3_DEBUG
( H, g' h( j) Q5 \( P - /*#define EDMA3_DEBUG*/! `7 H" |8 \8 I; X- `
- % B, }" P0 w/ [# D$ S
- #ifdef EDMA3_DEBUG' j8 ~% j% D, r D6 [" h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 l* k6 b2 b! ?1 `4 O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' ~) F8 P& U: O. D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% n* }4 G- Q4 s& a* Q$ Q& k - #else; V5 A* Y0 `! [8 [3 H2 u% |" q" T
- #define DMA_PRINTK( x... )) Y( Y' g" v3 z2 t$ v! J4 K1 N
- #define DMA_FN_IN* x9 U% S0 {9 [9 X" ]2 T
- #define DMA_FN_OUT
$ Q a3 D9 s7 }* h$ d2 t8 t/ } - #endif7 W @% p) e5 _4 u. V! S
9 G# s7 b9 R* v/ T/ D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. E6 B$ L3 m# y" b& q1 ?; ^" q3 O - #define STATIC_SHIFT 3
! [; A6 U& ?6 a; { B - #define TCINTEN_SHIFT 20( m7 r/ y$ b7 w/ m6 B) Q w" p
- #define ITCINTEN_SHIFT 21& J( l3 X3 q( c6 t, m: L1 @
- #define TCCHEN_SHIFT 22
5 @- x4 l6 P; b5 T# x# n+ M - #define ITCCHEN_SHIFT 23! a) F5 E+ K8 |+ V
* T# H5 [& U" w" A( \- static volatile int irqraised1 = 0;% n" n$ L% N* ~8 S: _ u5 f
- static volatile int irqraised2 = 0;
6 M# {3 j/ D! Y6 q. R) d: }8 a
8 N8 ], P% b9 G3 B. R! Y/ U. S! n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* \+ T7 {$ Z( J( X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. W/ \; T+ C" U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G9 U4 L& d3 I5 l! A* [! L1 {$ D
5 D, s W9 h- O$ E O6 y- dma_addr_t dmaphyssrc1 = 0;
4 h: X. M+ J; Q* q) O. l - dma_addr_t dmaphyssrc2 = 0; l; \! r2 w, J& f) @# a
- dma_addr_t dmaphysdest1 = 0;; V, ]$ f2 S; b1 z% v
- dma_addr_t dmaphysdest2 = 0;8 f6 r9 G' Q1 t# K+ E5 R3 o! T/ ~4 e
# s3 O" }2 n# ~$ U; p, A( O0 B- char *dmabufsrc1 = NULL;. S2 d( }( n: T) w
- char *dmabufsrc2 = NULL;
, _) `& X/ P8 F - char *dmabufdest1 = NULL;
4 n5 p0 ?0 L R - char *dmabufdest2 = NULL;
- a6 f& v- c: v: h5 N
6 }2 o# q+ r* f- static int acnt = 512;& f% ]* b9 u) N9 N) [; q
- static int bcnt = 8;' ?4 w# R W% L+ a
- static int ccnt = 8;9 J0 w M% U- x" p( k
- 3 q4 {0 f) }$ W! c% d+ Q6 K- M
- module_param(acnt, int, S_IRUGO);+ P- `8 i, c9 s1 A
- module_param(bcnt, int, S_IRUGO);- u3 n8 p$ R. w y$ {. q6 C
- module_param(ccnt, int, S_IRUGO);
复制代码
3 E; N* z3 S o+ b; _( o7 o y8 @: S3 {: T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 C$ @5 _0 a# e3 c) m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% w4 x3 B$ x) D8 [& D7 u. M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* M/ @/ P) C% U8 V9 @8 l
2 P: v& i9 @1 S6 j( V0 o( ^+ k, O: B8 i4 B Y+ |6 N6 @
|
|