|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ O0 }& R, K$ k3 ]- [code]EDMA sample test application" C& T( ^' g! K9 `
- /*$ A# a$ U# S3 h3 t+ N% r) R- q6 F
- * edma_test.c* Y, B3 p- G+ w2 z
- *$ l8 y$ s3 t. M7 Q. R# b: y
- * brief EDMA3 Test Application
- m2 W# D' R2 \; G0 P& r2 I - *
# a$ T4 d2 u- y. f - * This file contains EDMA3 Test code./ ?& ~1 o9 R$ R. U5 X
- *
9 e; c/ R( H& D3 B& z$ g& R5 G3 A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 ?6 P- |# M( k- y3 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT C* C5 Z$ q" N, R9 N
- * TO CHANGE.
9 q3 f) O. J. W: `- N - *( g* F0 v( |' Z: L3 ~3 `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- G$ o( z) e/ Y! |
- *4 w5 d4 y9 ?! r, L# o, B# X
- * This program is free software; you can redistribute it and/or
: D. N" V) ~% t% z - * modify it under the terms of the GNU General Public License as7 [. a6 }0 U0 W; b4 u9 y
- * published by the Free Software Foundation version 2./ j x! m6 R% Z) v1 b
- *; M o$ E5 k5 O2 g3 y, e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ y: V7 }+ o. w: n! M1 J* m
- * kind, whether express or implied; without even the implied warranty
3 m+ W4 k0 b2 Z3 `2 H8 K- _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 M- P5 O# d' `' d9 u+ C
- * GNU General Public License for more details.
9 m9 {/ [3 w) n' p9 k: W9 u - *// h. v9 `; A5 X0 q$ R6 a* } S
. P" ~% y0 p. l7 N+ _- #include <linux/module.h>
% Q7 p; [" J0 x) G$ ~ - #include <linux/init.h>! F/ E% }. b7 S3 d- u
- #include <linux/errno.h>7 ?2 J' M0 D- ~
- #include <linux/types.h>. D+ y/ F- e+ V8 a0 C$ |+ k( S% ?
- #include <linux/interrupt.h>
: y/ \! N! y+ y" E* W - #include <asm/io.h>
( r1 K3 S/ |) I" [0 f - #include <linux/moduleparam.h>
! q2 H. e# n( s. G& B: w# s - #include <linux/sysctl.h>
( q9 F' }6 b- z7 v - #include <linux/mm.h>
C) A2 i! x* F# r - #include <linux/dma-mapping.h>
- h) \+ A2 Q6 M/ J; T, `1 {# I
: n$ s' G( @, A) _- #include <mach/memory.h>
+ }) ~+ N* u6 [ - #include <mach/hardware.h>
" s, ~& O9 O R/ u0 ^8 b# D. ] - #include <mach/irqs.h>
$ \3 G; R& A# m* \. a/ [ - #include <asm/hardware/edma.h>& k, {, l* `. P$ p& J Q
- 2 M9 f4 h/ A. }, U
- #undef EDMA3_DEBUG: A+ m# b$ _ D& u1 k* P" G
- /*#define EDMA3_DEBUG*/4 ?1 \* Y9 |' T) n8 y
- r3 |) p& |3 R. q: i: q- W
- #ifdef EDMA3_DEBUG
6 N- k$ `1 K& M' z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; M( g1 l' ^9 k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 h* Z+ H2 ~/ t2 f8 L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: _, d4 i: Z/ J# C% `# S$ f - #else- z" P1 j( H$ M3 k
- #define DMA_PRINTK( x... )9 }4 P# J8 f- s* v' k5 P1 b
- #define DMA_FN_IN, y# G1 h- z9 n6 L
- #define DMA_FN_OUT
, u7 l7 {3 @1 `# m2 \ - #endif5 V9 b1 J, ]9 z: W. }* ?+ Z4 R
+ t" J2 B0 x7 U5 `: Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ n/ V. W, ]4 g0 n# F - #define STATIC_SHIFT 3
+ w: L) L4 p6 Y, l* e) I - #define TCINTEN_SHIFT 20/ o3 Q( D1 R: ?# ?9 ^# l3 y* i
- #define ITCINTEN_SHIFT 211 c- i M0 S' J" V! b% g) \* }
- #define TCCHEN_SHIFT 228 p- L- \' \8 Q
- #define ITCCHEN_SHIFT 23
- T i4 ?3 |: h% u - ! N+ N9 U8 W$ t+ k, E! j
- static volatile int irqraised1 = 0; i1 z" { f+ f6 \
- static volatile int irqraised2 = 0;% d# V P d) _) `! J- ?
4 |' m8 Y Q% T5 s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( \% l" T- q$ _, c3 T; E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ^/ s. o: |5 k. X/ a6 K. T) [0 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* u: j3 I# U9 I' J+ T$ \ v
; c- L3 y* L% ~- dma_addr_t dmaphyssrc1 = 0;
: G7 K6 @3 C! i - dma_addr_t dmaphyssrc2 = 0;0 c! v. y- `0 Z# f( C
- dma_addr_t dmaphysdest1 = 0;
4 j' V& ?5 P B E - dma_addr_t dmaphysdest2 = 0;, b# h3 |6 c. J+ u( }: I
2 g1 p: J7 j3 V( B# q0 [- char *dmabufsrc1 = NULL;, `$ |( U5 M S, }( b7 M5 u. s R
- char *dmabufsrc2 = NULL;3 l- J7 _+ ~) j
- char *dmabufdest1 = NULL;" T2 W/ z1 Q/ r
- char *dmabufdest2 = NULL;2 H9 U; ~9 a+ n+ X- G
- v7 f2 Q9 g# E1 A6 e- static int acnt = 512;
1 N1 L3 e8 @. V - static int bcnt = 8;
9 y/ C9 r3 U( W* r* @; Z/ ` - static int ccnt = 8;5 _3 Q* N$ K, W$ t }" V) h9 f, p0 P
- # F0 S/ ], i, i/ o
- module_param(acnt, int, S_IRUGO);' x+ ]# D5 I+ ^6 ^9 R8 G$ `7 j/ n% r
- module_param(bcnt, int, S_IRUGO);5 G6 p7 o+ \ U1 |8 u$ N: Z$ a
- module_param(ccnt, int, S_IRUGO);
复制代码
- z2 ?; z0 r; O0 B7 C. c+ o3 s# K7 K; x* @/ _* N/ R' K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% }/ ?2 L2 ?/ Q% |9 r/ r; {9 r/ |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 [9 x$ H% b; [$ i7 Z8 M( d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 P/ r, j9 l% B/ j" D) L* b+ u( ^' M
* W* j, \( J+ q" L7 e* i |
|