|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
S/ u! i2 @+ @: i5 [! ]- [code]EDMA sample test application$ W: s+ H8 P o8 |6 _$ E7 h
- /*
9 _8 w8 {. \" K9 T- a - * edma_test.c* s6 A; k- p, u h
- *
6 Q$ D) R/ n, l1 R- Y0 l2 w* v - * brief EDMA3 Test Application
* C1 P; O/ ~3 |% k. [6 h - *' \/ v! d) @$ z2 }9 U- d5 U
- * This file contains EDMA3 Test code.4 a4 S2 g; I0 f' H) i7 s
- *
. }' o9 r: w5 w X; f) ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* q# _1 f s1 x2 l$ ]- U2 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( ^: y. g+ E+ K0 W# P! @ - * TO CHANGE.
4 b+ q; K9 H, r% t, s - *4 M2 O) X" @9 b& A& n: k% l' { B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ h, M' [3 Q/ a5 A5 B- J( Z4 H% Y8 V - *2 T; \: D5 a$ k! [' t7 s
- * This program is free software; you can redistribute it and/or8 B5 S% {2 T! i* p
- * modify it under the terms of the GNU General Public License as$ ]( ~+ \) G" ~* o+ ^; a& W+ a
- * published by the Free Software Foundation version 2.
& W d+ s5 L) ]* L" R - *
- h/ c" u! `0 ]# v8 Q: Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; D5 W ]1 i1 W d - * kind, whether express or implied; without even the implied warranty
! J+ ^& Z, k" m0 H: V! C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* l, v! F+ \+ X; ~- _! t1 F
- * GNU General Public License for more details.9 I- ?3 C0 R* @4 a6 g
- */
$ ?- q$ L k" `& N; u4 g - - O: [- H9 z @9 W: U' D6 J
- #include <linux/module.h>
. S4 ~& {( _# U# L, p - #include <linux/init.h>
0 m5 s) J+ A( n5 i6 M5 j9 O+ w - #include <linux/errno.h>) G3 s9 v# C9 }* }, D
- #include <linux/types.h>
2 Q! \ p: `0 [& n - #include <linux/interrupt.h> V# f) v' q+ C: D0 I
- #include <asm/io.h>
, I4 |1 [+ ^7 p" Y7 P - #include <linux/moduleparam.h>
* X: B7 k8 n- P5 | - #include <linux/sysctl.h>- E: m7 S D0 T' a' n. n
- #include <linux/mm.h>
% ?" z0 V2 T. y5 O - #include <linux/dma-mapping.h>
$ ]6 k5 [6 s0 {) N* T - # y. A8 C+ d% i4 B9 u
- #include <mach/memory.h>8 W5 Q# e. \+ p+ U6 R# ~- v
- #include <mach/hardware.h>
% }9 S: A' |; Z! `& ?2 O - #include <mach/irqs.h>
% y0 o% w1 D- r: h1 Y& a) s6 F/ N - #include <asm/hardware/edma.h>
1 R( V9 h1 u8 d* t
" H' X0 Z% U k" Z+ P" I: C- #undef EDMA3_DEBUG9 D6 r0 [+ v$ a* i" E
- /*#define EDMA3_DEBUG*/' I% H C! X7 ~5 ^$ b
- ^" |4 a/ ] n- p. ^/ X$ b7 ?
- #ifdef EDMA3_DEBUG: K9 n9 K& W" g# h& b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' h6 P8 n. s4 W' X2 T$ c8 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 i: f/ J1 J4 {4 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( i" X7 ~, A( |
- #else
) r2 [1 }/ t0 ^: u - #define DMA_PRINTK( x... )3 a+ J+ e+ V/ O( w. t4 G; h
- #define DMA_FN_IN# g% v) l D6 x
- #define DMA_FN_OUT
/ ?; o) [) u+ @/ O7 H3 Y - #endif: r6 @+ d- F# g* g
- * h5 b# O; U0 N; m) E% p3 ?0 Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# Z; d3 T* h# l' k" z - #define STATIC_SHIFT 3
% w4 b! k: C! x2 r6 {) J+ ~, p - #define TCINTEN_SHIFT 20
) U% d, U1 ?! c: t3 @; J - #define ITCINTEN_SHIFT 21" r: L5 C& W; W- V9 V. {& \
- #define TCCHEN_SHIFT 222 \7 V1 W1 I, ]4 W% z
- #define ITCCHEN_SHIFT 23) a! w, _1 A4 B) Z- H1 T
- 2 v; f# L8 r B: j0 n' e o
- static volatile int irqraised1 = 0;- k T+ e2 ^" u% J5 Z: v
- static volatile int irqraised2 = 0;
! ]# f! k9 ]+ }3 C/ N3 F d( O6 E
5 H( w: K' H1 C2 B* t( w' g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ N1 Y8 r; G& ^$ G0 f- B( i8 _% x8 P2 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 b/ f; P4 C1 x4 G% t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# i/ z5 _5 h9 s6 H9 R
( B9 f3 Z, A* S0 c: ?! m6 @- dma_addr_t dmaphyssrc1 = 0;
]9 [7 }# v# U/ X8 |/ \ - dma_addr_t dmaphyssrc2 = 0;5 p$ c- `1 L( `& l6 p5 |% K
- dma_addr_t dmaphysdest1 = 0;! B0 z* l8 e, \) @, U+ J6 \
- dma_addr_t dmaphysdest2 = 0;
) W- C$ ~: s. i- { - 5 ?1 }' B1 `8 j( u$ f
- char *dmabufsrc1 = NULL;
Z6 _( W1 b9 g! l- s, C- t - char *dmabufsrc2 = NULL;, W# D0 c$ E- D5 D. `! @) Z
- char *dmabufdest1 = NULL;7 ^$ s. x+ B* ?8 e" H# }) b }
- char *dmabufdest2 = NULL;" j) V& {/ v4 r0 V* W0 \, X5 {
- / Q; ]5 W% |: |6 |4 y+ |
- static int acnt = 512;
7 a0 u }5 Q J$ @1 f5 ^7 \ - static int bcnt = 8;
5 D8 {. z# c3 }) A* V' g( h" } - static int ccnt = 8;7 j* Z: Z5 b' \
. E" }& G2 e1 V8 }9 u9 z, | N- module_param(acnt, int, S_IRUGO);
8 `% b9 {; W9 a( |; C8 p$ q8 X - module_param(bcnt, int, S_IRUGO);7 A4 F' a% H1 \5 L. q
- module_param(ccnt, int, S_IRUGO);
复制代码
. f T$ g! m. _* y$ U# h7 I; w( P6 ^. m. ~; A! U3 ~' x! ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 R6 i0 O/ I6 r: e8 v. V% [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) U6 u5 i: c7 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 w1 M- V U. }8 h+ e6 V3 X
. c5 _! r0 r' Q* v! c' M8 k4 ^9 [; \' [) j8 o3 r l! c p1 e
|
|