|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - x$ P' M U3 b- S
- [code]EDMA sample test application
6 \) I" W t. B6 M- c. l - /*
, `! L" q# B+ M; A - * edma_test.c( E/ r, { S8 E
- *
6 w6 ?, n# F& P, K) y" M - * brief EDMA3 Test Application
; X& g! c& J6 n( Q5 J/ w& R - *7 d& q4 e% ~6 h9 e1 I' E% E
- * This file contains EDMA3 Test code.
9 u5 `8 T" d* u6 J - *
- _3 h) p2 E2 e R' @ ?; ]5 y- A' E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( G. A3 c# Y4 |: z$ Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ k* _( o9 H* c' d$ Q - * TO CHANGE.
/ Y) x/ o" x# h0 }; ]4 i. j - *
" n% v+ J7 p: t, H2 H/ I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 Z# T0 R) e7 p4 Z - *8 s( l, W" v; n) c" g
- * This program is free software; you can redistribute it and/or
# q8 c, u. G. ^" F/ m S - * modify it under the terms of the GNU General Public License as
8 A: x# l" D, N$ [; } - * published by the Free Software Foundation version 2.2 O7 q4 k# \: |3 h0 b. f
- *6 w/ |5 I+ s2 z. l, c: @7 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ z9 j9 y3 C0 z3 F4 H: Q5 M2 t& O# f- r
- * kind, whether express or implied; without even the implied warranty# [6 R! v$ g6 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 f. B9 b8 o. y a* B T - * GNU General Public License for more details.
* Y0 b" D9 U: q K - */
4 \) G- ?7 g, ^1 i# d
& S2 O: q( {. u; f0 u( s5 e) S- #include <linux/module.h>
' E3 T4 @9 y" k$ L9 Z. F - #include <linux/init.h>
: O8 I m$ v/ [ - #include <linux/errno.h>8 _9 Z# U) U+ ^& ?; [. z
- #include <linux/types.h>$ @5 M. s* s5 k8 f
- #include <linux/interrupt.h>
5 x2 B! O. g1 {; q Z - #include <asm/io.h>% n9 c3 Q7 @/ s% A" [8 ?
- #include <linux/moduleparam.h>3 R. b$ C9 O' a9 g. G, O
- #include <linux/sysctl.h>5 W9 d/ Y2 Q, H" j4 Q" a
- #include <linux/mm.h>0 X8 l2 t* t" Z: R Y z
- #include <linux/dma-mapping.h>7 I3 Y8 j! A( I' e- u
- & x# X f S& F" s% N
- #include <mach/memory.h>9 h& n1 z7 `) h1 U- J' K* y6 G
- #include <mach/hardware.h> m4 Y: V! B& |7 }, S: b. q
- #include <mach/irqs.h>$ x8 C5 K) W9 [( r7 |3 j
- #include <asm/hardware/edma.h>- `. B& f. l/ U" z: O" p$ h
# i- T$ j: t9 J3 p0 t! V9 w5 ~+ T5 o, H- #undef EDMA3_DEBUG
: O$ ]# m3 G7 J3 ?5 r' Q - /*#define EDMA3_DEBUG*/
' B4 k2 Z& v: n5 Q - 9 H# A& h1 W1 g# h1 f6 y
- #ifdef EDMA3_DEBUG( y {2 o8 b' D- a$ y2 t8 o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- M8 n P; l' e+ g: r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, `( C; G2 L. M/ j9 x% B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" ?4 K Q. ]* S# U0 a9 }0 J
- #else
2 F: |2 e6 `+ v7 W- V - #define DMA_PRINTK( x... )$ z, y9 c8 L5 g% f ~- L( E; U
- #define DMA_FN_IN, ]- h- D; _7 h" g* Y$ x* i% Z
- #define DMA_FN_OUT1 R0 R. h( j% n% ]
- #endif
, I% D' U5 {8 u4 ~7 m
1 L' ^: @: s( g- #define MAX_DMA_TRANSFER_IN_BYTES (32768), F% d: j3 S; M7 D y M
- #define STATIC_SHIFT 3
, M/ C1 ?2 z3 o$ ]$ m - #define TCINTEN_SHIFT 20
5 p4 D" B5 B% I" d+ P" W H4 z - #define ITCINTEN_SHIFT 210 _! T' ], U3 U2 W$ Z
- #define TCCHEN_SHIFT 22
) N: S7 q7 E. X2 N! ^/ a' [ - #define ITCCHEN_SHIFT 23
- F Q/ h: i! R1 p& U- R- ] - 0 m1 Y! J( Z _
- static volatile int irqraised1 = 0;+ k* I4 M4 Z- v7 X2 e
- static volatile int irqraised2 = 0;: N4 O, _/ `# N1 [
3 X3 Y4 H& q: Z" ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 L5 N4 v. F9 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ?4 ]5 @. o% {" b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, n& V ]) z4 d# [5 A2 S
) n" z* Y' X8 ^8 I8 X2 e8 ]- dma_addr_t dmaphyssrc1 = 0;
! ?4 O; k9 U6 n! t( Q1 `! k - dma_addr_t dmaphyssrc2 = 0;' y4 m& O9 y' P' O
- dma_addr_t dmaphysdest1 = 0;+ t$ }0 m$ v" u8 q! y: Z3 }* q
- dma_addr_t dmaphysdest2 = 0;. @3 j/ |) W4 s, C- l2 Y
! q* [. w8 P0 m5 J8 v, R3 p- char *dmabufsrc1 = NULL;
2 S& b% P- n8 _% R- E - char *dmabufsrc2 = NULL;/ x0 ~6 ~" c( h- e) `0 L+ y6 o0 m
- char *dmabufdest1 = NULL;
% b' O. [: i; N7 j- i' X. O ]& S - char *dmabufdest2 = NULL;
' |3 [% s6 v! x* e( S `' S - ' C7 ^3 J5 A2 j! J" o0 m% G& {% y
- static int acnt = 512;/ G4 V5 N5 O; ~( o1 \: D
- static int bcnt = 8;0 }* j# f2 e2 H d9 c) z
- static int ccnt = 8;
0 |& j, p, d! E5 `. ~3 s9 n - ( {0 h( q5 N* p* f/ X) L% O% g( e% k
- module_param(acnt, int, S_IRUGO);
- v# V ?7 r9 N/ j8 E% @% n - module_param(bcnt, int, S_IRUGO);
5 i- V. S, ?$ c2 I1 X' w/ P - module_param(ccnt, int, S_IRUGO);
复制代码
/ F% L% O! \0 }4 y) B
& Q6 Y o- ?' O1 w, d4 H& v5 p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) T3 l+ {4 l& d$ B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% L7 Y# u; b1 {- E" W4 W. Q: ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) b/ w3 p [+ P2 r; h, O. L* n# ~3 _
$ Q7 f" E+ q- M: x9 K. O- x0 b( n ]1 ^. e
|
|