|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" q( ~. ]$ |! O5 `- [code]EDMA sample test application
5 o5 \ w" c% s1 U - /*
+ n* A4 ]! a/ _( ]+ f - * edma_test.c5 Y5 r! @/ ?) p( H- i& B
- ** s& J; I8 _( G2 h1 Z5 R: q
- * brief EDMA3 Test Application
, ^- e# M) T* B3 h. [ - *
% o% t% `( Y( W3 C# }7 F - * This file contains EDMA3 Test code.; M! A7 f, F* C! @" }: X
- *+ l" J3 O' f8 k5 D, P) z4 e9 f. _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 h( ^; F S( x8 n. D4 v# m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 g" q, Y% m1 d! z2 f
- * TO CHANGE.
: `7 t) h, L7 [* F+ Z% W - *6 I f, Z& E: n) g& x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! r. u6 S' X' r# r9 ^# c - *
: Q+ U) y: s3 E. S" L - * This program is free software; you can redistribute it and/or
1 ^! e+ L6 {$ { - * modify it under the terms of the GNU General Public License as# X, M5 i0 ^6 v# J" B
- * published by the Free Software Foundation version 2.9 ~ `# L: \2 b
- *
- `' j# l8 a. E5 }- `8 z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. f$ j/ N5 M0 O4 |$ C4 C
- * kind, whether express or implied; without even the implied warranty% G7 C! s) i" ?8 D5 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# H7 t1 V1 N0 g: ^7 ~! U3 l
- * GNU General Public License for more details.
$ B' { S0 p) C. G - */
0 D1 N' }& y' D L3 l2 ` - " A# ~" J; u2 J) w3 h% a6 o
- #include <linux/module.h>
/ q ^; s% M( ]7 r- F3 i - #include <linux/init.h>. G' U6 [+ C* m. n+ X4 h1 u- {, Q: H' U
- #include <linux/errno.h>
! v% g2 ^% H1 Q% r1 g - #include <linux/types.h>( ` Q* k+ g# G8 {2 b* p! }- H. S
- #include <linux/interrupt.h>" M# G8 d. u# K; i
- #include <asm/io.h>) T8 Z- y) d$ |8 }# \3 V
- #include <linux/moduleparam.h>8 K2 H4 q' ]3 J* S% o- r3 J( O
- #include <linux/sysctl.h>( D* ~6 A4 R N5 X4 m
- #include <linux/mm.h>
8 a. P+ G/ G! h! s - #include <linux/dma-mapping.h>0 _9 D1 a6 Z2 E4 W
) b5 @2 Y+ \7 \# \& G- _3 j- ^- #include <mach/memory.h>
$ }& U, L) T9 {. Z - #include <mach/hardware.h>1 X; n1 J2 I+ w6 j
- #include <mach/irqs.h>1 j# g/ K$ L1 X
- #include <asm/hardware/edma.h>
( l% P, \5 E2 J. ?" ]" O( A$ @" L$ Q
4 W) v5 K9 N; H5 i' R- #undef EDMA3_DEBUG7 }- Q! X2 }' G$ b( X
- /*#define EDMA3_DEBUG*/
3 I. n6 Q$ b/ P& v( I P5 D - 8 N* j2 H4 a; ?5 V/ j( e
- #ifdef EDMA3_DEBUG
" {' {+ J; M" @9 M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 Z/ g5 l* V0 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% [6 v* M0 I0 r; M( S0 f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 I* I5 I/ q. \/ X# ]2 z _ - #else8 v2 q r5 A& ]; b) z+ z
- #define DMA_PRINTK( x... )
6 C5 U: e$ a9 v% v; ]) ` - #define DMA_FN_IN
3 k4 J' v( a% j) \$ Q W - #define DMA_FN_OUT8 I* F' o4 n, Y) c& n( o6 O: d7 d$ E, k
- #endif5 N9 k3 P9 G" P! O
- 2 O3 p1 G5 f1 c$ `! M/ W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! p2 d- P; U+ {' a, ?
- #define STATIC_SHIFT 3. q: J4 i& _9 G
- #define TCINTEN_SHIFT 20# \8 f& J% C4 r6 O0 v" s2 s
- #define ITCINTEN_SHIFT 21 k3 u4 \( t9 P3 {) n
- #define TCCHEN_SHIFT 22
. u( U* B: |# p2 n0 Q6 E - #define ITCCHEN_SHIFT 23
, ]8 M6 d* T3 u$ q' F% S - - ]& b# N* N/ |8 ?& |6 z) w' |3 X
- static volatile int irqraised1 = 0;
; k; Z. _) i5 P% i s2 w( g - static volatile int irqraised2 = 0;+ L$ l6 u, n$ t1 F/ V$ q
; B4 ^$ s) A, I' V) w. X, f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& E5 H+ S9 F U% M) x- Z( O& M8 p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Y' v, n) f' X+ _+ H. C4 j2 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( p' j- C# U8 ~& \. N, p5 P6 q
- % u4 Z8 F7 b8 U6 \
- dma_addr_t dmaphyssrc1 = 0;% i! p u; w1 y$ n# L
- dma_addr_t dmaphyssrc2 = 0;5 J/ T3 I2 n' |2 a0 [1 S! J! ]
- dma_addr_t dmaphysdest1 = 0;
6 ?3 W* s) d) n5 i1 m# Y* } - dma_addr_t dmaphysdest2 = 0;# Y2 m4 d1 i6 K7 K8 h/ {& [
b$ d1 [- e/ D0 i( E0 t- char *dmabufsrc1 = NULL;/ e; @+ y- K$ A0 c0 X8 e
- char *dmabufsrc2 = NULL; x5 w9 `3 Y9 n- ^( \# Y
- char *dmabufdest1 = NULL;
1 z: t7 d1 c3 a) U2 ?+ S - char *dmabufdest2 = NULL;
$ N# k3 F Y' U) K! T - 6 x, y+ ]4 f2 r* e' f7 t8 {- ]
- static int acnt = 512;
# A0 x, s( U! r: B- E - static int bcnt = 8;; }9 T/ [5 i! a, [' x+ o
- static int ccnt = 8;
) R2 l, C9 p# u2 [) A
, \. m# _! R1 C' z$ ~9 l, r4 s# U0 i- module_param(acnt, int, S_IRUGO);+ @" [# G! A# V8 x
- module_param(bcnt, int, S_IRUGO);) A2 C" m/ x% d7 ~
- module_param(ccnt, int, S_IRUGO);
复制代码
; o/ N3 A3 d# G4 G& C- t9 Q4 l9 _; C! R- X0 y6 [: M" ~6 b3 W, s4 A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- M0 j( y6 B" H4 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 F$ d- R4 Y3 u% D+ L* b, P# O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 K: \0 j, J& [" y9 x( u3 C+ C: Q9 a0 q0 g! Y8 M: `. |
4 }* u7 Z. }: C& T1 T
|
|