|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 s* y/ M4 A5 `3 o* a @
- [code]EDMA sample test application
) D4 S& d1 U; G6 w, Q3 T) S3 a/ a - /*
4 Y0 `5 S- r$ b% k: Q - * edma_test.c
( ~$ s" t; A9 s0 `$ |5 a1 b# D - *: ^7 z/ x& o9 y$ f+ o
- * brief EDMA3 Test Application
/ @6 N% ~8 [) \7 Q. n; q* X - *
0 |' H4 r7 Z, x3 A5 G - * This file contains EDMA3 Test code.
, f2 o. V8 B$ b: X - *
* A4 I$ S. @" B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% |' I5 z( `, w5 U( H5 n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# v! g3 t( T! M! Y: O - * TO CHANGE.
# f! S. S( D- I) [: l/ A y - *, \) ^0 P9 S0 s7 [, l2 |, k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. v0 O! W, E4 g1 N+ [ - *
1 ?- I5 x( G$ f: [' I3 c - * This program is free software; you can redistribute it and/or( {$ A9 ?/ g2 o
- * modify it under the terms of the GNU General Public License as
1 ~, z# s: `+ V7 L - * published by the Free Software Foundation version 2.
% d4 f- n; t* s# \/ Y/ l# f - *( l- ^2 \- U) T$ `" F6 m2 j% b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" s0 Z& a2 H. I
- * kind, whether express or implied; without even the implied warranty6 K; o$ |6 \& n7 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ A# K6 B' ^0 m; Q0 O
- * GNU General Public License for more details.6 T s, n4 E2 X, T9 j
- */5 q) |* \! T& {3 Q: Y7 N" b; e
- - H, F# W1 i* T, Z6 ]9 I
- #include <linux/module.h>
" C: @7 W5 x2 r: j4 X/ ]$ C - #include <linux/init.h>' t. q4 R7 B, S+ J) q1 L8 B
- #include <linux/errno.h>
0 C% P2 Y& W0 X) D - #include <linux/types.h>0 Y; q! z5 M6 {' n- S6 Y
- #include <linux/interrupt.h>; s/ S( `# d1 y8 \( F
- #include <asm/io.h>- z7 i# E5 j' _/ w$ F* Y' L: W+ s
- #include <linux/moduleparam.h>7 H! G3 v7 R6 u" S; o7 {* W6 P
- #include <linux/sysctl.h>5 N( b6 _2 H# W& P* Q- e& l" Q
- #include <linux/mm.h>- U7 ^. Z: A$ T+ F) n% ?
- #include <linux/dma-mapping.h>9 o, J1 x" j, ~1 x
- ^0 u Q3 z7 {; x1 K4 t! g* N
- #include <mach/memory.h>
, Q p" d' R. R/ J - #include <mach/hardware.h>0 C. ~5 i7 j5 r4 f
- #include <mach/irqs.h>: }0 H1 w$ R# m# S/ S7 h
- #include <asm/hardware/edma.h>
+ \1 q- J* d# n* `7 c
* I( T* b: N3 b5 D' A$ p# P0 a- #undef EDMA3_DEBUG
0 X$ P0 J5 V$ P3 Q% q* @- @, b - /*#define EDMA3_DEBUG*/
, b3 Q4 t U& o - * F# D+ H, O0 G1 M% P9 d' f- G
- #ifdef EDMA3_DEBUG
% u- r5 X4 v9 Z' @' j3 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- i8 G m! j5 L* u; Z, _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ A9 ?6 _5 }' @1 F% Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 f6 q W% @4 ~' D- X - #else$ [ Z5 Z' P8 H) {" `; c
- #define DMA_PRINTK( x... )
# j5 B$ b& W, s" s - #define DMA_FN_IN
9 G/ @& Z$ R6 l/ }+ `3 E - #define DMA_FN_OUT
2 m' T6 R5 l% M2 A; s - #endif i+ {$ s( p6 I( M1 N
: ? N: g) z2 v: s; X# y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ G, ]5 T, X7 ?& ~ Q: T8 N9 L/ ^
- #define STATIC_SHIFT 37 T/ ^8 ]; v) g# m# ] J
- #define TCINTEN_SHIFT 20
6 B3 M8 ]- t L C& T! X! q - #define ITCINTEN_SHIFT 215 Y/ L0 B3 J7 U+ Y8 L$ q& L$ b" r
- #define TCCHEN_SHIFT 22$ s+ i* i9 N3 `
- #define ITCCHEN_SHIFT 23) y G, A- `$ r* u, n% m, _" ~
- , {8 ~6 x" r3 G6 j5 k' O9 b' ?. B& d- Q( `
- static volatile int irqraised1 = 0;
: i5 ?7 R0 r: T8 w - static volatile int irqraised2 = 0;
$ D& r, T' Z/ C& q1 E+ h, f5 ? - * F* P: j- J( b/ V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ~. Z: K+ I0 v+ Y; d1 h5 m7 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( n% |- D# o1 E4 V- X; v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); q7 F! e, _" B( j' L
- " S' B u4 x) r) X, P
- dma_addr_t dmaphyssrc1 = 0;
$ l y) Y* `* I! v2 [0 N - dma_addr_t dmaphyssrc2 = 0;) a" J4 s4 c$ @% ^" K1 x3 Y
- dma_addr_t dmaphysdest1 = 0;! b& u& Z* l: ]/ O
- dma_addr_t dmaphysdest2 = 0;
# B0 g5 s9 M( Y/ F* q4 O. C - & v5 _, Z9 f" _( e8 C, s
- char *dmabufsrc1 = NULL;
9 s/ i* ^2 b4 s9 ?# r7 {3 v. h - char *dmabufsrc2 = NULL;5 F( Q- E5 o0 j) \# `5 d2 J
- char *dmabufdest1 = NULL;
# Q! p( r/ r% N; S- z( O9 V7 |/ E6 d - char *dmabufdest2 = NULL;
7 P& B' p0 j. X0 |0 l1 J - 9 `, G) L& G* O' a( P1 E
- static int acnt = 512;
1 e3 V. O4 B! K' t' _7 E" X4 w - static int bcnt = 8;
! W6 o, N/ t. g4 k" y; k - static int ccnt = 8;
. W; n8 d; L# _ - $ s, m/ |! b' o$ M& ?3 h
- module_param(acnt, int, S_IRUGO);
, ^. `( m5 e( x! _" R& w - module_param(bcnt, int, S_IRUGO);) {3 v: P. u* P: |6 X' ]
- module_param(ccnt, int, S_IRUGO);
复制代码 + C+ `* l% e% W# O8 A1 T! Y
. p. y; R2 g- V0 ], R- r& U, B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! e& ?; w% l# X% K: Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 M1 t' Z5 w h$ k' l/ C, A& G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ~ C1 j' J! |' \' p* S8 d8 o4 _+ }" K2 C
! O/ r) W% W/ X' ^% x! U |
|