|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * V- h7 \# P5 V4 H- J/ y7 c7 V$ }
- [code]EDMA sample test application
& x) z9 d( x" I% x* N& \! h5 } - /*" ~2 [% y% k# b4 h
- * edma_test.c
( A# N% L, f* X - *3 K+ s! R* d, ]1 ~
- * brief EDMA3 Test Application
; P8 E, f" \0 X - *
% Z8 u d( I) Y, e* ~ T) i - * This file contains EDMA3 Test code.
. D, d5 t5 }) {" B7 ^, v/ a- I - *0 l2 l" T: t$ I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, G) Q v" p. v$ Z+ G: H/ ]( L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- u2 Q1 f8 E6 B; W9 h$ J! }
- * TO CHANGE. Z& B4 Q6 f# o
- *' r& ]. I$ ]$ l. v; E* A# @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ n, d4 G( K! s& q
- *" D' o1 m+ B' O6 u( B
- * This program is free software; you can redistribute it and/or$ l- ]3 e; n3 F7 p
- * modify it under the terms of the GNU General Public License as q6 X5 l8 N$ ^2 \
- * published by the Free Software Foundation version 2.
! \9 q2 U$ t6 Z* U - *
) }& [: A* B5 u$ }% C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 V, t8 ~4 [/ O9 ?% v, N- c
- * kind, whether express or implied; without even the implied warranty! `; d9 i8 Q) k9 s$ `# t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 ^' _8 T V- o b - * GNU General Public License for more details.
! o: U2 b& X/ z- o! ~: h - */
( J- v, h" @) |5 B( q9 K ~
' C' J9 E) @5 ?' H# g, U- h- #include <linux/module.h>6 M ~$ j2 i N- m
- #include <linux/init.h>! f( [4 m- E2 I6 S
- #include <linux/errno.h>
' M7 s* D- ~; P2 A; W - #include <linux/types.h>
& `, p" N( M6 d4 r2 a% G) m - #include <linux/interrupt.h>. [! g! p( q4 [% M
- #include <asm/io.h>
4 {7 w" U2 w' C! \ - #include <linux/moduleparam.h>
w( [+ A# }4 f5 ^+ |5 Z - #include <linux/sysctl.h>' f. V" g# w! k% j! P, ~
- #include <linux/mm.h>. a" `; F) X, M) G) c- [
- #include <linux/dma-mapping.h>
$ t+ |, o$ M- g, \' ]! w
3 h+ `* Y& J6 l$ G2 i2 V2 H7 J# n- #include <mach/memory.h>
( J$ g$ v& t; v+ o( } Y4 Z - #include <mach/hardware.h>
( F* B5 t6 w$ z7 D0 N7 a - #include <mach/irqs.h>2 t! O- u; A1 P. ?, f
- #include <asm/hardware/edma.h>
. s6 o: j6 k7 T; V4 U - d$ {5 `7 ^( z9 N. [0 {6 a
- #undef EDMA3_DEBUG% \1 O1 Z; |5 h! p9 |6 s
- /*#define EDMA3_DEBUG*/: e# i; W# s4 i, j4 D8 l$ [
- 8 J+ g! V/ Z- }* `0 G
- #ifdef EDMA3_DEBUG
( C* i2 x* U, r4 S0 A4 G) T; n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 s$ A9 W) T3 i, Y5 y, G6 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 q5 e2 z+ ?9 W3 B% Y4 E0 H8 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 O" l8 D1 p$ C7 u8 {" ?3 O$ V2 l
- #else( k T$ \+ ^& c! h
- #define DMA_PRINTK( x... )
7 H X P) k9 h8 M - #define DMA_FN_IN5 ]2 i& O F/ y2 G0 s- A
- #define DMA_FN_OUT
, X, u3 ^2 R( y0 q8 |) m - #endif
' g. N$ ~- ~5 j3 |6 [ - 5 a, R, t4 V' k! N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ ]- h) M8 k/ [+ n- j
- #define STATIC_SHIFT 32 D F, k6 \2 I6 e* f( U1 Z
- #define TCINTEN_SHIFT 20& b1 p+ J8 g* T2 ? T
- #define ITCINTEN_SHIFT 217 A9 ?* ~, S# f7 P4 B
- #define TCCHEN_SHIFT 22) O% M: I6 h- t* k) V! J+ O: `
- #define ITCCHEN_SHIFT 23
% d- q- x& W# u0 J* L/ s* Y7 W: y, h
6 V. u0 v, L- j- static volatile int irqraised1 = 0;' W0 K7 J* m6 S' `" l
- static volatile int irqraised2 = 0;
( y$ \! L6 ^- v6 m) t- o% S - 1 s+ |6 W9 q3 _; o: P" i1 A' K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. C+ @4 S/ p7 F2 o8 s) E' U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ g1 w, Q3 x+ @, V' i& R% J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }( X7 j; j' @3 j& C3 \+ Q" n
" H- q$ K. V9 A3 x7 b1 c1 O" G- dma_addr_t dmaphyssrc1 = 0; N! x1 N7 o$ m, {" S2 B4 z% q# ?
- dma_addr_t dmaphyssrc2 = 0;4 C7 `) J2 W( C
- dma_addr_t dmaphysdest1 = 0;; C! O9 k& T% M' _" L; S0 q
- dma_addr_t dmaphysdest2 = 0;
1 w- z" b: M @2 ]* X
' D4 n6 d4 `& }' R2 z- char *dmabufsrc1 = NULL;
/ n! [3 y+ ^3 I' r( D. z, B. D* z. V - char *dmabufsrc2 = NULL;: E' a2 [; {" m9 i
- char *dmabufdest1 = NULL;7 u, r+ ^" k7 O# l
- char *dmabufdest2 = NULL;* o& f7 W `2 n2 D, c
- 3 z* M+ b# B0 b2 K g( ^3 m3 X3 L
- static int acnt = 512;9 U/ J; C! q3 x" H& |1 j
- static int bcnt = 8;0 `5 b/ H& f. L% Z9 M: b
- static int ccnt = 8;3 J9 R( d7 R: f" K7 ^
- & P0 ?! n" |- L+ F
- module_param(acnt, int, S_IRUGO);
% x! W% X* E9 ], t - module_param(bcnt, int, S_IRUGO);5 x, T% u( G- `5 p
- module_param(ccnt, int, S_IRUGO);
复制代码 & s% m* B3 w- b
z- {$ A) s; e n5 l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! V: I7 E j z# Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ b* l& d* d! t5 B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 h; M5 y: q2 q- Y6 K) t9 r- |' K# a& O
( ~# V h9 C' Q8 F
|
|