|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. X* b4 U% m. C8 r7 h6 j; C9 d- [code]EDMA sample test application
- h8 R2 U2 x7 }$ X1 @, ` - /*7 W* D) r# A4 v' H! t
- * edma_test.c
! r2 I: B# g9 X - *" R7 g7 o. M6 t" h' d) l
- * brief EDMA3 Test Application5 Q6 S2 l4 r- r) h. k2 ?* V0 y, E
- *8 p$ @; L) p' b: W, {; t0 ~
- * This file contains EDMA3 Test code." g, R# f: g" [: U% p0 c' s ?
- *
: l* a; B% _. P: f- k* D( E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ F( L1 `; z4 T( P1 H9 P" f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ b5 S2 W. G3 U8 \, S9 ^ J
- * TO CHANGE.
) h# C% p6 ?9 Y. M0 ^3 ?9 _ - *
# W2 j1 S9 X$ Y- r$ x4 }* Y, ]: y( H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: @8 o. ~ Y+ e* ?3 j# z - *
. r6 M4 a# H W9 g) u0 v$ n* j - * This program is free software; you can redistribute it and/or
' F0 l8 m% j) Y( ~1 t - * modify it under the terms of the GNU General Public License as+ \# h# E) |2 l: C3 N* \3 q& g, X
- * published by the Free Software Foundation version 2.4 B) c4 I" ~8 L1 q( S
- *
9 b' v( P% O! o. L: f! ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 a6 t% h3 M; a% }5 \ - * kind, whether express or implied; without even the implied warranty
p, r* }: ]+ |6 X% b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ I+ W! |% A2 y: o3 B$ Y1 V - * GNU General Public License for more details.: k1 t3 j" A b' G; i- t
- */
/ W& t& m# n5 _( e; X
& |% U4 s- v$ `. l6 i M- #include <linux/module.h>, V% w8 M) M2 m) n3 \
- #include <linux/init.h>
$ {( J& m! ?; }! i* | - #include <linux/errno.h>
0 p- P+ D: p8 R& m1 v - #include <linux/types.h>2 ]: m' ]1 I/ K* ]1 z, U" `% v3 q
- #include <linux/interrupt.h>
5 d4 f: v0 g' m/ T% [ - #include <asm/io.h>
4 h0 O/ x; c% p- i5 t - #include <linux/moduleparam.h>
6 e) R# p8 q; M - #include <linux/sysctl.h>
: B! Q9 p5 u2 D - #include <linux/mm.h>
! u; q( z* R0 \: k* |2 ~9 b - #include <linux/dma-mapping.h>% n: T, T. c4 J; X$ C
- * W, Y6 |4 ]" [. z8 ]5 N
- #include <mach/memory.h>* k) r3 ^2 I7 ]
- #include <mach/hardware.h>
$ w( K$ U$ [& \9 ` - #include <mach/irqs.h>8 r# ^1 h4 Y7 ^$ y
- #include <asm/hardware/edma.h>7 ?) R1 l$ P: ~, {- N! Y# C' s
* _# T& o- I1 _; j K& L; I: M- #undef EDMA3_DEBUG2 l) ~1 _4 J. P- T/ v. C7 N
- /*#define EDMA3_DEBUG*/9 ?# P9 F7 `, Y) ~, }/ f
' d s* p, w% j; Y) c, e- #ifdef EDMA3_DEBUG
+ M' b( X' \: P4 l6 ?5 j, C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* a! d0 T! F* y: i8 ]% ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 E/ ~4 [$ b; b3 E/ ] k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# H- F% n3 T: k# m6 _* ]
- #else
/ Y& t5 h& n/ |7 N - #define DMA_PRINTK( x... )5 Z/ E9 m4 [9 _
- #define DMA_FN_IN
/ H/ q# `- ?4 k' g8 ~ - #define DMA_FN_OUT
; ], R" \' J- u0 W - #endif# }& T, k8 E9 ~% I
- / z5 M4 j' U& p- U' D. \) [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). ?7 N0 p: L, L% g1 o
- #define STATIC_SHIFT 3
# H# z! | i2 y, a/ u; K) i - #define TCINTEN_SHIFT 20
" q( j& `( b* k$ _! ], _ - #define ITCINTEN_SHIFT 213 j. V( L9 b7 i" k1 K
- #define TCCHEN_SHIFT 22
) I: Y" D" v$ `" z0 v, i - #define ITCCHEN_SHIFT 23' W0 Z9 s9 t* C. \
- 8 C. U/ I/ B: r# I
- static volatile int irqraised1 = 0;
F$ R! B- j3 t - static volatile int irqraised2 = 0;6 U% B* ~9 ~) g4 s o7 b. a& ]: X
- 3 T( t. [6 ], i+ K) E4 P3 J) e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. d1 E( ~5 D, U9 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 q+ d! c, U: |2 L7 T- q4 t+ c7 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z: b- p) k# i- J; S# z
- . U9 s% L% ]6 @
- dma_addr_t dmaphyssrc1 = 0;
$ M( P! C5 Z8 P6 ~. m3 ] - dma_addr_t dmaphyssrc2 = 0;
( y! W' n9 ^. }' o - dma_addr_t dmaphysdest1 = 0;
+ Z- K" T% l0 S `( b2 X - dma_addr_t dmaphysdest2 = 0;5 F# N/ v0 Y1 T
- ! T0 [- e2 L' H( B, t( S
- char *dmabufsrc1 = NULL;. G, z# F# U# A( G
- char *dmabufsrc2 = NULL;8 Q% E, h! Y$ H( s' U' t: |
- char *dmabufdest1 = NULL;
/ E# C* i3 _. Y- U - char *dmabufdest2 = NULL;
9 r, V3 \5 m6 j( w/ e6 }& Z
' J/ Q; x3 c: n* t X- static int acnt = 512;
% D+ S9 j8 \3 @% u' T - static int bcnt = 8;
b( s' [$ e4 D( G - static int ccnt = 8;
( J' e6 V" h/ u' V; b/ Y! k9 | - ; B: r g! R; B* K
- module_param(acnt, int, S_IRUGO);0 w5 b* X# |# t, ]& a0 J
- module_param(bcnt, int, S_IRUGO);) I2 s6 }( o3 `/ r! \7 f5 e
- module_param(ccnt, int, S_IRUGO);
复制代码 2 E. a5 h, a) M) j
2 ~2 z# ~2 b2 l3 i0 e9 Q1 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 F$ Y8 V& S) P* N% a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* {9 Q1 J' \5 R6 p* W7 r; u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 n% q4 C5 o: i2 B9 X
; b1 H2 e9 u- ?" I5 g1 T. P5 V
, d9 f% z& N2 A+ D [. R |
|