|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 C o% B, Y6 F2 v/ u$ b' @0 m, H- [code]EDMA sample test application
; G* v4 m% R6 E4 C8 M4 c2 c; ] - /*
* q; U" d3 `; r; q8 d - * edma_test.c( }6 e) E9 C% e; P
- *" f7 D; W: z% U {0 {+ X. y
- * brief EDMA3 Test Application: F. e$ N, w- X3 u" t% M: o2 }
- *5 _1 E6 N# {' ~3 p
- * This file contains EDMA3 Test code.
( E! x( p4 ] j% p, C4 _8 u - *8 @+ A' a7 i& N+ x8 O% c( K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ _* U) ~) n( J2 [) ~! w5 V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ X S" [/ q: s6 s1 M7 c7 `/ K - * TO CHANGE.( V1 c' l# b& X
- *4 j; K8 d2 ?8 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( v' q# b Q+ P - *
9 G8 j( } w1 \ - * This program is free software; you can redistribute it and/or- F, k1 X* P T1 z* k
- * modify it under the terms of the GNU General Public License as
( }" c/ s' \: ?: g7 T1 J - * published by the Free Software Foundation version 2.
1 u! u0 U5 }! r; F7 U ^ - *
, Y3 E' R% N6 G) {; q y8 ~$ Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. H) X, ]( Q: d* P+ s/ S( _( h - * kind, whether express or implied; without even the implied warranty
- c; q. Y3 T" g* G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( z. S: Y4 {/ e: ^
- * GNU General Public License for more details.
7 N" p4 R! D% Y2 y: k( o' n - */
& x$ d$ s7 f9 a7 T
* m8 N9 n4 v& o }$ }# b- #include <linux/module.h>
0 z# k" L0 E/ ~5 J$ l6 A9 V; o - #include <linux/init.h>! u/ O. P- z9 B4 X4 U
- #include <linux/errno.h>
k7 T& H0 |0 e, l: d - #include <linux/types.h>
% V7 |" B- s. U - #include <linux/interrupt.h>8 V% C; `4 \/ D$ L$ P8 _
- #include <asm/io.h>+ [1 l4 D6 W! C; u, k2 O
- #include <linux/moduleparam.h>
G% Y! s1 I# P) H - #include <linux/sysctl.h>
/ u! w( r7 U0 G' H5 t3 }! L - #include <linux/mm.h>. |. ^+ m5 v( S3 U
- #include <linux/dma-mapping.h>
$ }8 z# H+ V/ ]9 E5 y
- W2 K# j- h' q+ Y1 L4 z; ]- #include <mach/memory.h>5 E) j% Z- K z/ G8 j; Q
- #include <mach/hardware.h>$ q1 }( k8 K( k( B
- #include <mach/irqs.h>
$ B) C; C+ N" @9 T - #include <asm/hardware/edma.h>
5 C4 @( B7 ^5 }: ]( g& j. [6 a - ( o4 ^* D9 d/ `. k, l! z
- #undef EDMA3_DEBUG
! y% \5 G; i& k; x0 P - /*#define EDMA3_DEBUG*/0 G' M$ R* ^8 N
9 z- a$ b6 H$ Q! u- #ifdef EDMA3_DEBUG
% ?6 Z4 Q) P k6 ` B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). y( f- m+ |: y5 k* S1 w: v1 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 r" s( n. \8 G7 h8 F" d' |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 `+ |2 ]0 ^; f6 L - #else
w: ^3 A( @& O: I8 ? - #define DMA_PRINTK( x... )5 a% o& ^ _% z, J7 K( a% w
- #define DMA_FN_IN
9 u6 @5 l0 w0 e - #define DMA_FN_OUT
- @% P5 Z: i7 z1 x! `1 J - #endif
( t+ S+ q; [5 Y* T - / G0 |6 v6 N4 R7 Y2 t* j9 o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 \& |) Z. O+ A5 m0 } m - #define STATIC_SHIFT 36 J" p$ O- u/ n1 s$ b+ G- ]
- #define TCINTEN_SHIFT 206 b# t% @4 s8 t7 @; C- P
- #define ITCINTEN_SHIFT 21( p5 g, ?$ H) h/ q$ Z# L) z
- #define TCCHEN_SHIFT 22
* I: L' s0 O0 K! u - #define ITCCHEN_SHIFT 23
9 p5 V O7 p7 j! B& E4 _! ? - 7 E. `+ l1 @, h$ v5 j! t! J
- static volatile int irqraised1 = 0;% |9 l/ k" d! n; I7 G* R$ W
- static volatile int irqraised2 = 0;$ C( }7 i P) e- l) W! d6 T" U
, w( L) V) E- M p _6 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 V! r" @$ A: q7 t8 v$ q! Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ]& ]- e5 f# B9 w1 m9 F2 X& M. r# H; s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* s# e+ o' y& ]6 O0 H, o' }& X - % \7 s+ {& F) I4 x8 n* a" L+ H
- dma_addr_t dmaphyssrc1 = 0;
6 v) j+ e \/ X6 V4 { Z- ^1 l' f+ w. `7 Q - dma_addr_t dmaphyssrc2 = 0;
, a; w. h" ^6 I - dma_addr_t dmaphysdest1 = 0;
9 G! K8 N* c J! p$ M9 M6 j2 ^' ^* d: J - dma_addr_t dmaphysdest2 = 0;5 y: P. B8 W& L, t
0 Z& c- Y! g% ]( M( }- h% f) g* I9 U- char *dmabufsrc1 = NULL;6 B# o+ S4 M! e
- char *dmabufsrc2 = NULL;
/ Y+ w) X4 g( K: Y( H9 u - char *dmabufdest1 = NULL;0 r6 Q" n* a$ s4 u4 \0 Y+ _
- char *dmabufdest2 = NULL;. {. n$ F H! K; h. N
, W1 b+ U1 g0 g- static int acnt = 512;5 y7 v1 [8 l- t5 X
- static int bcnt = 8;4 v4 [# R' `; ^$ E: Q* \' l9 W, Q
- static int ccnt = 8;
, y0 _3 v" ]$ \0 i6 O - ( l; |7 o: A0 j
- module_param(acnt, int, S_IRUGO);+ ]. B* ]/ s# s7 K& |
- module_param(bcnt, int, S_IRUGO);
5 J1 ?* g+ Q8 _) q" s7 y1 i - module_param(ccnt, int, S_IRUGO);
复制代码
7 `" H' X3 @; S: Q% K+ D+ R0 U$ d
# C* \7 m u @4 |3 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% z% C( Q6 \3 q6 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' H$ @2 g; D# Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 x/ c4 z: t3 @8 t. d4 z7 M6 j+ p! z' m6 b3 a
( ~; P1 Q- B r- e! C
|
|