|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 I+ P5 J) v! m, h1 @- [code]EDMA sample test application4 a2 ]! P8 v/ k9 G2 y
- /*
1 f% h# q0 l7 r! j2 r" p - * edma_test.c
- I* F& p! z8 X - *3 M) A$ y& M% G8 f; r, h
- * brief EDMA3 Test Application
) L) a, a- |& r2 G0 J( P - *- h2 o' F4 f1 s H+ C& `* N1 k: P
- * This file contains EDMA3 Test code.
7 l( H5 ~7 b6 v9 z - *
* m$ B" |: I. o6 C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 r" d+ h( j C% g' ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' @, s+ ]1 _6 y$ a T) ~& s2 ~* ]/ c3 m
- * TO CHANGE.
G' M% { |8 G, r: k. l" Z! c - *" S# l6 h$ ~" l0 u2 z3 m0 ^, j; g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 ^4 _. {4 r" L
- *
- b" ~ x& r# ~ O1 P t - * This program is free software; you can redistribute it and/or; Y- \5 R! p" l0 s+ M9 j8 p
- * modify it under the terms of the GNU General Public License as! R; O& C5 ^$ \. O9 ~
- * published by the Free Software Foundation version 2.
4 [. s4 r( }( e$ g1 a - *3 h+ w8 h X3 |; q, X% ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* k& j! |$ `1 {2 C' C& p
- * kind, whether express or implied; without even the implied warranty
; E: v9 I. ?: L* i) ?' [0 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) A& J: N) E+ n6 ~4 s x
- * GNU General Public License for more details.
* T/ k9 i# B$ ~( u/ N j& S3 Y - */
$ w5 m* G* h* G N
* i* _2 K6 m. a$ R+ S- J1 ^4 b- z" e- #include <linux/module.h>
; i" {1 K' ?, a4 D& ~ C - #include <linux/init.h>
* K h. ~( Q- N8 Q- D0 Q9 s% y - #include <linux/errno.h>. u, x' ^: w. |
- #include <linux/types.h># g- H1 Y% }3 }6 R
- #include <linux/interrupt.h>
- ^2 `* O. N, M5 y! A+ } - #include <asm/io.h>2 f; F2 ]& R* f" K
- #include <linux/moduleparam.h>0 z; e" e/ e8 X4 x6 z
- #include <linux/sysctl.h>7 d% m! V. _+ a7 f
- #include <linux/mm.h>
2 h! r( [( K! N9 } - #include <linux/dma-mapping.h>
3 J5 X5 d; E4 h
8 |3 ^% O/ y; s; ]3 w! e v- #include <mach/memory.h>0 }; ~4 ~$ Q* q
- #include <mach/hardware.h>
. S% n$ V& J0 L8 t+ q2 b" i - #include <mach/irqs.h>4 r; |' y' t& m, U( D
- #include <asm/hardware/edma.h>; _- I& Z) Y, `! T: O; x) g
- * e/ ^4 E3 L' E$ U
- #undef EDMA3_DEBUG
; U* k: @2 x. C; x: _ - /*#define EDMA3_DEBUG*/
( _+ M# a* r7 ~( \+ e' l - 0 i b. }! P, [" @% z& Z
- #ifdef EDMA3_DEBUG
, V* C1 @* _2 z+ t5 J7 |2 l0 D9 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: [; t* i5 i; M4 @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) s# t# o: Q+ `" z- t8 @# h6 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 F. h* R1 j% C' [" C - #else0 B, p8 U5 u1 m! D7 K8 p& @) _' k. J
- #define DMA_PRINTK( x... )# H( y4 j" y/ P
- #define DMA_FN_IN1 d# Q0 V- V: O& t& I. D" h0 D
- #define DMA_FN_OUT
4 r- {. K: c/ W# B/ Z. W6 U/ b - #endif
$ r1 g9 [( i8 ]& Y; h - ! I3 Y9 S+ Z& L' @7 d! P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 S6 V8 i7 `! r, ~, j* H# S - #define STATIC_SHIFT 34 H- m% G# m# v* S0 f
- #define TCINTEN_SHIFT 206 r5 f- f5 @: q
- #define ITCINTEN_SHIFT 21- }: ]! P( I4 l' G
- #define TCCHEN_SHIFT 225 y. t% J) J* F8 G
- #define ITCCHEN_SHIFT 23
' X, K) c& q/ m" x9 {9 C6 J4 K+ p7 Y
9 R, `/ k8 t4 q* F0 c- static volatile int irqraised1 = 0;
8 d* |; B' K! x; L% f - static volatile int irqraised2 = 0; X2 @" R9 A3 n `- o
! q" k. w9 _2 D1 ]9 K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 F% ]0 N; Q' E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 f+ S: Q0 p; O( v0 { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ^) C4 u% `4 `+ B& P: f
- 9 \' }2 N" w. r& [9 Z
- dma_addr_t dmaphyssrc1 = 0;. |7 J# ~8 z' I/ u" I% @
- dma_addr_t dmaphyssrc2 = 0;
) F! ^/ z' I8 A - dma_addr_t dmaphysdest1 = 0;
6 {. H+ v& q( {' n2 m# O - dma_addr_t dmaphysdest2 = 0;
2 R7 ?- Q7 {8 W6 n- G% q
2 c4 X2 q6 [- `- char *dmabufsrc1 = NULL;
, g& s# t# r, a# [$ m - char *dmabufsrc2 = NULL;0 _0 s+ r# @$ K
- char *dmabufdest1 = NULL;
. ? |7 K& i1 A3 }# t - char *dmabufdest2 = NULL;( }* ~+ ]) s s9 M, i1 H
]8 o3 A+ e; j5 Z5 x7 n- static int acnt = 512;
! C. p& q$ r0 S* R0 U5 a - static int bcnt = 8;
' r l& q# x6 S+ p! s- P8 L6 w2 s - static int ccnt = 8;
: @$ j) ?6 [# I: N0 N2 D
8 X7 A0 x/ O2 P- T% ]# F6 y* i- module_param(acnt, int, S_IRUGO);
6 Z: ?) Z) T) v- [4 i1 e* @' _9 o - module_param(bcnt, int, S_IRUGO);
$ {/ q8 s: H) U: X' o3 w - module_param(ccnt, int, S_IRUGO);
复制代码 L" J* a# z! I4 ]% D
# Z* ~6 Y* G$ F @" j, f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. Q1 T" Y1 o0 n# G* ~6 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 R: }( i; v |# v' W# L `* b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 z- w2 Y% q+ @2 v0 a: K2 z) E+ K0 w0 e2 I2 ~# l
% u8 L7 a$ D; @9 v h
|
|