|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , @6 n% w( u" P: m0 \3 g
- [code]EDMA sample test application* I1 ^( W! @) z) h
- /*
9 Z" B8 Q7 j0 {8 l# ~5 T - * edma_test.c( A% [7 `6 c' d8 H
- *
0 F+ S( X; q! X7 h, s/ U# t - * brief EDMA3 Test Application
* B0 R) G4 ^% u/ U! u$ J - *
+ ?, n/ E- a' w7 V* i' L - * This file contains EDMA3 Test code. Q2 t4 O8 ~5 e' d$ x Z
- *0 D4 a; W3 R& G$ {$ U7 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE z2 o7 X0 R, u0 X' }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT d# F+ O: }5 ?/ U% V5 R6 C3 c. t
- * TO CHANGE.) `6 T' P1 V p' T* _# ]
- *
; i& _# x0 M& g; ^. m; D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" J+ v: C! p* y8 j- r4 e H
- *
1 D% G9 u% \/ i6 r) Z - * This program is free software; you can redistribute it and/or
& j f) c, m# `: b( } - * modify it under the terms of the GNU General Public License as
5 U2 C$ f: G& u- _1 A9 {0 M: B - * published by the Free Software Foundation version 2.! r& q& t6 R, x7 }, j
- *& R* l. ^% p$ h$ ]1 Z s1 @% Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 e, l# X% s1 h6 o - * kind, whether express or implied; without even the implied warranty. @* F) b. k# R3 N" d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
}9 h# z. C0 U! p - * GNU General Public License for more details., w! M5 X) ] V
- */5 C$ e s4 E: |9 L7 W
- * ?! ~1 f" o$ T0 I2 d
- #include <linux/module.h>0 v' N' e2 P& ]3 L* g
- #include <linux/init.h>. z4 t$ g" {& j
- #include <linux/errno.h>
% o$ |* w/ R* o& D4 o% K: R: B - #include <linux/types.h>% a T4 U( N+ {4 t! I& M
- #include <linux/interrupt.h> B- |4 N0 }! |9 x1 S! w+ g
- #include <asm/io.h>' C: e3 _, Q' z% L4 X
- #include <linux/moduleparam.h>- n8 l$ x. a6 v8 w5 a0 V
- #include <linux/sysctl.h>0 g& R; B! n0 Q1 R
- #include <linux/mm.h>, l. H" _0 R* A
- #include <linux/dma-mapping.h>0 }$ O: r. E* j# W. p/ L
8 j* }) Y+ w9 K4 h5 N- #include <mach/memory.h>: Y0 W7 |+ A1 d' x2 h
- #include <mach/hardware.h>
2 |* `: U6 B; @" l+ Y - #include <mach/irqs.h>
g3 E) L; o: t6 A( F/ z - #include <asm/hardware/edma.h>
: X% G6 }% P* z0 \9 ?
m4 Q: S8 z2 \. ?3 H+ Z" [- #undef EDMA3_DEBUG' x+ ]: f- { {" u8 ]: q
- /*#define EDMA3_DEBUG*/
+ l C$ d" s! I! ~% G5 u
x6 d/ x0 v$ F( ~$ ]0 d* H6 J) J, }- #ifdef EDMA3_DEBUG! A; d1 U, O' J% ?8 r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 f+ q" R2 d* S6 h8 {' l( p2 | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, d5 x5 P. t7 R- C( g7 F1 B9 _7 x7 R" n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ S1 a1 m4 V0 C" _! }- [8 t - #else9 c3 W, Z& g4 K \
- #define DMA_PRINTK( x... )+ J9 d0 T2 u# k2 d& m
- #define DMA_FN_IN6 E: m& Z& X8 ? n. x
- #define DMA_FN_OUT, g# G) Y4 g0 d" J8 ?
- #endif) l/ b ^! \# r: z. r) Q
- - _; q7 d3 K' _! _( I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) u9 J8 J4 |* \' P# e - #define STATIC_SHIFT 3
' d( c" |; L' C+ e - #define TCINTEN_SHIFT 203 S' e9 P! U# i% [3 v! _/ v3 A
- #define ITCINTEN_SHIFT 21% j: [( u2 s1 P# J! W0 R: f
- #define TCCHEN_SHIFT 22( P g- d4 _; V& N$ {
- #define ITCCHEN_SHIFT 23
. e; R$ T; Y! U7 n - 5 N9 T& \$ ?! z+ d6 \, X/ u& v
- static volatile int irqraised1 = 0;4 g4 Z$ a& f! M. D8 l
- static volatile int irqraised2 = 0;( Y% m/ A/ F1 X& I% [) b. s; b3 `
2 ]& y$ w1 K& k1 H& ~! a0 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 L4 ^5 W. }2 z" f" B/ {) i3 J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q: u9 E \' Q& W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; Y* _8 B0 k9 r `8 g
1 ]( b+ n3 d! l5 {3 w7 ^5 w- dma_addr_t dmaphyssrc1 = 0;- h8 ~$ O. f" y* h, T
- dma_addr_t dmaphyssrc2 = 0;1 f. g1 D' y7 E" f
- dma_addr_t dmaphysdest1 = 0;
2 R1 h: v; U# k$ A( v. h - dma_addr_t dmaphysdest2 = 0;
; T' M) @9 o6 l0 k% e
{( d- K; _: \! I/ T1 ~- char *dmabufsrc1 = NULL;
; l! g; R# u& S. W - char *dmabufsrc2 = NULL;
" ~: v4 `( z- J8 C - char *dmabufdest1 = NULL;
( P( l- U4 Z1 c - char *dmabufdest2 = NULL;9 j) D8 n# C2 E
7 S p/ Y3 c* S: j5 |3 q1 Q- static int acnt = 512;3 J( Z" c0 Y& H+ I! q! t, @
- static int bcnt = 8;
. |/ H) c$ Y( k7 p0 w8 F# p. F - static int ccnt = 8;, ]! F1 U8 \# g
- : ?. S @7 g \- R4 I8 e
- module_param(acnt, int, S_IRUGO);; W6 Q7 q6 u, R4 [, K
- module_param(bcnt, int, S_IRUGO);& @5 R: i$ r6 i# n; f q7 ^+ ?
- module_param(ccnt, int, S_IRUGO);
复制代码 5 n. T. P1 M6 O; M+ e1 Q0 n: r
; i6 n0 M$ s9 B* u( U, n, h1 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ N4 ?" L7 ^. Y2 K7 _: ^& Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ x9 U. ]8 o/ T: R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 K2 w3 B" r. Y% X% N7 P8 W
! T# h. q+ `0 Q: w$ O0 G! a" b8 G4 z }7 r
|
|