OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 12355|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 ^/ S0 o9 |9 u8 n* H
  1. [code]EDMA sample test application. l0 s7 U; S" }% V& l( ]
  2. /*$ b3 Y) s7 k* A' j# C) y
  3. * edma_test.c* V% s. |3 R$ S9 ?: J1 o0 y( G
  4. *
    5 G' g) }* H8 [
  5. * brief  EDMA3 Test Application
    1 a5 n1 [* ~" _, X/ a- y
  6. *
    7 J+ h) v( b; E) `3 E
  7. *   This file contains EDMA3 Test code." l- V% ]" |0 L, l5 e* \
  8. *
    " G% o6 d1 v+ k8 U5 P6 d5 O0 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ z9 ^# ?$ N3 H$ P) V% n* I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # _% p0 @- f9 W
  11. *         TO CHANGE.! l) E: ]9 F* s9 j8 [8 p
  12. *
    ' u8 c+ D) A- A2 Q" r+ Z9 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' P8 ]1 ]1 A0 m- Q
  14. *5 T3 W& |. `: W$ r& ]! E
  15. * This program is free software; you can redistribute it and/or
    ; r/ _! Q) }+ v5 D0 h; }' r/ Y2 Y
  16. * modify it under the terms of the GNU General Public License as, n0 c; T' K# D' L9 e9 g( P
  17. * published by the Free Software Foundation version 2.
    % p  o' A* X8 `
  18. *
    ; q5 d! z1 @7 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      B8 [& X: a* s) E& Z0 e
  20. * kind, whether express or implied; without even the implied warranty
    6 s) _! h; ~4 G$ }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  b3 ~9 u9 p2 L" d$ c( C7 }
  22. * GNU General Public License for more details.
      U3 m( n, _) F4 i2 N3 y0 Q8 ~
  23. */
    9 M% Y2 G3 \+ M

  24. 4 F% B+ c+ M& w, V
  25. #include <linux/module.h>0 F4 P( n) z, D, j
  26. #include <linux/init.h>
    ' D+ }' [4 F+ b
  27. #include <linux/errno.h>
    # P- a! r' K3 Z" G
  28. #include <linux/types.h>' B9 C9 n) i3 M# |8 y
  29. #include <linux/interrupt.h>
    9 [, G2 q; [; `0 `
  30. #include <asm/io.h>6 f* I6 N: q8 n& ~7 n, M8 i% z
  31. #include <linux/moduleparam.h>1 I7 @7 H; r+ x" O, ]$ _$ K# s
  32. #include <linux/sysctl.h>$ S; ?5 |- u* w% ~% l* L
  33. #include <linux/mm.h>: I% U' E1 K9 Z' t2 n3 [" a- J
  34. #include <linux/dma-mapping.h>- S# r7 X8 G- J6 r

  35. / d( \. @9 k; @! ~
  36. #include <mach/memory.h>
    / A$ m8 H; r/ z% T+ h7 C% e$ F) G4 L; g3 `
  37. #include <mach/hardware.h>, p5 G. W( l: b# g& r
  38. #include <mach/irqs.h>
    ! k4 n9 V$ Y# y, P4 K7 L1 B
  39. #include <asm/hardware/edma.h>
    + X8 e/ Q* I  ^- s6 R" \5 a. X
  40.   D) \% x, W4 K' a# h2 a
  41. #undef EDMA3_DEBUG
    ' Z4 [; n: A- z! ^3 U* z& d* r
  42. /*#define EDMA3_DEBUG*/' l) w8 U$ P7 ^2 @3 z% R

  43. & _) G2 E4 j2 |8 t6 X# s4 G8 }9 U
  44. #ifdef EDMA3_DEBUG
    2 d2 i; q2 P3 d: \8 g' `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( L5 \& n  B% p6 j6 c1 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / a  c$ W5 ^6 Q* U9 i# C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" j3 l2 K0 D$ `) s8 F, \: X) Y
  48. #else( e* i# U% }+ D2 @$ h. a/ g
  49. #define DMA_PRINTK( x... )
    . z3 ~$ A) N; j  a
  50. #define DMA_FN_IN8 U8 F4 |6 ?; ]  `- C
  51. #define DMA_FN_OUT* z3 }$ l8 |& q
  52. #endif# f8 Q8 W0 \$ M/ ]$ f. f) A; T

  53. & H8 V7 f2 H0 B# ?/ s6 e3 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + S5 o' t1 a: _7 R2 ]
  55. #define STATIC_SHIFT                3
    : s9 j4 c& l1 {$ }% e4 z, ^/ e, G9 W
  56. #define TCINTEN_SHIFT               20+ J( C3 V: o: l
  57. #define ITCINTEN_SHIFT              21( V" O$ ~, R- H. ~4 O
  58. #define TCCHEN_SHIFT                22
    5 K; @* {/ I9 C
  59. #define ITCCHEN_SHIFT               23
    . f( x  J! ]/ ~* N; D- i% ~
  60. 1 J5 `: `, I8 k/ P* b) c3 Q( X
  61. static volatile int irqraised1 = 0;1 J2 |6 q6 X1 m% h
  62. static volatile int irqraised2 = 0;
    2 `. ~- s( @. v" M: i: I1 J
  63. + ?8 [! j6 w* @: N; D+ I( m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p5 k3 \& q: x1 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . q: r3 `2 J* B4 x- }! I7 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : H% n6 J) W% G' y& ^0 u" K! K

  67. 6 q2 L. g! Z, r; S; w' l6 }
  68. dma_addr_t dmaphyssrc1 = 0;5 H8 {& O: V; X, N4 g5 }( t
  69. dma_addr_t dmaphyssrc2 = 0;
    7 Y7 U0 `. K; R: `7 ^3 o
  70. dma_addr_t dmaphysdest1 = 0;
    ' v' i2 k+ p* q. y, |0 Y1 Y
  71. dma_addr_t dmaphysdest2 = 0;
    - ?3 n  e; n) o$ M* y; Z% _" D
  72. % B$ L, x" P; s2 S+ ~
  73. char *dmabufsrc1 = NULL;
    + G) O) N  ^- A5 P, [% S2 L1 y- c
  74. char *dmabufsrc2 = NULL;
    * i+ u. k3 n. A) ^& R( z
  75. char *dmabufdest1 = NULL;7 ?3 z; t- \+ N6 z* r
  76. char *dmabufdest2 = NULL;3 R9 v" M) y- {' C: A- t% B) ~# ^

  77. 7 z" C) `* v! C; o! J  A9 n
  78. static int acnt = 512;
    - M! ?$ o! S7 |4 {: D! Y0 U
  79. static int bcnt = 8;" R) v  u0 G9 [) [
  80. static int ccnt = 8;
    & m3 L8 D" b4 i0 s' E/ j
  81. " @) @! H# m! n" s3 l& Q4 W
  82. module_param(acnt, int, S_IRUGO);  D, O0 ]0 O  \" v3 J
  83. module_param(bcnt, int, S_IRUGO);: K% w  w& A* x& ?" d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 R: s, b8 Q. I3 g7 z" a7 c
" a1 i( M/ H' r, t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% T6 x4 n4 [2 Z. @$ {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 O; I/ u/ R% X" Q/ A3 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: k+ l7 E. n& f- z( d+ l$ y9 v* O9 h3 f0 ~2 V) V5 r. v# [

0 L" d# e/ ?2 y( h9 A2 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-3-8 16:14 , Processed in 0.040100 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表