|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) u* O1 W b* w1 u9 @4 O1 p m- [code]EDMA sample test application( o. e$ t+ ?2 D: M
- /* p! P" b9 ~' G x B6 v3 i% q
- * edma_test.c
) [; u( y9 w/ J - ** v. i0 N8 M* K0 ^# u) S7 ? }
- * brief EDMA3 Test Application
0 L0 x3 `% G" f' @ - *& x1 {8 m! |: C7 w
- * This file contains EDMA3 Test code.+ |9 U, ]+ Y' @; M; b
- *# s* W2 [) g3 k2 r; H( Z$ y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" Z/ }* o+ v5 {) z0 C: s' K* m, F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( `( A- f4 U/ X& T - * TO CHANGE.
L1 k6 x6 J1 A. O3 e6 }$ c - *
4 x) W! M$ m' i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' R( h, _% E( h
- *
( z/ p- I5 _4 O L5 k; D - * This program is free software; you can redistribute it and/or
* O9 @6 m+ P3 W2 p9 L& i - * modify it under the terms of the GNU General Public License as& ~1 `5 ~/ z5 S3 v _7 j
- * published by the Free Software Foundation version 2.6 @1 I$ j' ~( N4 D
- *7 n% ]. ]) \) s3 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 p; ?% g7 ?7 l+ I! y
- * kind, whether express or implied; without even the implied warranty: W" j) U/ t Q* c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 s5 W! S! C3 n% b; i
- * GNU General Public License for more details.* b' R# J/ Y' K( u
- */: u) A5 I9 t( E/ ^" ?7 o
- 3 b- i2 g6 e6 i: V
- #include <linux/module.h>4 r; A' s4 d( X
- #include <linux/init.h>; a. K6 V8 j! e! l9 A# ^5 M
- #include <linux/errno.h>
4 M* z, Z$ I3 W - #include <linux/types.h>
4 }' ~( Y" m5 f' |2 G% _ - #include <linux/interrupt.h>
$ l1 F. V) r( E' l2 t - #include <asm/io.h> Q; A: y+ b; g* ~: F
- #include <linux/moduleparam.h>
7 f( I4 z+ E( O, {# | - #include <linux/sysctl.h>" d! a2 s4 d2 J( o w
- #include <linux/mm.h>6 Y K0 [7 f7 o2 Z& x3 q ]2 W# q
- #include <linux/dma-mapping.h># Z! a2 s8 r2 x
- : `4 N7 V P6 u2 I5 |, }
- #include <mach/memory.h>
/ b* q4 ^/ m; i, Y1 U% p - #include <mach/hardware.h>
, t! c) M+ X" m. g - #include <mach/irqs.h>
2 F, W: f# m, e8 ], D: h* f8 z. M - #include <asm/hardware/edma.h># l" M- r! T" A; ]- J) W8 s& H
5 o( p7 S: Y& E( h3 `- #undef EDMA3_DEBUG& t4 K a6 Y+ ~) h
- /*#define EDMA3_DEBUG*/' c! t5 a% [$ v7 w0 r
- 7 G' b7 A3 t; o* r
- #ifdef EDMA3_DEBUG
( p G }& A/ q& r% F9 |9 o3 p! { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 [$ s4 ]* X. J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 [- o# U: g) P0 C! M" }: i, r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% K/ W: u" l0 h. S8 Y, W. V* y$ F - #else
0 n! \; |8 S4 f - #define DMA_PRINTK( x... )# F& \$ H( p0 Q
- #define DMA_FN_IN
" F% N0 B9 y2 p - #define DMA_FN_OUT
3 \6 K/ e" Q; ~! v& }! E! ~+ ^ - #endif
6 M9 V+ _ K: }" g - + a* c7 Y1 `7 w2 p q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! L7 q! W+ T! ?4 I - #define STATIC_SHIFT 3* w- H# _ I4 e% ~/ W& h
- #define TCINTEN_SHIFT 20% s2 ]& h: Z3 r$ O
- #define ITCINTEN_SHIFT 21; P0 x( Y) x7 {# \$ @% B- z
- #define TCCHEN_SHIFT 22# W: a$ i, ?* ]
- #define ITCCHEN_SHIFT 23
3 G: g4 v5 h! q% Y - & V. r, `; A+ L9 b# m) L+ R
- static volatile int irqraised1 = 0;
2 V" ?. d4 n& D/ d0 j7 v - static volatile int irqraised2 = 0;
9 e8 X5 y0 o3 j- B' C
9 \1 b& m7 g4 O* E/ \1 G: _3 [; q' w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 t& J* v& E" N. P! I: I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ H' G) L8 J9 y( n. }: e' k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& d( D% F' k( X; @6 O9 I - ' |- g) k2 S) S/ a5 R, Z/ E8 x" G
- dma_addr_t dmaphyssrc1 = 0;/ m# k; Q& d- z" T4 W
- dma_addr_t dmaphyssrc2 = 0;
( y, f3 u* W5 u. D8 t4 S - dma_addr_t dmaphysdest1 = 0;3 T( g& T% s: s( d, x% Z2 c+ N
- dma_addr_t dmaphysdest2 = 0;
, r) S' x/ N2 R - ( o# u9 K' @! ]' [0 C* E
- char *dmabufsrc1 = NULL;
! @% m9 q/ z u - char *dmabufsrc2 = NULL;" V9 O8 W2 Y1 Q+ J- h7 n
- char *dmabufdest1 = NULL;, O- H$ D) j' M+ s; d
- char *dmabufdest2 = NULL;& _, j5 }% v) S4 f% `
- 1 G3 Y8 I ~9 v" V3 g1 ^( l
- static int acnt = 512;
" E6 P4 u5 K' @+ x, v7 r* m' ~8 M - static int bcnt = 8;
& B, r3 R/ v6 c3 h- J0 j$ @, } - static int ccnt = 8;
" v7 V8 D! ^9 {8 \ - e, @3 x9 P8 x
- module_param(acnt, int, S_IRUGO);
) h+ T, m* f% M - module_param(bcnt, int, S_IRUGO);6 q! ?5 H( ?+ w: y
- module_param(ccnt, int, S_IRUGO);
复制代码
9 p% p* m, V7 ^ S$ P5 ?( P8 Z' {
0 A# D ]9 _* C. b) ]1 F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# l% ?, p) x9 F4 S" _. jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* \4 _& x* k" t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- {7 ]7 ]6 A* {" U; j1 v- C9 h2 N' ^( G- y, a* o
$ |5 g: J5 W8 y, E( F, z- d6 t; x
|
|