|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! K& Y. a' l7 \0 w- Y3 X- [code]EDMA sample test application5 [4 |. t- d8 w6 e/ t
- /*
, G6 |/ g' D6 }$ W' }# I. _ - * edma_test.c% x$ e9 f+ A( w8 ]3 w. |. b( O& g
- *
2 ~# I7 W; R5 Y3 @3 S/ X - * brief EDMA3 Test Application) e. h! z& r% {2 ]
- *
# r; c+ [. b9 K$ E1 o: O% E - * This file contains EDMA3 Test code.
' }" \3 P7 E% q+ Z1 d" F4 p f - *
$ o* j5 W$ l+ B/ r4 V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. k& D% j+ Y3 F3 Y2 l* |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' |3 q: y( n$ l* J6 N - * TO CHANGE.
" `4 m, A5 u& Z G |# | - *
2 ]5 o6 z$ u% u9 O+ e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 o4 Y2 D d# N1 T - *% y7 c& ]4 U6 m ]
- * This program is free software; you can redistribute it and/or
# U, H% e& S/ T - * modify it under the terms of the GNU General Public License as
7 ]# d; R# V. D; Z+ h! C& W. o - * published by the Free Software Foundation version 2.
8 g: ^& }" M! H* k9 i - *
* @, ]$ i' D! f @; _$ f# v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# h7 D' k9 D8 f1 O% T# w& z* X - * kind, whether express or implied; without even the implied warranty4 X( R9 s ~; I( s `# y* C# g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. {# Y7 e0 [0 a: W" O! s
- * GNU General Public License for more details.8 T) K* O$ Y4 }4 _3 c6 G
- */: X1 i1 }; N& q5 x k1 t
: j# J- [4 f' ]- r4 p- #include <linux/module.h>. `7 }+ {" M% T! ]+ D
- #include <linux/init.h>1 K+ g* G4 j# {
- #include <linux/errno.h>- m/ F- u" m; j, I# l
- #include <linux/types.h>+ r% \6 a; _. x2 e
- #include <linux/interrupt.h>
: f' V/ M) m' }) o0 f6 ?# O: U - #include <asm/io.h>
7 F" ^" s9 D( _8 ^' R8 r& P B$ b - #include <linux/moduleparam.h>
1 ~; l4 Z; Y1 c N- _$ l" C1 j; `' H - #include <linux/sysctl.h>
# s. h" `- \0 S+ x6 ]1 J4 O - #include <linux/mm.h>+ H2 ^) A& p9 T, L# K% {
- #include <linux/dma-mapping.h>0 s( l# Y/ K" \ m* E s" q
- ( |$ c, @* b1 i1 N* J
- #include <mach/memory.h>
* H3 V. G* n) A# q! O* ]$ }; m - #include <mach/hardware.h>8 q/ o, D! G# s$ d
- #include <mach/irqs.h>9 o4 o5 r# }/ Y* k. ?
- #include <asm/hardware/edma.h>+ W; B. m2 S, ~# X8 o4 L
; I% C5 S. e1 D: z/ y- #undef EDMA3_DEBUG& I0 L+ {. o1 f8 q/ @' a L- I
- /*#define EDMA3_DEBUG*/
9 L8 C, R* l+ [5 [0 S$ e. i( P
. c9 L0 B3 @0 V5 L& S/ N- #ifdef EDMA3_DEBUG1 V$ p4 _% _; a9 C3 @9 }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 f& G( Z, F1 \- J2 ^" T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. |& [. D) c; z- H3 C, r7 K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ x& Z# M, E2 Z; x/ \) T) b% @
- #else
4 K# i0 Q! Q7 b4 |, P - #define DMA_PRINTK( x... )
5 v4 z+ R- p6 N1 n' h4 A/ `; K- R - #define DMA_FN_IN9 j- k6 M Y) U2 t/ ^0 T. t m
- #define DMA_FN_OUT' k. M6 K& _! j2 e( g, X- S& m
- #endif
) m4 \, h' U, ~) O: N/ w; J - , n% D: Q: n2 u1 G% B0 l% c: E/ [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 {5 N. Q# M( }; i - #define STATIC_SHIFT 3
! a8 Z# P4 q, ~5 X0 j3 l1 n - #define TCINTEN_SHIFT 20
8 [9 w) L1 _+ z% F3 y - #define ITCINTEN_SHIFT 21
% a4 J! T3 B( ?( ]( q: O - #define TCCHEN_SHIFT 228 |1 u+ j/ g5 W, e; j
- #define ITCCHEN_SHIFT 23
! t8 ^; l: Q1 t) ^! R$ \1 H, ^, U
5 u: g) _ E& V* P/ C- j- static volatile int irqraised1 = 0;6 o5 c" k6 e" X" \( |5 h
- static volatile int irqraised2 = 0;
7 _( X u! X' b$ O" Q8 a - ( g% o' x4 L2 d& L3 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Z+ R" G1 U: u, o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# f& {" L& v* W+ Q, d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 p: s. e% j k& n, ~- a- l; M
1 p7 W: I/ Z7 m0 ^- dma_addr_t dmaphyssrc1 = 0;1 T; R7 A# w6 ]- f
- dma_addr_t dmaphyssrc2 = 0;/ N( Z: D: D& ~" ~
- dma_addr_t dmaphysdest1 = 0;
$ l% i9 F" a! U; O! e - dma_addr_t dmaphysdest2 = 0;; r1 U+ V* L9 U3 c2 S9 C% N
! w/ D: n* [- H1 p% |% R1 h- char *dmabufsrc1 = NULL;
$ K, i% R. m6 v - char *dmabufsrc2 = NULL;
9 {& J8 k& K% ^0 `' s1 } - char *dmabufdest1 = NULL;
. ]7 B- T( w. q9 a5 R8 g- U! ` - char *dmabufdest2 = NULL;6 M9 W1 r: e/ S; `* ^5 h* a
' ]% P. e1 S9 z* x' J- static int acnt = 512; a4 s4 t: }; A- @
- static int bcnt = 8;
: r3 [7 [2 J9 V+ q3 O - static int ccnt = 8;
/ q" y7 y4 M/ u0 l+ o2 r9 p) I
4 g0 C* O3 T: p% l0 W- module_param(acnt, int, S_IRUGO);; N3 w7 Q8 {0 ~5 _$ y8 m i, |0 d) u
- module_param(bcnt, int, S_IRUGO);
4 }; k% j4 Q! |3 Y - module_param(ccnt, int, S_IRUGO);
复制代码 8 h/ ]! [2 \1 ?7 i& b
; K1 N4 b/ x( o2 A6 F/ ?5 l" a7 }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ I8 D, c9 y3 Y6 J; Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 @ F2 ], l# W) m6 F( a. B: A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 P/ l% E: h6 _# p' S
6 N' L h; M* I# b+ w
( w2 | B7 ~0 t1 N |
|