|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ^& {2 t; {; W$ x5 @' w
- [code]EDMA sample test application
. H- S1 Y7 M+ ^* d4 E! \0 u3 ~ - /*
7 C! Y5 g* x$ A% V, X R- }' h$ O - * edma_test.c# w9 N( C. K1 u' y
- *
- u9 A. x' X6 `- r5 [" k - * brief EDMA3 Test Application0 Q" ?) |4 ^" u
- *
6 r; {2 ^4 j; I - * This file contains EDMA3 Test code.8 d' o3 J" z3 D4 H: o b" D
- *
6 Q& O1 H, |9 y9 e1 h) b+ t) n c6 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# F3 B. I& a/ h9 t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 c2 [) l) J3 Y; Y$ C7 B7 ]) h* n - * TO CHANGE.
+ J. `' G; y( F: r- { - *
& ~( _0 |! x3 C' L+ B) Q4 Y3 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 |6 v& G y7 v) l& l/ _ - *
' r) x7 t. x- D; J9 v% g+ Q) P - * This program is free software; you can redistribute it and/or
: w+ p s' f4 X3 k/ ] Q& V n2 T - * modify it under the terms of the GNU General Public License as$ @) b% ^ B9 U7 F8 r5 X) e, E9 |
- * published by the Free Software Foundation version 2./ C/ N5 q' P2 E
- *- ~& E4 E( ~8 q! y5 e4 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 C, M: w4 E; L8 {7 K8 f" ^ - * kind, whether express or implied; without even the implied warranty, D5 j7 U& V& |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( p+ o( q# o# M2 C3 K - * GNU General Public License for more details.
( d) j: p% j% [; u. i - *// p6 J1 y- E( ^$ k
- . S( ?- P* i8 v% `
- #include <linux/module.h>
% s; G4 k( Q( G5 N I$ q6 F; p6 N% P - #include <linux/init.h>
1 A j) D' p- w7 u0 E - #include <linux/errno.h>% Q) P& b7 p w! _# Q
- #include <linux/types.h>
# O# n# N; g9 c0 j/ x( E - #include <linux/interrupt.h>
* g) _& B: y1 U# `6 ^ - #include <asm/io.h># V3 f& \3 S, R0 V1 n% h
- #include <linux/moduleparam.h>
+ ^; F% M1 y( m' X1 e" m1 }" m- v - #include <linux/sysctl.h>
3 W) A/ J) h; ~) ? - #include <linux/mm.h>0 o8 j; a/ `- w
- #include <linux/dma-mapping.h>+ ^1 E9 w; _) M" f; y
% _: h+ c+ z* f8 e- #include <mach/memory.h># A+ O/ g$ C( F8 O7 n
- #include <mach/hardware.h>( ]) [; m s' R( h3 @
- #include <mach/irqs.h>; y4 P, h' E$ r% z4 L% }
- #include <asm/hardware/edma.h>0 C4 P: T& e5 g' d6 }* h" B1 ^( {
9 d' i7 F" Q: j- #undef EDMA3_DEBUG: f6 R' F! f3 f' U( O+ K
- /*#define EDMA3_DEBUG*/& R' U, s( d& p7 l6 u
- # F3 N$ i; @0 ^3 O) Z
- #ifdef EDMA3_DEBUG$ B; O1 h/ h" \. R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ }6 y+ e, p4 V( a8 R/ _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& ?+ `0 j7 ^+ G3 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ?4 N/ V; x" J
- #else* k9 c! ^1 c/ j ]+ g o+ _ ^
- #define DMA_PRINTK( x... )6 x; @1 \! ]: N- U
- #define DMA_FN_IN
# h. l4 y! c+ g0 v( f - #define DMA_FN_OUT
m# I/ H5 L3 L3 F* s. j - #endif, a" M3 a9 Z6 E2 p9 Q- n Z: @! A
4 s9 s6 a5 t a. w [' F' G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
G K6 e. h/ N - #define STATIC_SHIFT 3" Z3 A; r0 l5 b/ R' g7 ~$ ~* I
- #define TCINTEN_SHIFT 20
' J5 L% D) e1 ^2 ~ - #define ITCINTEN_SHIFT 21! I$ V" e* Z% w# e+ m- `, G+ I
- #define TCCHEN_SHIFT 22
% Z8 G& `, S; y( S - #define ITCCHEN_SHIFT 23; e( k$ }* P; I9 v- { b
- 3 S8 i: K# M* i
- static volatile int irqraised1 = 0;- k8 \6 s0 M" b( A) \
- static volatile int irqraised2 = 0;
8 D6 ]9 E }" O, o4 l; s - 3 A% j+ C: X5 Y# F+ q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 z% z5 `; D N9 j) E; M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 a: L, m% k# k4 @ L1 {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; t5 ~% ]% t1 O( Y7 Q - : \ W4 A, X; u* ?1 n3 z3 ?% L
- dma_addr_t dmaphyssrc1 = 0;
% o% [' o/ S7 F - dma_addr_t dmaphyssrc2 = 0;
" `. g* \7 D2 g' @ - dma_addr_t dmaphysdest1 = 0;
/ c% q& r. a6 l% m - dma_addr_t dmaphysdest2 = 0;
1 M8 P# ?" [1 e7 A - ' h7 H' b# s# |% j
- char *dmabufsrc1 = NULL;, K: {/ a3 R2 A o' C1 H
- char *dmabufsrc2 = NULL;
5 j, p3 h' O! [2 \/ [0 X b - char *dmabufdest1 = NULL;
2 n9 U ~8 Z: v - char *dmabufdest2 = NULL;
2 h: R% e+ l3 O3 W; U - . G4 R, w% ]4 `4 O2 m8 D
- static int acnt = 512;
1 O& B4 r+ u& J - static int bcnt = 8;8 g" \/ v# z z5 }' E( {
- static int ccnt = 8;7 {5 _# N) x& p8 w8 v. u6 \
- 1 m7 x9 u7 ~2 ~! x( R, _" l2 H& B
- module_param(acnt, int, S_IRUGO);8 J$ M I2 p# w3 }% B9 M- E c
- module_param(bcnt, int, S_IRUGO);
1 r- V }% I. _' l! g) H. T - module_param(ccnt, int, S_IRUGO);
复制代码 ) L6 z9 j3 j8 @; B7 K1 x, P
- c: w4 @& h: U8 p! |1 u; T: p- O6 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. O T+ |* s6 M+ _+ A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 j; T" R2 `" [- q6 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 h& f$ t8 p, m, ?# |5 u0 w7 P
; H1 F+ ]) p- c, F `9 r: s+ z' h9 c, O
|
|