|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 v8 E: X' q1 d: c/ X- [code]EDMA sample test application
5 n6 N3 d/ t( _, d6 ~0 z6 ^0 C; K - /*- }9 V$ |4 Y& S: X/ M' k
- * edma_test.c4 p- s& `9 g' w- L: r% b
- *
P: D! h1 N6 y - * brief EDMA3 Test Application. Q, X( `- ~" x' d5 r
- *
5 i7 R9 M( E# k - * This file contains EDMA3 Test code.
) D: l5 v' t& ]! ?" d9 h - *
8 R K9 H9 R( e e6 a- G0 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, H, E) O5 X; B5 t2 |( } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, X, N; B# q7 y$ ^$ m2 z
- * TO CHANGE.4 K" F! E9 k) W5 |4 {: |
- *
% c8 W5 a& L Y; C% H5 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 I4 ^0 g" Q% q4 l
- *
( K. y0 J9 C: |/ [ - * This program is free software; you can redistribute it and/or {- d, Q( K" w& b9 H
- * modify it under the terms of the GNU General Public License as
) P6 c( _9 [& A. U2 ?8 Q+ ] - * published by the Free Software Foundation version 2.
0 K% }5 S# g1 A4 j - *
& N, Z* g5 ? _8 Q z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) J0 \* \" Y7 I. I6 Y I# g
- * kind, whether express or implied; without even the implied warranty/ u6 f7 P: \5 v5 b& c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) |9 p' c7 t6 s4 o$ @; D
- * GNU General Public License for more details.+ _# A# O5 Q6 G5 u$ m- d
- */
! v7 N! `' h( D- T& M
$ @- O s& }1 o3 w+ ^+ d' u) |; E- ]6 y- #include <linux/module.h>+ q! K. d8 p, a+ \; J
- #include <linux/init.h>2 n( d9 b! R5 w6 }* i3 w& }
- #include <linux/errno.h>
4 M, B! y+ u( C6 J - #include <linux/types.h>
/ B8 d9 U7 v! H; C - #include <linux/interrupt.h> N6 D# @. P" [( ~ h4 p
- #include <asm/io.h>
3 i, A& J! ^8 ^5 O) G) F - #include <linux/moduleparam.h>- j, ?& H, n% z
- #include <linux/sysctl.h>
* M5 |# J, ]1 t. f% d) [# K - #include <linux/mm.h>4 r' A( |- [6 n% o
- #include <linux/dma-mapping.h>
/ d, Q; }; v2 s* ?$ } - 1 O6 ?; g* u7 @7 d
- #include <mach/memory.h>$ G1 t( W g4 t
- #include <mach/hardware.h>
3 m3 s- ?' p2 j, F. Q - #include <mach/irqs.h>
+ \' w$ E" `0 C1 o - #include <asm/hardware/edma.h>
8 M% [1 ?/ S6 C x+ g% X8 B
! Z$ S0 F; V% M& V1 q- #undef EDMA3_DEBUG: `1 P# S; j" @
- /*#define EDMA3_DEBUG*/
$ F9 i2 K1 O! l |0 t) { - . [9 G9 L6 c! {7 T; U) R( C0 }
- #ifdef EDMA3_DEBUG) {# ]. `; Z3 e D; w8 D' v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 t0 U! |8 U6 m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; V. D* }% ]2 j8 @% j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ^, L" B, \# ]1 m+ H
- #else4 I1 _5 g* ^' N: x# M
- #define DMA_PRINTK( x... )/ {. o7 U5 w& e6 H+ `! w2 d
- #define DMA_FN_IN) t* b. {0 x$ S/ O5 d
- #define DMA_FN_OUT3 N5 t( ^: P3 b2 E U
- #endif
7 g* ^* s/ _6 K0 g _ - # h5 M6 [7 K! I2 T1 M8 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 T* t, x: l: c. J - #define STATIC_SHIFT 31 `) ?6 p* [7 a) t/ k H
- #define TCINTEN_SHIFT 20
! Y* V7 a% v+ D* R/ e1 L& C& R - #define ITCINTEN_SHIFT 218 S* d S" N8 e% Y
- #define TCCHEN_SHIFT 22
3 y' z, k+ |4 o/ ]8 \2 l - #define ITCCHEN_SHIFT 23
: D: G. _* U' ^$ B! e$ S - 5 ^, v2 ^/ G/ A
- static volatile int irqraised1 = 0;
2 u. D$ W; ^+ u/ }' J - static volatile int irqraised2 = 0;% Y; Q2 O: n1 g
- : t: L* X: Q8 h% z3 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ E7 `- ?+ W( x Z$ u5 M: C5 f# H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: H1 y) V U& L: o5 y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `/ x! G; U4 w& F1 ]+ c$ O9 x
/ D! T, m; B' T1 J( G9 z6 ?- dma_addr_t dmaphyssrc1 = 0;; `: i; ]0 w/ d3 e; F' Z$ G# \
- dma_addr_t dmaphyssrc2 = 0;
, j6 u/ L3 f r1 O - dma_addr_t dmaphysdest1 = 0;
% b2 K$ g; l9 G, y' e" d- m& Z - dma_addr_t dmaphysdest2 = 0;5 I. ^4 i! a' Z/ d# \ U P
- ) d1 P& \" H0 L; u) t
- char *dmabufsrc1 = NULL;
8 a! f- H2 r& v& j1 e1 z% p - char *dmabufsrc2 = NULL;
" F; U# P# @5 [3 l8 y. o$ G - char *dmabufdest1 = NULL;, q* y* c- k: ]/ ]: ^6 Y3 [" a
- char *dmabufdest2 = NULL;
% L( M- j* B4 `& H1 h - 1 U8 n' a1 y4 l0 ^ h
- static int acnt = 512;
, W- B/ h) U4 k3 E$ m6 @ - static int bcnt = 8;
6 ~5 |5 d t( w0 U& v9 {$ O - static int ccnt = 8;9 Y6 l8 D, B( x$ O! L' Z3 g
* Q5 i. `+ v8 N" Z* B- module_param(acnt, int, S_IRUGO);
2 h7 e+ p3 Z) S3 g! K$ j3 U" C - module_param(bcnt, int, S_IRUGO);
2 j y2 e; i+ A/ U( U) g - module_param(ccnt, int, S_IRUGO);
复制代码
* O7 C2 H/ u: D5 ?9 J
7 \& @% u0 N3 w6 w: r' U' p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 g& M+ u, S& h: H7 {9 S0 B/ Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; @6 [" @( `) E' M/ g0 `- s; { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. F* r/ E. q) L' ^: l. w: c- [8 E8 n
, _0 g) u& ~' x) X9 M: h9 b5 T+ k! z5 [* |" h+ z' ]9 e
|
|