|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) R Y" |3 O! w$ P3 [9 g5 {- [code]EDMA sample test application' V% v7 M$ @6 K& j
- /*
) U' }- p5 E* g8 E% D3 k - * edma_test.c
0 _. l5 Q/ }* ]- N0 [ - *
. C A4 B* g2 O3 z" s - * brief EDMA3 Test Application8 l0 a$ U. x8 s* h* _
- *6 u6 S- z! G2 v7 {4 T* T
- * This file contains EDMA3 Test code.
- n/ }, s- w3 \' F; ~ - *8 K5 p/ y8 ?2 {: D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 f* e. A, w9 ?7 H. a+ D6 S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) U l- I" ~+ Y: k- _5 h
- * TO CHANGE.' |# T+ Y) z+ [; h/ b' W0 p
- *4 `% {9 N1 [3 ]5 Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; O% v/ a& p) I - *4 n" J7 ~3 o( |3 M) L g& t* P
- * This program is free software; you can redistribute it and/or7 l. ]0 G! I9 ]6 w
- * modify it under the terms of the GNU General Public License as& N% b7 e) l' p* i6 ?* W0 a2 a7 I5 F
- * published by the Free Software Foundation version 2.
. h" _, D) a2 B' J+ A - *
9 Y0 K' Y7 B3 ~/ i, F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 A( P5 T9 K" e( A! ~) Z+ F( Z
- * kind, whether express or implied; without even the implied warranty( }$ X+ j$ l8 H: C0 @6 D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, ~# m4 U. f: [6 q) T9 j
- * GNU General Public License for more details., V4 R( N9 U2 W2 ~) d
- */6 M, d: H5 b! x: U6 B& O0 k
- 5 D3 s# }! E- N* {$ v% L y! R
- #include <linux/module.h>
# p5 J0 u. m6 B$ g3 m - #include <linux/init.h>
# w. g/ c. {- w - #include <linux/errno.h>
6 T* u- B5 E# P% i; i - #include <linux/types.h>6 x7 z) N, ~1 f3 H5 U
- #include <linux/interrupt.h>9 g t) H9 ]* e f+ v
- #include <asm/io.h>
1 ?" r& e- m' R - #include <linux/moduleparam.h>9 r* T( A, M l& M2 O" k. B+ o: L' @
- #include <linux/sysctl.h>( p5 `$ B+ A$ j1 U
- #include <linux/mm.h>
6 v* J2 _9 a8 m* \8 \; i) S/ v* E( F - #include <linux/dma-mapping.h>, U# Z1 H! v, y# o
; }/ v2 W5 |2 Q, u' O% s, x- #include <mach/memory.h> c0 d& k6 {- ^8 m& n7 p
- #include <mach/hardware.h>
; D' j2 p0 E8 d8 s# Y4 T- J6 e - #include <mach/irqs.h>
# q8 ?* a/ i- D5 N1 ? - #include <asm/hardware/edma.h>
5 i; |/ b0 y9 f6 N+ p1 s( t- n6 }' O6 T - + f4 ~2 c/ Q2 H! q
- #undef EDMA3_DEBUG5 }0 H! j1 r8 U" Q( C7 D0 X
- /*#define EDMA3_DEBUG*/
. J7 G! e4 R; ], G _5 T+ r - ( M! ?' ~# s) [4 c; s
- #ifdef EDMA3_DEBUG
8 \: k8 E5 { ?' R" k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ a# u# k; d$ M! b) n; @! l8 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( g# o7 m& P- c3 s2 ^6 P2 ]' \/ u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- i. k) C" T. N5 u V, H
- #else6 W' W, T' [; M( C$ `; ^
- #define DMA_PRINTK( x... )
. A0 \* A! O/ { - #define DMA_FN_IN+ S- y6 V: R- ]! I" }. U- X( e' P- J# S
- #define DMA_FN_OUT
7 R. x t5 {: y - #endif
; \+ c# v: C, c
* |1 n* O6 M9 U( _, C9 M4 t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ \5 u$ w/ b2 x+ r7 g - #define STATIC_SHIFT 3/ x5 d5 I5 M$ o2 L* Y- N
- #define TCINTEN_SHIFT 20
3 B' y, V; s, ~+ d0 B - #define ITCINTEN_SHIFT 21: s) ?2 J. o) X1 \. _6 G" N
- #define TCCHEN_SHIFT 22
* f/ _- _$ u4 g6 p4 A! }9 U6 K - #define ITCCHEN_SHIFT 23/ y4 a) F! S, l% N: \& _" J- q- |4 q
- 5 p: o; I& x& d
- static volatile int irqraised1 = 0;
' F( x1 s2 n% ^( Q6 Q; ] - static volatile int irqraised2 = 0;+ n; G3 U1 C% {8 z! X8 n
{/ e* _+ a9 r" a& t$ q5 |1 ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 N0 Q+ q0 d: A) u8 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& V! p+ D7 E/ s& T/ S9 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! o$ ]1 P( k9 |- ~7 i' ^% H
3 O' O) ]) [% K& w" o! H5 Z) i- dma_addr_t dmaphyssrc1 = 0;6 J+ D6 p& X. e
- dma_addr_t dmaphyssrc2 = 0;% A; q( c/ w9 K
- dma_addr_t dmaphysdest1 = 0;
- s9 H) W" O- c- F( | - dma_addr_t dmaphysdest2 = 0;
0 u6 f( |& p& `" R - ; g {& n5 W+ r( e+ h/ W& F/ H+ y
- char *dmabufsrc1 = NULL;
. U" J8 `7 Z, j6 r% f+ I3 { - char *dmabufsrc2 = NULL;* X: V& ~* m6 P& S7 R6 `
- char *dmabufdest1 = NULL;& ]4 n. y; l+ c
- char *dmabufdest2 = NULL;0 ]! s8 M1 b" o$ O F1 }
Z0 a* o8 m* v, m/ W# E- static int acnt = 512;' |" C( l( a7 P$ C! P4 }
- static int bcnt = 8;* f; b/ v+ u: d5 V" Y$ x
- static int ccnt = 8;
( V+ m/ y- T7 \: U0 K" N
% H4 g# T$ E" {$ n6 q' z- module_param(acnt, int, S_IRUGO);0 R; Q% B9 _( X( x/ R2 v0 m) T# y
- module_param(bcnt, int, S_IRUGO);$ u1 r1 N5 \' B* f; O) g& @' A
- module_param(ccnt, int, S_IRUGO);
复制代码
) L+ \# M7 Q1 L( `
7 P( D' V* f- _/ o, ]" t1 [$ w, ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 w7 p7 t# F( w' R' C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- A9 B8 r( T! E7 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* H1 L% W! {5 F( H# g/ K
8 ~7 j- y9 X4 Q
4 ~7 y1 k9 @- A/ ? }8 F |
|