|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 y, f" u% Z8 d7 W
- [code]EDMA sample test application+ n8 B0 h! \" o7 l. }% M1 {
- /*
- Z, ]. f. o0 r8 k4 V6 S - * edma_test.c
0 F$ K" |! g( z& |2 w; D2 O - *; [8 p* _7 [; e5 e' W2 i2 ]
- * brief EDMA3 Test Application) P. V1 u! Q! `
- *( ~- C) ]: L# m
- * This file contains EDMA3 Test code./ h( \% j# q1 a! m
- *
+ O! w! _: F! E6 K8 |& ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& N4 B6 ~0 m1 [0 w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' D# F E) @4 l% g- `* {. K4 a - * TO CHANGE.
$ J. M" I8 S' D3 \! h) ^8 _: g - *
' [# h8 m8 N X( h) ]% J2 b3 H b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 K4 p5 L; G C! M: }6 G8 Q8 Q) ~ - *
- z: v2 M$ y) P Q! ~ - * This program is free software; you can redistribute it and/or6 i3 y5 T5 F% ~, [8 c
- * modify it under the terms of the GNU General Public License as
# k% F& n, R ^5 J' x; { - * published by the Free Software Foundation version 2.! _1 L6 @) x4 K: ]9 z$ p
- *: R8 I- D/ h7 A% U8 Q# r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" q! e( F4 y) @! M8 X1 z: c - * kind, whether express or implied; without even the implied warranty9 d* E& T5 \& {8 @" w0 E7 U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 }( o: q8 p( j0 q- n! z - * GNU General Public License for more details.* x6 c6 X$ |6 V; }6 a2 e r2 b# r
- */+ o# g1 x, R" g) p0 k
- 7 \" G" ^" j# ]3 ~+ ~: z3 \( S& d5 F
- #include <linux/module.h>
6 e6 R% }5 d6 n/ A - #include <linux/init.h>
3 L* N& v* A+ z$ d* X4 _2 C2 Y' U - #include <linux/errno.h>1 W. c6 g8 i& R! B- g7 z, Q
- #include <linux/types.h>0 E7 i( z1 o: \) {
- #include <linux/interrupt.h>
0 l, \* a" C$ _) T8 X( u) b - #include <asm/io.h>
4 A' t7 q6 I6 w/ f) S; [ - #include <linux/moduleparam.h>: x# g$ G8 j$ S( S: b& I
- #include <linux/sysctl.h># O$ \' K+ S" O
- #include <linux/mm.h>& N$ a+ u! s8 D; q
- #include <linux/dma-mapping.h>
) G2 D0 s* b+ k [ - " f1 p7 v, q0 R; G4 Q) a
- #include <mach/memory.h>/ u7 L! a s/ T- M4 A
- #include <mach/hardware.h>$ c$ I8 t# `" J& f( l
- #include <mach/irqs.h>8 \+ T+ `) H3 O( B! J- H( _! U
- #include <asm/hardware/edma.h>
& @& m2 X7 z# _2 F - 1 M& E6 w. S" L7 _8 f
- #undef EDMA3_DEBUG U* B+ n" Q# w& x1 F" h
- /*#define EDMA3_DEBUG*/
z, ]% ]4 n5 O2 F - . g, u9 E& E8 l* A1 R
- #ifdef EDMA3_DEBUG/ S/ ~7 t& ~7 C1 N* u7 G9 Z |* r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# V% `* Y& e2 @/ m, |2 _2 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 ]* n0 M# I: W! g" P# v+ _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( X; @' k+ t' L3 v% B7 t - #else g7 Z9 X+ N* [- G
- #define DMA_PRINTK( x... )6 M- ?% z; w0 h# f8 V
- #define DMA_FN_IN
+ t7 S: z( n* v( S# h9 k. [7 d - #define DMA_FN_OUT* R4 V$ }' ~- O% t% u8 K4 b
- #endif
% E9 l# Z2 n! n& u- @7 c
" _3 l. P# u" J8 P B( n8 D: p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ g% l4 ^0 j I) x) g9 S - #define STATIC_SHIFT 3. ~5 ], d4 X% j# u0 D2 |
- #define TCINTEN_SHIFT 20, K9 N* M: _+ U
- #define ITCINTEN_SHIFT 21: Z* M: C& S, H9 r" g, s5 ~7 E1 _
- #define TCCHEN_SHIFT 22
4 Q5 D) X' b; T8 ~8 J) P9 l - #define ITCCHEN_SHIFT 230 [: m( h, q% H
- 8 P) ?' N+ k# G
- static volatile int irqraised1 = 0;
N3 t! J) I9 s - static volatile int irqraised2 = 0;; z# f7 p# s, W7 I
J/ j4 [) l; ~* G+ ^: K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# g7 u9 R1 c7 r4 X' k% S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 X- ^% H L$ M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& q5 O3 X" u# A/ V v
+ `) T; y" g% L! V- dma_addr_t dmaphyssrc1 = 0;
$ l% z0 t. p5 I' Z: T - dma_addr_t dmaphyssrc2 = 0;
) q9 q% k. P+ \, m. h N! Y' C3 J - dma_addr_t dmaphysdest1 = 0;
9 _8 J% s) O+ u2 d/ f- V - dma_addr_t dmaphysdest2 = 0;: X# r6 h" c2 h7 N" Y
O1 N" f# v9 {; l' U6 e- char *dmabufsrc1 = NULL;7 t G$ q/ x) O+ y2 y7 W( y! V2 m: ?
- char *dmabufsrc2 = NULL;3 Y/ `8 p6 |4 f% d
- char *dmabufdest1 = NULL;
0 I( H7 D$ i$ j5 g+ k* H. [+ J% F - char *dmabufdest2 = NULL;
$ Z2 o* V: s5 V$ x& g
1 }/ z5 @2 f$ s: F) Y; r1 ^4 d X- static int acnt = 512;7 |% f5 Q" _: Y0 u R
- static int bcnt = 8;
3 v9 l) q) Y% U+ O3 Q2 k" r- j! U - static int ccnt = 8;. t5 k/ i" \# _% V8 q6 M
- ' d7 O5 I6 a# P0 Q5 C
- module_param(acnt, int, S_IRUGO);
7 }7 o1 t3 J! Z' D - module_param(bcnt, int, S_IRUGO);# D! _$ M n( V! \# z
- module_param(ccnt, int, S_IRUGO);
复制代码
* r( W" A f3 R- ]% R9 |
; \& X# t# Z0 I2 P8 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 N, ]3 i0 y; B1 d3 E% f4 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; h7 e9 m" Y/ P1 H/ c# l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 h) v$ v9 a4 ]& m4 k, q
1 a$ P5 P# n; {( z$ g' Q
3 C. A4 }& {0 f% T. n m% C |
|