|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % j* p% v3 w( P3 S
- [code]EDMA sample test application
. Q/ V6 W" L, V( ~ - /*4 s8 N% ?+ ?1 E7 z p3 J/ Q( A. J0 B; {
- * edma_test.c- ^! D- B3 t& i& ^( P8 H
- *+ K9 \/ Z+ q }# G. m
- * brief EDMA3 Test Application0 V2 E2 b& r+ o( v
- *" g! G6 i% k: |7 T5 c0 P
- * This file contains EDMA3 Test code.
, B \/ z% ~# U3 D3 j* X - *
6 V0 o$ z# a2 l" W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! t# L# L3 h4 k! P: c% @8 I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 }- i) m* P2 r3 e( S3 D# j - * TO CHANGE., G0 w7 A ~: u) h# w: h; o
- *2 M" h& E/ Q; w/ C7 R A, D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# K" q) @' G' n2 v1 p' f ~7 _/ @
- *
. r; q8 ], E- e6 Q: c9 n2 C5 C% c0 y - * This program is free software; you can redistribute it and/or c2 ]9 k) q' s. m( ]# z5 q2 G! ~
- * modify it under the terms of the GNU General Public License as
; r! F* L# |: b6 K3 q - * published by the Free Software Foundation version 2.
( \+ W% b! q. V0 V& H - *
7 l" w, e1 q; J1 @ L" K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 K& U' G, m, H2 e - * kind, whether express or implied; without even the implied warranty' _6 j- ]# m4 w Y1 `5 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# _5 A7 o9 U+ V& O G$ S# e+ l1 ]% h
- * GNU General Public License for more details.0 l5 d- |0 ?1 o/ x
- */
) z$ u% [3 y M$ h: O R - 8 C. I( G/ m. b& g
- #include <linux/module.h>; g, I% s2 @9 s6 j9 ?2 ~- m* S
- #include <linux/init.h>
1 }" T6 p7 a! E% X - #include <linux/errno.h>+ M, t6 E( l% K0 V% y
- #include <linux/types.h>+ ` T( B% W( S* X
- #include <linux/interrupt.h>
" \4 t g6 p1 S" B5 G* ` - #include <asm/io.h>
# Y! h- X/ x! Z+ A2 _* V# A - #include <linux/moduleparam.h>
% z& N# `# [5 m5 M, n; S6 H' W: ? - #include <linux/sysctl.h># E8 j% z8 y$ H6 r4 Z4 K
- #include <linux/mm.h>
& Z( ]( V e* ]! I. B& N3 l8 w) Q - #include <linux/dma-mapping.h>3 O- t5 z; |0 p( @
- # |/ q/ L: P, g G4 Q# J2 D
- #include <mach/memory.h>
/ Z* n B8 ^, n3 z9 A/ U - #include <mach/hardware.h>9 t4 x3 l m6 \4 A4 f0 P- A
- #include <mach/irqs.h>
& V5 P5 k9 E8 _- H u g# { - #include <asm/hardware/edma.h>
" {7 T. ]/ W. |8 }( }; D* ]
& o* w+ ` ]# a3 q& V# V- #undef EDMA3_DEBUG" Q' F+ u# o/ U' ?
- /*#define EDMA3_DEBUG*/- I7 o) Q/ m4 a5 q" z/ Y* L. h6 w0 C
; c1 r5 [! S8 E0 h2 a- #ifdef EDMA3_DEBUG6 W5 |7 P- t" s8 n% o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! |+ b1 J" N# g) @% T- Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* R: _9 V% B0 K3 }# F- b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 M4 o2 G0 l H6 k! N- d% q - #else
- o' N0 U6 ?4 F7 t% e5 f; a; }2 c( q+ s - #define DMA_PRINTK( x... )
' N' D0 e' S* D$ C8 K - #define DMA_FN_IN, a6 N/ h, C8 I! `4 Y, X5 ]2 J
- #define DMA_FN_OUT5 V3 E# z% Z) T) H- v- o( F
- #endif
! ~) t- A3 `0 x) }; F9 | - , A4 k/ f8 f. N! O2 \2 E; ?; ^0 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 |1 Y+ `! h1 u2 J6 ~; U - #define STATIC_SHIFT 3/ w" R1 S/ w) ?/ |' }, W; D( D; h
- #define TCINTEN_SHIFT 207 i- O6 M0 J5 j3 p; x8 U/ y) y
- #define ITCINTEN_SHIFT 21
0 i$ F! {" r, X/ O" [! l - #define TCCHEN_SHIFT 22
# W0 u! Z5 m+ I6 } - #define ITCCHEN_SHIFT 23
9 V. B5 W6 j+ D& ~8 i) e+ D - 5 ^: R; r4 r2 D- q5 ]. q# d
- static volatile int irqraised1 = 0;6 U2 Q+ f1 o E+ t
- static volatile int irqraised2 = 0;0 }4 f1 S$ W! _# } L
& ]+ V* k9 s- y9 E1 x' c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ~5 z! o% ~6 I7 c/ `. f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, A1 X2 ]' i2 V1 z% T* D( ~% f) C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# I( X3 |" I2 J5 h - % g% |! @9 H/ Z
- dma_addr_t dmaphyssrc1 = 0;) \4 P& S6 K n4 _: D- C0 j
- dma_addr_t dmaphyssrc2 = 0;) K: V; ]1 W) C, Q' v2 f* y
- dma_addr_t dmaphysdest1 = 0;) D4 @3 O0 q* b$ M; R
- dma_addr_t dmaphysdest2 = 0;; C/ }. c, o& q
/ X$ S' `+ c+ U' x. c8 G4 m- char *dmabufsrc1 = NULL;
5 G' E* A% E: X: m% k - char *dmabufsrc2 = NULL;. a/ {6 E9 R! I
- char *dmabufdest1 = NULL;
/ T% v! b V' D - char *dmabufdest2 = NULL;
, a5 ~3 f: l* Y: x - - M. i/ s% \, ~, e0 E' `$ o8 @
- static int acnt = 512;9 ?. T5 w2 F5 ^) B
- static int bcnt = 8;
9 ^/ k6 e" |7 d) B8 I0 R - static int ccnt = 8;
. s( ^3 p* @' i! [# H4 @ - 4 |" m$ w5 K# G+ B# L/ B
- module_param(acnt, int, S_IRUGO);2 s4 l8 U3 Y8 W% c
- module_param(bcnt, int, S_IRUGO);
! C* x4 p# J! _% E$ A - module_param(ccnt, int, S_IRUGO);
复制代码
: A$ U- Q/ l0 o* b, q) S
7 f) v9 S8 N, g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# J' D& e+ I- y+ |1 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; c3 S C' t* Z d+ k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& V: l& j& |$ }. S) i# m
9 a- a4 T' T' M" y' k
1 w0 J" r1 s0 U8 p# w; Q |
|