|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 m: ^! B/ q& r# U% t% B+ n. u/ R
- [code]EDMA sample test application
3 R$ O A7 L% f7 i: I* m/ T - /*4 F3 R8 C' Y0 M' w& S- ]
- * edma_test.c1 n) \- K0 _; F* ?8 V' ]" r
- * c* T4 u4 W" X2 u ~
- * brief EDMA3 Test Application' k3 Y1 G$ \3 T2 x' ^6 h& u( z
- *7 _# l8 V4 V# e+ ~3 w
- * This file contains EDMA3 Test code.% v0 F& u x" g5 Z. p, b
- *
% ^" ^% }/ S% o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 _' \+ `% D9 g5 c) N% D- q, @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! q. @: F; S1 S: f
- * TO CHANGE.; C0 ^: A# X' f1 L- @! q0 j+ ~3 r
- *1 w- a9 U% m( c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 Q% b; z2 r4 Q# O* o1 ^8 c, G; N/ c - *! h- [4 Z5 |- a
- * This program is free software; you can redistribute it and/or% B- y4 b8 \6 y
- * modify it under the terms of the GNU General Public License as& w+ d) o5 `" P; k* G
- * published by the Free Software Foundation version 2.
/ O# e# A3 p, } - *6 a! Q* m% G0 o' r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" f' |' R( e+ x& e0 ~ - * kind, whether express or implied; without even the implied warranty
$ X% o/ X' z9 H% [/ q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 V2 u3 P: u) w R+ T- O - * GNU General Public License for more details.
# j1 ^! Z% \$ _4 ^* G9 | - */
, e/ c: M* Q2 H/ S* ~2 S
1 S5 X, X/ P3 \& T# \, U2 m- #include <linux/module.h>7 [: Q% Y/ s9 w: ?' A$ O8 D
- #include <linux/init.h>
8 a0 f1 |8 D0 [( E- x+ ]+ f: m9 F - #include <linux/errno.h># _9 H, Z- h( E: g. p; z8 [) @
- #include <linux/types.h>
* Y- ?/ M S% E% H, x - #include <linux/interrupt.h>
1 T: e* D8 I$ h - #include <asm/io.h>
% O$ j: J, Z# V1 l - #include <linux/moduleparam.h>' F2 `6 Z+ F2 `* r+ A2 `: ~
- #include <linux/sysctl.h>3 B; v: E* C1 ?8 |: q
- #include <linux/mm.h>
: w- V1 W' Z9 E# \ - #include <linux/dma-mapping.h># K( O6 W0 B3 x5 y9 H
- # @4 s( g9 M# h q# x; [* m5 U0 J7 c
- #include <mach/memory.h>: h' P& l, m5 }6 j
- #include <mach/hardware.h>
& X9 T z6 B7 \5 L% a* W( T' { - #include <mach/irqs.h>$ n) i/ l% h0 ~# }" b, t
- #include <asm/hardware/edma.h>4 b, G* s3 D' ]# K ]* e4 g
- * [' H1 R: l& u: e) e$ V" B
- #undef EDMA3_DEBUG3 S" B p, V3 t3 f4 V9 D) \
- /*#define EDMA3_DEBUG*/
; v% n4 B; ~: z: y - ) @" {9 r4 {# l9 `4 I- g9 y
- #ifdef EDMA3_DEBUG$ ?' a7 J2 `, N5 m# w! r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' e' i* R: e1 `0 h" P9 K% ^& d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ f5 ~! d9 W9 ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 s: y8 p5 V, G8 e7 y* s' S7 a# @# {
- #else. ]- H/ {5 |, w8 l5 O' g
- #define DMA_PRINTK( x... )( r5 {; I5 x, D; ~4 |# f5 c9 ], s
- #define DMA_FN_IN
( K! j$ f. S4 I" B' F4 x, ~0 Q5 _ - #define DMA_FN_OUT
5 M L: y# }0 f4 z" @' n - #endif
& y# p0 S% t+ N3 ]5 i- R( e) ^
0 P* |$ }) {8 ~+ o$ D4 {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% {) g- N8 g- y5 q; F `) p - #define STATIC_SHIFT 3
+ F9 B7 ]/ S% A - #define TCINTEN_SHIFT 20! @ @# q+ V( h) k5 [- e9 h
- #define ITCINTEN_SHIFT 210 m# _. p* Y" c9 M7 T
- #define TCCHEN_SHIFT 22
* P0 s3 x) m/ b, F! W - #define ITCCHEN_SHIFT 23
$ m2 U* @9 [0 d5 A6 m5 W
% S x; w& w1 g, K, T- static volatile int irqraised1 = 0;0 ^; x$ M8 \" F" l: l+ r
- static volatile int irqraised2 = 0;+ ?9 \ p4 ^+ u3 z7 X
. z$ {1 q3 ?6 O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 y/ | a( h. a G) f% ~1 A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; U s: v, g3 }4 Z" I$ { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ^4 n% x U) i7 m& R9 Q, l
- 8 k) h: h3 Q3 e
- dma_addr_t dmaphyssrc1 = 0;
* k2 w1 r" Y. ?3 E* t - dma_addr_t dmaphyssrc2 = 0;
( I: P7 l+ G6 o1 C" k - dma_addr_t dmaphysdest1 = 0;- t. a( D) q% t# A- `
- dma_addr_t dmaphysdest2 = 0;9 d! e* r: n% C. }5 u# D5 {
- ; D. E4 N7 `+ M% p: }% M/ ~
- char *dmabufsrc1 = NULL;
7 @6 Z A- y* K+ d; P `3 @ - char *dmabufsrc2 = NULL;6 Z1 y$ `5 z, G, t' E1 c
- char *dmabufdest1 = NULL;2 j" c3 I' h, a6 f
- char *dmabufdest2 = NULL;; m. g& R4 e6 c' q' m
- 8 v. H( q4 G2 N
- static int acnt = 512;
/ ^. D! E+ v% K7 R - static int bcnt = 8;3 O+ o- }& p4 u0 I& x
- static int ccnt = 8;
8 F+ `0 D" N7 g: j' H' k# s! t
$ N; E6 q# T' W; Z. E) C1 J- module_param(acnt, int, S_IRUGO);$ c/ S1 x1 Z! h' t
- module_param(bcnt, int, S_IRUGO);
6 i) r7 e- b. b G - module_param(ccnt, int, S_IRUGO);
复制代码
( M q' u; A" Q, _) h7 u O+ b& Z& i5 n7 Q- E4 b0 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 g4 t" \ U$ r' d/ U0 y) ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) B1 B5 U5 e4 _. [) d! z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% a \- i7 A' r% ?% \7 T+ Z4 z
4 V4 p; V0 q5 t. m
9 ?( y; `* V0 c! T* I% k# k |
|