|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 Z) i/ \# R* _/ a A6 @- [code]EDMA sample test application0 ]$ l0 ~2 N( K: v
- /*' X# U+ T: O2 X; E
- * edma_test.c6 x) ^9 i/ N2 Y1 a) r
- *
; j, T# t, r. T - * brief EDMA3 Test Application& ~# {& T# g" X/ Z. {& A! P" r2 Q2 C! U
- *
6 [8 o# N# h8 Y1 w - * This file contains EDMA3 Test code.; m7 s; S& p" I/ s
- ** _2 ]. w# r. Y7 P% ~7 v+ x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& u5 e3 d4 K, T" [9 ~" K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 w/ I @6 F8 Z$ l - * TO CHANGE.
4 T8 U+ H/ X: B - *1 k" g% L. K9 K& @* M' Y; h9 r& Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& F) d4 v9 Y- f, m0 x+ A
- *
- Z+ |$ n( @9 d5 [& N - * This program is free software; you can redistribute it and/or
0 k! A" F/ ?" K1 R8 h# y+ O( U - * modify it under the terms of the GNU General Public License as, p1 d6 h& F/ N( }$ j4 J/ N
- * published by the Free Software Foundation version 2.
& Q( V6 d# f8 E9 k0 A' ~ - *2 X8 [( R T) n8 U& J1 W/ Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 d7 U3 P* ^! i6 Y" E% M# G - * kind, whether express or implied; without even the implied warranty! P. E) i( x/ Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ \, V3 |. X* [8 K! _5 L/ q5 _/ n - * GNU General Public License for more details.
) [& x0 q& z4 j% \. e. w0 X% G - */1 d' k d. x/ q1 @; H3 t5 [( o
2 w. \! d4 |4 o+ j) W- m& M: y. q- #include <linux/module.h>! N$ m( X; a. ~2 h( c
- #include <linux/init.h>" W7 C& _( N" g! O! ~2 y4 w) ^* ?
- #include <linux/errno.h>
1 [' b7 U! @% \# F' Q z4 [# c - #include <linux/types.h>
5 X/ m9 I7 [3 S8 U. E% U - #include <linux/interrupt.h># e. h( v$ Z4 l4 u- v+ u1 v
- #include <asm/io.h>+ L! i+ m! N4 Z% l, g
- #include <linux/moduleparam.h>
- [1 X9 w* e/ V) i1 R - #include <linux/sysctl.h>) s+ d) E- }/ L C; v% U$ o+ t1 [. t
- #include <linux/mm.h>
" s& D4 b* E; j1 k' \ - #include <linux/dma-mapping.h>& ?0 |( j4 J2 _* u+ U
- 6 B9 j) K* t$ u$ F) x
- #include <mach/memory.h>- O& K/ ? t; h& i% ^0 F
- #include <mach/hardware.h>
5 C* N: a. \# ^0 o! k, b8 m - #include <mach/irqs.h>
7 [" V/ Y$ t" b5 t2 |% L% \ - #include <asm/hardware/edma.h>( M. o$ ?* M* h: c1 G) v+ R
- - D: ~3 f9 g& k6 W; o
- #undef EDMA3_DEBUG# z5 ?' p: B( U$ U. j3 [ [" M
- /*#define EDMA3_DEBUG*/% C7 {5 M4 T z( ~( Z2 H; Y
- ' H7 ]4 ]5 p, j4 }! Q0 A
- #ifdef EDMA3_DEBUG
* g6 ]1 B' }. v% D* Z% g0 ?5 u ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). q9 S, D, V) Y- O) Y6 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 s+ O% |! Q" V5 Q4 q9 h. j5 D4 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 e: O4 G4 b" I3 w2 o
- #else
6 b" q$ x* j/ g! ^$ V6 o - #define DMA_PRINTK( x... )7 x5 R7 Q+ T* q
- #define DMA_FN_IN5 q: _3 |* o3 V& o7 Y
- #define DMA_FN_OUT
5 }( k0 J4 e0 ?& z. w; e - #endif6 S1 F9 j |* b
2 P- e( E; k9 q4 V% r& Y# t- _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 o# u) ]; R- g Q$ M1 r4 ]) v( p7 X9 U - #define STATIC_SHIFT 3
: s* R& f* p h9 {% f2 D# I, a - #define TCINTEN_SHIFT 20
1 x1 k: f' {4 h( ^ - #define ITCINTEN_SHIFT 21
8 ]3 `( t; w9 u; v' j: [( A5 o6 ` - #define TCCHEN_SHIFT 22# v; A5 V+ G: V6 l6 J( M
- #define ITCCHEN_SHIFT 23
$ d, f2 K8 I9 \$ z( x - $ [2 p; q7 n2 G R
- static volatile int irqraised1 = 0;* {) c: X+ J& r3 V: c, A/ W3 A
- static volatile int irqraised2 = 0;
/ @1 o9 ^ c: F# T
' J6 m! M. L- ] c4 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 c2 B3 q3 C2 T' h8 C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- U! [ C1 N+ h _. |) ^$ g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& @& B; }! c; ^! a8 m" j# Z - ( o* B9 K- [( A# U; m
- dma_addr_t dmaphyssrc1 = 0;
2 ~7 k. T8 ~$ Y- L# G' j - dma_addr_t dmaphyssrc2 = 0;
, ?$ R, \! z' G, v7 D5 V2 V8 ~/ I - dma_addr_t dmaphysdest1 = 0;
( N8 I3 c. l/ r" k9 \- { - dma_addr_t dmaphysdest2 = 0;% {4 e% L3 v, d, D
- ( A' v# Z O* j( g# Z% Y# y
- char *dmabufsrc1 = NULL;( W3 U1 Z% C1 _1 I4 f
- char *dmabufsrc2 = NULL;
6 v4 E' S# v- K: Y I" P. D6 A5 T5 V - char *dmabufdest1 = NULL;
( M9 {( r3 c+ i) u" f - char *dmabufdest2 = NULL;+ N9 q, ~, i9 c; x
- 9 b* G6 k) q/ j. S3 j4 l" ~2 J
- static int acnt = 512;
1 w1 v1 [! U& ~6 z8 n. C/ e5 Y - static int bcnt = 8;
9 [4 W% n2 |: k - static int ccnt = 8;
" _6 S3 C I. k- D- i* G - / U, k( \8 B% n7 o P: H6 J# W6 e
- module_param(acnt, int, S_IRUGO);
$ S& t, w" C' @4 F - module_param(bcnt, int, S_IRUGO);+ e3 r- n1 `( s5 D1 G
- module_param(ccnt, int, S_IRUGO);
复制代码 + Y3 C+ x$ r, K) l8 M( b) {. |+ \3 {
/ h: e; ^! c; v8 u. q+ B* Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ k/ X1 U% ?' J- h: `% v8 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, K" ]# E2 Q- m' ~- D, U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ]4 f. l8 r& `3 z7 A' _
) q/ [8 R" D5 o% V
* Z8 v+ u: w- E9 b& d6 `: q& Q |
|