|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) p; i* u( K& Q: [* `- [code]EDMA sample test application
2 M. q% ?& o8 V% R( ~* B - /*" _6 u& z6 X2 r- W: L: X, e* J6 N
- * edma_test.c
, V! K: K+ H+ E; Y2 x - *. V6 U; _; _0 f0 s4 }7 f
- * brief EDMA3 Test Application
0 ^/ U) b8 u& l! j, f( R - *8 s% k( F0 M" ]
- * This file contains EDMA3 Test code.8 i! Z$ c, O7 E6 W3 }; n
- *& \! l& l s+ K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 c! w3 j* n3 I) N& c/ N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 e% P6 ?8 h3 h" A: v
- * TO CHANGE.
4 m! f+ y! P# U. T+ ^4 x - *
3 ^4 }0 t3 b( B; s+ i$ I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 h/ B! i& j$ | p - *
( z( |0 F# K1 d# z9 x - * This program is free software; you can redistribute it and/or# ~& w8 N+ E& P r6 X
- * modify it under the terms of the GNU General Public License as# L2 [3 J- n+ S0 @( T
- * published by the Free Software Foundation version 2.8 w- Z* I, K' W8 D
- *' D# \$ a2 @; Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 o, z; h. |9 x1 k4 O4 Q& S$ I L2 }* n - * kind, whether express or implied; without even the implied warranty
: |1 X8 k- r& j7 I" Q8 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% x) {0 q5 g, `" `, m
- * GNU General Public License for more details.+ i( k0 j5 l" U& Y
- */8 Q9 c% g1 h9 p8 {; u$ H; h
c. v" k! L( G3 p; g, [6 P- #include <linux/module.h>
0 O1 w( r! T' C& B* n - #include <linux/init.h>
. c4 U" }$ V& i" q - #include <linux/errno.h>+ a# d* Q2 ]: p$ q" e; P6 Y9 z% c5 u
- #include <linux/types.h>+ _5 R D- L+ z, y% g( d* w
- #include <linux/interrupt.h> s3 T$ C# a4 \4 t& F+ [4 n) J
- #include <asm/io.h>6 x, i& u! F: j3 T5 l
- #include <linux/moduleparam.h>! W" ]# Q( D3 ~$ y
- #include <linux/sysctl.h>
4 b' U* E* A/ {( `7 j - #include <linux/mm.h>8 x, d% U% C6 r& G
- #include <linux/dma-mapping.h>
, C1 z" c7 Q1 B" u, W, B - 5 z' L; P" m7 o# u" L1 i3 O5 R
- #include <mach/memory.h>$ g3 S5 q! O k4 l" e6 i5 s
- #include <mach/hardware.h>3 E; B" K9 y" H4 s* i5 |
- #include <mach/irqs.h>
- g# |! `9 z5 w - #include <asm/hardware/edma.h>$ g6 B2 m% \7 c* W; w; N
- " H5 S( a V2 f! [5 ~- `0 y
- #undef EDMA3_DEBUG
3 U. p6 C9 w# t e - /*#define EDMA3_DEBUG*/
# @$ t+ v' F5 M5 K- w2 I$ {
' ^9 o6 u" T6 U$ B- #ifdef EDMA3_DEBUG
) v! L V+ J1 s. `: R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): q2 E7 q- k5 [. r1 F, s+ m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ]8 d% }, [4 p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. j% i7 L3 `# |' M- z U - #else {4 v+ n- ~3 z8 n
- #define DMA_PRINTK( x... )
) q s$ Y& v9 j' n3 r* m! p6 ~ - #define DMA_FN_IN
: Z( C( A) D7 w# S" ^- {* d5 x - #define DMA_FN_OUT! j5 n' t0 {. T$ i7 f7 i
- #endif
. i' l3 X, b4 i. U: u2 l( q( U" n8 ?
2 a! E! Y! g9 y! F. Q2 G+ e6 O9 u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& y: q0 p3 @0 l" c. J - #define STATIC_SHIFT 31 a6 o) i/ l( U
- #define TCINTEN_SHIFT 201 F1 n: b9 a2 l/ u6 H
- #define ITCINTEN_SHIFT 21. N$ c8 s/ D8 }; C) J
- #define TCCHEN_SHIFT 22
. h) [/ p* z7 d1 d. O3 k - #define ITCCHEN_SHIFT 23- s; j- E: \5 O
- 8 P% \/ p# i1 P+ L9 x
- static volatile int irqraised1 = 0;
# H4 }. N. d- U - static volatile int irqraised2 = 0;
) ?3 e' j: r' z4 {
# ]/ V8 g- d3 n, I$ z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Y( e$ `2 n+ P) | d2 t6 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* s4 A0 N2 c% _6 v+ g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* c' u4 Y9 `6 F
) d) Y" F% t3 M. c& X- dma_addr_t dmaphyssrc1 = 0;7 Z1 M p2 ~% g: S
- dma_addr_t dmaphyssrc2 = 0;
4 q6 H" [8 U0 q( |1 R - dma_addr_t dmaphysdest1 = 0;
6 x. i8 j7 M+ k - dma_addr_t dmaphysdest2 = 0;
8 a2 F4 ?( [+ \ R5 U' m4 o
/ [ H, f! V; x7 y! I7 u2 Z) v9 p- char *dmabufsrc1 = NULL;/ T( F% @3 t, R4 O7 G
- char *dmabufsrc2 = NULL;' b& I6 n9 N: t# f
- char *dmabufdest1 = NULL;6 s* i3 t' E( h) ]
- char *dmabufdest2 = NULL;
+ `3 t2 ^8 ?4 ~2 e7 h
" T; T( j0 j+ v. R- static int acnt = 512;
2 G+ ?8 R1 {* N/ E4 o+ E# t# | - static int bcnt = 8;
% q( n+ M3 l' F3 D9 I( j$ H - static int ccnt = 8;& i& W5 e2 y {) H
: ?7 [' [4 l2 u- module_param(acnt, int, S_IRUGO);8 q) g1 _7 V3 D: s
- module_param(bcnt, int, S_IRUGO);! ]9 K0 z+ e2 h) X) j7 d. x$ }. B
- module_param(ccnt, int, S_IRUGO);
复制代码 2 _: W; v" b- @; c7 G
+ R U+ [! W$ G7 t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 E" \9 R1 T2 C7 u0 k; x4 r) v4 ]: u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ I3 k& @! d) r" o, B- C% b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, o- M2 e" ?; R) R& j& n* n
' _) x* h7 [& f6 J3 d. ~! X
6 B, Y' l, X8 i/ o/ Q m5 c
|
|