|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . l/ J9 n0 ?; f! ?/ H9 V9 F
- [code]EDMA sample test application6 M. o T- c6 y' o. l
- /*8 |( J9 C% u6 v+ z. N; {. h# l
- * edma_test.c
t' N3 l6 N. U( E6 U$ X - *
& [& y/ K' i2 T2 _. H+ Y8 e; j - * brief EDMA3 Test Application* K: a5 D/ O+ S1 ~
- *
9 R5 z( N( y/ M2 A; H' h - * This file contains EDMA3 Test code.; B( Q$ [0 _6 N+ x2 v
- *0 V# P/ R% F! E0 D+ G9 [1 r4 x& i8 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 H3 e1 g' E' x* I( ^' i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ p& V5 f4 F( l7 t! L4 a1 [ - * TO CHANGE.
. f* N% f) G5 r6 @9 O - *
8 h5 p" n4 Z; a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, U* N8 i1 j; _, Z3 T" z# x4 I
- *
4 R B( V; Q; t0 H" ]. | - * This program is free software; you can redistribute it and/or
3 `1 t. m2 p* z8 ?. G. J9 S0 e - * modify it under the terms of the GNU General Public License as
* C3 t7 w( s1 V. L0 K - * published by the Free Software Foundation version 2.1 d& }7 c7 a7 G2 w3 ?: x1 b+ Z- ]
- *
* |( X. c& S- ] W) n# S, |0 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: e3 B- k& g( w- H2 E1 o
- * kind, whether express or implied; without even the implied warranty4 o0 H! P( X5 \$ @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 N( b8 }% @2 }; \( D7 R
- * GNU General Public License for more details.5 n! u2 @( a, K$ f4 E4 f
- */
; H' H! m# K8 W - 2 ^: ~) W; Q" C) \; P
- #include <linux/module.h>4 E5 o8 m# v, k% S# E
- #include <linux/init.h>, y$ l: S0 Q) ]: _7 F
- #include <linux/errno.h>
% f t' w( M# h5 i5 T - #include <linux/types.h>
0 s' d) C0 t3 ]8 }) x - #include <linux/interrupt.h>8 l4 b) a. N6 a# I
- #include <asm/io.h>4 d# \ a% s# ~
- #include <linux/moduleparam.h>2 a0 _* O, U; r
- #include <linux/sysctl.h>0 o l5 t" n+ A8 l/ L4 l
- #include <linux/mm.h>
0 ~, q5 a% b- @" \0 K: ` - #include <linux/dma-mapping.h>
4 ^$ k4 {4 M% e
p) s" p M% D/ b8 n& w- #include <mach/memory.h>
9 D1 V. H/ |% r9 P& y% R4 z1 m1 z - #include <mach/hardware.h>
1 T; R" b/ j, q: S L - #include <mach/irqs.h>
9 ]: c H J! c _( S - #include <asm/hardware/edma.h>
, s8 H2 b4 n! G
t G6 e* T! A0 s; t0 M- #undef EDMA3_DEBUG
6 Z7 p1 W! B: Q/ V - /*#define EDMA3_DEBUG*/
" o8 ?1 Z+ O, i; W- j, u
" Y4 U- i, b9 F) i& E: W- #ifdef EDMA3_DEBUG' ?7 F5 K, q3 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 m3 N( C5 h( V; P* c8 X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; ~6 M4 ]- V& S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% w! a/ |# Z5 K - #else5 k2 I! B$ v1 j: s
- #define DMA_PRINTK( x... )
* J( J$ t8 R% G3 u: v# j! r/ k - #define DMA_FN_IN
3 c5 _- E0 `7 @) R5 }1 A7 O - #define DMA_FN_OUT
6 t9 G; t/ W! Q, _) a( D1 C' p+ U - #endif9 w' T% `" [$ R; N: ~& t9 d
- r$ m6 m I) i7 N' s5 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! |5 `* ]3 }% f& |5 \
- #define STATIC_SHIFT 3) [. g9 Y9 Y q4 G% z) g% a9 M9 m
- #define TCINTEN_SHIFT 20
5 S S( A1 @! T - #define ITCINTEN_SHIFT 21
7 T$ P6 |( x3 s" ~/ R; ~ - #define TCCHEN_SHIFT 228 S8 F3 Q. C9 u
- #define ITCCHEN_SHIFT 235 m3 p/ ~# W; Y h+ R/ c0 \
- : k# Q# {# i ]" }( H
- static volatile int irqraised1 = 0;# [9 I* Q' R( {) M \1 S. D
- static volatile int irqraised2 = 0;
7 m% a) q2 @* i* n1 l, Z
# V: b# l* I) R3 T6 _, w- l+ }3 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 q; ?. z, n1 T( D c0 C; {0 F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ^( y( F0 d" d/ b5 i4 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# K; [+ P0 X) l8 e - * |# g! \/ a C' }- T# ~
- dma_addr_t dmaphyssrc1 = 0;1 V" s q3 G& T" z# A' [% K
- dma_addr_t dmaphyssrc2 = 0;5 v& `- J) q# R( n8 ?
- dma_addr_t dmaphysdest1 = 0;
3 [5 [$ g/ G) Y% u9 c6 j - dma_addr_t dmaphysdest2 = 0;8 }8 b; {4 Q' ~
" i7 {3 X7 N0 I- char *dmabufsrc1 = NULL;
+ k% Q3 X8 R% z6 W) W- y% G - char *dmabufsrc2 = NULL;! @: j) I2 o+ d3 I( o; U- ^
- char *dmabufdest1 = NULL;3 @* t& x5 @3 g# Q2 a# x+ m4 {7 L
- char *dmabufdest2 = NULL;
4 E2 ]8 {$ F z# A( H/ {" O- @* e
3 _0 _. _* k/ f( i: u, s- static int acnt = 512;& P- O) C. q5 ^3 t3 ~; W0 `
- static int bcnt = 8;
( F; _) O6 E- J* t - static int ccnt = 8; }3 o3 p9 h7 \2 M7 S# K9 Z4 U
- 4 r G& V" q7 ~4 C! H
- module_param(acnt, int, S_IRUGO);
. v( ]/ t! {- @( E - module_param(bcnt, int, S_IRUGO);% J) p3 ?. I5 j% z r
- module_param(ccnt, int, S_IRUGO);
复制代码 3 x; R/ x' c* b1 h! t% ^4 p
, p8 t5 }: s, n0 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; [- z% y; W; j: Q5 l* m8 S& y) A/ c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 t5 X) A9 d j6 d3 x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ]; Q) U& k# X8 h. v9 u
b, q4 C% _* H% {
- w4 Y0 o4 l4 v
|
|