|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , r. f5 Q8 Z. n" Z2 w
- [code]EDMA sample test application5 b: A( w; }1 B" |9 q! Y
- /*
0 w( z w( Z. x7 [1 v - * edma_test.c3 j7 K7 e4 F: I ?, }
- *, ~ K2 M( A& G( n8 a6 t
- * brief EDMA3 Test Application' w8 ~6 \+ C" t- F5 Y: f
- *7 [" d* U' X9 w# l
- * This file contains EDMA3 Test code.
! \0 r. R( W3 a2 q: _$ S - *
% m/ l U5 o" { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE p3 ^, M$ o$ k3 |2 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 _! J/ E* m+ G# M - * TO CHANGE.
7 Q* b1 `+ h T t, Y* b) @ - *
* h/ L6 c0 K& Q; Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ m3 I3 }4 m) o2 a/ x+ y - *# M% j9 ?" _5 j: S1 ^! \- W1 ]
- * This program is free software; you can redistribute it and/or5 S3 q: D" l. J% u; L: J c
- * modify it under the terms of the GNU General Public License as
! v/ O h/ w5 E - * published by the Free Software Foundation version 2.% u p' a) g$ {9 `6 k
- *
" } d) n) I3 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 W$ h0 P+ A3 h4 ?; F4 B7 a4 D - * kind, whether express or implied; without even the implied warranty
! K4 t% z* }! @- i, Q6 D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 Y! |/ H; @9 d; i' z - * GNU General Public License for more details.% N1 T- d* L/ ~0 A% [
- */
9 e( A" Q( Z; c" s2 a( ~( \9 { - 1 P% e5 k' Q: o
- #include <linux/module.h>3 {: K" G- `1 O% B& I1 K; K2 Y
- #include <linux/init.h># e6 z r* ?- V1 h4 |
- #include <linux/errno.h>
# z2 T0 b# I- y+ N: }( j% h - #include <linux/types.h>5 a5 K9 o9 x- F' w1 Y
- #include <linux/interrupt.h>
' Z: s# l! O! k4 ]; b - #include <asm/io.h>
3 K; w( p; w- Z' V* S - #include <linux/moduleparam.h>- N1 \& C5 @" f7 s
- #include <linux/sysctl.h>; x* S! G0 b* V% [- Z w
- #include <linux/mm.h>- r2 Q3 j1 T* F! d3 [+ B3 [1 F3 N, D
- #include <linux/dma-mapping.h>
& ^7 m7 j) l. Z: a* k& Y
3 [/ L) k# a6 `/ O" d- #include <mach/memory.h>* t. P5 ~# M: c, g+ B* s
- #include <mach/hardware.h>
8 A* g0 k+ ~% v S - #include <mach/irqs.h> [% D7 z, R% U( }6 k+ P
- #include <asm/hardware/edma.h>, v N' [. V" E/ d& [
- ; L* _! j( w3 r
- #undef EDMA3_DEBUG2 `$ [4 {! @$ }8 o8 C( R7 X
- /*#define EDMA3_DEBUG*/; _) L4 `/ p8 \3 A# W/ q5 U
" g8 ~% |% A2 G- #ifdef EDMA3_DEBUG
* i4 }7 r, N( w6 z* k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 l3 p8 k1 H# l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* O) E1 L& M* q4 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, ~6 Z# n2 g" O, B# K! @ - #else# {9 ^. G2 w2 Y" V
- #define DMA_PRINTK( x... )+ k' P% g" g2 _" E
- #define DMA_FN_IN3 H; d, P6 C7 M# q+ |+ f: p
- #define DMA_FN_OUT
9 L! }- u8 Q. W: M% s- `* k& [9 s6 d+ | - #endif
$ t% ^& p8 X g3 o - " d1 D1 }0 A6 g9 E, S+ k6 i2 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% ~8 r) E5 T' F
- #define STATIC_SHIFT 34 D, ]) ?- g, d% Z/ i; ^) c
- #define TCINTEN_SHIFT 20; G' P0 g$ @4 k7 J3 d! r8 l3 \
- #define ITCINTEN_SHIFT 21
2 d- m0 M6 C, F0 \% S/ ?" v - #define TCCHEN_SHIFT 225 D3 e, E1 W: v+ @* I9 s
- #define ITCCHEN_SHIFT 23. \ B' ^1 D" O& |( h
- ' S' n w/ S: o' O
- static volatile int irqraised1 = 0;
% j' D1 @+ j6 G" l1 i+ Y - static volatile int irqraised2 = 0;
2 `( L/ n2 i, n! a7 }# } - 0 \3 J$ r& o, A/ S; ^4 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' T+ I u+ Y3 i$ N6 w$ }6 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Q8 ?; B' O7 x0 n$ Q4 c; H8 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& {* d A6 [+ ?7 h0 h
: l* Y% p4 i) N- dma_addr_t dmaphyssrc1 = 0;9 e1 g9 D* i3 s! g
- dma_addr_t dmaphyssrc2 = 0;
4 f6 M) t P, l7 f; h% e - dma_addr_t dmaphysdest1 = 0;! b# u+ J# ^3 s1 ~/ ^2 D8 U8 D4 M7 \
- dma_addr_t dmaphysdest2 = 0;
8 }' q( `5 g: f. Y
9 k3 ]2 q8 g# `9 K# @% d- char *dmabufsrc1 = NULL;
+ F% ~" J& J1 x" O - char *dmabufsrc2 = NULL;
% b4 t: g ~, P - char *dmabufdest1 = NULL;
. {7 S' _8 A5 c - char *dmabufdest2 = NULL;
5 s1 x) _5 Q0 d1 Q4 ? - & ~! }. L s# n" A
- static int acnt = 512;6 v8 D" v3 o1 k- }' U. B/ O
- static int bcnt = 8;% K* V7 j, w; j* J
- static int ccnt = 8;
* g" A" x# g& U! U2 K; ~ - 3 ^- ]- k0 Z; t; h7 r) n) Y2 e( C( G% A
- module_param(acnt, int, S_IRUGO);
5 A* j9 @3 k/ X v, ` - module_param(bcnt, int, S_IRUGO);
o q' L+ F+ A - module_param(ccnt, int, S_IRUGO);
复制代码 ; r% {8 ?, S7 c0 J
8 A1 S1 J) L0 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* y$ z0 G1 Y6 O- D: U7 }! o2 I& R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 Z+ L2 M' |8 f* F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, N. |6 _+ S* S8 Z- c; b ]$ ~% O, P- x; A( X" F5 N3 n
- l& z8 l% t9 _- v# w- K$ I
|
|