|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 l* }5 K. Z. u S
- [code]EDMA sample test application
7 h0 W y+ D) t( ? Z - /*9 o% u# q3 w4 _
- * edma_test.c$ V$ h5 q- v6 Y6 _
- *4 R: w+ P' w$ s* E
- * brief EDMA3 Test Application
N2 U5 N0 q& J, I. t - *
9 f/ o3 e, g9 H s2 f! n$ J3 g* x - * This file contains EDMA3 Test code.7 N( n) E. }$ i5 Z: A
- * F" m% E8 O( \! z e k, @2 v# C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. [# ]: S: V+ U* b9 Y8 R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% h; J6 M/ f( f2 y8 U) |) P
- * TO CHANGE.
. Y7 n) Q, L6 p4 I# g - *
4 B& Y* O( m% e& y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; \- P! ^0 Q8 u8 s - *
7 _8 W9 ^( E, y% X6 z, M - * This program is free software; you can redistribute it and/or
; x: ?- W3 I( D - * modify it under the terms of the GNU General Public License as
9 I" T8 k, s9 ~$ f6 D3 a - * published by the Free Software Foundation version 2.9 B0 _4 Y+ d8 M2 @/ X
- *+ g& A4 Y, o' M$ `, s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 R5 ?8 F$ K1 U+ }+ Q - * kind, whether express or implied; without even the implied warranty
- Y7 b" p: |% X& y0 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 g# K/ F; u+ X- B - * GNU General Public License for more details.6 A. p4 ^% a/ x% s
- */
8 Q, g$ C( H) U7 P( I% J
7 |: Q2 h1 L* ^3 B W" n- #include <linux/module.h>% o; }" t" \2 b- ]# g' p
- #include <linux/init.h>
# b) t0 c( C$ l1 q3 N - #include <linux/errno.h>
7 H9 t! d% F9 B# J1 q, y2 o - #include <linux/types.h>; A0 c% ^4 ~' G) w) ~( r+ k; L( D
- #include <linux/interrupt.h>( A$ B) b* c& O& ^
- #include <asm/io.h>- x1 p4 B7 G; n U9 X
- #include <linux/moduleparam.h>$ m9 S1 i8 g6 t6 Q, w) Q
- #include <linux/sysctl.h>
; B \, V0 }9 K. I4 k2 B! H! g - #include <linux/mm.h>
! v) d# u: k5 m2 X - #include <linux/dma-mapping.h> Z% Y& I( _8 P+ Q, {( j
: w. z3 a- N' Y. N- #include <mach/memory.h>& K3 u8 E6 p' a. ^# S# b
- #include <mach/hardware.h>3 \& `1 u' l* j" B
- #include <mach/irqs.h>
# o1 \5 e: F6 X3 {+ E6 D - #include <asm/hardware/edma.h>+ K7 M$ C/ k/ h1 }5 R" Y
' [9 \' w8 l# P. p# B- #undef EDMA3_DEBUG
$ @3 N* [! z9 `4 I4 R( `; X - /*#define EDMA3_DEBUG*/8 I( i0 G: g4 `4 ^
' `" M* i- x, F# O+ Q- #ifdef EDMA3_DEBUG
; \, `' A/ H7 K# E3 a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ F! U5 r0 j1 C. a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 v3 b9 u0 }- n8 B* V |9 r9 C3 K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 a. W- N8 f& _$ ^4 v
- #else6 _9 p5 ^- _8 L$ u b
- #define DMA_PRINTK( x... )
: l r/ l5 ?0 H7 L( U2 h - #define DMA_FN_IN9 F h2 a- Y e9 V3 K$ C
- #define DMA_FN_OUT
5 M- `8 N4 i3 W; k H+ @% l - #endif
& D& @3 G' \( B% Y - ; R$ [7 Y5 m l, ^0 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. ?' Y: C$ Q3 q7 p% s }) R - #define STATIC_SHIFT 3' }* k: t" j$ z9 T# J: H- l
- #define TCINTEN_SHIFT 20
% B. w6 ?" n0 i, Y% I - #define ITCINTEN_SHIFT 21
5 n, c- {5 B6 b# Q1 H - #define TCCHEN_SHIFT 22. z9 k% L5 k' z$ B+ l
- #define ITCCHEN_SHIFT 23
, [2 w% u1 O; c7 [ - # P! f8 ^3 l7 ]4 r
- static volatile int irqraised1 = 0;
% g% P* D7 ?& e2 v0 o/ a - static volatile int irqraised2 = 0;
; L* A5 y0 W3 d" ^# h - : B$ f8 j0 H$ q& P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Y% Y$ }/ ~, K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 y2 L: B- G! H4 |* E: l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ f, {, }# ?1 {+ @7 D3 A1 e - " }7 C, B+ U8 W$ G* N
- dma_addr_t dmaphyssrc1 = 0;
! }; h; M- I0 i$ J) R1 H - dma_addr_t dmaphyssrc2 = 0;
^) W) n" c* j$ c* b - dma_addr_t dmaphysdest1 = 0;( k5 b; z# \9 z/ h5 K5 ~
- dma_addr_t dmaphysdest2 = 0;# c/ ^* b" z. ?5 S6 d, y: H' w( Z
- ' O% Q) d6 n* g$ r& i$ k& {
- char *dmabufsrc1 = NULL;
2 l! U$ [; U# L U4 C2 `( Z - char *dmabufsrc2 = NULL;
, q' u2 g" g, J3 @& y& } - char *dmabufdest1 = NULL;
& q4 {3 n9 R) p$ Q( q! B# V - char *dmabufdest2 = NULL;: d. |2 C* q) u5 x( Q5 O
$ S" r; {: e& J- static int acnt = 512;
% V% e1 M) j- B' J7 f - static int bcnt = 8;+ h1 O7 Y8 y1 V- e; h
- static int ccnt = 8;
/ k- P, y. B* Z# C& Q2 B - u0 X4 d+ t# \+ e9 T6 e z
- module_param(acnt, int, S_IRUGO);
4 B7 h: m7 a9 h: V. J - module_param(bcnt, int, S_IRUGO);, T1 h5 [: B j) o& b1 C+ B
- module_param(ccnt, int, S_IRUGO);
复制代码
# w0 z) x" u7 ?% w, f+ {% b& e, `
9 q9 Z% G. V& g+ {/ Z$ Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: \/ Q* B$ U. V1 k* d4 Z, v( Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: I* V0 e E5 S w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. f+ i( F; f( a( q: j
7 f) R' z ^/ o
6 H6 X# @7 \/ u! l- z6 I |
|