|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & b. p8 u5 P v: b* r
- [code]EDMA sample test application" H) |& G9 ], p
- /*1 i% V1 `% r6 ]! s3 c! |8 A
- * edma_test.c5 y- g5 U0 f; u
- *- O0 F6 l8 {: r+ `- j
- * brief EDMA3 Test Application
' F* _8 W' @. p# M3 y - *+ A2 ~$ q; I3 }, e/ W# R0 e+ {3 Z; n
- * This file contains EDMA3 Test code. S/ p9 R# u# d8 q5 F
- *9 o# p8 K+ L0 u- W- M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) Q$ T8 `: a' `( j7 R/ s5 y s- M9 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 l5 \3 E" y1 c" o7 R: U
- * TO CHANGE.- L O6 q) T% d0 Q+ m* P
- *. C8 `& p: q1 Y2 {$ i }; p# u! E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 M! B! U- [+ D. }, `/ v5 n
- *
" ^# }: o3 o' L" d. @% h3 i - * This program is free software; you can redistribute it and/or
: R; n8 D, T- Y$ Q1 X& j# ` - * modify it under the terms of the GNU General Public License as
% x/ ?- L; l7 J+ ^6 i' A: j - * published by the Free Software Foundation version 2.
/ @, W3 o+ o3 D. l. q- R" O - *
: b6 w1 P" K0 p. c1 |# _5 E& b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 B' [7 D( f+ f3 h) g - * kind, whether express or implied; without even the implied warranty0 y+ Y6 i" r2 O, J3 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: @6 Q1 x7 `; U& F4 J4 I- ` - * GNU General Public License for more details./ g/ I. |0 \9 |, W b. O
- */
9 x, u! V6 n4 p$ D9 U - - p" G0 U9 u: y0 @# d
- #include <linux/module.h>
9 S2 }2 D Y; P* x! l& o - #include <linux/init.h>
1 o& T+ O- R3 G# \ - #include <linux/errno.h>5 W6 c1 n1 K0 h! ^3 P
- #include <linux/types.h>. U/ l) G. n# Q( n: N8 {
- #include <linux/interrupt.h>
( P% C* C9 r a1 U; C - #include <asm/io.h>
; J9 t( l) l1 t - #include <linux/moduleparam.h>' K: ~ e7 E: e* A) p) N4 F7 K
- #include <linux/sysctl.h>
$ E7 e! s: Q2 E1 G' E - #include <linux/mm.h>
* D3 S4 t v2 l. D6 S9 ?4 d7 a. y - #include <linux/dma-mapping.h>; z9 q! v% P+ o
6 f) x8 z9 Q2 ^/ T2 y: H- #include <mach/memory.h>
: F- o, D* g5 E7 E - #include <mach/hardware.h>
5 ]7 f% v4 }( e: N8 S0 v& X - #include <mach/irqs.h>) g4 j: z" i' o# g8 F: c
- #include <asm/hardware/edma.h>; X4 v3 Z+ Q" o& c8 E; ~4 |4 V
% b+ q% A$ q) C' k- #undef EDMA3_DEBUG
# W; Y6 D4 H7 t5 B - /*#define EDMA3_DEBUG*/
! @8 Z* U& c) }" u% L* d, i
9 Z; r6 t: H6 G5 p5 ?2 ^- #ifdef EDMA3_DEBUG
' E; b. O% T D! t9 q& S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% }: e5 o; H3 M3 ]( o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). j' r, r5 {; C, X# t: ~2 J% j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ a. m& y- ]0 Y( K. F; ]! a - #else4 e9 a7 `% v' k# ^7 j: E" o
- #define DMA_PRINTK( x... )
" {$ K! P2 ]% C- I( e - #define DMA_FN_IN
! A. i/ y! A( M* {/ h3 V: q - #define DMA_FN_OUT p6 B; G% ]7 m
- #endif
# ?. X% y3 U; d, L5 A% \3 B3 [, @
# J* z7 O8 M* H( Q' i* y. Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! m' [5 c N. j) W9 D& Y Y - #define STATIC_SHIFT 3
K& K: f0 R, Z7 d( X - #define TCINTEN_SHIFT 20) g0 ], ^2 M7 g, l; D. a* A5 W
- #define ITCINTEN_SHIFT 21
7 g+ Q* Q) k1 h) o- p3 z; p$ B - #define TCCHEN_SHIFT 22) ]& U# Q% {( `
- #define ITCCHEN_SHIFT 23
& Q, j+ Q! F5 ?% ^# `& P# A H - D: I! K; A" T0 h! P- p* s0 h; B; C
- static volatile int irqraised1 = 0;. ]6 M8 T8 ^2 k- B' d# K0 |
- static volatile int irqraised2 = 0;3 z, k6 {6 u! u% G. x, V
- # A5 b/ @, e$ s0 H+ S* T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ |- K3 X! r# w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 ~+ r2 k6 \5 |2 n' s6 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 K% W- L7 o$ t) o) d' I: P0 f - 1 V& g V. V7 x5 X, ~) `
- dma_addr_t dmaphyssrc1 = 0;0 a- w6 Z% m4 v/ l) X% d5 {
- dma_addr_t dmaphyssrc2 = 0;* S% N ]7 R) f1 d1 n, ^1 U
- dma_addr_t dmaphysdest1 = 0;
8 c9 Q. l9 G2 u6 A2 v - dma_addr_t dmaphysdest2 = 0;% g6 G1 N8 n! z A
7 E/ r- f: J) l( A, c: o( X- char *dmabufsrc1 = NULL;
: s e }: _$ c9 h& c - char *dmabufsrc2 = NULL;
! \0 }: c- M' {8 y - char *dmabufdest1 = NULL;5 H* P7 D2 r$ @3 c0 {* ]7 M0 o# R
- char *dmabufdest2 = NULL;# K w R/ f# O- W" s( o
- ( K, n. G+ s W# v
- static int acnt = 512;
" x4 A2 S4 x/ P2 U$ k, N - static int bcnt = 8;& u0 ]' Y7 T) P' R4 T" T
- static int ccnt = 8;5 V3 Z" g8 ?( v# ^" n# G( O! W
- & z% Y4 x w* e/ o2 f( K
- module_param(acnt, int, S_IRUGO);6 C$ F4 p/ x* _+ @1 a6 f9 M- i6 m
- module_param(bcnt, int, S_IRUGO);7 _2 N5 i$ @+ [/ ]+ k
- module_param(ccnt, int, S_IRUGO);
复制代码 ! S( D6 V- P# S8 `! \! S5 h8 C
* f' y5 h, Z/ ]& E/ t, E& n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 M3 m6 H4 B2 H% Q, S- B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ ~& S" a) u% _3 U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 X* @) ?: N( Y8 n5 E* u0 \, O$ ]5 D3 u9 ^! N n
2 B8 A7 Z6 r% F$ i/ y# J' G$ r |
|