|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 A* }4 T) R* a6 v8 h
- [code]EDMA sample test application- w5 b& ^' R% i% ]: k' N4 @
- /*' E4 J" `4 `4 W9 f2 y
- * edma_test.c
8 q5 w% a) b6 J/ |9 } - *
/ s- B) `4 Y: ~ - * brief EDMA3 Test Application
1 G5 t6 X( v/ N! k - *
' @' h: ^8 j( G" \2 w3 E+ f - * This file contains EDMA3 Test code.
( U: K6 c$ S, S; H# R0 M0 J - *
; [1 | h' v2 b/ C N+ e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) Y* H2 j5 O7 f- ]# X* M# K. f, c- N9 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 L, F" M% S' X1 t5 q
- * TO CHANGE.& I8 k i" `6 ?. A' C
- *% a) J' U' d( k/ @7 F2 \6 P& c+ i) `2 F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 o% ^( b, ? Q- [
- *! ~+ [- Y- A ^5 y* r$ p
- * This program is free software; you can redistribute it and/or
4 q( }/ e" v( d - * modify it under the terms of the GNU General Public License as
4 \) ~% a: B0 e - * published by the Free Software Foundation version 2.
5 d! Q; |: H! w F5 @ - *
& e4 f& P" W/ H5 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 p1 y, ~5 X) V _' A1 g& D - * kind, whether express or implied; without even the implied warranty8 @$ ^+ y0 j" L: U0 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ h4 K# n! [5 o% K1 F2 w
- * GNU General Public License for more details.! ~7 R+ f; Q$ Y1 n
- */* O2 u8 y& J$ j3 p
- 7 n; t0 a2 G0 m" L) f0 |' m
- #include <linux/module.h>/ R" L4 t4 K" |5 M: w8 \. F# o
- #include <linux/init.h>
; c2 e% b- }" Z+ q - #include <linux/errno.h>
( P! y* r4 X: y+ s: A0 Z% t - #include <linux/types.h># Z5 R K/ ]2 v/ r
- #include <linux/interrupt.h>
. R; g0 q' M" T/ ]/ i9 s - #include <asm/io.h>/ l% J5 G% a' q( n, Y
- #include <linux/moduleparam.h>
* w, {% C9 v C+ {) A - #include <linux/sysctl.h> Q2 x: \+ j" w& M
- #include <linux/mm.h>
8 V+ s: l# _- @+ K3 `4 _ - #include <linux/dma-mapping.h>
( J/ |, C, P7 p
) ?, N: ~1 S6 |! u9 N- #include <mach/memory.h>! j( k5 i- c% s% g$ F* I
- #include <mach/hardware.h># G+ e: c6 J; z5 N8 z4 l% W2 u7 z
- #include <mach/irqs.h>
$ I+ X7 i B- q- } - #include <asm/hardware/edma.h># {8 S3 ^' B" E
) C- n) X: B+ O5 k0 T" b7 N- #undef EDMA3_DEBUG- z# F# m' R! w4 n9 ]* U& a
- /*#define EDMA3_DEBUG*/
* W; q+ a% p% |) H: x/ Q
8 h R3 b& u1 b4 a+ m- #ifdef EDMA3_DEBUG
$ |: F+ M3 |7 c: ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 C& a, ^( X& E3 U' K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): A1 [- |6 V# I5 }7 t% _, @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ G' s+ x7 \+ u& C - #else
7 m0 P6 J, t% m9 |* N( @7 s; p - #define DMA_PRINTK( x... )) w! Z( V/ l. {( d F$ [* h9 T C
- #define DMA_FN_IN
/ V+ d0 u; k. ^. ?5 f7 y2 K - #define DMA_FN_OUT
- ]0 U0 @ Y! _6 [; w# s" H - #endif
0 U/ ^0 c* i" e - + f+ m3 |) T! D. |$ y g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 ]7 X. V* k( D1 c+ \ g( U - #define STATIC_SHIFT 3
- k& K* |; ^* }. L3 v. P2 j. C3 { - #define TCINTEN_SHIFT 201 z/ r& v. D( l: F0 o2 x
- #define ITCINTEN_SHIFT 219 \( B5 c2 M/ x" ?
- #define TCCHEN_SHIFT 227 w) U6 j/ Z! a$ M
- #define ITCCHEN_SHIFT 23
0 N a A$ ^7 k$ _" u
3 S$ V0 r3 v# Y4 G$ W3 `- static volatile int irqraised1 = 0;" i2 W, V- u/ w7 I( [5 N8 J2 v! ]$ g+ v: o
- static volatile int irqraised2 = 0;
. R3 q- w) b: z# Q1 {8 M+ ~ - 8 f7 k& ~+ W; A r5 {5 [$ w5 w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ c$ J, p+ j3 V2 z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 z# G& u7 V% q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 K/ l7 I0 V& z% R - ( I' E0 o. F+ ~7 N8 J' ~
- dma_addr_t dmaphyssrc1 = 0;; \" v% D/ k3 D: O- G
- dma_addr_t dmaphyssrc2 = 0;
( W3 ^2 v. ?6 S. @: |+ o - dma_addr_t dmaphysdest1 = 0;
3 Y7 E! V. V( Y1 n3 N8 A - dma_addr_t dmaphysdest2 = 0;
7 K- V% [" s: h5 k. P - % }" m2 m, P' ^# N: r
- char *dmabufsrc1 = NULL;& a* }, p; B# N. X
- char *dmabufsrc2 = NULL;4 r' o8 J& p7 c
- char *dmabufdest1 = NULL;
x" p* u* p; ^& ?# E! K - char *dmabufdest2 = NULL;: f, E: c$ g2 b- H' p
- ( K& U2 `; `# d9 C! |
- static int acnt = 512;
) a* V4 |. [& L - static int bcnt = 8;7 }+ P. L; J2 R+ y$ ?% Y0 ^
- static int ccnt = 8;" |1 \% V* Y& _4 X' D2 q. O
# E8 ]9 @/ B0 t# ^9 \9 p% u- module_param(acnt, int, S_IRUGO);
% w( W Y) d6 D* J - module_param(bcnt, int, S_IRUGO);
3 I6 M+ l6 h B' _) S - module_param(ccnt, int, S_IRUGO);
复制代码 " z& h& X2 ]8 A/ y; B
4 u" l5 P% |) Y) @& g7 K' Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- d: Q2 p$ ]& e+ v, Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ y" r* f* v) k- S3 M, @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Z2 q* P$ y: U d4 u6 X6 }* M" f0 P
s" Z- E! B3 Z4 M1 w5 w& |4 {( ]$ y9 K! o! \& L& Y+ [
|
|