|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# n* \# c* L+ H" C' \- n- T- [code]EDMA sample test application( H: B/ H( \$ I, U- A, O6 J
- /*: \& Q6 H% j+ n! x" {
- * edma_test.c$ `2 \6 N1 t& W
- *
' W7 O. p7 |3 q5 Q# ^5 z* z - * brief EDMA3 Test Application; i# w) L' ~1 x, c* x3 p
- *( B8 ~& p' {3 N- ^) f/ Z
- * This file contains EDMA3 Test code.6 |- v5 T2 A6 V4 U! A$ \
- *: Y) L* g- q4 @2 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 H4 M0 j7 v0 m; Y0 _2 k3 x$ ]- ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ c9 T5 m! q: s - * TO CHANGE.% X. |% J- K R! K3 H5 L* }
- */ p+ a8 @' s/ y+ V) w% _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* e; ]( c& L3 M- [% E' t* L1 { - *& G1 L& g& z# ^; [6 q' W( @
- * This program is free software; you can redistribute it and/or: x& h4 z3 z1 Z. N( d- `& w
- * modify it under the terms of the GNU General Public License as
S. d- G3 a! t% X. x2 V2 E - * published by the Free Software Foundation version 2.3 z. |" f. ?7 r3 u \- \0 _
- *7 k4 m8 I0 l4 n1 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 g- i( Y7 _4 b/ R+ z F- L - * kind, whether express or implied; without even the implied warranty |3 w- |, K- A1 p9 e# x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, k! Y: z/ N( n; O( k' Z
- * GNU General Public License for more details." e% I7 T9 |' R9 J Q; S
- */
* ^4 u7 l' l9 J, w - 6 `. s) ^! t- n0 q4 ?
- #include <linux/module.h>
4 x' M5 \; `6 f& L, V, R+ s - #include <linux/init.h>7 N- E+ l1 Z6 n2 M+ n# q! l) ]# m( T
- #include <linux/errno.h>
$ ~$ w0 X: H, y7 N: \0 ?# a, Q% [7 { - #include <linux/types.h>
" p, A# i# E) I# y* T& f - #include <linux/interrupt.h>, n' u& E& D) C4 f8 b% _
- #include <asm/io.h>
* } G( a# k3 R6 a0 y- \( j; m2 E0 | - #include <linux/moduleparam.h>
' ?+ v4 E0 a% T7 B! b - #include <linux/sysctl.h>
1 @. W8 q% d3 K, U( @2 r, ~ - #include <linux/mm.h>- ^; n! @: Y, G6 n$ F' C
- #include <linux/dma-mapping.h>
$ L( P' z9 V R. W
: _/ \/ m) W5 X: H( g- #include <mach/memory.h>
5 A8 j3 o& w% c# Z5 F: H - #include <mach/hardware.h> w5 q5 \7 N, ^ F! ~
- #include <mach/irqs.h>0 h0 n/ f. j- T* o2 P
- #include <asm/hardware/edma.h>
: p" s% u l7 a; F% Y - , M2 N2 o1 x7 Y/ u N9 K3 j2 g
- #undef EDMA3_DEBUG
, e! m; }, r: r - /*#define EDMA3_DEBUG*/
- Z% s3 K3 g9 V; {8 [
/ p" ~" T3 Q7 q1 z& |3 G7 |4 o- #ifdef EDMA3_DEBUG
: F( n Y5 @8 U) R, h! t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* r- e2 k: S6 G0 Q6 x! ~/ h% v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 }+ `2 f. C0 Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 P& d; v( Y$ M- n" l- k* E - #else7 v/ k5 O1 Y! A1 A h2 ]% b1 n
- #define DMA_PRINTK( x... )7 F5 x ^4 G# d
- #define DMA_FN_IN
1 f# ^& z5 Z4 I& e9 |6 i2 E9 D& L - #define DMA_FN_OUT( [. a4 F4 i; A( i/ k0 V
- #endif; W0 ^4 e% H# N+ U! m* a+ y& Z
* X! w! b( B+ t1 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. K( f. \: v3 j6 r. U& d( T - #define STATIC_SHIFT 3* g# p, A* [3 ]& f5 A4 ]0 z* D
- #define TCINTEN_SHIFT 203 v2 o. l2 o! s4 U
- #define ITCINTEN_SHIFT 21* E- C, e: K! \6 [; ~5 B d( M
- #define TCCHEN_SHIFT 227 H( ]7 i9 r6 m( l' P
- #define ITCCHEN_SHIFT 23- x- U0 n+ W& L+ H: h" x, G
7 u7 [: O+ j# @3 r, ^- static volatile int irqraised1 = 0;
* ?0 Q0 g. s* i' \ - static volatile int irqraised2 = 0;9 m$ Y" t" @0 D3 l- v, T
]* q& E4 J3 ?1 u1 u& d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M j2 Y5 g3 R6 h# R' }# }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 @( C6 X" S. [4 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E n2 t* k3 m- d) Q
+ T8 K6 O8 } I: E3 ?5 g- dma_addr_t dmaphyssrc1 = 0;) g3 \- H/ s0 w A# x: A
- dma_addr_t dmaphyssrc2 = 0;7 U2 G; j& E2 A- ?! Z! d8 u
- dma_addr_t dmaphysdest1 = 0;& u4 n8 `* T6 h, e6 c6 H( A: Z
- dma_addr_t dmaphysdest2 = 0;
! M( b \. n( j9 y - $ k4 D) ], g7 H9 x5 s+ \
- char *dmabufsrc1 = NULL;( b' V9 G4 }) ~/ x6 d) D q
- char *dmabufsrc2 = NULL;& Y$ q& t. n( B; Q% g0 | a8 B
- char *dmabufdest1 = NULL;' {2 x, ^" u5 k& `" e
- char *dmabufdest2 = NULL;
' V9 F) T: _8 M7 j$ n. f
* H7 C- i& n8 c2 ]$ a5 I, g- static int acnt = 512;
8 l; V# z7 k0 p$ Z i" N* P - static int bcnt = 8;) F9 F2 k3 b5 ]' u9 ^& Q
- static int ccnt = 8;
- r/ P( G; b) C: Z) A - / r% d X' P- Y7 O1 w
- module_param(acnt, int, S_IRUGO);( O x \& y1 F& _
- module_param(bcnt, int, S_IRUGO);
% V' s g1 X- Y/ O: s - module_param(ccnt, int, S_IRUGO);
复制代码
/ l* L5 n f+ ]2 x/ Z1 O* ]
5 ]( m/ A2 [$ I! S, f" l6 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 U) W+ V" ^3 E3 A0 J( m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% z9 o& r, Y% j2 L) H4 [* c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ a1 n/ n% V- t3 s9 |6 {! k, t2 N3 W9 E U6 z l. b: F
3 z6 ~' a3 Y$ O |
|