|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' w1 O% R8 h% ]! y/ v' I$ B ^
- [code]EDMA sample test application
6 h* @( o0 c. g' Q: M - /*4 c7 ?2 d6 b7 y$ T* W
- * edma_test.c
! k1 J9 k% r2 ` - *- x8 g8 f3 Z1 Z" [: m: E
- * brief EDMA3 Test Application
/ |1 {, N* ]- k" ~/ v - *
2 v* b1 \" f3 U5 y! E - * This file contains EDMA3 Test code." D9 w6 |" p8 d7 L- U/ p( ^
- *
5 d6 u/ r0 _ j+ E( R$ J6 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& w) x) i1 z2 c- o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ C4 \7 G5 x- A1 H* k8 y, n - * TO CHANGE.
( v$ M" K4 P/ h2 {: m8 t2 Z - *! i( U0 Y4 ~$ k; w8 t: [! A; r- q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; ^. ?3 s% W9 [" K: z# X
- *0 k- Y7 s- M! D2 B4 P
- * This program is free software; you can redistribute it and/or
6 B6 U5 q+ V6 X% V, L1 l2 U - * modify it under the terms of the GNU General Public License as) Q5 a8 m; V' f4 S* _! s' c" A
- * published by the Free Software Foundation version 2.
6 u9 |$ x/ @* \; Y% a+ \. m - *
" L- c6 I: @) @6 r9 \0 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' \" M- C2 Q, i' b, R* p$ e - * kind, whether express or implied; without even the implied warranty( ^ R4 T* q3 w- U$ R1 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
C$ f# e" {% C# X, k; I) { - * GNU General Public License for more details.
* @0 F: R' d! g# q - */
4 ]3 m6 A- g, {" k& x W
7 a- M/ a, N5 R2 U6 O3 b' e% h& `, }- #include <linux/module.h>. I! v$ p8 q2 M& L1 H8 J; }# U
- #include <linux/init.h>
+ I4 ]4 { |: L5 I5 O9 Y( c% S - #include <linux/errno.h>: n M: T) Z# ^4 |! j1 \
- #include <linux/types.h>
+ j; A' W2 n/ [% D - #include <linux/interrupt.h>
% f7 y2 N# B/ X& I! O# { a - #include <asm/io.h>+ S# u( H+ x. s& m( G7 B
- #include <linux/moduleparam.h>$ G( [! [: o: ]
- #include <linux/sysctl.h>2 Y7 O; c5 h! @3 r+ P
- #include <linux/mm.h>9 b5 l7 n* |* f+ j h, }: s% `3 v
- #include <linux/dma-mapping.h>+ c. F+ I- N' p8 V/ X5 c, k
% F' b' Z. z- }; X7 q$ L- #include <mach/memory.h>0 i' K7 v. j) c* }' {
- #include <mach/hardware.h>; P$ e( j- r: h X, R4 h
- #include <mach/irqs.h>
/ \$ _; d" S& d5 I. J - #include <asm/hardware/edma.h>
" ~ x) b$ C- ?$ p - , ^9 D" {8 A1 r# T; E
- #undef EDMA3_DEBUG* ?3 h, z/ ]' C* S: Z8 P- m V3 t
- /*#define EDMA3_DEBUG*/) F2 m% b% m; s4 C2 {* U" W2 w
9 t7 a( z# ]" r2 H. ~- #ifdef EDMA3_DEBUG
2 x, r1 ^5 t8 |( q3 b4 T; J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! p4 y, ^( o/ n. ~& [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 I5 n9 _( r* t) M! ?+ w3 b' u' X8 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) m3 d0 ]6 w( B4 J8 X. C( P
- #else
7 ?! n: B4 ~ U( D - #define DMA_PRINTK( x... )/ Q0 H. J' i% ^0 g
- #define DMA_FN_IN
2 c6 y9 n0 J% G - #define DMA_FN_OUT* c& y- {+ o, d V) M7 ]
- #endif8 e, k, R# }% E
- W; k/ ~% j9 a! n# {2 r) J3 z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ y$ v) A8 v- [5 C" l
- #define STATIC_SHIFT 3
- @4 L5 G, @4 Q( |8 ] ]/ b - #define TCINTEN_SHIFT 20
: }) y% J0 J0 o( c- _3 v* E! s6 s - #define ITCINTEN_SHIFT 216 D( h1 g( K! N7 o8 D2 j2 m m" Q
- #define TCCHEN_SHIFT 22
9 ^4 m1 [ ~1 r6 w, W5 I o; ?0 @ - #define ITCCHEN_SHIFT 23
. ]1 w0 i9 Q' d5 G( g& `
- r; k- y- |+ u+ U) W4 J- static volatile int irqraised1 = 0;7 B$ g! u2 X. j' G
- static volatile int irqraised2 = 0;& M1 P3 i( q# p) r$ V( p
- 1 E; ~4 h' x6 L+ l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 F( Z7 m" x+ n& ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); w" [, c) ?9 W7 g: v, _# C0 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. X* ~1 N/ Z2 {9 y
- % l! z& g' i1 o' A! Z4 x! H' d3 X
- dma_addr_t dmaphyssrc1 = 0;
' e: u) ^, b3 o - dma_addr_t dmaphyssrc2 = 0;# M2 p ?! r' I$ S) T
- dma_addr_t dmaphysdest1 = 0;$ r' O& m3 D8 j) Q- O
- dma_addr_t dmaphysdest2 = 0;
$ s7 }7 y7 U+ r! w; E2 l - " g. Z* h. m0 g* d3 I3 F- Z, D
- char *dmabufsrc1 = NULL;. T6 m1 P6 `4 b
- char *dmabufsrc2 = NULL;( W( D2 i+ j' O7 C1 {
- char *dmabufdest1 = NULL;
; o7 b- \! L3 Q, u3 N- K - char *dmabufdest2 = NULL;+ t; O" d8 C2 d- f( t
- % H! r3 q t% M6 I' {: I
- static int acnt = 512;
1 G- r# v6 G: M9 O) J( P0 ]' J. O - static int bcnt = 8;
7 E" h7 A" n7 K! R+ n - static int ccnt = 8;- W/ v, i. _, \9 J
- * c# a& |- \: S1 B! B! V2 y
- module_param(acnt, int, S_IRUGO);' u& V0 ^! U- }' i
- module_param(bcnt, int, S_IRUGO);
: Z- j! O. M6 z. R8 z3 M) m - module_param(ccnt, int, S_IRUGO);
复制代码 ! n3 m! w$ J+ z7 |7 C
) O8 W# K! s' E- g8 x& \5 ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" j, C( |0 L3 E# W! g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 r& t; e4 T9 C; V2 f: m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% L% K- N& B+ |- p0 t0 o4 v% O" X% A2 Q) |# U, z$ t5 B
2 I \9 ^/ t0 `0 G
|
|