|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. q4 X4 ^' ?" h \( J% [- [code]EDMA sample test application# K: d/ D; w3 h) }6 c
- /*
( u0 C% _9 {& Z; x( B0 G% t - * edma_test.c+ R V, ^9 W5 [% Z/ g9 m
- */ ~' j! U' N7 a) D9 L) `- b
- * brief EDMA3 Test Application
" q* b8 N7 l- c: ~# a5 q- } - *; S: O X2 J! G, K
- * This file contains EDMA3 Test code.7 M7 w* V8 w9 ~6 e* k2 C9 ~
- *
& n* r) s1 l. u$ A) U, j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( x0 D/ t, J7 E' ~0 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 g6 v& q' ~' x7 p: q+ B; N( F0 _
- * TO CHANGE.
" S2 h% r: ]( f! E! c! U; d - *
- h$ Z' } Y- [+ P! o# A M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 g9 n! F0 U! b+ Z! V7 {
- *: ~3 `) P+ ?/ s, P* {* D1 d2 S
- * This program is free software; you can redistribute it and/or: ~9 v4 O$ q+ _( ~0 F% L; W7 u
- * modify it under the terms of the GNU General Public License as r. y9 x: ~" i8 I: X
- * published by the Free Software Foundation version 2.) I. E% N% v! J4 A4 S
- *0 @, x0 U* k/ P- ^- m4 ^( Y, F+ C( Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 a* ]% ? a: [+ L: T+ C - * kind, whether express or implied; without even the implied warranty
7 }9 H( o) c2 O( n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 [* ~- O! N8 }6 Q# L
- * GNU General Public License for more details.
% B# | s& O$ r, w1 V% K$ s - */
R" H6 @- G- q' n# H2 \ - . e! F7 M# D5 R) J# R, n- A) P: ]4 Y9 w
- #include <linux/module.h>
8 W1 ~, u# F5 V( ]" }5 R! u - #include <linux/init.h>
% E, E0 \. s2 Q6 J2 { - #include <linux/errno.h>& S4 `6 M, G" [* b
- #include <linux/types.h>) o+ b; f* b* R( B7 e- D5 y; y0 A
- #include <linux/interrupt.h>
" Y2 H0 R: u. X( X, L+ R/ ?; X- ^& R - #include <asm/io.h>
" G6 E2 } C5 E: X - #include <linux/moduleparam.h>$ b5 r! T* N# F
- #include <linux/sysctl.h>+ ^1 _* u0 j" e5 w) y
- #include <linux/mm.h>3 E2 `( F2 e) _$ D( e) ]
- #include <linux/dma-mapping.h>6 Y5 G2 B. @3 X: t9 W9 M& P
, U! k; S3 b/ R8 M- C7 [- #include <mach/memory.h>7 V( ~5 g2 I1 A7 X2 ?3 N0 x
- #include <mach/hardware.h>- t; ~6 \& C/ P0 M# S
- #include <mach/irqs.h>
9 P+ i# N: ?; {2 A- K# N/ O - #include <asm/hardware/edma.h>
- t9 N- K, s1 d. q2 X
1 w, H9 a; j/ W" S. C& Q, t- #undef EDMA3_DEBUG
6 g9 o0 z6 v0 M- @ - /*#define EDMA3_DEBUG*/) b1 v) E4 p) J) N
- 6 P9 D' |5 J) [) U D9 `6 q1 ~
- #ifdef EDMA3_DEBUG; M% y3 A# Q, h' p3 z' H4 o3 ] S/ k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) \' U1 ]6 z/ d: I, `/ v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 t. \6 y% ]( `+ h% v/ |% l) s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& J* F" z& X d$ \" x4 D - #else% L* u, C" u& I$ q
- #define DMA_PRINTK( x... )
3 [' v$ R; H% N! e! r) l - #define DMA_FN_IN9 R6 u' w; q; c. y1 S. M2 a
- #define DMA_FN_OUT
& D% w& l! v8 I. `9 o5 l - #endif m& e1 ^" {# Q; z( l
- 4 }3 a0 |, M8 h, P1 F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, g Y" I& D# C) W% s - #define STATIC_SHIFT 3" H& t# q$ K6 D6 }( i2 W3 L& D8 O2 J
- #define TCINTEN_SHIFT 20
7 x* | @3 y1 Q - #define ITCINTEN_SHIFT 21
1 F9 u! f9 g& \ - #define TCCHEN_SHIFT 22- { l. @; ]3 |5 m2 a! p W
- #define ITCCHEN_SHIFT 23
9 |3 U/ G% r0 o2 ~/ s3 A0 E - . U# d2 i: k7 E: g! n7 `
- static volatile int irqraised1 = 0; B6 s; ]7 Q3 A
- static volatile int irqraised2 = 0;
0 ?' z/ E$ j8 m& K! ]
* `) D' A) G- i. b& _9 Q- `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% e& |/ e' Z3 d; E2 Z# H; ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~$ G0 l/ @8 n0 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 D) {3 T: e# A7 Z% T
% b( Z( @6 H6 G. e" k& H- Z- dma_addr_t dmaphyssrc1 = 0;
F; L7 b S, N1 H - dma_addr_t dmaphyssrc2 = 0;- c3 E4 `0 E m# d
- dma_addr_t dmaphysdest1 = 0;: Z0 ^4 C9 k# E( n- `" L/ {
- dma_addr_t dmaphysdest2 = 0;
4 v0 |5 E% \4 ~, f - 5 V( U3 g0 K, p
- char *dmabufsrc1 = NULL;9 N u; {! U/ ?( }' S6 j, ]
- char *dmabufsrc2 = NULL;
7 ~; m& o$ @* g# O* C - char *dmabufdest1 = NULL;
% m, `) J2 l- d - char *dmabufdest2 = NULL;
4 }/ ~, F! u, J" G# S4 N& f& z - " `5 j* J+ M* S$ H( h0 i+ T
- static int acnt = 512;
! F' f8 v# c0 C. W - static int bcnt = 8;* b4 l6 I$ q4 V
- static int ccnt = 8;
% D" K' {( O* ?& C) }: D% r- |2 @ - 8 z! n$ z5 Q) K; A$ D
- module_param(acnt, int, S_IRUGO);
Q' f9 e( X0 c) @, `# F8 L5 ] - module_param(bcnt, int, S_IRUGO);
! v+ H; |! U6 F/ h - module_param(ccnt, int, S_IRUGO);
复制代码
3 U9 u8 z( t; Z
0 a: d" }+ l( s" K, P! ?( J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! v5 d" S) d) ~! f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 {) ~$ ^6 S5 Y- B; Y/ p( e2 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 P! U3 \, \+ \8 ?
* E0 i, z# f4 h4 H2 q
9 D! l7 K, J4 O+ P7 s |
|