|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* o/ k/ K5 Q0 r& `7 g' G4 y- [code]EDMA sample test application% v2 V0 | W+ h5 ?. O7 g3 d
- /*
* @' ~ [, h% o - * edma_test.c6 i2 G" \* M* F7 [% L
- *4 ^2 x" k1 {, O! x, I) s, _/ j6 i% b
- * brief EDMA3 Test Application
7 m6 X0 j6 ^6 O) R4 r - *+ h+ M+ w, \& c0 p
- * This file contains EDMA3 Test code.) a* V5 L/ t O" T# |0 l' A" d1 Z$ f
- *( y* r% i9 `- P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! H d7 r) {; E7 Y) [3 P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 R" T. W; }3 F7 F. `/ l
- * TO CHANGE.
0 U! w# n* i! \9 p# w4 d, i0 H- I* h9 M - *
5 l2 j/ o7 K+ ]- I5 Q5 ^% l: ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 m" U2 T, ?; Q6 D: N9 V
- *
8 K" K9 w3 D2 ]& J6 n - * This program is free software; you can redistribute it and/or7 u* V/ S' u8 C. v/ B1 w9 z4 f
- * modify it under the terms of the GNU General Public License as$ |; i; U! S1 f1 Q- T1 M {: w
- * published by the Free Software Foundation version 2.
1 D# p3 O X# S4 I2 {9 E - *
. b d" e! V1 @3 E6 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; O# y- M/ Z3 v( ]$ n, D2 o
- * kind, whether express or implied; without even the implied warranty' R1 p4 S. l- |! d% m8 \8 l$ R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ D0 l. w t9 H( Z - * GNU General Public License for more details.2 }$ r$ M) I4 y7 z1 W7 V9 \
- */
8 X7 p1 _ r. [4 d3 I9 c2 j" D# ]
/ Q. w# |' w7 G- #include <linux/module.h>9 w3 o# B" K( k5 [
- #include <linux/init.h>( [- Z D1 I7 Y5 u
- #include <linux/errno.h>
1 N' \: C. g; C# {: j% M% ^ O+ b - #include <linux/types.h>- Z9 L4 T! S, v
- #include <linux/interrupt.h>2 O" i4 }/ m+ K6 }4 f5 |
- #include <asm/io.h>
8 `; F3 ?. G2 @3 M: Y8 ~- k7 W# M- j - #include <linux/moduleparam.h>
' e# C/ v. k( j' k. q% a+ k - #include <linux/sysctl.h>- s0 U- O7 R+ ]; s
- #include <linux/mm.h>/ J) {4 H b6 v2 t
- #include <linux/dma-mapping.h>5 z3 J' u" f7 _) ]0 g. M7 W1 |8 K- R
% K4 O$ U) g# Q- #include <mach/memory.h>, V# m9 ]2 q. `
- #include <mach/hardware.h>
) Q0 B; P$ c( v( E) j" ] - #include <mach/irqs.h>
- @" O) g# J2 f, H' Y6 L - #include <asm/hardware/edma.h>6 ^$ E- x4 T2 ]; p
- 3 z% s* p' V9 m. X
- #undef EDMA3_DEBUG
& e0 y/ H* i6 X' o4 t4 i" l5 Z- [' v - /*#define EDMA3_DEBUG*/# t0 H* X% c" Q# m
a& Y. R! k) r# x& v. {) }- #ifdef EDMA3_DEBUG
* U0 Q( F" B8 W; H3 Q3 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 n3 c9 |5 F) T+ n3 t* D4 S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 q' A" W# P7 Q2 W( ^! q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 X( |0 ^7 Q4 N# A& m3 v
- #else1 d2 ]2 J1 u; E. p6 D% c# _/ \: u
- #define DMA_PRINTK( x... )" s6 }9 K- e9 M- \. z2 u# O
- #define DMA_FN_IN
. M/ L$ |2 V$ l+ @4 H1 C3 { - #define DMA_FN_OUT0 ?+ N* e) Z/ j1 H7 N) [
- #endif3 }" ?7 {+ H' Y( o. ~5 X) c# @& l
- 5 ]0 l* A& y" e5 o0 d, m( P! b0 E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& y% Y- r+ H1 @, Q; M
- #define STATIC_SHIFT 3
& p$ E7 } O& X* Q - #define TCINTEN_SHIFT 20
2 k! t4 }8 F8 s' ?, C$ \4 } - #define ITCINTEN_SHIFT 21" W- a" [! O3 x! E4 D; I
- #define TCCHEN_SHIFT 22
' C8 b, ^0 W+ M2 k+ b' w' m - #define ITCCHEN_SHIFT 238 A& m; q1 I6 I9 P k3 {- y8 ?/ Q
- / t' f% ^, g+ k% M8 B# o% q. B, k
- static volatile int irqraised1 = 0;
" G6 F9 P1 M" Z' K! ]" z - static volatile int irqraised2 = 0;( n K+ G* w1 S2 k( u
- ( d/ E; ?9 k' W/ O8 O) Q: z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- s0 w3 i7 S+ _. _3 Q# a1 j) m# O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ P1 _# G) F! R* G8 ^9 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% w$ [. ?9 {/ A/ x
. k; Y; `, H9 l8 f- dma_addr_t dmaphyssrc1 = 0;
( J/ |( }. C5 h' }% ~& ?5 K7 }% t, P - dma_addr_t dmaphyssrc2 = 0;% R, R5 e6 B8 }/ |5 h% m
- dma_addr_t dmaphysdest1 = 0;
" U( J5 P& {& x4 i' r$ g1 ~! a - dma_addr_t dmaphysdest2 = 0;
: w2 _( F4 f( b1 F9 S% N5 Y X
/ p$ I8 }3 Z: n9 G& U6 Y1 Z7 v- char *dmabufsrc1 = NULL;
+ n Q4 \$ M% _7 `: b - char *dmabufsrc2 = NULL;
2 ?( x) v% } G0 ~/ I - char *dmabufdest1 = NULL;; p, U f" N# m7 J" w7 r0 h# L
- char *dmabufdest2 = NULL;
* f4 ]7 J, ]* b# B: Z
/ D1 _+ \1 Z4 Y2 J' K- static int acnt = 512;
* X- h' c# a; @* r% B' f - static int bcnt = 8;4 l/ n% U# r( u% f% o1 i
- static int ccnt = 8;
+ U) v0 P4 n& h/ N9 L* e$ x
9 r* H, g2 w( I( k, C/ j- module_param(acnt, int, S_IRUGO);
! } L; w2 T# V O4 | - module_param(bcnt, int, S_IRUGO);
5 P7 z$ ?2 e" I$ ]5 [ - module_param(ccnt, int, S_IRUGO);
复制代码 ' f3 M! y% j) p9 }, K0 P
# |' V, M/ [# w n" g* } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. _: T. k$ e! E7 D! H2 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 j( V5 Z# X/ ~6 X3 A; H; l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: b5 |3 X7 K9 j: m' Z& P) w- G) |1 @$ v0 g: X! C* i' m
! P! w" r8 S; b
|
|