|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 B/ O( R+ P6 ?9 k3 `( k
- [code]EDMA sample test application4 R: w4 b# e% G" T Y ~ c! @
- /*
1 T" m1 T% W% |2 W0 e |0 I - * edma_test.c
2 l, K9 q& D7 m9 ^ - *5 k: ?! M+ V( x2 [" p% z
- * brief EDMA3 Test Application8 T- P/ @: X+ K
- *& g$ m. q" T$ T+ G: o
- * This file contains EDMA3 Test code.# \$ W5 T! e% e7 L+ j
- *3 ]0 ~ b; _4 ~. r/ K- a3 P. ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( W* v1 r# e( ?% U9 |! `4 {! A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' r, }) X3 u* \9 k" s4 K
- * TO CHANGE.
: X3 k3 `3 w8 H! J: N - *! R0 n, F; i) o% F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 o4 B0 v; x6 l3 Q) x$ J
- *9 U: s& `* a4 N2 ^
- * This program is free software; you can redistribute it and/or
1 k/ b$ l J: ~! q5 G3 | - * modify it under the terms of the GNU General Public License as
# Z" e, |( g( E. d g - * published by the Free Software Foundation version 2.
5 g1 S' C6 Z& l* n5 o: Q$ L - *
: G1 @, \3 n5 V* i: _! H0 W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ? [0 S6 Y) b* v6 {. [
- * kind, whether express or implied; without even the implied warranty
, [( B4 l b4 A9 U, `; T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 a, j. L+ l2 x& W. Q - * GNU General Public License for more details.
( n4 j- W2 a, _7 e: j - */3 {6 d+ y1 n, T7 i, R& [1 f' R
- 0 J5 U9 f9 }( ?
- #include <linux/module.h>
1 {, F! x- R. t+ e4 x# G- n - #include <linux/init.h>
! E/ v, J7 ~% @0 @ - #include <linux/errno.h>
0 F' F! a4 A7 b9 F2 T/ K/ r - #include <linux/types.h>
1 t% f4 L: ?( T( t, t" `, z& @ | - #include <linux/interrupt.h>& m0 }# B3 |* d) r# r
- #include <asm/io.h>
: y4 L8 f7 t! e0 ^: ^0 P( L - #include <linux/moduleparam.h>
9 m7 h# H; s: S) S) \ - #include <linux/sysctl.h>0 V" w3 S9 u6 C- [, V
- #include <linux/mm.h>& ~0 c$ v" }# v/ K4 u0 f" _/ L
- #include <linux/dma-mapping.h>
; N( W# a! l9 o- j' W - $ k1 K& @5 ^) B+ P
- #include <mach/memory.h>9 z& K8 j0 _& \0 w! ?* V ~ o
- #include <mach/hardware.h>
4 z: p4 W- z6 u6 n) L - #include <mach/irqs.h>
! i* c! k1 _9 X' C - #include <asm/hardware/edma.h>
8 C! J1 `, {3 ~- |3 K/ w& m - # M. ~; q/ }# e8 C
- #undef EDMA3_DEBUG, U3 Z/ R! d# _% n: J0 S( ~ x
- /*#define EDMA3_DEBUG*// ?3 S v% [ l6 I; C9 E" b& @& m
- $ g$ p) \$ q* d4 A
- #ifdef EDMA3_DEBUG
, i$ }) N- v; {; W' d; C3 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- g# Q1 R' h! n5 w- B0 M) X2 ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 n9 A& Q7 e8 ], r' V# P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 A5 B; w2 _1 N% l; f
- #else, G" o/ Q V* p, g! |7 f% P
- #define DMA_PRINTK( x... )0 s& [: \8 L. {% a, F4 P
- #define DMA_FN_IN
- ~5 D. d: N7 i3 t0 q5 z - #define DMA_FN_OUT
% U/ V4 D: [% a0 ?# ` - #endif, I; {4 O6 V' I0 w$ \* o# q+ }
0 s/ A9 k: H! K) Y# T7 d4 T) c5 `- ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ \! s# T- F& M' n8 ~9 T - #define STATIC_SHIFT 3
2 O9 G+ q+ U- ~. C - #define TCINTEN_SHIFT 20
& S; x- a3 X8 Z - #define ITCINTEN_SHIFT 217 F T' H9 I7 k$ b& O9 [
- #define TCCHEN_SHIFT 220 M6 e* c8 s2 z% x
- #define ITCCHEN_SHIFT 23# r. k" ]' k9 l7 n2 @/ M2 o5 A
- ( C4 ~0 c( Q, z5 W% W0 J
- static volatile int irqraised1 = 0;
p% D8 k* t, `- Z - static volatile int irqraised2 = 0;
, N/ U5 Q* d. n+ u; b
# R; I" b- k# u9 g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' f) }# x E+ f& C, q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. f5 s2 u- r0 ~) ]4 x# U9 e; m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) v( s6 u8 f- R0 d
( e8 o+ k) P C/ U# {- dma_addr_t dmaphyssrc1 = 0;3 `8 E8 C. R( L& ?# {+ z
- dma_addr_t dmaphyssrc2 = 0;
# b: L0 k+ h; B; D9 b5 w; m9 x Q0 b - dma_addr_t dmaphysdest1 = 0;
1 |6 J7 G% V' T; L3 w - dma_addr_t dmaphysdest2 = 0;
6 }: W. r9 U9 j8 w" P& y - # q$ ^( @$ V @% z) ]7 s& a5 t
- char *dmabufsrc1 = NULL;
t/ a2 i4 N f0 F - char *dmabufsrc2 = NULL;
$ M) P9 C% c. x - char *dmabufdest1 = NULL;
, u9 [, n) {6 R; }# r - char *dmabufdest2 = NULL;
% ]7 w8 M& X9 ]+ q7 b9 ~/ o
; e- U. M" p/ ^8 K7 r- static int acnt = 512;
( _. n$ K9 u+ Q! U& m9 N( y - static int bcnt = 8;0 B. n7 ?) U5 q
- static int ccnt = 8;! O/ T! B2 d% w4 r, l
, n7 |% Q. Y( |: }5 W h- module_param(acnt, int, S_IRUGO);" U. P/ A! B4 X9 w$ @
- module_param(bcnt, int, S_IRUGO);; n5 G( m' G3 |+ P
- module_param(ccnt, int, S_IRUGO);
复制代码
y2 T8 s$ o* A/ h* x
: S% |$ C2 D- _* b! F M u1 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 z/ ~, d4 p2 M: s1 b; j1 [+ u- Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 S- ?- r) j, x& p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 m1 h, V/ L* Z/ w: ?8 w, [/ ~ H2 L
) q* F3 G ]" v) i( v
|
|