|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + N" E+ W+ g+ V8 \( Z5 s& y4 C
- [code]EDMA sample test application
3 T+ [. [" X5 E+ A - /*9 ~* V, k6 H; r' ?! Z/ A& K8 c
- * edma_test.c
, h1 \9 p4 H. x) z - *; w) ]& K* u+ B* |6 u
- * brief EDMA3 Test Application/ O3 T3 i: G9 ?/ I
- *
+ n" w. ]9 H* T. N - * This file contains EDMA3 Test code." T0 O. W; u7 P" O8 M( y+ l
- *$ s1 `" r, l5 w7 S8 [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' ^$ r) ?: h( G& H2 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 S' O: `9 O$ Y! A* U k
- * TO CHANGE.8 ^" s, @+ ~% R( Z! B
- *
8 E! ~: O3 }6 r8 v6 ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& z& o& E$ S# H - *9 A" A4 H2 W' G0 v! _" b& y' P
- * This program is free software; you can redistribute it and/or( u" J5 Z9 F& B2 O
- * modify it under the terms of the GNU General Public License as- g+ r- V# v8 Y7 L5 ~* W
- * published by the Free Software Foundation version 2." `7 E: l4 `9 F
- ** t c' M, \8 ^; Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( e% R! m' }8 z
- * kind, whether express or implied; without even the implied warranty
! \1 u2 s9 ^5 ]6 @ D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% a) B7 i# c! D2 u - * GNU General Public License for more details.1 f, r* V+ s7 o1 S+ |" ?
- */
: U2 T8 J" u0 W - # p) {) y. [# D8 _+ f, d! A& ]
- #include <linux/module.h>! h9 @2 Q8 n; r; d
- #include <linux/init.h>
/ ]+ y9 \* I& n6 e - #include <linux/errno.h>' K% u) S) e; I" w9 f" K9 [( i
- #include <linux/types.h>0 C& b. i# e1 v
- #include <linux/interrupt.h>
8 T) i# m* S! Y4 B2 o { - #include <asm/io.h>6 N# f. U% @# R2 |" l
- #include <linux/moduleparam.h>
* @8 ]' V1 j6 j - #include <linux/sysctl.h>
( f6 ^( |8 T9 v. w3 _ - #include <linux/mm.h>
. b E% ^5 H5 y" x - #include <linux/dma-mapping.h>- a. N3 h; y0 R& s) t
- # t1 z0 ]. E, J+ T% J# N
- #include <mach/memory.h>
. l) D6 l$ A) T2 t - #include <mach/hardware.h>3 y w" P% B" e& i; d
- #include <mach/irqs.h>
: |; C9 i( A, ?) Y3 `) ^. p - #include <asm/hardware/edma.h>$ w2 L# S! B' W
- 7 ^6 H) O% R" S8 j1 y3 N
- #undef EDMA3_DEBUG
- @( W# X5 h. ~( a( q5 O - /*#define EDMA3_DEBUG*/
. i" m2 a) h- j7 l- V5 W
* v* z4 c& v9 k. }# G( ~) J- #ifdef EDMA3_DEBUG
2 V4 G. z4 T4 I# R9 p) b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( y3 J$ [% a# t$ M" Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 M) l( ^" z5 I" K Y9 x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) s) D' p1 E2 m
- #else. H7 m; Q$ T4 M" Z0 A8 w s
- #define DMA_PRINTK( x... )
- n6 H4 x! C+ X9 j: e' i2 S - #define DMA_FN_IN
: O: M, C9 n C6 F7 C1 N - #define DMA_FN_OUT
2 k3 D+ G; m& ?) g* I( F# h9 y3 q - #endif
* M' b, p# O1 x5 Q - / u; W; }) V4 w6 t. L9 H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( q3 ^: D( D, N. `5 o* C
- #define STATIC_SHIFT 3
% T4 T0 i' k6 ?2 Z2 Y' r- v1 [ - #define TCINTEN_SHIFT 206 ~. c+ I" r. A8 ~$ |
- #define ITCINTEN_SHIFT 21
) C, P' H" P/ L. f7 a - #define TCCHEN_SHIFT 22% T8 k' Z; I3 O3 y2 |
- #define ITCCHEN_SHIFT 23! A `8 P' a% W+ _. K: f# e
- # J+ v6 `8 H2 n- e
- static volatile int irqraised1 = 0;
" x7 r# ^& l6 P/ K- I1 e - static volatile int irqraised2 = 0;
% k9 s- h8 C: ]5 d6 w" P! m" X7 \ - * A1 F3 X# V) B% h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- Y) f! T+ l) `$ E0 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) e# {. i j+ u7 V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ c2 v0 w- L5 O4 ^1 B) J
3 S8 R1 Q6 W/ g& P) |2 O- dma_addr_t dmaphyssrc1 = 0;
" X, q) R7 }4 @7 b! G/ x. q1 A8 x - dma_addr_t dmaphyssrc2 = 0;7 M! _2 G2 z- ` u
- dma_addr_t dmaphysdest1 = 0;
( V( r- P6 I- |# S b2 N# s* o - dma_addr_t dmaphysdest2 = 0;
0 `+ l' n# T4 W6 ]( X) ? - 6 X* k9 I1 j' T6 I" Y! W; J
- char *dmabufsrc1 = NULL;
3 x3 g$ r! C+ n J: R" ?% f - char *dmabufsrc2 = NULL;
1 I0 q5 _& l: g0 }( o+ `. {+ A - char *dmabufdest1 = NULL;
$ ~$ a# P+ Q$ F% G8 H; U& v - char *dmabufdest2 = NULL;
1 a2 D g8 |5 V6 N/ b2 R - , c1 {6 m, p: \
- static int acnt = 512;1 I7 {2 o/ K1 D. S: z I# ]" m
- static int bcnt = 8;
) P0 r# R- M# B7 @6 V' I& _! A/ J - static int ccnt = 8;
! r3 X4 N5 r, K' _5 I1 l( w. ?
$ Q# {; J" q* a5 {- module_param(acnt, int, S_IRUGO);
2 s! [- ~! p; \4 I& M' t) V* ~+ A - module_param(bcnt, int, S_IRUGO);% Y7 T. C4 z+ e' r
- module_param(ccnt, int, S_IRUGO);
复制代码 ( ^7 _. j7 K" M5 ]# P1 t7 T$ ^
& G( q3 ?$ g( ?& @# B) X8 V4 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 Y; `+ N; I5 d. R. U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 W. O5 `( d2 W5 d1 H$ y M( t, I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 `4 ], d3 p- c5 r
9 k" d; U( j/ B6 l7 Z$ O, R4 d& |- ?* b! C9 Q; w
|
|