|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , y* V- i" v" d8 E9 q2 K: @9 P
- [code]EDMA sample test application( `3 D- d0 I1 l& Y x$ S7 l4 G
- /*
( Y7 g, D0 ^2 E( j - * edma_test.c1 g- a) u! ]# }1 y% j% _7 R6 z
- *
; A1 V: {: Z' L - * brief EDMA3 Test Application
/ h/ B& z1 k, {5 O1 e% w6 Q) k - *
8 v# n3 ~ X% d - * This file contains EDMA3 Test code.
( H$ ?% o8 ]% n, Q - *3 A0 I5 W0 X+ g! E. z/ R! i, G9 |" H9 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( Z9 B& ~: B% g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 L/ P1 f2 ?; ]# u% W - * TO CHANGE.3 @( D" {( Q% b) H' L9 D
- *9 I3 j0 N& d# b+ V' M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 M# F! N- ~: {1 n. x: D - *7 v' o2 p: w1 S: d6 P8 A1 z; ~% q& N
- * This program is free software; you can redistribute it and/or
+ r9 E4 ]9 F7 D4 b% I) Z% D - * modify it under the terms of the GNU General Public License as6 N) \" r# [' r0 I
- * published by the Free Software Foundation version 2.( m% k- O7 q1 X* s( O
- *
& H. P' x$ x* P5 @# x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' } ?3 H1 |+ j4 o2 m6 n/ R - * kind, whether express or implied; without even the implied warranty1 w" p2 [& Y7 n5 m- J5 o, E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 I6 L4 R# Q+ A - * GNU General Public License for more details.9 J# F6 a+ [3 a, D' E; z
- */1 }" [3 C; i3 F( X1 T! Z
- 3 K* b: p+ j+ U2 d
- #include <linux/module.h>
" i1 r" Z0 K; W - #include <linux/init.h>
0 h9 M6 s# p. D' s" y - #include <linux/errno.h>
2 e# k; u3 J- a) R* d - #include <linux/types.h>
- f( ^, Z, x; w' V5 D - #include <linux/interrupt.h>
/ m. k1 ~% H- Q - #include <asm/io.h>
' X5 J0 f6 [8 w3 ?9 R9 f - #include <linux/moduleparam.h>
5 b1 z4 F% U7 @# Z2 Z8 ^0 M! x; ` - #include <linux/sysctl.h>4 e7 `: m# m# A2 J# o
- #include <linux/mm.h>
+ ~6 p6 g# P& y L8 q( g; k - #include <linux/dma-mapping.h>
* X7 s8 n3 \1 z% m Y3 J: B) b
7 u( t$ O! `3 ]; T0 K" B: f o- #include <mach/memory.h>
: K2 G" Y. K/ w8 V& n - #include <mach/hardware.h>4 T, h- O, e5 l; m% s$ h/ l
- #include <mach/irqs.h>* }) M( t Z" R. p7 H _
- #include <asm/hardware/edma.h>
" _& ]0 v0 `7 B$ Q - 3 Q. f0 O h% u9 x1 L. S& l. p! _
- #undef EDMA3_DEBUG
3 G3 b6 n" e$ Q# _ Z: p" C1 p - /*#define EDMA3_DEBUG*/- D3 f4 y+ Z' j. Q5 Z
! r9 _: w( v$ `- #ifdef EDMA3_DEBUG
, N# p8 Y! H# ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ I* ~9 ?) n/ D0 ]( B% A1 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 {8 ]$ W+ m2 ~* s" d* b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) X' q+ b) n/ O5 }% `! @
- #else8 ~6 v3 y8 j& {4 R: H+ E
- #define DMA_PRINTK( x... )
3 S) d. Y) K0 B - #define DMA_FN_IN
2 z% l6 Z% x; @5 _( n - #define DMA_FN_OUT: z8 e6 I" R/ }' L$ Z% x* M
- #endif/ `1 J' q, l+ c& i& G5 y3 q- y
( q$ m7 O: H- U; Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ [7 y: A# o, H& @
- #define STATIC_SHIFT 3" K( S) U# U( x: \1 B k: H. y
- #define TCINTEN_SHIFT 200 l, \9 B' M% T
- #define ITCINTEN_SHIFT 215 W* ?! n6 r# _0 i& p0 b1 g- @
- #define TCCHEN_SHIFT 220 p6 E3 N* q# c2 O) `; R
- #define ITCCHEN_SHIFT 23
& y/ f/ q& O. C, V8 K5 S# G% i - ( `9 I& C6 k1 _3 b+ R4 A2 ^
- static volatile int irqraised1 = 0;; x4 s; X+ \. P% f7 R
- static volatile int irqraised2 = 0;1 V1 N0 v6 ~8 y+ @
4 Z A4 n7 F C6 t7 B# [+ B1 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Y8 y# U- f1 X) U0 Q- O; k. e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 D' R- M( F- U* |) d! c: a! C ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 u" J+ M9 w# t) x+ s5 n+ R - 5 c+ L# o2 i( @! O0 s
- dma_addr_t dmaphyssrc1 = 0;
( r9 a5 Z0 d& [( H2 \ - dma_addr_t dmaphyssrc2 = 0;
4 w# I/ H4 T' v8 S: H - dma_addr_t dmaphysdest1 = 0;
7 b* t( y: q7 \$ M( `6 o - dma_addr_t dmaphysdest2 = 0;
" l. S" ` `* q, `0 l
3 J' y5 T( Z7 V; l+ x; r2 R% }- char *dmabufsrc1 = NULL;
+ X7 \5 C; l: I! ^' s C - char *dmabufsrc2 = NULL;
w& Q$ v5 \3 D$ l8 m: U+ z - char *dmabufdest1 = NULL;
- V% T' N1 \ u - char *dmabufdest2 = NULL;1 i: C8 i! n+ J6 w3 p; z, {3 H
7 d V: m# V0 ~7 T- W- static int acnt = 512;# K1 ^# n8 ^: B$ v
- static int bcnt = 8;0 y5 d+ g R$ ~* F) E
- static int ccnt = 8;
! \" n) N" O5 P% F2 w9 [( q; ^ - 7 Z7 T9 @) U( h4 \
- module_param(acnt, int, S_IRUGO);
3 |8 q2 O& V6 D7 S, k! R% H4 f; `& z - module_param(bcnt, int, S_IRUGO);; e" {2 d& q, w/ r; I
- module_param(ccnt, int, S_IRUGO);
复制代码 $ x: L3 Q, N |0 L$ G8 `
! A# G) O4 r8 W- \# y/ G, b/ X2 U& i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% O: `4 M( B7 C' u# r# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# z: v0 R o2 N* a4 l g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 D. h2 x) C& T% M' k
( _2 b) G2 W! S) d9 d- _7 \7 K3 z3 T8 g6 P9 p4 q
|
|