|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 b3 K) d( M7 O" d% w* G6 b5 t
- [code]EDMA sample test application
% V1 B s- I& a, `# m+ Q( D/ u - /*+ F/ S# S6 F A3 F! ^9 c; B1 r
- * edma_test.c: r3 m% s9 w" D$ a5 m
- *
+ I/ f, ]! N: F5 J {$ E# n - * brief EDMA3 Test Application
( M/ |' Z& t1 e; y7 W6 [ - *
6 b \+ b( \% [9 P/ d" b6 K* @ - * This file contains EDMA3 Test code.; s4 w1 ^/ I. S
- *: h! \/ L5 a% f2 Y5 @6 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* Q; B7 j8 z: ]) X0 S( {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: N* p/ }. }9 C" R
- * TO CHANGE.
5 Y/ N3 P) k- M2 {. i - *
; F2 O# m1 {& Y1 \2 W* d! m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 z3 g* R% x* ]
- *
$ r! p# F( [' n - * This program is free software; you can redistribute it and/or
3 N" {: ~% e, |" r- V - * modify it under the terms of the GNU General Public License as
' T* ^$ A# E5 m3 G7 J - * published by the Free Software Foundation version 2.7 c8 b. m; x! s* Y% L% ?! ~+ H5 N) O9 p/ }
- *4 a& r& q h8 N' E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 b C5 d5 i* s0 q* U4 \/ }+ Y - * kind, whether express or implied; without even the implied warranty
/ E2 `& h( r( V8 R: u$ H0 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% ]8 j# }. |& y( ^8 {( _: B
- * GNU General Public License for more details.1 M Z! d( O# Q5 d+ T
- */- |7 z% n: F6 M- ^+ }
! l9 `8 [7 W" `) u3 ?- I- #include <linux/module.h>
% k0 X) z! D' ~( q( d - #include <linux/init.h>
; h, }; v. A* A0 n" P - #include <linux/errno.h>$ V" l# L: k+ M* P
- #include <linux/types.h>
- T! ~% ]7 \- O - #include <linux/interrupt.h>
; o/ ~6 n9 Q% e% M1 Y% P. D0 Y - #include <asm/io.h>
5 W9 u4 q* c- X - #include <linux/moduleparam.h># U6 Z" P* S6 x) b
- #include <linux/sysctl.h>
+ H4 d3 N4 i. ?) O$ d4 v* k; N - #include <linux/mm.h>
. h& i- \# B, K* h4 k7 v+ } - #include <linux/dma-mapping.h>8 q2 {* _$ i, u: K: M. s
6 q w/ i7 t* S2 W0 Z. [- #include <mach/memory.h>
- o3 X# D) u9 |: `2 O - #include <mach/hardware.h>! |+ {% c' u# Q9 x1 @# c6 \. ^! H! w
- #include <mach/irqs.h>
( t' y9 I4 v6 _4 Y: ]8 A* d - #include <asm/hardware/edma.h>! b) |' ]6 o2 K+ L: D0 |) z: R2 s; G
- ! J" [! H P! |
- #undef EDMA3_DEBUG
& p2 S: l6 j: ^6 t2 |8 H" ]+ U1 P% y* f* Y - /*#define EDMA3_DEBUG*/% s, f5 T4 x: B, X8 {
5 |/ R- S, ~8 ^4 ?, {( h- #ifdef EDMA3_DEBUG3 P7 L" E( H! V8 X1 L* s a8 r& `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), {; }! b9 ~& u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" P9 ]3 o6 [+ ~+ B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; M! @1 P/ r! C" S - #else6 }- f4 I) n0 S' n2 n* ?
- #define DMA_PRINTK( x... ): `- W& u% A! q9 `
- #define DMA_FN_IN
! S& X. O" N# H( l6 [ - #define DMA_FN_OUT
3 w' D+ L4 ]$ a6 k% }5 y9 J% E - #endif) r( @ ?: k9 h1 d# U
- 3 u6 G5 k8 D7 d7 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 g# w* {$ O2 a' z - #define STATIC_SHIFT 38 u" i) e- B0 G: V. H! C" A
- #define TCINTEN_SHIFT 20
6 w2 \# M; H' v* _! o6 A - #define ITCINTEN_SHIFT 21
/ m/ _# g" e2 u4 t# A1 P5 N- _ - #define TCCHEN_SHIFT 22: ?! G4 f, M+ H* E+ p" h5 }
- #define ITCCHEN_SHIFT 23
$ C# b: {* O6 f& V! Z: @ - * P$ N) W1 \: q+ p
- static volatile int irqraised1 = 0;4 G/ T& i" ]( L/ g0 r% u
- static volatile int irqraised2 = 0;
2 Q ?6 A8 g. x - 8 y z* z' i" p" V: `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 B4 j4 L. C/ y( n' n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- j3 G- p0 ^8 s5 M9 W/ L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 U/ o7 N% l# K
- ( |3 G" E. c, n/ }, x
- dma_addr_t dmaphyssrc1 = 0;
7 k6 K6 T* D4 h9 J" c' V - dma_addr_t dmaphyssrc2 = 0;1 p; M. o' z& q
- dma_addr_t dmaphysdest1 = 0;) O! v% Y8 @$ k/ H$ w& s
- dma_addr_t dmaphysdest2 = 0;; I- A: H8 t, u0 g8 y$ y$ W9 u
+ ~ K9 ]# \: d+ w2 ]' z1 j- char *dmabufsrc1 = NULL;
( `' {2 U( t0 L5 i( M% h- K- X - char *dmabufsrc2 = NULL;
0 k6 J% V$ x2 B5 `# e0 ]2 P$ y s - char *dmabufdest1 = NULL;! U T$ ^9 \ q; z- Z& a2 C$ d
- char *dmabufdest2 = NULL;( k/ q6 b4 E" r. C3 u7 d
* v6 X8 }2 j- O* \- static int acnt = 512;
" b9 L# ^8 h, F0 k - static int bcnt = 8;
7 o6 h1 n9 J4 O0 z$ Z - static int ccnt = 8;
7 n8 G9 H. q) E3 l
- Z1 {8 e6 f) R i+ e- module_param(acnt, int, S_IRUGO);
" B3 \+ N1 q( `5 w. @ - module_param(bcnt, int, S_IRUGO);/ h7 E* D; i% A7 P
- module_param(ccnt, int, S_IRUGO);
复制代码
! `; J6 w+ }" ~' f) f e, d. j! X5 M0 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- C; p) N2 i" Y9 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* ?) W, w$ L9 ^ R0 t2 t9 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ l2 L( U( a; n. @2 n. }
( @1 d7 [! U8 X4 R: M" c, o1 ]+ v" D7 ^9 _; ]5 h9 p
|
|