|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 x% z4 ]) i1 b, ~7 U' G- [code]EDMA sample test application
7 G Z, n! X8 D- R5 e - /*
3 F5 T0 ^7 y7 Y - * edma_test.c
8 }! g/ g( {) ?* V% ^ - *6 Z3 m; v5 d" C5 b# ?/ F
- * brief EDMA3 Test Application
0 F) l1 t' B* @2 l, U - *
# j8 ?7 X4 S: u - * This file contains EDMA3 Test code.% a9 A" F& Y- T- M) X4 v% ~: @- j
- *
4 M5 D# g0 M! m: u# F8 R x* R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( n2 a2 W8 X. i6 y# ^, s2 V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& e9 t: e6 o2 V6 Y+ b - * TO CHANGE.
( Z* E$ }5 R+ s7 u - *
l2 _. N; u0 L7 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' y4 {9 ?5 G! q1 u. f
- *8 x- M9 F8 B" r# b+ ^- y5 m" \4 r1 Z
- * This program is free software; you can redistribute it and/or7 I" L8 Y2 X x, o/ U: k
- * modify it under the terms of the GNU General Public License as$ j3 J* E7 P+ q: f1 ~
- * published by the Free Software Foundation version 2.
& y( ~9 C4 V7 ^ - *# Q9 A) G! t* Q$ [6 g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, j1 m0 X) I, C, E$ H8 C( F - * kind, whether express or implied; without even the implied warranty
, ?4 J3 W* R- P. o) i- Z3 C9 r7 g" J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! T! t& N! ^* X: h, H - * GNU General Public License for more details.
1 |; B; k% l8 |3 f# ~* f - */( C9 p2 m) q6 D# b* e
5 W% O. H# f t( x- #include <linux/module.h>
+ q+ K4 M! u d% E* M - #include <linux/init.h>0 j6 I* K4 j% j. L% [* O* Q
- #include <linux/errno.h>
! Q3 E. n; w+ p0 j" } - #include <linux/types.h>9 \9 G$ {+ G9 u, B; j. B$ {
- #include <linux/interrupt.h>
) B; k# ~( B9 Z- v$ ]2 f, B - #include <asm/io.h>
; W6 p' N. h5 Q3 e- j( P1 X+ L - #include <linux/moduleparam.h>+ E2 K2 z, C, x& {( r+ @- |
- #include <linux/sysctl.h>
; e U0 B8 Y6 z* i9 A - #include <linux/mm.h>
1 Y! O- I' d7 O" C# m) { - #include <linux/dma-mapping.h>
+ J: [$ ] ~% y
0 P! i4 `, i0 H5 i; Y3 [- #include <mach/memory.h>
' l! Q$ A& p; _$ x0 n1 k - #include <mach/hardware.h>
& a6 a- {4 Z8 m) A - #include <mach/irqs.h>
: |; ^: D* z7 H7 S, r+ m6 V - #include <asm/hardware/edma.h>
- s7 |4 \# |+ J2 I7 D6 k! `; g. X6 C9 e4 R
8 A' c6 O3 B. [& `6 @5 ^' m9 t( R( U- #undef EDMA3_DEBUG R- T) L; z; M$ `& O; f0 f
- /*#define EDMA3_DEBUG*/
1 w( ~6 p: S6 n0 F6 h' E/ Q& e5 W - 1 w6 R! E. B: i C! J
- #ifdef EDMA3_DEBUG
G9 ^" ]6 I5 d. z8 b7 X) B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ^/ {5 ^% R& N& n7 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 { a9 ^8 M$ P' e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# l, N9 E2 G# H2 o( p4 n9 Z
- #else. r* _1 [, B b) \' v/ F
- #define DMA_PRINTK( x... )* H: l$ R d& l
- #define DMA_FN_IN
) T4 P1 f. r5 j0 Y - #define DMA_FN_OUT% X, I" k) x: q: e. @, R
- #endif
, a K& J4 A7 a0 Z' s7 z# v - ; C7 U" E: B- K* r0 R% I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) H' u5 r9 K5 i" u# x- t - #define STATIC_SHIFT 3
; d$ M+ u. \& E - #define TCINTEN_SHIFT 205 h8 {+ {. x) g0 s$ F5 ]" v
- #define ITCINTEN_SHIFT 214 m8 B; A \$ T/ S
- #define TCCHEN_SHIFT 225 W0 [, Z/ M5 d6 t
- #define ITCCHEN_SHIFT 23% L! k/ N; f& @- _7 g6 S6 A
- 4 J q+ a. Y1 x* H& c$ V3 i: |
- static volatile int irqraised1 = 0;( W5 L8 i- h+ P5 y9 w% B5 A1 Y
- static volatile int irqraised2 = 0;
8 C$ j# n* l$ ?$ X$ m
) W! m# x/ f4 }$ ~, a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 _* f* _$ f5 ~1 E7 \ B+ u5 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: H% z" X, y5 B, I X0 x6 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 u4 P* R/ m. u
2 F5 `6 V' f' V- _6 n/ d- dma_addr_t dmaphyssrc1 = 0;; n9 H7 O7 y8 r" ?& q
- dma_addr_t dmaphyssrc2 = 0;2 }$ K9 H' }2 _* S0 J [: d7 k
- dma_addr_t dmaphysdest1 = 0;4 ]/ k% v$ M5 n! E! _8 G4 N
- dma_addr_t dmaphysdest2 = 0;
8 y9 ?8 l( z0 P) J# I - + Z2 G8 c) g7 k$ T
- char *dmabufsrc1 = NULL;
8 G& d/ k# x7 X- @4 R - char *dmabufsrc2 = NULL;0 t% J% b. p3 E8 _' W c$ v
- char *dmabufdest1 = NULL;
4 t8 G5 n$ ~+ e - char *dmabufdest2 = NULL;
5 d1 _8 Y* [) R5 F; ]
3 j' i" B0 U0 k! u2 p8 l- static int acnt = 512;* m6 Z+ d* ]) B! Q# P& n9 J$ z0 S4 H
- static int bcnt = 8;9 F& L3 i( T/ K# @( w
- static int ccnt = 8;5 K O; M c# E4 [" t- o' }# s0 e
! [3 k* a. y! E7 [- module_param(acnt, int, S_IRUGO);
* u4 v$ d5 e6 q4 B% D" x/ D. Q) R - module_param(bcnt, int, S_IRUGO);
4 G8 U) R/ L0 J# x# P, U - module_param(ccnt, int, S_IRUGO);
复制代码
! e, I/ u7 N9 U1 @% B& o: O( ~- U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* w0 f+ P1 t) G/ f! p* k* tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 p7 @9 P$ m2 c. s" c& f/ O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 a' ?' K& T7 t ?: [2 |. S1 y7 \. I/ x4 I7 u) o9 c0 f
: W8 [" r1 A. Z$ t- F |
|