|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' m5 G# x/ i u
- [code]EDMA sample test application
) N; X* h# m: {6 E9 q - /*5 B p7 F2 |2 J( s P; m
- * edma_test.c
) R9 G9 d. z4 Y6 T6 t - *! _7 q) H6 O: c& Y' M/ J
- * brief EDMA3 Test Application, Q* T- J0 d& {! Z. m
- *# n4 y q) n$ w8 g
- * This file contains EDMA3 Test code.0 P0 U8 z; }8 D6 |7 ~% e
- *( Q; y* g. y3 N- i: A/ p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# b2 Q: [# q+ Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! A. ^7 u' S& ^ - * TO CHANGE.7 U) p6 {. D* R: I2 K# m9 s2 p
- *0 g5 p- b7 `* z$ D2 j9 F, j; M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 f) D! C, t8 Y3 i, w( e( m O. F
- *
; |4 R. ~9 v( k' ~ - * This program is free software; you can redistribute it and/or4 E- V- g: U4 w7 A
- * modify it under the terms of the GNU General Public License as7 e# y/ t! t7 @3 T5 _
- * published by the Free Software Foundation version 2.
( }2 O0 v1 n' X/ P - *
( J4 D$ V+ {- G# s) e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Z5 k/ y" J; @3 c# Q' B7 V
- * kind, whether express or implied; without even the implied warranty
& W' C2 n3 {7 F& x8 h' p A z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 ]/ y' s5 D! f$ u! `4 S
- * GNU General Public License for more details.
9 R# S9 B! ^/ z2 S4 U6 X - */
! H5 U$ o1 R* g
9 `. X7 L; R7 |3 V- #include <linux/module.h>
" s8 H' F- U% x" e' x% @- M2 ~ - #include <linux/init.h>
* i; _1 ?0 f3 j: V9 n - #include <linux/errno.h>7 c0 z$ {5 e3 s
- #include <linux/types.h>9 A% R5 q y0 F* J. G" g
- #include <linux/interrupt.h>
/ R0 I8 v4 z3 s& S. r9 n - #include <asm/io.h>$ n; \( [/ W8 ^! o9 v3 i" W0 S
- #include <linux/moduleparam.h>) j2 q; @- f |, D4 N
- #include <linux/sysctl.h>
% l- L n ^' a ^* P* x+ x - #include <linux/mm.h>
$ v3 \8 B; S r: o* x. X: N' B - #include <linux/dma-mapping.h>
3 |5 x3 I( C9 T6 Q7 \" ^- ? - 8 a; b: @! S6 B: G2 {6 A
- #include <mach/memory.h>& L% E, k! t" r& `4 U* i, a- q3 D
- #include <mach/hardware.h>' K2 x3 w H. O- c& `. s2 c
- #include <mach/irqs.h>
/ L6 \. w2 W6 } - #include <asm/hardware/edma.h>+ z. Y; v3 e- o
- 1 I+ f5 L0 U( k E
- #undef EDMA3_DEBUG/ R* g; L8 E$ L: r, Q
- /*#define EDMA3_DEBUG*/9 u( o* D1 O6 O- m
: g+ o( r9 f3 g5 ^- #ifdef EDMA3_DEBUG' z$ m: _: c9 l! k) ]4 n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) a, N' z% }7 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' t) K% s( Z) W0 l% C- @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 h5 m1 b5 {+ C, M" V. R, C - #else% s8 L" Y* S. {! Y1 g' m
- #define DMA_PRINTK( x... )' Z, X* n$ Q# u$ C' w$ F1 f
- #define DMA_FN_IN" A" y% G/ s! ] r) m
- #define DMA_FN_OUT( ]5 \5 D( l) g, a% |
- #endif
3 g! Y. W/ u6 t& x
! X" Z: K/ X- k1 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768); w/ Z5 i* ~2 U: R: d# d
- #define STATIC_SHIFT 3
x! _, O$ ~' p+ J - #define TCINTEN_SHIFT 20 d" K X* d' q1 I' Q6 _% S
- #define ITCINTEN_SHIFT 21
" V3 j* _$ v" {, N - #define TCCHEN_SHIFT 22
; ?2 e r- l6 Y; b8 I - #define ITCCHEN_SHIFT 231 i6 e# `$ H- L3 ]
! _% C4 k# e& a% K- static volatile int irqraised1 = 0;
7 `& h, i" }8 z" L) J# Q& W - static volatile int irqraised2 = 0;+ M9 P5 P8 S7 c
; i1 M: y D: P" ^5 r g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 q2 [6 q9 Y, t! H6 d: L" H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a: h4 [; }2 ]% g4 @* c j2 v/ [- K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
n9 h/ ~: L) T/ U! O4 h& U( t
! ?8 j5 O1 r( i- Y0 k4 q7 h8 f- dma_addr_t dmaphyssrc1 = 0;
; i0 w7 ~; u% A8 S$ u' d - dma_addr_t dmaphyssrc2 = 0;1 p. c: \- J0 E" r
- dma_addr_t dmaphysdest1 = 0;% ?, M/ m1 Y4 y) g
- dma_addr_t dmaphysdest2 = 0;
4 _- w1 t( d f+ K( [, B
- c1 v" t- N C( l8 v/ @! U- char *dmabufsrc1 = NULL;
) d7 E+ k8 \& p$ W7 z1 D L - char *dmabufsrc2 = NULL;; E7 r# x, s9 @( T) ], E3 M9 @. q
- char *dmabufdest1 = NULL;' r5 _! S+ F3 m! Q
- char *dmabufdest2 = NULL;1 ^& _, e/ q4 L
1 z" U+ r! x' t, V5 I' Z9 S) R- static int acnt = 512;9 `: d& W- n1 }; p! n c& `* {. }
- static int bcnt = 8;
( I$ a1 G: u. j% Z. h1 `% G; @ - static int ccnt = 8;# ~# {+ F9 X* F7 j( y* x) G
- ) `8 x @$ I% u+ U6 j; Q" s
- module_param(acnt, int, S_IRUGO);' a& Z A4 ?/ q) @5 x
- module_param(bcnt, int, S_IRUGO);
, l* \ o& I. [/ g/ [: r8 t: W& [ - module_param(ccnt, int, S_IRUGO);
复制代码
& M8 Z$ v2 ?3 Z0 L
% P- {7 t. z& I3 R% K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; f4 i" Y/ y+ S* p; Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 w' Q) l6 K+ k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ E" i) j$ E7 A/ ^: |+ o' w% h; x1 i5 z4 L# R
! |0 B1 U; a' K |
|