|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # G5 T* w9 `# Q4 i3 R/ x* K" |
- [code]EDMA sample test application
* d) V7 |8 J6 ~0 C - /*
/ ]* B4 m$ _( a H - * edma_test.c% y2 V2 H0 O4 c: N5 j! H w, ]
- *0 N8 o( b O/ K0 C# g7 t$ S% H
- * brief EDMA3 Test Application
" N$ u3 P% U7 I( O# U) ~+ ? - *
- `- N( c6 K4 i' e: { - * This file contains EDMA3 Test code.
8 v! f8 I2 S/ I( I$ r - *
; L. Y" ^ F# a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: T% [. |; {3 x, }2 s0 L7 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, G& B( z- z& L4 P" E A& X2 d) l0 ` - * TO CHANGE.- l. s; l& |% A: y% G& d
- *
& l0 G: J" v, _( z' K! Y4 a+ c( e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, X& p7 k- V2 r2 b1 r. p% J) d
- *9 G+ D0 m( Y# P0 j7 W' N
- * This program is free software; you can redistribute it and/or
0 N. ^" \, y* a - * modify it under the terms of the GNU General Public License as- D; m1 K* q& M8 L) g% I( n3 ?: P
- * published by the Free Software Foundation version 2.: T9 i: I4 I8 ]/ X
- *. r& Q6 X) P$ G7 e* y* }7 x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 _% J$ @; s" K$ p6 h |
- * kind, whether express or implied; without even the implied warranty
2 W$ r8 \) \3 @+ j- v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 h' U/ `7 n8 ^# b - * GNU General Public License for more details.; [& w2 l7 b2 E; c
- */% r, t; }; |+ \0 I( N
+ B+ \1 } @2 i& `- c7 Z- #include <linux/module.h>8 ?5 J$ w- B* s. G
- #include <linux/init.h>& S7 q" p) b7 t
- #include <linux/errno.h>
9 J' e" i. G. I- ^! H) C - #include <linux/types.h>1 v% Y b& t$ h7 M/ ]* a* U
- #include <linux/interrupt.h>
$ j( N: X" f3 b - #include <asm/io.h>1 w- ]5 F5 e. Q1 M2 I) O) c+ R" [* F2 ~
- #include <linux/moduleparam.h>
- X2 M. a/ n, @8 _ - #include <linux/sysctl.h>
3 ]! |4 z* G0 B8 z - #include <linux/mm.h>
. f# Z U, y1 c1 A - #include <linux/dma-mapping.h>
" T) t P" y/ @& f* ?8 X: Z
Q& K' R- q q& h+ b- #include <mach/memory.h>, \+ y5 Y% Q9 E
- #include <mach/hardware.h>
* ~! P4 a- ~. O" t, Q - #include <mach/irqs.h>
' P8 ^# U+ N* I1 }1 o* g - #include <asm/hardware/edma.h>. q- q( c- {7 @# B( q. @
( D/ D$ g9 z- Y8 }0 ]0 q$ p5 T- #undef EDMA3_DEBUG
( W( f! p6 ^, S% j+ B - /*#define EDMA3_DEBUG*/
$ _( q* r9 [; H5 f
3 u! h! e! L! U) F+ q% f8 p- #ifdef EDMA3_DEBUG
! \, `! @" ?% m/ f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). O, k- E* z# I3 P9 x; a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ i* A5 F' Q& W) x9 F* q" \& R0 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% S, E/ ?. v# V4 Y0 d& \
- #else. U) Y9 F! V# K; H. m7 r$ d. i: I
- #define DMA_PRINTK( x... )
8 P M) d, J A1 { - #define DMA_FN_IN% w' x* T9 h6 O; s
- #define DMA_FN_OUT1 a7 d$ W" E: T+ I
- #endif Q* j. b# e4 ~5 j
- * N/ R+ `: Y* L& r3 @' _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' |! f d" C1 m( r
- #define STATIC_SHIFT 30 R5 P6 v# z& Q7 q
- #define TCINTEN_SHIFT 20
$ D- b: M1 K( s& i1 x2 x - #define ITCINTEN_SHIFT 216 f W0 f/ c5 C
- #define TCCHEN_SHIFT 22, @. B* ]! H: z- B2 |
- #define ITCCHEN_SHIFT 23
" v7 T# [2 z j: @* E
; l1 V0 W1 Q, t& L, o& ]3 I- static volatile int irqraised1 = 0;( _( l8 k6 r( B- l+ _8 V9 @: [0 h
- static volatile int irqraised2 = 0;
) T2 }& N. c( s/ B f. T9 d! \ - ' {, L+ a7 H2 j" o2 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 j- U3 w( Z* ^9 p# @$ _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h# s6 P3 ]( b# C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% \- y/ A# ?: w9 M4 I [6 |
# |5 P) S* `$ ~$ r- dma_addr_t dmaphyssrc1 = 0;5 Y4 |8 y+ G: S( O* e- z- r% V1 r R
- dma_addr_t dmaphyssrc2 = 0;
% W/ n4 M! ?+ |0 }/ d - dma_addr_t dmaphysdest1 = 0;( |) q. C9 S& F8 c4 e
- dma_addr_t dmaphysdest2 = 0;
7 L- R, d# a3 H' P1 ]- F - 3 L- m7 F$ z# ~- E
- char *dmabufsrc1 = NULL;/ O4 [8 q2 a. d4 L9 c, r/ r
- char *dmabufsrc2 = NULL;
' k( g$ [. Q& Q6 o3 y - char *dmabufdest1 = NULL;
3 u- C" {0 {! m9 i% L! Q, h - char *dmabufdest2 = NULL;
! Q3 V7 n9 {1 K& s3 R. g- U. k0 I) ? - / j' _! U! r2 R# w
- static int acnt = 512;
7 i: p) t5 y. u3 @3 n# ? - static int bcnt = 8;
+ `4 @ P& E1 R8 Z0 T8 h - static int ccnt = 8;8 ?- S! S3 \/ L; _5 l1 L
9 O9 I; q5 B# q9 S6 l- module_param(acnt, int, S_IRUGO);
! v* X$ I/ \0 l8 B - module_param(bcnt, int, S_IRUGO);7 }$ G! q8 }/ I) z$ L/ |
- module_param(ccnt, int, S_IRUGO);
复制代码 0 W" C5 Q/ j" g/ ~
$ ^0 B9 ?: P2 b M7 ?% Q7 E6 R& R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( \8 @6 p' {+ v/ d' l' zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 q( ~2 F) F" n" X/ G) H; @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 }0 g$ `: y; P+ |2 {/ Z# T
, z) }8 V1 f3 V6 d% K
, N, b; K+ Z0 E8 G |
|