|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 F$ l! f, T8 C$ J* Y) x7 }- [code]EDMA sample test application# E! t2 Z) ~' J
- /*9 t8 G1 M- f3 R* d/ ?0 v
- * edma_test.c
. {( j7 Y9 T B6 {0 F/ l0 B. ~ - *
! l: o( g# s" p2 C" A0 c& M* R; m - * brief EDMA3 Test Application9 d8 I _9 a( D3 e: j3 |; `
- *
0 ?; s# |( \& Z4 T) } - * This file contains EDMA3 Test code.: R8 p- `9 ^/ _/ }- T3 w" X+ F: `
- *
+ j- O& G4 Y# @6 B* W2 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 K2 ]0 ^! U+ y1 V( I6 }3 z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! h. k" d$ l0 q0 O - * TO CHANGE.7 R% \% v/ J o" s' ^0 J
- *
& i2 Q1 p& U; a" W. r% { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! g9 j7 O4 ~8 q0 u- I6 f - *
' i0 D& G! V9 b* ~ - * This program is free software; you can redistribute it and/or
6 L G! G4 {* Y - * modify it under the terms of the GNU General Public License as
1 }3 o: V0 y E. w5 S - * published by the Free Software Foundation version 2.
8 I/ z2 e/ `5 X: e' s2 Q - *
@3 I' u7 A* s2 Z& Z# i' \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' l% l. `2 m" I' Y! ^6 f0 S5 f3 Q" X - * kind, whether express or implied; without even the implied warranty8 _9 W6 f2 F$ Z D7 j/ @9 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. m( X( s, e1 P9 M! k7 N - * GNU General Public License for more details.
+ H* q1 j4 x7 u# @* X - */
8 }' V: |' D4 p
$ g- q2 Y( a- d7 N, Z: Y; M- #include <linux/module.h>" O& q9 ]# m1 h# v! O# |
- #include <linux/init.h>* R' f3 S& V* q% S! i/ r2 u
- #include <linux/errno.h>% k4 J f! o# W; i9 ~
- #include <linux/types.h>5 t' S. O5 Q' ?) y3 p
- #include <linux/interrupt.h>
, A' x9 ]4 F. [( { - #include <asm/io.h>* U1 V, O3 G: v: s6 p7 N' j) b
- #include <linux/moduleparam.h>! r& N( q" i, m- U m
- #include <linux/sysctl.h>
8 t0 G3 @" N. F3 i: U7 k; A - #include <linux/mm.h>. @7 H9 h" v0 Z% i
- #include <linux/dma-mapping.h>" c' T" j$ q. A2 C+ b6 e& T$ z$ q
5 f! G8 u4 L4 {6 a; p5 e- #include <mach/memory.h>
1 J3 ^1 Q8 o3 J3 w - #include <mach/hardware.h>6 N+ g5 W X6 K& A; g
- #include <mach/irqs.h>
, v1 | ?2 s8 U6 k2 [- p - #include <asm/hardware/edma.h>
1 m- U" z# }3 ]: h0 b( ^" E
' Z" x7 N6 [* O7 H: u- #undef EDMA3_DEBUG
% A& D) q' J0 g- C! _8 h/ I" ~/ t - /*#define EDMA3_DEBUG*/
) k0 U9 y, Q* P+ b/ }' L - 7 k' V1 b, U. x* w; C/ S
- #ifdef EDMA3_DEBUG w5 j5 U2 o) q" g" e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 ]2 D# F5 P6 x0 y- q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# o1 J7 w; H+ P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 g8 @; [; r7 l9 _ - #else. t" W8 Z3 U' A6 j% t. w- h
- #define DMA_PRINTK( x... )2 o1 a# V3 W5 }
- #define DMA_FN_IN4 J5 b7 R& [- ?5 n( G2 w/ Y) t) ?
- #define DMA_FN_OUT
% a& ?0 I% g& C- ?/ g. l0 B - #endif
! u& R8 b# y# n1 x1 g) _ - % m* ?$ e. z4 U( j& [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) P* g' t& w- I. c) v6 p
- #define STATIC_SHIFT 37 W% p4 h7 W7 S1 p- _. H: J3 g n; y/ B
- #define TCINTEN_SHIFT 20+ e& O$ V, o4 P+ i7 X' N
- #define ITCINTEN_SHIFT 214 \1 r+ t5 ]' G* s) I! s
- #define TCCHEN_SHIFT 22
X3 B" w$ K k - #define ITCCHEN_SHIFT 234 e, r" F5 v3 S& O1 ]
6 A8 ^7 X+ ~( J% {* x- C- static volatile int irqraised1 = 0;
' k; h* V5 e: L( q - static volatile int irqraised2 = 0;$ b }% s% L4 _4 N5 ~8 q
- 0 I' f" b3 X |( z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; y# Q5 Z1 C, j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) [1 Y! _1 b7 |# D& ?9 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 s" H/ `% r7 s: b
" `% Y0 H2 T' ]5 W4 ~# c% @0 i- dma_addr_t dmaphyssrc1 = 0;
( ]0 d* C; z! j4 t6 ]! a9 X - dma_addr_t dmaphyssrc2 = 0;0 Z$ Q; ?+ G) O, v1 Y8 [& [; I
- dma_addr_t dmaphysdest1 = 0;
+ B K0 }! j2 T- h9 T5 T7 H - dma_addr_t dmaphysdest2 = 0;
* |+ p+ B2 V. v+ M- u. w - ! X) d2 ~4 T! B, \) q
- char *dmabufsrc1 = NULL;
; ?. V9 W. T. T: |4 k - char *dmabufsrc2 = NULL;& E7 m8 d7 j- s
- char *dmabufdest1 = NULL;
. r; I5 _+ {& L) |% J' D - char *dmabufdest2 = NULL;# B( E' D2 Y7 j
5 r; m3 V [% ^0 m/ \" Y4 P- static int acnt = 512;9 o$ J# t- C' K @7 p+ s$ D
- static int bcnt = 8;
8 ^' \# n& S9 {7 c7 q - static int ccnt = 8;
) }6 z+ N; ?: V+ J. t$ B! f
( J0 R. q" E T! S8 E) ]0 D- module_param(acnt, int, S_IRUGO);9 Q/ v, o- B1 E2 ^
- module_param(bcnt, int, S_IRUGO);
) t/ f1 ~1 ?: R# b% R - module_param(ccnt, int, S_IRUGO);
复制代码 - n) F4 T0 ^5 H5 G8 G1 W
8 Y" q8 l0 ?4 \4 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 v8 W+ j( V6 F! k1 |arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. E2 L$ E/ ^& e8 A3 w& m& U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 C' S* A5 G% w+ q4 N I2 v! }8 r
% p- O% M! i Q0 E7 G: h+ e' J2 X# n: g
|
|