|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* u. D% e5 ~# Y5 k/ J4 S3 c- [code]EDMA sample test application$ `3 Q$ H" \, z# [
- /*
$ `" j4 |0 i! W0 ^ - * edma_test.c+ J" ~' s+ T' m* I
- *. i$ _) q* a |/ v
- * brief EDMA3 Test Application
" { d& X0 L3 P1 {" Q# @% ` - *
: g" k" U+ I7 W& Z* P+ s1 @ - * This file contains EDMA3 Test code.3 E( T6 t1 N) I3 m( D& J
- *
9 l5 s" I) q* S# ?' U# q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' g! f) e P* X1 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; p/ |- j3 X' ^: G - * TO CHANGE.) a3 j0 _, S3 c/ x+ l' s5 V
- *
. q, l( W- ^1 I6 q* j2 [1 i( a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. B8 I1 K6 ]' \* g; x
- *1 N0 u) R+ E3 t* ]# Z/ E
- * This program is free software; you can redistribute it and/or
, H8 Y# _! |) }. K# ^ - * modify it under the terms of the GNU General Public License as
; r4 S( B: }/ m/ O( P3 k - * published by the Free Software Foundation version 2.8 s/ [8 H9 H6 }6 v2 j! B2 g
- *8 i( ?/ g1 P. Y5 D( R/ j! z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 g4 Z8 Z2 U( N9 E - * kind, whether express or implied; without even the implied warranty0 W: J4 ~, G, R5 M2 ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& e1 e, ~1 j' F7 n" `5 L, l l - * GNU General Public License for more details.5 O$ D% e" a3 k1 B" \
- */
& d& i: w) a+ i - 8 d6 G! M1 T# @3 `! e. Y+ l! k
- #include <linux/module.h>1 m4 g! B3 p% s$ d( ?
- #include <linux/init.h>
$ a+ `; i% N- _! e+ ~ - #include <linux/errno.h>
" \9 s( M2 [3 V& q- f, R4 n - #include <linux/types.h>( W6 k* K6 D+ {
- #include <linux/interrupt.h>/ H& q+ ^( F1 T& m' D: h
- #include <asm/io.h>; I0 C M J/ P/ c1 P
- #include <linux/moduleparam.h>
1 _ N0 Q9 x4 } - #include <linux/sysctl.h>, S3 L1 x% _. l% Z
- #include <linux/mm.h>* U# v, m5 d1 h3 B) X" I% _# S- z5 E
- #include <linux/dma-mapping.h>
% ^6 `2 _7 B' s/ t: U - s& S9 n- B; F8 y# E1 m
- #include <mach/memory.h>+ X6 f( H, c/ @0 b
- #include <mach/hardware.h>$ p/ k1 p: a/ z t
- #include <mach/irqs.h>/ {7 |) r; d, k7 e
- #include <asm/hardware/edma.h>1 Z# R5 t/ S. N- c
0 V4 h& A$ A p2 p8 g3 P. S7 D- #undef EDMA3_DEBUG
o1 L# E0 O9 Y; q3 G' e - /*#define EDMA3_DEBUG*/
1 R9 g! S+ _" |7 R9 ?
5 u* r7 {$ U) n+ e' N5 a& D! }; Z- #ifdef EDMA3_DEBUG
0 w- J1 a2 f9 Z. Z5 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); Q2 A/ D' F5 n7 U; B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 S3 j$ l3 v& d- ]; G3 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
u- N$ W/ z$ v, \* d7 p - #else
^9 \! K$ r, N9 _$ r - #define DMA_PRINTK( x... ), T) j$ M# A* e9 @6 G
- #define DMA_FN_IN
$ I9 @. [5 C" I - #define DMA_FN_OUT
" l8 j# G' o# N( \ - #endif
" M4 b5 s. u( C+ O; b - 2 E y6 p; ^3 _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ C6 X+ y$ T( ?) G" @
- #define STATIC_SHIFT 3/ s0 O0 A, T5 }' u+ h5 x
- #define TCINTEN_SHIFT 205 E4 P+ f y" ]
- #define ITCINTEN_SHIFT 21/ \. a0 ~4 R( g" H; Z- p* I2 X
- #define TCCHEN_SHIFT 22
- J8 M" k4 ]- [! d: y3 X! q - #define ITCCHEN_SHIFT 23) h1 U6 o0 g9 l
- : @! p0 W7 D% q$ d
- static volatile int irqraised1 = 0;+ ~# L% A6 H' b T# z
- static volatile int irqraised2 = 0;- D3 Z9 @4 ~( J1 b0 y$ Q: M$ J
- 5 g( T" O1 y# Q+ V4 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ b% U/ a( n' u8 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); l; O7 N, A' Y9 v' @0 H q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
S1 X3 S# Z% i2 P2 K* s9 z. F- U. C
( h, S& Z5 K. K! u. v- dma_addr_t dmaphyssrc1 = 0;7 @' v5 b+ }- X! ?1 d
- dma_addr_t dmaphyssrc2 = 0;
; i9 n z6 D9 }: S9 T* d" P; f: ? - dma_addr_t dmaphysdest1 = 0;/ ]% j7 k/ T3 m8 {
- dma_addr_t dmaphysdest2 = 0;2 N" K; p5 q6 x5 P8 J1 B8 ~! l
- 4 x- M5 c _5 m% K/ h2 M$ O8 z
- char *dmabufsrc1 = NULL;, @. d4 \5 p+ Q! q
- char *dmabufsrc2 = NULL;
1 l7 C5 k; x6 P, L- y. o - char *dmabufdest1 = NULL;
* O$ j3 i; H1 O+ A& v/ R - char *dmabufdest2 = NULL;
0 g0 i1 e# l3 c5 V - 2 v9 z" A& v+ h0 ?- a
- static int acnt = 512;+ c! V, K" D; r) \ N* v3 k
- static int bcnt = 8;* G- p7 k. J8 P: c
- static int ccnt = 8;
9 v6 b' C9 p7 V
" ?: c2 x! |5 }" G; d* I- module_param(acnt, int, S_IRUGO);
) X1 e7 F' c* | - module_param(bcnt, int, S_IRUGO);6 D- V; q1 n6 @2 K+ S
- module_param(ccnt, int, S_IRUGO);
复制代码
\4 Z! o& X$ U# w3 O0 ]! z4 A7 L) V, J- B. W* j4 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' \ [5 B: _ M1 C5 h; i& jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' l! I/ X% b4 W9 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 D5 w5 P. Q5 Y q" U: |2 ?. ~0 E* p8 \) @8 T [
0 O# `% d. `( k( X1 R4 `4 X |
|