|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: A) U; X0 r5 V: `: t- [code]EDMA sample test application
( A; G6 W: N5 k5 [( k - /*
& b6 o$ O# C2 m( ^$ n; S. I - * edma_test.c
* `. F2 y* I9 ? - *0 u m; O! a2 c- {' C3 A
- * brief EDMA3 Test Application) e: i0 x# \" [! g# d8 n; v% f
- *
8 K. X5 F7 j5 X5 e# R$ @9 V - * This file contains EDMA3 Test code.) J: z% I5 z2 @" ~# b
- *
~1 R/ @) z* E% n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. q V: I( q. M- }+ K5 B9 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! y( V* j' Q: R' u' }$ R7 x - * TO CHANGE.
4 L# \' [; q! K - *
2 m7 {* p: m, j3 a0 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! X* x t# v4 p - *
! b8 ?" \* x" K$ n; ]: i; L) i - * This program is free software; you can redistribute it and/or- X3 Z! ~5 U5 t% v
- * modify it under the terms of the GNU General Public License as
6 I4 U$ H5 k/ I0 G0 U - * published by the Free Software Foundation version 2.6 K0 [' q L' o/ n2 C; y
- *" T$ P/ Y+ a3 P: }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& q3 ]+ `1 D- ~5 y, t
- * kind, whether express or implied; without even the implied warranty
7 }3 ~9 z1 u0 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 F# g0 t% ?9 L
- * GNU General Public License for more details.
1 q- p/ v& f. s2 z! j( { - */, v4 c4 r, t4 n* T# ?4 l
- % m. c; @7 u8 [6 z" ?* [
- #include <linux/module.h> c* y" L2 h1 V1 s/ m8 b. O ^0 A9 B
- #include <linux/init.h>
5 |0 |* |5 ~, W8 [8 P0 \ - #include <linux/errno.h>9 o0 o+ Z6 N* h! W) p
- #include <linux/types.h>- R; Z& ~ c( a! h F* \
- #include <linux/interrupt.h>
6 Y6 Z( D& `+ r - #include <asm/io.h>. k: x0 B8 j1 _
- #include <linux/moduleparam.h>1 U5 L* S7 g8 \
- #include <linux/sysctl.h>& n( m! I- W0 a" L
- #include <linux/mm.h>
. `4 m( d+ Y0 v' w - #include <linux/dma-mapping.h>( C" y+ ^; B& E8 |
- % X) d% W O+ {& U
- #include <mach/memory.h> ? g; S; e1 j: P9 |, k( `
- #include <mach/hardware.h>4 {8 f9 f% O8 r) k" S
- #include <mach/irqs.h>! |: I( i! d l4 R- I# [ y
- #include <asm/hardware/edma.h>
( A9 N6 P" @; b2 Y& ~ - " X# G9 |+ N$ N/ @- w9 x; j
- #undef EDMA3_DEBUG
6 X/ E. Z d& T/ c6 B; s+ X# e, Z - /*#define EDMA3_DEBUG*/
0 } Y$ [- g2 { - + N9 c" B/ x4 X; A# ~) @) j
- #ifdef EDMA3_DEBUG
! B# \( m0 r9 G4 m, e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 T0 K1 M( s$ c6 W% H/ z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! H; B5 o i% W# ^* R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' g: n+ }* I4 |% k. F - #else
! g1 F* F* ^! z1 p8 t - #define DMA_PRINTK( x... )& k# b" y+ d# c' R4 B
- #define DMA_FN_IN* M0 f5 O& D6 ~ ?) H! V2 }
- #define DMA_FN_OUT" ?* P/ H# G4 T2 _
- #endif+ Z9 T" Q7 w2 a' @. X
6 b) E: |7 T% v5 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 d% `* B2 _4 L0 N' C9 u - #define STATIC_SHIFT 3
/ n7 E ?+ t8 c9 n - #define TCINTEN_SHIFT 20
, w/ o& c3 d- A% j - #define ITCINTEN_SHIFT 21
3 P) L" H" y2 L& y% y! P: L - #define TCCHEN_SHIFT 222 v P9 f3 q! |$ X' k* ?& Z
- #define ITCCHEN_SHIFT 23; _+ [% Q2 F0 Y6 c6 l
( l( z8 S' A0 a; f; Q% y, l- static volatile int irqraised1 = 0;
/ Z$ k- M! T4 A4 | - static volatile int irqraised2 = 0;5 B3 K8 ?7 a/ u% ^
+ ^/ w5 y, d* K S$ j$ [0 P2 j5 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ k" f: Z, ^0 `( W; d( B9 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 M. _' k) o' y" J, E- Q: F) E) o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 h( e6 l. g9 x! `5 G1 R# \
- 1 t" b+ x0 a, M- s r2 e
- dma_addr_t dmaphyssrc1 = 0;: ?) o+ ?# Q/ b% [
- dma_addr_t dmaphyssrc2 = 0;3 {; C4 n( k" {& L# W! m5 X
- dma_addr_t dmaphysdest1 = 0;% J0 }4 Z" ]9 a% Z9 _" i+ v
- dma_addr_t dmaphysdest2 = 0; B! \% f( t1 `: B% K
: [% P$ u G" \5 q0 ]2 C7 H- char *dmabufsrc1 = NULL;, g5 y8 S* U z- @7 Q9 B
- char *dmabufsrc2 = NULL;3 w! _- o2 n. [4 N
- char *dmabufdest1 = NULL;* f9 b; Q! ]. _( c" ]
- char *dmabufdest2 = NULL;
! V* U$ _, ?4 {3 i4 n; O! y
: m# f5 T1 M6 r* O: m: C+ {- static int acnt = 512;
- o/ S6 M3 z/ W m) ^. } - static int bcnt = 8;% y% P q, ^# i3 F
- static int ccnt = 8;
' i# r9 p J& g6 h# _ - 6 |: r6 j4 _% C4 h Q- D
- module_param(acnt, int, S_IRUGO);
6 B$ J& D0 E, f; | - module_param(bcnt, int, S_IRUGO);. O& A/ ^" m1 ?, q. A
- module_param(ccnt, int, S_IRUGO);
复制代码
# W& Q. B# S2 g2 N5 g! j: A+ u* F$ Q8 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* G6 d4 j8 \' C1 I. ]. ?
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 p4 ^& }3 i8 l' x: T: Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; ]" r, o/ J; z. t5 @2 O5 x, R: x/ t' k0 y! I3 e* L
( E6 O* |* f& u7 y5 N |
|