|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 g- b4 J! W8 z' J2 j' y3 `- [code]EDMA sample test application
1 T; C8 n( S! b$ O- | - /*
; N% Q% A% N6 K3 A- Y0 H; u0 o - * edma_test.c
2 G D/ Z0 I: d, D* q$ [. d0 O - *5 m' s1 B( b1 m, I
- * brief EDMA3 Test Application
$ n, |1 y8 B& g L+ W - *
# [* M# R& j% z$ r; s: S - * This file contains EDMA3 Test code.
! _$ q9 G) R1 r& Z$ K% L* g2 M" L - *! u8 v" V$ @0 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% l0 k, P6 f9 {# v5 r! a9 F8 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; Y+ `6 O2 c( R% o - * TO CHANGE.
0 {& W |8 ?# b4 D; q& [9 G, \ - *
8 i9 Q7 i" Q5 q: ?6 }( A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; J- ?( h! ~8 ~ - *
4 S- v8 y) }) {$ J R% c; C - * This program is free software; you can redistribute it and/or/ m6 V: }" z/ @6 L K
- * modify it under the terms of the GNU General Public License as, \) L# b. m* w Q7 b& `5 Z
- * published by the Free Software Foundation version 2.
2 i7 K9 y! c. P7 M) w! | - *" q# K" r+ l* p( v" U" ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" _; }( l! m# u4 O% o7 }% E& [( T
- * kind, whether express or implied; without even the implied warranty, f; P- ~8 G* i) b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
N' r: D. _3 G; L1 q7 U" Z* Y - * GNU General Public License for more details.
. o! X; v% u" X# M5 N: w0 m - */" p, r7 Q" O( U, U$ O: p9 @
6 C, ^, Z- h. A2 V- #include <linux/module.h>! S( j0 Y2 u$ u: m! k
- #include <linux/init.h>% C$ j. B, V: L+ g }
- #include <linux/errno.h>+ x" `+ d6 E2 W; N& \4 M* {
- #include <linux/types.h>
+ e3 ~4 r0 |! S0 N: C0 O/ a - #include <linux/interrupt.h>
9 c; c1 [, [# s5 _" i' @4 R - #include <asm/io.h>
7 h$ w) _9 Q' ^* q/ ^ - #include <linux/moduleparam.h>4 u- X+ q! Q8 t) n
- #include <linux/sysctl.h>3 m. i H, q/ ^( P5 p& D: G
- #include <linux/mm.h>- c. o6 r, F5 c [# x6 f
- #include <linux/dma-mapping.h>* G6 {. S# a! M+ a
- / m8 n+ b1 s6 m9 u" U) K
- #include <mach/memory.h>9 g3 h$ Y. N; u1 b/ e
- #include <mach/hardware.h>
# [( Y+ M) `3 W9 x5 i - #include <mach/irqs.h>
+ [# X/ p9 u, e1 b) L) | - #include <asm/hardware/edma.h>
& B3 K9 |) d$ y4 g7 d- F! f4 g
8 ]! m+ T, Z9 T- #undef EDMA3_DEBUG
/ @! Q, r/ d& b) }6 W- k - /*#define EDMA3_DEBUG*/
% m2 S/ V3 O3 V+ ^, j6 S7 e1 V - $ h: W6 o2 M0 {
- #ifdef EDMA3_DEBUG, r8 t+ q* V$ c$ M: k2 h1 ^9 A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" X% q7 E6 x& y( x9 V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 l2 c; Y! B+ K: ?& |, C! X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) K+ t Z: P- }" n - #else
8 i+ P- G6 Y8 s4 W: a$ [ - #define DMA_PRINTK( x... )9 M0 Y \ \$ @/ L+ k) e, ]
- #define DMA_FN_IN- K m k9 d$ ?* D! D+ K! }
- #define DMA_FN_OUT6 `+ Y* g- w( w) g3 y/ a
- #endif
" c+ X" g) Z: w% S - ' h, H1 w( E2 U7 k) i/ {) x) W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ d( l1 z) V+ |! ~* L; p
- #define STATIC_SHIFT 3 ^3 Z& I% ~$ M6 B' B
- #define TCINTEN_SHIFT 20+ W$ t9 h) Q3 L$ i5 \
- #define ITCINTEN_SHIFT 21( f p, v, p, v% z4 y( L
- #define TCCHEN_SHIFT 22) A1 p; I8 k- k) \! w8 H% E% K
- #define ITCCHEN_SHIFT 23
2 x$ q0 ~ n) x, F4 G9 K/ y+ f - # @4 T2 q: S G. t+ ~6 j, x
- static volatile int irqraised1 = 0;
+ l1 @ N$ ?/ _ - static volatile int irqraised2 = 0;
) [% v9 A, L4 {& V3 L - 1 b7 ]; _: F# K4 r8 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ?9 t8 M. u( Q0 d w, ~. j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [- D4 x9 x7 Y5 m2 n8 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" L5 ~* O# Z5 o! S - 6 A4 }% i% [! c$ F! i# B. E
- dma_addr_t dmaphyssrc1 = 0;
5 C5 N. O* x5 ` - dma_addr_t dmaphyssrc2 = 0;- ?$ g+ b! t$ N8 \* m
- dma_addr_t dmaphysdest1 = 0;9 I3 W1 N0 U* F# L+ o5 G- R+ r; E6 D
- dma_addr_t dmaphysdest2 = 0;
4 ~, Q- c1 a+ I+ v1 y1 r; f
# m% a/ v+ c H9 i2 q/ b! }- char *dmabufsrc1 = NULL;( R* m7 B8 P E+ w
- char *dmabufsrc2 = NULL;
# o E( {1 ~: B: B/ T - char *dmabufdest1 = NULL;
$ H# q# B; W0 a1 _3 @ - char *dmabufdest2 = NULL;8 U* b* a' t; f6 n1 f: ^# ?. ~
/ O; E" R0 z3 e- static int acnt = 512;
& } h! U# O7 N9 F1 S - static int bcnt = 8; {0 {9 x* {! z3 C- M
- static int ccnt = 8;0 A$ ^2 E* j4 u- ^4 R( V
- / T3 G/ R5 i' [8 W) A* ?
- module_param(acnt, int, S_IRUGO);. _: _1 _% e( _0 c' |9 G6 ?
- module_param(bcnt, int, S_IRUGO);5 [! b& n6 X5 K+ S; M- f3 I
- module_param(ccnt, int, S_IRUGO);
复制代码 * b! `+ s* W9 e* Z! E/ U- f
+ b$ [$ w2 j/ y" N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 C* O: f- b; a7 I 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 a' Y$ D# \. i) n8 K: y+ Y- J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 S# @( A K- _/ M/ C
# X+ b) _4 _* L% T) o5 d
) `- E- C( a8 P8 p' ^ y8 |: O' R! R |
|