|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : b$ M0 X: w/ t o% ^2 f' H
- [code]EDMA sample test application8 t$ U3 F4 p- N9 l7 w/ R. D! T
- /*% B7 z8 K5 J# j* E7 H$ R. n, s: y+ x
- * edma_test.c
1 c6 ^ i2 d8 r; ~8 T* t - *' N- W7 d9 ?! X, G( K$ z
- * brief EDMA3 Test Application7 j% h. `' S0 Q. N- ]
- *
$ H v( m% g2 C/ w* B" `: t - * This file contains EDMA3 Test code.% l6 R3 R7 X2 j; M
- *$ G8 G% g. x1 m, W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ u5 \$ b8 h4 @ Q/ R9 V- l4 ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 C, B& B1 L8 n% R - * TO CHANGE.& w# N" J6 ~' ?0 u" G) Q
- *5 u2 Z- y& c2 {9 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Q& w+ D3 \! N9 V$ ]$ D9 d
- *0 K) u! ~' e. a' l& s
- * This program is free software; you can redistribute it and/or
3 e8 O$ V& {4 |+ C7 I7 j$ h - * modify it under the terms of the GNU General Public License as
3 ~6 d/ u( j2 V' [3 P5 d0 f - * published by the Free Software Foundation version 2.
7 V0 n) r+ K9 z0 H8 Q5 m4 R - ** w* z: [9 s# R; @9 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 `! p8 v; P) X9 v, m7 q6 j - * kind, whether express or implied; without even the implied warranty
# p! `9 |3 S% d u1 E: {, G/ p* H8 i# j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* l' a: Y! H9 J9 r9 a8 N# m4 P
- * GNU General Public License for more details.# T- b2 F% r) [" k5 d4 Z
- */
# L3 K8 J) d# Y8 M% S7 h9 z" B. Y
: E5 R2 A! ^- y* I- #include <linux/module.h>2 I0 ^0 B& {+ x
- #include <linux/init.h>
; r# Q; ^# a5 }6 H9 f - #include <linux/errno.h>
' Y/ c- @# h1 ^5 U0 N - #include <linux/types.h>
0 {8 l% q. j5 p9 c; i9 I( D - #include <linux/interrupt.h>$ t- V8 q7 G0 J+ M9 w6 _, F2 E' J
- #include <asm/io.h>6 i w$ H, \. x+ U( t
- #include <linux/moduleparam.h>
' S: v/ S1 Y4 J- M7 a% e1 f - #include <linux/sysctl.h>3 D! `; k( A% b2 w
- #include <linux/mm.h>
0 [* o9 s5 |4 H$ q" A1 f - #include <linux/dma-mapping.h>0 h* L/ Y4 O$ Z) n/ j+ s
- & ]/ `" ?. G6 E2 B7 e- O
- #include <mach/memory.h>4 Q4 w7 M, s5 Q' ^5 r
- #include <mach/hardware.h>2 F# ^* c) W2 O$ r) j7 q: x1 P
- #include <mach/irqs.h>0 G$ g& u, e6 B2 ]$ c& W
- #include <asm/hardware/edma.h>
; J. Y |6 [! h - 1 C- {- U# X! t' ~1 }& M) O
- #undef EDMA3_DEBUG
* L7 i8 j& m6 O5 P+ K; L8 m4 W - /*#define EDMA3_DEBUG*/
" Q! \# e0 h8 W+ X* B1 k - 1 A: D' G& S0 A" Q6 {2 }+ B
- #ifdef EDMA3_DEBUG
, _% i) t+ F. E1 X/ F/ N8 ^( ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), D: b5 [# s. G; B4 n6 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, k: e8 C, }. p, S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- E5 K) L2 y$ x$ d% k# ^
- #else% N# y. M( Z$ d' P; S
- #define DMA_PRINTK( x... )
6 l* O4 P3 n; d2 |, e, J& l - #define DMA_FN_IN
4 R$ x/ ^2 x1 j( B$ h: L, ?" g - #define DMA_FN_OUT1 ^) ?; Q2 o9 x! {0 e
- #endif
/ Q. Q/ B/ [1 C# V, X3 g: M; |
$ N( t) @5 X d1 b8 q/ V- r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 P. g$ e, N; g/ b# p& K - #define STATIC_SHIFT 3! P( A3 B. U* Q6 ?- ?& [- A
- #define TCINTEN_SHIFT 20
O( S0 L6 h U# G" a) o4 r - #define ITCINTEN_SHIFT 21
4 E3 ?9 E/ X8 C. M f1 H - #define TCCHEN_SHIFT 22
; j, r- B# e! w! ]* Y5 E - #define ITCCHEN_SHIFT 231 y. p* A7 }" Q/ Y: R
- : ^% u& ~ d! m
- static volatile int irqraised1 = 0;
+ s6 G3 d6 v4 h7 n+ ^1 a p, k# q, s& D' N - static volatile int irqraised2 = 0;" V5 s3 A* k; }* I1 N. l: t
. M6 ~2 j. y% h& r& l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 |6 T* Q$ }& Z/ f3 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 U2 `7 b1 ]/ }& |) M) q1 m+ }+ W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 q) \: A% P7 ^2 ~; I5 n) e* _
- y% T) p6 e5 w% ?) E: q- dma_addr_t dmaphyssrc1 = 0;! z k7 ~2 q4 b8 R! i2 }* }; ~7 V
- dma_addr_t dmaphyssrc2 = 0;8 m! R3 i4 }* h6 ?5 K1 u
- dma_addr_t dmaphysdest1 = 0;
: s+ r1 y: y# ~9 z0 l' w - dma_addr_t dmaphysdest2 = 0;8 z' O9 `4 x+ r) R# U
+ k$ u0 N; q0 l- char *dmabufsrc1 = NULL;# u8 x" U- e' v
- char *dmabufsrc2 = NULL;
D0 m9 N T' i. }/ N8 p' } - char *dmabufdest1 = NULL;2 O$ w8 x" f0 J# ?8 Z' [# A4 t
- char *dmabufdest2 = NULL;
4 Y: P" [$ { R% Q - ( ^* B# |4 o) w
- static int acnt = 512;3 B1 ^- f- a) P y
- static int bcnt = 8;* O8 L. W" ^" v2 s* z S: e
- static int ccnt = 8;
, A" p: t& G1 b - , j( k2 O# ]' x2 g2 \
- module_param(acnt, int, S_IRUGO);
; M2 x/ e! V4 V, f8 c - module_param(bcnt, int, S_IRUGO);
5 u) |+ g6 J3 n8 ] - module_param(ccnt, int, S_IRUGO);
复制代码
& p9 d1 {, A0 E1 N! m! e2 G! {* `- W# p) T' l3 o" Y6 w- c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ _( R3 m$ ~9 f3 B: @7 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# F5 s2 Y% g! F; v& _" _ h$ {0 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) p$ V4 p9 A: O# T7 B! S5 k3 g* `. E3 G) W: X9 L2 U
# X" m% n9 n- U' d6 O# @+ D
|
|