|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 N" `% M( I7 R+ E8 e; S
- [code]EDMA sample test application
3 K9 b$ c# }" y2 C6 X: n - /*) e8 M1 @" e6 A+ L% s) [
- * edma_test.c
& i9 T5 I; {8 t5 Q1 H4 O; a - *
7 e) k9 X9 U% s* h - * brief EDMA3 Test Application$ {3 K1 m! ~7 K- { I
- *0 [, B3 r# Z$ s! h' I9 _3 K
- * This file contains EDMA3 Test code.; c+ K* l4 h2 u/ G
- *
& S6 w, l0 L+ l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 k+ u* Y8 l1 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! r( G) H) ]) M! C" o
- * TO CHANGE.7 w3 [4 _0 {6 V e+ `
- *
7 \. A6 g# S/ B. H3 ^) H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' C6 H2 A) A- n& v
- *
$ P* X& L s' J. y - * This program is free software; you can redistribute it and/or
: k0 j" V: c+ l% a" w* r4 H - * modify it under the terms of the GNU General Public License as* ^$ S8 [5 M; {7 G5 ~) p6 v( x" z
- * published by the Free Software Foundation version 2.
7 v1 T! Q Y5 o! h - *. N8 V& ?, n( U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) g W' }+ C; f$ G4 K. Y
- * kind, whether express or implied; without even the implied warranty1 y3 M( d1 B: A; w H, x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ s8 {( O5 ]( a+ C: f1 s* ?
- * GNU General Public License for more details.
' W0 e& w) M9 Q - */
& M+ {+ x8 b& h' r1 G
6 F8 ^# t& i, G0 i- A6 B- #include <linux/module.h>
2 q" ^1 M) Q" A; Q - #include <linux/init.h>
( \8 u" R& P/ R L8 z- o5 ~$ e4 E - #include <linux/errno.h>) c+ [4 S& L- m+ q# `
- #include <linux/types.h>
2 ]0 v% q6 s; A, \0 F6 l - #include <linux/interrupt.h>
2 w" r7 q$ s- |8 G" j7 q$ u - #include <asm/io.h>
' R1 N# d ^0 e& o - #include <linux/moduleparam.h>% k3 q" y# R: T3 r! _, N" _
- #include <linux/sysctl.h># ?' ^3 L! Y. N3 H) N6 O9 k
- #include <linux/mm.h>
0 ^$ ~9 K1 A3 M6 ?6 y, \ - #include <linux/dma-mapping.h>
! J2 y- U$ M% O8 S7 L - ! D( H2 _6 P2 \- w# c: G4 ~
- #include <mach/memory.h>' j0 O4 z1 a+ r/ k- k! O
- #include <mach/hardware.h>
3 n* M) ^. [3 M# ]% P# L, x - #include <mach/irqs.h>
9 C$ ~8 \8 X5 l - #include <asm/hardware/edma.h>. s; S, q) H$ ~! H: X
- / |7 v( I; j4 a0 Z* z; `$ [
- #undef EDMA3_DEBUG" t4 I4 x, r; E
- /*#define EDMA3_DEBUG*/
, Y& q: |! t& X3 R: R5 K* a - 9 E. j( R. P2 A. R" H. r. y" g
- #ifdef EDMA3_DEBUG
9 l8 P8 r- W# [& }9 p/ C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), f' }2 }8 j# U' I' a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# n( a H4 Y! w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
b" W4 c H" }- n0 ^4 w# | - #else" g I1 I2 H/ |, g
- #define DMA_PRINTK( x... )$ a. |/ @( x) [5 N! }6 G- x
- #define DMA_FN_IN) l K% G* Z2 u ^8 O3 l' w- _/ w5 A
- #define DMA_FN_OUT; k; ]" v9 {' U* Q) X$ y
- #endif
1 A6 ^' z6 Y2 g" p# Q - * K9 V& K( J8 j1 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 a5 K0 O. g0 L. u. w! q" D - #define STATIC_SHIFT 3& S/ y) A) ^, f, K( V8 [9 C
- #define TCINTEN_SHIFT 202 z. v; Z" t9 {5 Z
- #define ITCINTEN_SHIFT 21
; @$ g3 }) D# P/ @* E) m0 N - #define TCCHEN_SHIFT 22
, F, \. R2 z- Y( q) X5 i - #define ITCCHEN_SHIFT 23& U4 W& @: a! W8 i' \/ ~
7 @6 t8 w3 G8 K; d/ q! ~" n3 E- static volatile int irqraised1 = 0;* P" ?: _4 u/ m+ V; _5 D5 z L+ P- e
- static volatile int irqraised2 = 0;
8 c: _6 h8 ]3 l8 r. L - * U& O9 i& q( w+ |( c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 {( _, z% h. E r' q; t) D# \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( F+ X' S0 @# \1 [0 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: S8 n- F c& j* q+ k ]
- : X( t) ]3 Q' s- w+ C7 T
- dma_addr_t dmaphyssrc1 = 0;
1 \+ C2 x# B: a - dma_addr_t dmaphyssrc2 = 0;# h7 S. _+ q v+ n2 J5 `) N
- dma_addr_t dmaphysdest1 = 0;& F# l0 H+ P1 C; Z( e
- dma_addr_t dmaphysdest2 = 0;
Z; `& ], O- o9 m
* _8 F% q0 x2 m0 E' L8 n3 D- char *dmabufsrc1 = NULL;6 j) s$ f c8 m& z7 r
- char *dmabufsrc2 = NULL;
( y/ H; J; X; |9 q6 ]! C/ o - char *dmabufdest1 = NULL;+ {5 _$ {% X5 Q3 H, N4 ?' Z' P
- char *dmabufdest2 = NULL;
) c+ p Q8 \! F - n5 h' w' R+ Z3 w
- static int acnt = 512;5 |+ \5 f2 u+ f& _4 c6 }
- static int bcnt = 8;
! L8 k. R/ `$ \% ^ - static int ccnt = 8;
5 J* L4 z1 t7 U! m - % `( L0 X( |5 t; [" j; u- O/ H
- module_param(acnt, int, S_IRUGO);, W! C$ u$ ~( I8 v7 k2 m" K
- module_param(bcnt, int, S_IRUGO);. X3 l1 p9 K* C0 N9 m) N/ H
- module_param(ccnt, int, S_IRUGO);
复制代码
: c N% [, M- E& P5 n1 `1 t: D1 H+ T7 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 w+ l5 d1 F$ d! J$ G8 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 K8 k8 G# Q4 s$ {* g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- k7 M; H8 N2 Q+ k
. p" k; {% X: g+ v# w% N ~" d0 q8 q' \1 f
|
|