|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 |3 f+ a( N! Z, n9 V2 Q" o
- [code]EDMA sample test application$ G" z0 f+ M$ E: K7 g
- /*
; M! S; H; c6 } k3 ^ - * edma_test.c
3 q* b+ V3 ]5 M; D6 ?% A; V7 V - *
6 k6 _( C1 J$ g# s H - * brief EDMA3 Test Application3 e, h# v7 r! e2 ~) ~" g
- *+ V3 E, J/ n7 t* c% q8 ?0 V9 Q# h( [
- * This file contains EDMA3 Test code. q" n9 n) b* d, H
- *
7 ~$ H3 }7 N8 b' c t# d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 X# P3 q) H7 u3 w6 d" b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# B1 j) _* r" p - * TO CHANGE.
& z! d8 l. |9 ?3 Q. H! t* o |( o8 I - *5 E. i, ]! `- D1 x5 X) n. O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 l% l6 I8 Q1 f - *3 s4 }/ V7 c. q
- * This program is free software; you can redistribute it and/or" c2 Q3 L& ?2 n6 u5 s5 d
- * modify it under the terms of the GNU General Public License as
+ T' g; x% x8 A/ j2 m0 V' D - * published by the Free Software Foundation version 2.- D# `* v0 N5 m( X- o! u+ w5 y
- *
) Y, G4 t: Z" N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, d( N6 x( D* ^- V - * kind, whether express or implied; without even the implied warranty- ?- W0 h5 N. U8 ^) B3 R& c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ @0 w. L2 y- U1 u
- * GNU General Public License for more details.2 c. E% r7 S1 _2 g% T2 U( ]
- */" Y* ~ j( N8 J* v
. p: X6 \3 B$ J- Y8 }$ f" w- #include <linux/module.h>0 D- g5 z, H" \+ \( Z3 i5 h
- #include <linux/init.h>
, S* J$ Y6 U9 j! B$ s. A - #include <linux/errno.h>0 k+ ?/ r5 |/ L- ^7 W# ~& T! x$ m4 n
- #include <linux/types.h>, s# e+ Z6 H% [" a- U' X
- #include <linux/interrupt.h>
3 Z( \5 k: |5 Q6 Q( R+ ^7 |; Y/ f* f - #include <asm/io.h>& D' X$ {7 ?0 c o
- #include <linux/moduleparam.h>
* y/ H" g. k# q - #include <linux/sysctl.h>9 ?" u0 k+ l+ E3 [# j3 t+ I
- #include <linux/mm.h>8 E; f+ c/ o1 Z5 M0 n
- #include <linux/dma-mapping.h>8 S0 q0 U( B8 c' O% n2 \
- $ a# R& T" B3 @
- #include <mach/memory.h>
* ~; n7 q; @' m8 {+ _1 a - #include <mach/hardware.h>2 M E( {, S& `1 B4 `
- #include <mach/irqs.h>$ B: k' Y) u& J
- #include <asm/hardware/edma.h> R" X, ^+ y. e+ t- ]- h) ^
& S3 h- M1 m( h- b! @- #undef EDMA3_DEBUG4 j4 a8 C! Q* B0 m* f; X6 V1 \
- /*#define EDMA3_DEBUG*/
+ t1 I" a# x0 `9 i* [5 B; a9 k
( F3 ?: l/ o0 |/ x5 X- #ifdef EDMA3_DEBUG
$ l0 s% E( x6 ^7 l/ e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# P$ d- L! n, W& r. I1 z% a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: w% r1 N! A) W) Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ?3 D( ^5 X, }3 ]
- #else4 _, H) ]1 u1 a3 n
- #define DMA_PRINTK( x... )2 z' L" s! J7 @9 ?( s' L
- #define DMA_FN_IN; e. H3 P3 C) Z% z
- #define DMA_FN_OUT# K% |: Q; {0 `; V
- #endif
1 p/ p5 o" {) L
+ r+ i$ q0 ~5 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ _# F( y) l6 Y; n
- #define STATIC_SHIFT 3
" j* P9 F! a9 ]3 ~& Z# ]9 ? - #define TCINTEN_SHIFT 20+ a2 S5 P: t- y# f
- #define ITCINTEN_SHIFT 21
6 x# H4 H0 Y9 L" s C" B - #define TCCHEN_SHIFT 22, k4 B: v3 a. d3 M. X" R
- #define ITCCHEN_SHIFT 23
: W6 O, p+ C7 t
9 ~$ d1 W0 ^/ k. H' s$ K9 }- static volatile int irqraised1 = 0;
1 {* h7 C+ j) W3 E - static volatile int irqraised2 = 0;3 r" l, a; s) T! l
9 O6 K7 B+ f5 d( P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, j; F b, v* }- n9 R6 x2 H4 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ?. v8 U4 v, A3 z" k# ^4 r, `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 _/ `# R; m! X% u
" y% t$ p; d. ~) X- dma_addr_t dmaphyssrc1 = 0;
+ p/ m9 K- ^# _1 J3 v9 Y. y8 t - dma_addr_t dmaphyssrc2 = 0;9 r8 ?4 S5 N3 K
- dma_addr_t dmaphysdest1 = 0;
/ B" |- W& w" O+ |3 ^ P - dma_addr_t dmaphysdest2 = 0;8 [: ?8 |8 Q" Y) W
% ^0 D% `) p( B$ u9 l" y% r- char *dmabufsrc1 = NULL;
, m" z b( v2 z# O - char *dmabufsrc2 = NULL;0 N8 w$ N9 C6 h2 D2 a' B \3 K5 W6 P
- char *dmabufdest1 = NULL;
: p. O7 d6 v( b0 [6 T - char *dmabufdest2 = NULL;
3 Y5 k4 k. G$ N- E
: Z- e- P- n" x8 {7 ^8 D- static int acnt = 512;; c4 q* ]! C$ h$ E
- static int bcnt = 8;
$ U/ {$ s+ B( ?+ E - static int ccnt = 8;& Y" Y; h; m, a7 G0 ^* d
# u9 T8 U# q3 P1 O3 ~ Z; V4 T- module_param(acnt, int, S_IRUGO);
4 G* a1 c8 u. K C# t - module_param(bcnt, int, S_IRUGO);1 J' x4 r% N* F+ Z W
- module_param(ccnt, int, S_IRUGO);
复制代码
" {4 Q8 A' s% c6 E9 E2 o& O8 O2 D5 v/ |. v' t& T! S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ x$ n# U! z5 m2 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 g8 n# O0 k9 R( c6 l @* o8 ]# l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ?+ M* o' R& e- @
0 @3 ]! `/ Z$ j! K4 [0 z
. n2 k$ C. H! L" ?3 z: `
|
|