|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" m9 L# O5 w' S2 j O' ~- [code]EDMA sample test application5 Z0 `, q' y& L- Q
- /*6 z3 ^0 {+ k0 ]5 A) ~. e8 N2 S
- * edma_test.c
/ f7 X) j3 i6 E9 _6 m% r - *
2 X: d# \) _/ y( I. V - * brief EDMA3 Test Application
5 o: i$ n# u6 R - *8 o( \- X9 _. q$ X8 M0 {
- * This file contains EDMA3 Test code.# j; N# _( q3 n q7 l- r
- *
9 f$ j0 E; r" F0 T. M) U4 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 a& X0 U$ P" X! C3 U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: S% w" v8 ~( Y9 j s - * TO CHANGE.5 C% v- H. T, W! a* A( s
- *' G1 K$ d% ~ T1 v7 P9 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ E+ S4 C8 W' a! {. z+ l/ O - *2 O) c8 H& |% O# o# R1 ? C) r9 _
- * This program is free software; you can redistribute it and/or3 S% n9 [: r+ ^% Q
- * modify it under the terms of the GNU General Public License as/ J( g, j; P( M! q
- * published by the Free Software Foundation version 2.; l: y3 t, q T" u
- *1 a& H& F) F9 V0 ~1 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 _8 }! G: q, U6 @- ^" [3 \" b - * kind, whether express or implied; without even the implied warranty" p4 w% @ M& t7 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 t: s5 V. j- ] z
- * GNU General Public License for more details.* a" R" L- W% R
- *// ?) h5 {) N8 \5 [" m, p
- % P6 \6 }) b/ ?7 |5 }) o1 b
- #include <linux/module.h>/ d: j. W- s1 l
- #include <linux/init.h>+ n+ t3 ~2 V7 Q' ]# `8 }
- #include <linux/errno.h>0 k4 z+ K# r9 B0 l* F" L
- #include <linux/types.h>
. b& F* x1 m ? - #include <linux/interrupt.h>$ @7 R! T- \- w; `/ W- n |
- #include <asm/io.h>4 Q1 ? d: Q# n# @6 l# E7 G
- #include <linux/moduleparam.h>3 p* D6 q* x9 r% ~
- #include <linux/sysctl.h>: a3 }7 q4 J6 `- `
- #include <linux/mm.h>
+ l3 M0 j, }4 P& s) h - #include <linux/dma-mapping.h>! B& f/ u6 p8 z# q
8 N4 g- n3 s) B- C2 \: W' Z% M- #include <mach/memory.h>
% Q' G1 i) V, i/ b8 t& { - #include <mach/hardware.h>
1 v3 ^- J' ]+ l5 l/ ] - #include <mach/irqs.h>
/ j+ i# n. _- e b) y/ I% N6 l - #include <asm/hardware/edma.h>! ]" T. ]' W& H
- * i& L- { ?/ D3 X- T3 t
- #undef EDMA3_DEBUG5 x( S* T3 D' ?
- /*#define EDMA3_DEBUG*/" Q' F: P& u# N
- 3 i1 h5 V6 H7 t% _7 H) {# ~
- #ifdef EDMA3_DEBUG* P6 M5 g0 o& M$ b3 S+ X# D8 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 m2 n: s3 }/ ~ I* E, _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 E {6 \: _- W( u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ d d& d7 R0 m$ W$ o9 I0 U' X
- #else3 D9 p( @+ N6 U" s* c& E
- #define DMA_PRINTK( x... )% G4 d# E1 C9 M. g
- #define DMA_FN_IN
5 W& U, l3 c; ^2 A$ e' f. |+ y - #define DMA_FN_OUT7 ?' Q6 {# a: m- W
- #endif* X8 I0 r$ l! M) Y
# V" ~, X7 ^- G" R( x- n& e/ x+ L' Y8 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 d: X. o7 V, Y: V$ u/ M: t6 u. E
- #define STATIC_SHIFT 3
$ b2 U3 a0 ]$ x( ? - #define TCINTEN_SHIFT 20
0 R @$ a7 D& H/ w5 O- Q8 o8 P2 o - #define ITCINTEN_SHIFT 213 P8 K, Q( j0 \, T& N# B
- #define TCCHEN_SHIFT 22
$ b" O( O9 F$ D2 A$ |) d. Y8 @4 L - #define ITCCHEN_SHIFT 23. v1 S) a) F* h k$ i" U9 z
- - O1 |* ^3 a9 V! Q' M, I6 s
- static volatile int irqraised1 = 0;
, k7 F: T, y6 o6 e! q - static volatile int irqraised2 = 0;
0 { D7 t- V" d1 h G/ x- \% f - / p+ @4 `* E; l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* G, {& \& H4 _4 ~) Q) \2 E: w4 H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* `+ p8 D1 p7 N& J( [( E/ M0 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% q% w7 s6 R9 Z# s4 }% T
8 R/ { f4 v: s- dma_addr_t dmaphyssrc1 = 0;
8 v# I) U( i& ?) M+ r - dma_addr_t dmaphyssrc2 = 0;
$ _( b; ^! c* C! h - dma_addr_t dmaphysdest1 = 0;. a' d" o5 B9 v) Q4 a5 y7 a4 W1 ^ V
- dma_addr_t dmaphysdest2 = 0;/ G* a+ B' p# m4 J, {+ Q1 Y; s% W
L* T7 q0 @. b( s) J/ a3 r- char *dmabufsrc1 = NULL;; q4 O T1 h- r: p/ D
- char *dmabufsrc2 = NULL;4 b9 h1 r, W0 f$ k
- char *dmabufdest1 = NULL;
( p& Z" ^9 f" d - char *dmabufdest2 = NULL;7 j9 \/ i$ k7 k* N
- ) {+ x) Z- R+ d g$ f% N4 \' X* v
- static int acnt = 512;% a! g5 { p! G& {( H/ U$ m
- static int bcnt = 8;
; j3 ~( ^ [4 I - static int ccnt = 8;
" }- u2 l7 d( t' R) p
3 L( r5 ^* E7 T7 g) o- module_param(acnt, int, S_IRUGO);. e. w( ?* p! h8 H6 _) `/ y
- module_param(bcnt, int, S_IRUGO);; R( W3 G- b% I4 }2 @6 i+ S& D
- module_param(ccnt, int, S_IRUGO);
复制代码 0 f$ x% T$ `! Y+ A* |
5 O% p* {2 r# }; J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 \4 E0 x% C$ harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 I5 q3 Y# R' \8 z- k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 Z5 K6 y( p8 | ~9 y6 W' k0 Q
0 ~- u! J$ d( }5 E# `
/ F2 i: U" F8 c
|
|