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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( U6 h; z9 t: g/ V
  1. [code]EDMA sample test application
    / p8 x: q; n4 f: T% w
  2. /*
    0 l9 x1 [% ^! Q2 R4 ?: f& A# K8 c
  3. * edma_test.c
    5 Z; I3 G! V3 n4 q- ^! c
  4. *
    # p6 @# s6 b; l2 s" p
  5. * brief  EDMA3 Test Application6 J9 m, h' ?5 w9 m/ n
  6. *
    " t0 W0 w. k+ O: l( P: M& ^8 k6 a
  7. *   This file contains EDMA3 Test code.9 o6 z+ w* q# }* W' h% Z* _- n2 A& U
  8. *& k. A: \( Y* j* ]9 Q( m1 ~4 ~; k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ x5 a! a# V6 r# U: K) w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 E' d  z) c* E- A2 }0 j/ s8 |
  11. *         TO CHANGE.
    5 S6 u+ S2 ?: B) W, _
  12. *5 i2 w4 ?  H/ R( z  m' I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # }! ?# Z9 k! B$ e' S
  14. *2 O) z7 {, H9 ]9 R" m
  15. * This program is free software; you can redistribute it and/or- S- k$ ?: E; a& J) y
  16. * modify it under the terms of the GNU General Public License as. {; G; n# D5 w+ i7 M
  17. * published by the Free Software Foundation version 2.5 g2 n- k( o( g1 R! V7 ]
  18. *
    ( Y5 m# p4 f) i4 _' x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- h+ M% A+ q6 s
  20. * kind, whether express or implied; without even the implied warranty1 j1 [6 U  N6 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 h7 B7 ]) z, a: u6 Z5 S: ?
  22. * GNU General Public License for more details.1 z/ m& y  _" n( I  c' ~
  23. */
    ; f/ i3 Y) W  `0 s3 ~
  24.   n" W8 W8 s8 p' N
  25. #include <linux/module.h>
    8 V" F+ P9 q: Q2 b4 z& _! k+ r
  26. #include <linux/init.h>
    . t+ _+ {5 e' ~1 z
  27. #include <linux/errno.h>' M5 F2 k& i8 ~' d  z
  28. #include <linux/types.h>
    . m$ ~( j5 V, o7 W, q# z# n4 a4 s
  29. #include <linux/interrupt.h>
    & v) {+ G% B5 \1 F# ]' D1 I
  30. #include <asm/io.h>
    " e' q! X! G6 X' _$ n6 d. N
  31. #include <linux/moduleparam.h>3 T: I" U. h( V8 g: Y$ c
  32. #include <linux/sysctl.h>
    # [/ a2 C" c  T5 e& J
  33. #include <linux/mm.h>
    , f4 Q$ I9 x5 q+ e; E
  34. #include <linux/dma-mapping.h>
    9 f& j9 s& X& w8 W1 f

  35. 8 \' k" m9 r6 c/ P
  36. #include <mach/memory.h>
      Z5 c( l: F" c
  37. #include <mach/hardware.h>
    $ Z+ E' m  N! v2 f4 m* R  [  x
  38. #include <mach/irqs.h>
    5 p( m/ S+ T& M( J) I
  39. #include <asm/hardware/edma.h>
    5 }6 E+ ^% B' m% H, J, k- B

  40. 6 C  C' p; v5 _2 a! {$ Z
  41. #undef EDMA3_DEBUG
    + b# I5 u" u0 ]
  42. /*#define EDMA3_DEBUG*/
    . @* [( y) N" k. T* b
  43. " O, I, H: b5 i( D1 D
  44. #ifdef EDMA3_DEBUG
    ) q% U, M8 K/ ?2 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- E' O8 F8 R/ N/ u& R5 M, A8 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* m& g& E% k, _4 Y/ F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , w% \0 z: D& G: I7 s6 w
  48. #else) q. m# y* h- Q
  49. #define DMA_PRINTK( x... )
    6 U/ b- {% o# b# x
  50. #define DMA_FN_IN0 W5 O, n: M, k5 q; y9 J
  51. #define DMA_FN_OUT
    " X2 K, N5 ^" T  q! z( r2 M
  52. #endif- W5 I( G0 N- l4 E+ y% w: @
  53. ! o3 c* ?% d0 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' ^+ g3 c, p/ U; Y, o+ D
  55. #define STATIC_SHIFT                31 r, I9 G9 {7 E% m" Z. y3 y- L
  56. #define TCINTEN_SHIFT               200 k: \4 V$ F6 i* z% S, y, G7 Q/ |
  57. #define ITCINTEN_SHIFT              21/ q9 N( }. X# W# [" e$ ^
  58. #define TCCHEN_SHIFT                22
    # c& x6 b. I; B
  59. #define ITCCHEN_SHIFT               23
    5 E0 `1 T: }' t: m; U3 p

  60. 9 O5 E6 K- V( O: j
  61. static volatile int irqraised1 = 0;
    1 x" u7 H9 Q: _: g9 [, w
  62. static volatile int irqraised2 = 0;
    ; [6 r) P* Z& X2 }0 q

  63. , v( c, r$ l3 {, N: Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 `2 s# b+ Q8 ~  A2 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 m7 j' f, K% t# i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) E9 I# T) c9 W. H# ^5 `5 z

  67. ' F' \  q/ M4 O1 g: U; q
  68. dma_addr_t dmaphyssrc1 = 0;9 u- C) l' a; A) V2 o
  69. dma_addr_t dmaphyssrc2 = 0;
    : t3 n+ @% F: F8 b. e0 e
  70. dma_addr_t dmaphysdest1 = 0;
    $ \  w, g3 q! i& A; F
  71. dma_addr_t dmaphysdest2 = 0;) N: a, U5 c9 }; T+ B% p

  72. ; e* I4 ~+ r, D$ Q# }# a5 }2 n: w
  73. char *dmabufsrc1 = NULL;3 B! j3 u. g& X$ W. L" X! n8 \
  74. char *dmabufsrc2 = NULL;+ K( ~* x/ M! `$ f, b  d0 }( t
  75. char *dmabufdest1 = NULL;
    ( y# F/ j) y0 D% X
  76. char *dmabufdest2 = NULL;5 [3 |8 a% t$ u0 P7 v* X
  77. 2 z3 M4 |5 `6 M6 s7 X7 f' |
  78. static int acnt = 512;
    3 K9 W) O; p; w! H# Y& Y
  79. static int bcnt = 8;( ]1 V7 a. U: m% h
  80. static int ccnt = 8;
    : N7 D8 r1 r8 g% G% e" D+ J
  81. 7 l) v: x0 J9 Q& g) ]
  82. module_param(acnt, int, S_IRUGO);0 Z' |" {2 q) A
  83. module_param(bcnt, int, S_IRUGO);& G$ ~' Y  X) b5 X( r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, Y4 Q  O; `( P; A. Q' N. E. ^: O% H. v6 C; m  b, F4 t2 b/ k$ N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ G( @9 {/ b# K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 F9 C5 Q5 H2 F" m1 ~; b- w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 z; c- c4 R. Q  q& S+ ]

9 x' s6 N: d2 l7 N+ h9 a; N* f/ {/ I; f) p! h+ J: t, s  k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-10 15:33 , Processed in 0.042201 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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