|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ z3 E( I" z+ y2 }; h- [code]EDMA sample test application
/ c/ P6 x( q9 p0 e" {0 o" B5 U - /*
) c, l g! r5 s9 X V2 I - * edma_test.c& e# E( V, x4 _& @- g( b8 Y+ r
- ** ^# H) t7 }5 f0 n
- * brief EDMA3 Test Application
" `7 `5 U$ J- Z i3 w* q0 f' `3 d - *7 G* c! v+ M b% ?( d/ u
- * This file contains EDMA3 Test code.
. v% e% Q7 b- e, ? - *
0 h ]* N( k3 L$ J0 q0 I! ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: { Y9 j- J6 j$ n3 j, U4 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" v) X3 s% S' Z+ H" b' G1 U! f - * TO CHANGE.
' o; }3 T: s# X2 t9 u* j# s6 c - *
0 V& C1 n) P% o [2 E5 t% |/ C" N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// t% f7 g/ ~9 p8 A
- *- ^5 M" `) v9 y. @; _) S
- * This program is free software; you can redistribute it and/or
7 z4 ?2 g6 Z% e7 o, g; r' y3 N( X, n - * modify it under the terms of the GNU General Public License as* i# ~% |# ]5 j8 I3 w4 H/ g
- * published by the Free Software Foundation version 2.
+ A" u! @7 e% W9 ~/ L6 V - *- [4 H% V: k' T! M5 A9 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' X9 q, e( a4 a' ]7 j
- * kind, whether express or implied; without even the implied warranty
7 T. g2 F- X0 b6 z- h0 ]4 n: v$ W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 f7 ]4 P1 w; X5 [" d% j2 Y; |7 y - * GNU General Public License for more details.
8 c8 l4 u# J W- t - */
8 e" t# V* D' f$ T/ N( r - . | p. b" P+ E! A
- #include <linux/module.h>" B6 a4 ], T p$ s# r; r! _
- #include <linux/init.h>
! d5 T: [: C# o( ?. n8 R- y6 S) ]' f( c+ F, e - #include <linux/errno.h>
0 ^$ n( a5 P H* w$ x# ^0 F - #include <linux/types.h>
, @' @4 {; p1 N5 C6 \, ~" M - #include <linux/interrupt.h>3 b0 V- n6 W# u6 x( H( B2 r
- #include <asm/io.h>
2 R' l: Z- ?: O - #include <linux/moduleparam.h>
6 ^0 H; e7 w) E; D) S, K - #include <linux/sysctl.h>
* l- P' P& t5 i - #include <linux/mm.h> {, [) ^* X& S- I
- #include <linux/dma-mapping.h> e' f# h0 }% v) T. K/ K) A5 E7 P
) `) m2 v! p# h' c- |% L8 \% a- #include <mach/memory.h>
7 H4 {$ U1 c% n- c$ i- _1 X - #include <mach/hardware.h>, b8 k5 _% z! f* A" d
- #include <mach/irqs.h>4 o* x2 i0 ]/ v# h1 W* N
- #include <asm/hardware/edma.h>
8 g: ~- N& t+ e' r2 V5 Q - + u+ ~# |5 m, {9 { B
- #undef EDMA3_DEBUG- ~' _9 l" \8 y$ A
- /*#define EDMA3_DEBUG*/
! w# E+ H+ T$ O, H5 h0 [( s4 q, G, j
, n7 b! [, _1 w3 z) L5 S- #ifdef EDMA3_DEBUG/ i3 I, n2 z; E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 _) }. U: Z2 I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) l, ^7 Q2 ^9 i1 k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ U1 ?# g! k" L/ W! K8 k! |% @- c
- #else
. g R- \6 r. B - #define DMA_PRINTK( x... )
/ a4 m: _8 `# ^+ w) S - #define DMA_FN_IN
% ]5 |* W w" N( ~8 t - #define DMA_FN_OUT
2 `4 z N n# t& l6 @* N; F# [ - #endif* D( l: ]7 n' }; R! k
# [2 P0 d+ G+ ~* D1 b- #define MAX_DMA_TRANSFER_IN_BYTES (32768) {% T! j/ k% w6 i, k
- #define STATIC_SHIFT 3$ V6 K% D! t, }% O7 m
- #define TCINTEN_SHIFT 20' f0 ~; D: V1 S- w8 K, P& T: x! E
- #define ITCINTEN_SHIFT 214 f j! u% Y7 H" Q) }+ V9 I% ]
- #define TCCHEN_SHIFT 22
. y0 x' W9 U, h - #define ITCCHEN_SHIFT 23
. ?4 n% U7 w8 x/ {6 f: S/ p
' D! ?( `8 E+ q) F4 _) ^7 m( G; |- static volatile int irqraised1 = 0;6 u( j. b% d# B- L7 y7 W
- static volatile int irqraised2 = 0;& d' T( [; u0 p5 P; N
- ( m# R' a' B- B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 R3 L: s/ F+ i; M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ?* O* g& }5 \5 G/ R6 w9 ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ^+ h h& P# \, T7 a" X8 m - 2 @9 f# c- C& ~1 X- Y1 `
- dma_addr_t dmaphyssrc1 = 0;
) ~4 w5 K+ g7 w7 [- ~, z - dma_addr_t dmaphyssrc2 = 0;
4 I- |9 g# @1 r9 W - dma_addr_t dmaphysdest1 = 0;' u# B& c- |, M+ T% N
- dma_addr_t dmaphysdest2 = 0;
$ ^8 t3 z6 w+ d2 C - * t1 V# F! K" ^7 t
- char *dmabufsrc1 = NULL;% |9 i9 ~$ P/ b% l1 d* Z% {
- char *dmabufsrc2 = NULL;
" B9 Z+ D! Z; b$ L7 [6 R: z. W - char *dmabufdest1 = NULL;
, I/ f/ H$ x: ~5 n& Z - char *dmabufdest2 = NULL;
9 ]/ G2 u* f9 Q: Q. D z
$ l% R: s# h; e* C' o& q6 e5 V- static int acnt = 512;$ x) K5 l2 `7 O9 ]; a% }+ Q
- static int bcnt = 8;
# V" ^1 m# u( r# h# P* D' l8 M - static int ccnt = 8;
0 c9 ?; `- f( L, @
4 T& `1 i: K: P1 ~7 O- module_param(acnt, int, S_IRUGO); T2 c* `! `7 ~( S& t. N
- module_param(bcnt, int, S_IRUGO);
U# e0 ?3 ?+ r2 i O4 w - module_param(ccnt, int, S_IRUGO);
复制代码 E1 ~6 H: |6 q9 V/ e) s
, N% P" @( v* E, l8 {$ W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 x4 E N1 O9 r& H8 ?# A9 S, T( n: _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, F6 [7 X/ \6 t- a* m' M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 b' Y% t1 v) i; r2 X- [! K" q
% b5 j2 X. }1 Y( f; K/ Q3 e; D& {; r) A* f' }4 o% J/ K$ J5 u7 W) c
|
|