|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 @ R) [. t# D. m" i, N2 \, H
- [code]EDMA sample test application
, W3 m0 G6 H6 w! S. J* v - /*
2 B: i6 r9 m0 P6 J2 n# A - * edma_test.c# z% P: u' a* \
- *) h1 P/ ?3 M0 K6 n- ^! E# V4 j9 S
- * brief EDMA3 Test Application
2 S2 m+ g0 o% S' |6 Q# Z - *7 b2 Y( \: v1 G. m
- * This file contains EDMA3 Test code.
0 p/ K8 \$ o3 U8 G5 N - *9 m- V* p2 _3 m6 X/ c7 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 J5 ]; [$ Y6 b2 i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ v, r) ?/ C- Z$ `
- * TO CHANGE.
2 l6 c l4 y8 d+ _9 ~ - *2 D0 P# r8 a! S! | k# K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 a& r# r6 \' P$ Q8 q
- *$ P1 y2 B9 V+ F1 }7 ?
- * This program is free software; you can redistribute it and/or' @) D- C( F! U& V) O
- * modify it under the terms of the GNU General Public License as/ N: w% ~ F0 E. l- Q5 Q4 D% D+ d
- * published by the Free Software Foundation version 2.* x) \$ G) R7 t7 P
- *
, j8 @( x' C( C* e- X1 p, w, P& i* O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ n' H- b0 A: c3 D3 F7 S
- * kind, whether express or implied; without even the implied warranty
2 ~1 o8 X6 w/ S0 C G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. ~* z; i+ I2 g- n" y* {
- * GNU General Public License for more details.9 ^$ n; R) V0 \( l
- */0 j7 v, t- j4 ~# }, D) g
% Q! p7 |3 ]# A% E5 I) ~- #include <linux/module.h>1 @; R4 z( H- R3 t
- #include <linux/init.h>- e% {$ a& ~. R. B+ p$ P3 r9 N
- #include <linux/errno.h>
9 t: _4 c. L; | - #include <linux/types.h>
3 M" ~7 H, s6 \: ~ - #include <linux/interrupt.h>9 d8 A1 ]$ h5 q0 n- v- s
- #include <asm/io.h>: ]6 _4 b& r `
- #include <linux/moduleparam.h>* x, k5 l5 q. j" i* v
- #include <linux/sysctl.h>
$ y6 K5 s; E* V0 b5 ^ - #include <linux/mm.h>
1 p0 m5 o" }' j - #include <linux/dma-mapping.h>
8 O5 ? ~" H7 B3 l9 s" u8 j2 e
9 X! q2 z5 U- k. x6 M- #include <mach/memory.h>
! O. k; V" Q* o2 w3 N6 c; A8 E - #include <mach/hardware.h>0 K, L- M; v$ k- E/ S* D, M/ |5 Y: e
- #include <mach/irqs.h>$ B' ~0 o9 ~8 z- B. c
- #include <asm/hardware/edma.h>* A9 y/ i0 |5 G- C% b
7 O9 \# p( e# H, ?/ e- #undef EDMA3_DEBUG
9 C# {' c" ?' ], ~: b: w5 j - /*#define EDMA3_DEBUG*/
( p# A. c/ z3 S
- @; E4 I# M7 H2 e1 Y- #ifdef EDMA3_DEBUG
& O2 r* i6 }0 k6 v4 L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ c0 T' h* C8 r4 Y3 ? W0 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 ?0 q" m( i) Z5 L. {, G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 } { Y6 f& l/ _ - #else
+ j9 [' e& K0 j' [ - #define DMA_PRINTK( x... )- z) K( b2 h& ^/ D
- #define DMA_FN_IN3 A& a9 t' w8 p5 N
- #define DMA_FN_OUT, i$ w9 z1 {3 ~: n% v" {( ~
- #endif+ a! ~7 O' F8 ^* i" E& {8 ?$ O" ^+ V
- ; y4 b7 w& _+ o, l7 b5 A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ O: A; Z3 a& H+ p0 u. V- C - #define STATIC_SHIFT 3
9 F4 Y7 ~ Q- E+ b3 [1 |6 \ - #define TCINTEN_SHIFT 208 _- H: H! o5 w, w0 x8 F0 S+ {
- #define ITCINTEN_SHIFT 216 |: m# v9 e7 D0 g
- #define TCCHEN_SHIFT 22
, M- s$ c2 D- o" @' A - #define ITCCHEN_SHIFT 23
+ d3 b4 S$ k6 n7 H, t - + `( Z' G4 o! p8 i
- static volatile int irqraised1 = 0;: v& r. h9 u3 f: e6 g
- static volatile int irqraised2 = 0;4 C+ G+ K2 ~) L% _
- & \ o9 l* x1 q# D- `) Z2 A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i5 v4 ~, H8 C. ^. k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ]% _2 u- J7 o3 x ^$ {7 M' z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g- c2 \$ x) S" v q5 [
- * L! o; L' ^' X; b' z, t( l
- dma_addr_t dmaphyssrc1 = 0;
/ ^: O; J" V5 G$ n( X7 M - dma_addr_t dmaphyssrc2 = 0;
) ^7 W0 {4 B3 j1 ~( D - dma_addr_t dmaphysdest1 = 0;1 L6 n% T# u1 h) c8 I0 z, Y% [6 h
- dma_addr_t dmaphysdest2 = 0;
! u/ A7 K4 W9 a" n4 |" W! P; l7 t+ y
* F0 Y& |$ s4 _) Y' L+ w- char *dmabufsrc1 = NULL;
7 R" C' V/ J/ g; a - char *dmabufsrc2 = NULL;
; o3 l! T `7 C; `9 U - char *dmabufdest1 = NULL;
% e! H/ H+ f$ G% s5 A8 Y5 `0 U - char *dmabufdest2 = NULL;. D! h9 \# H( @5 c: }, x4 R+ U/ k) F
0 I; N8 u' D1 }) L ?; ^- static int acnt = 512;
# B; P, h3 N, x9 B5 V - static int bcnt = 8;8 [# A: r( ?, R+ A2 J+ b' ~; H( j% `
- static int ccnt = 8;: R: _. Y& d v, T8 Q" g
- V& h; \, r: b1 a) Y5 l- module_param(acnt, int, S_IRUGO);
- m0 A$ n$ l/ E; b8 g, ^ - module_param(bcnt, int, S_IRUGO);5 P) i! {: h7 V+ c1 I# V
- module_param(ccnt, int, S_IRUGO);
复制代码 - {1 L# `; r' \
2 P2 l8 \" W! Z2 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ j" w9 G1 v- Farm-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 v- Z1 e- q2 H* _, _9 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' H8 g C, M1 K
& F* n% \( N' V7 p2 p( t7 R4 A6 E+ ^3 z6 G, C
|
|