|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " K& {6 {1 N- |2 C: M! b7 R: c3 P
- [code]EDMA sample test application9 d7 y: j; ~$ d- c; h
- /*& `8 l8 j% ?3 b7 Q3 a+ e1 Q; M- q- a% }# b
- * edma_test.c
! i) I& K6 U0 T! z - *
7 J- y# r, y0 Z+ O - * brief EDMA3 Test Application# a9 |* h6 Z/ g- J* C% H
- *
T. ^5 _) s5 s9 A - * This file contains EDMA3 Test code.; ^" l& R( Y+ d$ o7 t7 S
- *9 b; N4 _! l( _4 P3 N( i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ h1 |6 `; L: |* W* c+ l0 G" ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ b% \! m" T9 u: L7 B
- * TO CHANGE.. X9 f- V* D) W& `
- *
* m& k v8 w* | D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ a* i2 F( N) n" m$ b3 p - *
0 { Q" s9 Q2 V N! {3 L: a' [4 K - * This program is free software; you can redistribute it and/or+ r0 b* U& M; |' `
- * modify it under the terms of the GNU General Public License as) o7 B: o& N5 U
- * published by the Free Software Foundation version 2.
, P9 }- b M$ T* R: i - *
# q/ N7 i: e6 b6 ?1 ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" A z9 k8 K" F - * kind, whether express or implied; without even the implied warranty
# r% f; H+ H# { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& Z, _! q. A* F. V4 _ - * GNU General Public License for more details.
- i! I$ }$ G- M9 @4 `. a - */( e8 S4 l3 s: J6 V
- 4 }0 ~8 \' n6 u! K$ g8 q6 [/ @
- #include <linux/module.h>
/ N. j% H) t! ^0 z. ^* v - #include <linux/init.h>9 m& p7 J+ t# z- v* T, u1 h% C2 U+ Z
- #include <linux/errno.h>! x& f2 d; d0 N. O0 o
- #include <linux/types.h>
9 B* Z, ?7 j: J; e, j/ P# x0 l; y - #include <linux/interrupt.h>
5 {/ T9 G' `! X: ~2 J- e - #include <asm/io.h>7 u$ I& x3 f# [9 n
- #include <linux/moduleparam.h># @4 O0 J! B6 T i7 ?
- #include <linux/sysctl.h>
* r" {7 `, l" a" Z7 T" ^ - #include <linux/mm.h>
; M5 D- t% Y0 F! R3 ~ - #include <linux/dma-mapping.h>
8 v# w. w1 c' R7 O' G/ v/ o
& I! Q; u/ T, H1 C% D) G! S- #include <mach/memory.h>% w/ t: F. y/ d8 F
- #include <mach/hardware.h>
4 e3 [* E+ k# b - #include <mach/irqs.h>2 d% t8 `2 Q& R4 ~$ ?
- #include <asm/hardware/edma.h>
0 b' \% }% S4 G8 d' F5 L7 _1 x y! v0 B - + a$ N' q, ]; e p
- #undef EDMA3_DEBUG
. ?" E9 F1 I# a; f# t - /*#define EDMA3_DEBUG*/
7 g# M7 s' j0 ^( y - 5 E, D# D9 G; A1 P3 _" {
- #ifdef EDMA3_DEBUG7 j4 |) A- W, I q# I) y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; }6 D' {$ r* R- L8 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ U. C0 y; _/ E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 x6 _8 [0 Z. }, X5 [. W* T* N - #else$ ]3 J( n3 @2 }: L
- #define DMA_PRINTK( x... )
" D6 r/ u! h3 ]5 s/ G- } - #define DMA_FN_IN6 g+ _% t# o1 U; j" c4 J
- #define DMA_FN_OUT2 X- S1 R( e1 z3 H, Y9 a% Z
- #endif) d, V. t+ @% j( K1 P0 A2 c5 ]
, U+ m! G: G4 l/ [' Y2 Q2 _$ ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( n; {/ t4 B. d: _: Y9 J8 p- q3 H/ S
- #define STATIC_SHIFT 3
* G- e; g7 L$ A - #define TCINTEN_SHIFT 20% i, R: M5 E; [1 _, U# W
- #define ITCINTEN_SHIFT 21
/ l0 ^" r0 l7 H- ? - #define TCCHEN_SHIFT 22$ \( _. G4 ?+ S& j6 Q0 C
- #define ITCCHEN_SHIFT 23
- V, j) E5 Q. @* C( { - F; u5 B" n8 q2 s1 G
- static volatile int irqraised1 = 0;
: H7 \/ ]5 Q# r9 h9 w8 k - static volatile int irqraised2 = 0;, k, G, |% X2 {9 E6 M
- & }4 i. Z& Y1 b+ Y! k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `/ t% M4 p" b1 j1 _& `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ e* p/ D8 F- H! l) Y! N: |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Q- c! e9 N9 f
' f# w7 |' |* B, x# u0 Z& H) `5 A- dma_addr_t dmaphyssrc1 = 0;
( ^, }( M- R& L$ w4 s/ Y - dma_addr_t dmaphyssrc2 = 0;( n, ?; v7 T1 p
- dma_addr_t dmaphysdest1 = 0;
3 J& `- ^% ?! k# } - dma_addr_t dmaphysdest2 = 0;
0 n! D5 |0 ]* T3 p4 Y& O# n - 2 ?) x8 ?/ L! I% m; f8 J
- char *dmabufsrc1 = NULL;
( R u* w" `' v# ]: W; t1 K1 C - char *dmabufsrc2 = NULL;
8 t# e |. {, W1 x$ d& _ - char *dmabufdest1 = NULL;& R. o1 Y. p; a
- char *dmabufdest2 = NULL;$ ]8 p1 q9 u0 k& y; ]5 U
6 t2 L* F4 U/ d+ n) p- static int acnt = 512;& Q) O# a6 K/ R! |: [
- static int bcnt = 8;
2 J m0 }) u; s4 ^% F; z - static int ccnt = 8;
* {5 m2 ~$ a& ]0 d - * d3 M9 x4 d) u/ G
- module_param(acnt, int, S_IRUGO);- w4 E) H0 j9 a. ?' p+ U
- module_param(bcnt, int, S_IRUGO);. |* G2 D6 s1 I! |$ [) |. n
- module_param(ccnt, int, S_IRUGO);
复制代码
, r" A: `% g2 j$ X5 e% X+ Z2 T) H. G' I! R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; g* N; S, V* P; h# g0 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" F* k* Y g h7 u! \) M1 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' M5 v6 E* t1 r& }4 d) D. r
' v4 j. ?) P+ l6 w' ]5 i
! `: X1 s8 m1 Q5 I |
|