|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 D* q6 U2 l2 _2 d2 t
- [code]EDMA sample test application- n$ j4 r6 E J+ ?: [
- /*
) ~9 e; G' K; l5 E% F) k8 | - * edma_test.c
. Q) s+ \/ S$ ]- j" B: p" \ - *: x, V$ a% A+ d. s0 f& X
- * brief EDMA3 Test Application; O8 m8 i( D9 p/ s+ z3 N! @
- *4 y8 C; S, g7 X) s9 [5 k; K
- * This file contains EDMA3 Test code.* T/ \9 K& ]1 I% M( F+ S
- *! o7 e3 ^' L9 |- ]* \5 r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) V, a& n" W- J3 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 g! M2 K# ~: e6 o. D, T* P - * TO CHANGE.
% i; {4 N h, y& V$ o/ M( H5 A& _ - *4 q @6 d) C: v+ }: B5 y' x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 O+ a' D' E; V- j- D' X - *8 C! I- ]0 }& a1 b4 }- n- m
- * This program is free software; you can redistribute it and/or
. f& Y, [/ i9 S! b, J; \+ n% l5 G - * modify it under the terms of the GNU General Public License as. l4 I9 H) ]. y; P* c! X, R
- * published by the Free Software Foundation version 2.
! P; K8 X4 U( Z8 a - *) r4 z& b( z, m0 g2 ?% E8 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, Z( v( {% V% H; h. C
- * kind, whether express or implied; without even the implied warranty) E! P' P& b9 i7 Q, N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% D8 B5 e: o$ q% N* y: [ - * GNU General Public License for more details.
4 j. h8 o0 L3 w0 q - */" W# [0 r0 J( t& }1 ~
- ( L6 D! k& I. @/ R
- #include <linux/module.h>
. ?0 d% N8 u7 J, X+ v9 L - #include <linux/init.h>( p; l" [. K7 E7 _( f
- #include <linux/errno.h>& K. v* A1 _" W. D+ C7 m
- #include <linux/types.h>
& d" s4 h" S. t! s6 d' i - #include <linux/interrupt.h>, `5 Y6 O" E8 [! f4 p
- #include <asm/io.h>
$ {0 T+ ]% ?5 Q' a6 p7 b - #include <linux/moduleparam.h>
! [' ?' H; @6 | - #include <linux/sysctl.h>1 E* B3 M; j( J, J' n2 O! E
- #include <linux/mm.h>
% j3 b1 V) ~- T8 u' | - #include <linux/dma-mapping.h>
, | U' d8 g- d# K - , U E. J8 }2 v7 K! }% K5 W7 `
- #include <mach/memory.h>6 Y, p) |, }( P7 ~. p! z
- #include <mach/hardware.h>$ F! [+ W% Y) U% q {, H7 y
- #include <mach/irqs.h>
: \" V6 w f) C# w4 M( ]+ d - #include <asm/hardware/edma.h>
+ L, Q" c. s# z2 Q: p+ o8 t" L
' q. O8 ^6 w: [1 X; m- #undef EDMA3_DEBUG
s' ] F+ J+ a) Z) {3 E - /*#define EDMA3_DEBUG*/& O) }! X2 g/ C7 K
# ]$ P4 V% b0 U! K! n; K- #ifdef EDMA3_DEBUG
$ L1 R" _1 I3 h4 |* d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ]4 z3 V& e# P9 k# O( A) C9 ?3 D' ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); U& ~4 f- l" a' e: c" I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- W- o7 T. @2 e: e* \+ b/ K- W: ~
- #else
; h* J; D# S5 R* N - #define DMA_PRINTK( x... )" k; a% G- M& M
- #define DMA_FN_IN! q% h/ c$ E x4 s5 L7 A$ v9 Y" y
- #define DMA_FN_OUT
# }; ? M" {8 h - #endif; l* V8 U* g; ]6 K
9 _) a* k- I% U) R' Y% z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( V/ F- I4 @9 Y; T
- #define STATIC_SHIFT 3) V: K( W/ N: ~( Y. n1 p& K
- #define TCINTEN_SHIFT 200 W+ }4 h1 R% f0 \9 s# N
- #define ITCINTEN_SHIFT 213 r- {) W- B' T+ C. [
- #define TCCHEN_SHIFT 22
2 P9 o) F: q1 I- q4 s - #define ITCCHEN_SHIFT 23" t8 l$ r% E; _! ^; b
- - U4 a& i2 a: T4 R. q
- static volatile int irqraised1 = 0;: f# k0 Y' b0 X- L
- static volatile int irqraised2 = 0;* l2 ~' D8 z3 U1 U: F. {
2 h' T; k2 R4 @: _$ G1 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ T ^9 B# D2 _9 [5 X) S# }0 i$ y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# e- X1 r! [9 c$ V# U" r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ L# s" T" f# ]: w6 s2 R
# p: D1 _6 D4 O% v. o( i& \$ o' u& E- dma_addr_t dmaphyssrc1 = 0;/ @) Q8 `0 H# a3 q& ]8 i) w" H
- dma_addr_t dmaphyssrc2 = 0;
k+ U* G0 X$ _3 D - dma_addr_t dmaphysdest1 = 0;, h% X; r$ P8 Y z
- dma_addr_t dmaphysdest2 = 0;" E' _4 \9 z2 q$ ~* O9 E. v0 w
- 6 h6 u2 A- c( D) U4 b" v+ s" K
- char *dmabufsrc1 = NULL;2 W. ?. {: @- J7 `! a" p* @7 E
- char *dmabufsrc2 = NULL;9 T0 Z7 d: ]2 I b/ v
- char *dmabufdest1 = NULL;
% \ }; _' w9 t* S. F% p3 @ - char *dmabufdest2 = NULL;
8 x* d5 D, W# m, n - % t1 L( S" E9 \$ i* D, v, n. D
- static int acnt = 512;* E" J' H4 ^8 u
- static int bcnt = 8;
. F y% V0 F/ l. f: b7 B# E - static int ccnt = 8;6 L; z8 A6 l* {9 ^ L
- 4 e9 G- u7 Y6 Q* L- j
- module_param(acnt, int, S_IRUGO);
$ J3 J+ y' S$ }) Q, d P1 `- i - module_param(bcnt, int, S_IRUGO);0 S+ y% l3 ]. ^0 i' p1 a
- module_param(ccnt, int, S_IRUGO);
复制代码 , N' }3 b& U! a: [$ N/ G! q2 m
1 D6 o1 R9 s9 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% k j& r: {9 F P jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 E) Y) n- n& }7 [; j- q# i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" x7 X7 g+ q2 K5 Q5 l: L3 ]6 S+ K- S2 p% U; w
( E6 N4 Y2 z, j. m |
|