|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . N& k8 d% Y C7 S' Y8 J7 }" h; z3 D3 Q
- [code]EDMA sample test application- v7 F" K" D8 m# e" z) K
- /*
8 o: R9 p' G9 O6 w4 W+ @) P" M6 G: U - * edma_test.c
# S9 Z ~ P$ w% i - *
" V# Z B5 I5 O E% r$ u, j - * brief EDMA3 Test Application9 o- m8 Z6 q* V# i+ b' j# N
- *$ L. _, _' r' f" v+ e
- * This file contains EDMA3 Test code.: `$ V" D! U5 @8 z* o& d+ M
- *
/ R) ] ]. i3 L$ P% G/ H4 ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: p9 ?" B' R' L3 V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. A* N8 w8 }/ l( b8 p* |, O2 R+ ` - * TO CHANGE.
0 u& B/ F3 M3 g' x% _ - *% q# \; T3 c, i# J' }* `( A, a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 W, [: |9 X( Q! a
- *
9 B' v+ n2 |; K* z; N - * This program is free software; you can redistribute it and/or
, \9 x9 O4 d5 g8 ?4 L - * modify it under the terms of the GNU General Public License as
+ w$ V6 {3 v) Z5 A - * published by the Free Software Foundation version 2.
* L3 Y2 P" @. c) z8 m - *3 W, O0 N# C, D( v" J6 M$ J( N2 |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ [' q3 w" W( X
- * kind, whether express or implied; without even the implied warranty9 O- h7 Q/ K$ s& M( T1 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 a. n6 p9 x6 O- X - * GNU General Public License for more details.
4 l1 m1 R& O/ c/ X - */. j5 u9 `$ E ]$ {2 `
" F- g- ]1 Q+ t2 Y. k2 T- #include <linux/module.h>9 l6 |1 ?% h w1 k% k
- #include <linux/init.h>
; Y+ i. F: J1 S - #include <linux/errno.h>
6 T# E V3 T5 R5 q" i - #include <linux/types.h>
& ?) |+ y5 ] t, z% i+ F1 y, I - #include <linux/interrupt.h>! E% F$ j& D0 @# a$ p! h9 v- J
- #include <asm/io.h>
h) [) @! c; k2 Q. s) U& u5 a2 R! K - #include <linux/moduleparam.h>
0 P' _6 m4 ?* a% r T( F6 M - #include <linux/sysctl.h>
/ Q' ]. T& U+ E3 _. N - #include <linux/mm.h>
; w: ]! ~* V1 D1 k% o- s. T - #include <linux/dma-mapping.h>. Y6 u, G$ P: T8 ^7 q" y
% ?0 y9 L" W- b6 t; N b- #include <mach/memory.h>
, D W, }' @2 n U( `! k, [ - #include <mach/hardware.h>1 y# i. q- Z7 P( W) D
- #include <mach/irqs.h>
. |8 Q; {4 T& z0 c' ^ - #include <asm/hardware/edma.h>+ B3 _5 J4 }' X4 @. Z
6 Q2 a# K6 g7 n7 x4 H- #undef EDMA3_DEBUG
; W" L/ l8 }5 p5 Y k - /*#define EDMA3_DEBUG*/0 F* T9 s2 B/ S1 R3 \) M, Y7 l. n
/ l$ C* R; @. o' F8 P: o9 a7 e& p- #ifdef EDMA3_DEBUG
. V' `' k- ]+ I9 U# f6 \, g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( Y9 W* I$ Y8 J1 S8 [5 z% _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ q6 a/ u! q- g. ^0 S2 _7 y* F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' h7 c/ H$ u4 L$ G
- #else
* ~0 ]- {6 X1 c8 E, E - #define DMA_PRINTK( x... )! U( F) L7 I( _! d* x% g0 |
- #define DMA_FN_IN+ l6 [9 F' d2 O/ M$ [- n* d; G
- #define DMA_FN_OUT1 D- m7 u% |& j0 y6 V/ q. ]: O
- #endif# n) F6 K( t8 W3 F( c, \
( k1 ]' ~) a1 A& C- c" J4 w$ d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ t) F1 B* @/ r, |9 Q$ i2 d
- #define STATIC_SHIFT 3
, ^ c4 v8 t% e - #define TCINTEN_SHIFT 20. A' v( E8 z) t: C4 \& y% h8 z
- #define ITCINTEN_SHIFT 21
% C. Z5 r" |( ]7 ?4 N6 z- H# D7 ~ - #define TCCHEN_SHIFT 22
' b$ F! D) K- O3 s6 ? - #define ITCCHEN_SHIFT 233 w* D7 c# }3 Q' p3 ?5 t$ M! P
( F% M+ [7 A6 a, r9 S- static volatile int irqraised1 = 0;
" f0 R$ y; U7 a; j; K - static volatile int irqraised2 = 0;
, D T& N3 M0 r - {+ j% c- D# ?. B' U% ~+ m8 S3 r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 Z. }2 R1 _! r# E" o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& q2 k/ n# y i1 Q" b# _$ x. G* F( v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- S; \' m2 d9 A( {8 E
- " d+ P# h# v* ~9 y1 W3 f% U8 F
- dma_addr_t dmaphyssrc1 = 0;
; o4 J1 t; @& V' P: L! S - dma_addr_t dmaphyssrc2 = 0;" E; e" J+ A( s1 m$ A
- dma_addr_t dmaphysdest1 = 0;
$ d4 {$ q5 o5 L4 D: W - dma_addr_t dmaphysdest2 = 0;
! Y3 ]# d3 a8 u# ^$ Q5 A - ) u8 F- o. B! j9 Z9 U) \' s# ?
- char *dmabufsrc1 = NULL;
# [* e! _( s; Y+ ?8 v( u - char *dmabufsrc2 = NULL;2 l/ Q& e: Y" x1 k. A( d. K
- char *dmabufdest1 = NULL;
[+ K! c0 ^$ H' W: n# s* P - char *dmabufdest2 = NULL;* B$ \, B- R# @+ K s, {6 ]2 W4 B
- . z- D0 K) I1 V
- static int acnt = 512;
7 V, U" Z( x+ r9 Y/ Y5 \/ X) z - static int bcnt = 8;( h6 Y* M1 k7 u! A9 p
- static int ccnt = 8;
0 k; Z8 g( [$ S7 ^' |' o
+ Q, L# O. }# i2 w- module_param(acnt, int, S_IRUGO);1 }' ^, n0 N0 o+ T4 c4 ~. B
- module_param(bcnt, int, S_IRUGO);
9 G3 G; a/ @4 P/ }' e - module_param(ccnt, int, S_IRUGO);
复制代码
) t& u; }4 Q: ^5 H2 P9 Q+ _2 H" D. L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& E/ R9 k( z3 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! G; G t& ]+ [1 N' ^5 _/ H2 ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; a2 K( j& {0 D f* N. j
. R+ J: J9 b2 R, u' b4 q7 V* |: H
5 Z: C% D) S: ?% R6 { |
|