|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 N8 T6 w0 k3 h8 y
- [code]EDMA sample test application9 w7 `1 P0 H8 F$ q
- /*
) F W; A. J9 ^ - * edma_test.c
6 w6 A) l! T0 n; y - *5 O/ l; y5 v: v @
- * brief EDMA3 Test Application
. [ ~# z( j" I) t* P8 f - *6 u& a9 M# z% @2 F7 y! e" }* l
- * This file contains EDMA3 Test code.
- d( i1 m3 v; J/ E0 Q9 g! f) n' Y - *7 O1 U/ N( s4 c) v$ K; q' u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& X$ P. D: W/ [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, {. N3 v+ l0 ^ - * TO CHANGE.: m% g2 t. x/ Y) o3 G: f; V
- *: t2 P" ?/ k8 Y0 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 S* p ?& D' z4 F& B& B - *
$ X) U& q U9 q - * This program is free software; you can redistribute it and/or" W; H$ N( q9 \
- * modify it under the terms of the GNU General Public License as/ ~$ B! |' K. N0 ~% f) F4 d
- * published by the Free Software Foundation version 2./ j% n. m4 Q/ k1 a3 h6 {# S
- *# _0 B- D/ @$ _! Y- i& T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! u$ [, J7 i9 s( m2 d7 J3 H - * kind, whether express or implied; without even the implied warranty
, j, h& W' A5 @! i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 i2 }+ ]2 x) h+ G; D - * GNU General Public License for more details.6 ~( N( J7 L" r
- */$ L8 R3 L8 J( `
: Z% B2 Z; ~# E8 y0 i- #include <linux/module.h>/ Y7 P, ]3 h6 T @& {6 @
- #include <linux/init.h>
3 r( s# D1 N. `8 O+ L" Z! v - #include <linux/errno.h>" \4 U! l2 g J6 y8 }
- #include <linux/types.h>" O' W9 u; m. B d0 }0 ]
- #include <linux/interrupt.h>+ D: e2 Q. K$ c9 g
- #include <asm/io.h>7 O. J" t* [4 \
- #include <linux/moduleparam.h>
! L; Q' I; b# `, T# @; S - #include <linux/sysctl.h>- m6 L2 n$ s/ l) H% ~/ u7 c& x
- #include <linux/mm.h>/ l( l/ w0 X* a9 ~3 j) F8 w8 ^; e
- #include <linux/dma-mapping.h>
' ?3 o3 K* Q2 S# D6 H - $ L8 } F' c- _9 E: V7 p8 G
- #include <mach/memory.h>
/ m( P6 C& e: L$ q8 R6 \9 u - #include <mach/hardware.h>
1 Y, G; I4 j1 j- T5 q - #include <mach/irqs.h>
! Z3 Q7 a& G |- }5 U4 Z - #include <asm/hardware/edma.h>$ i1 _7 A: x. T9 [; l3 s* r3 p
5 X) u) b% n6 u0 ^4 `$ r& [- #undef EDMA3_DEBUG* [. A7 _0 G- `- O+ I$ J- j
- /*#define EDMA3_DEBUG*/2 X6 l4 v, _. ]4 i6 Y
; n i+ E- [' X. R+ K- #ifdef EDMA3_DEBUG
) ^2 m% F4 {# y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). @1 N7 q# L' k5 J) N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 o% ^ H- U, Z. t) I- H: h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 c+ T& F+ ^& J - #else } Q; P1 \/ X; H+ p
- #define DMA_PRINTK( x... )9 v: S' Y4 a( R
- #define DMA_FN_IN
9 _+ z# t# l) {# m - #define DMA_FN_OUT
1 v+ U! }8 O0 Y' ^ - #endif, g: J7 S4 b* p+ i. \
- 7 `) u/ j g" t* y" Y( a4 z) I% L6 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" n [ N5 i- P6 I
- #define STATIC_SHIFT 3
, f- x, u$ F3 X @; Y/ ?$ R - #define TCINTEN_SHIFT 209 X; n" T8 `9 E P! Z4 m
- #define ITCINTEN_SHIFT 218 d1 D+ q. A. i, E a
- #define TCCHEN_SHIFT 22- A2 e! x+ r/ `6 t# S
- #define ITCCHEN_SHIFT 230 u: L5 @4 H; |0 B$ F( s
D x$ G' Z0 V% |- static volatile int irqraised1 = 0;
- u$ t z# A2 W2 D - static volatile int irqraised2 = 0;
) t5 q7 k7 {1 x; y8 H0 Z1 E - G+ x. o( Q" e% y8 a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ D1 b+ [( w. v, [; _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; i7 y7 w- I3 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( F/ B0 O4 U( x. W, R
- ; m5 Z1 f% P5 K$ C @$ S5 o8 z4 H
- dma_addr_t dmaphyssrc1 = 0;
5 D9 X0 L6 r: R+ j( t - dma_addr_t dmaphyssrc2 = 0;
7 _6 M( V/ E4 v - dma_addr_t dmaphysdest1 = 0;
0 K& g6 w7 o. Q9 n, @ - dma_addr_t dmaphysdest2 = 0;
" q* p! T @' A
. R: b3 q$ f0 \% v( U6 P- char *dmabufsrc1 = NULL;7 n0 l& f/ [3 Y5 g: q" J. S+ K! |
- char *dmabufsrc2 = NULL;1 ]( S& m. v& [6 ]
- char *dmabufdest1 = NULL;
, J% M6 ^9 [! T% ` - char *dmabufdest2 = NULL;
! o' r1 y: v N) L: j
( ?4 `7 f9 c( N2 g1 G+ u- static int acnt = 512;# e: X6 N) |; E
- static int bcnt = 8;/ ?+ ~: r3 r' y7 R+ [
- static int ccnt = 8;- N# S6 |# p {! Y) v; R
- 3 M( A% W" g- D& g
- module_param(acnt, int, S_IRUGO);
+ x X' N4 G7 K+ |' z& p9 A - module_param(bcnt, int, S_IRUGO);; Q# R4 U4 b4 T$ N0 v
- module_param(ccnt, int, S_IRUGO);
复制代码 4 V I7 p9 Q/ [4 J% t
9 \* E) g& l5 t0 r+ d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# R2 B7 J5 Z8 d1 F9 w* x( `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) x7 ], W4 ]+ k2 b a+ f! ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 x5 p0 h3 }- f6 b/ |; w1 a
& Z' b7 I: o8 U$ Q2 \6 Z D( @6 I6 v3 p) N+ W0 [) e
|
|