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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! L1 J* U, J% r& R5 p2 a
  1. [code]EDMA sample test application! k" i; b; j; M" z+ Y' b/ j( ~
  2. /*5 m' g8 `, E4 f& _9 r7 R9 h, @* k* Y
  3. * edma_test.c9 `0 s4 ]" Y5 @4 w" h
  4. *
    8 o# x! ?" D# k) B5 ]
  5. * brief  EDMA3 Test Application! Z* r' [) {5 w  ^3 {# S
  6. *7 g/ \; {6 N" a$ X4 t
  7. *   This file contains EDMA3 Test code.
    2 p* d! z9 M7 e( `8 ?. B
  8. *3 C. W- e% J2 b" d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. @, z" h7 Y- o# t) M4 Y6 r# J( Q8 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - j' j5 K% r% a2 E. f6 A
  11. *         TO CHANGE.
    ' m8 k' T1 |: {
  12. *
    ) [& A0 a7 v, W/ u3 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 R- B& ~4 n- i3 O
  14. */ e3 w, s6 g5 ^* ^6 Q6 K
  15. * This program is free software; you can redistribute it and/or& J+ F6 [+ c  S: f1 b
  16. * modify it under the terms of the GNU General Public License as
    4 _5 o2 k+ \! |
  17. * published by the Free Software Foundation version 2.
    $ l6 j+ ?( [( v$ Y& u  u* F9 v
  18. *
    - K9 h# d0 N1 ^& ~4 J; c, y; {0 ?# Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 K$ X( l2 d  e; A* Z+ _$ V
  20. * kind, whether express or implied; without even the implied warranty4 A1 U7 Z, j% Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + O6 g+ f  S  M0 i) u( ]1 L
  22. * GNU General Public License for more details.
    0 @1 j3 ^# P2 T. z& k- f& \
  23. */4 W+ B) q( U; U5 V  m; x4 L

  24. " h2 `7 h3 |3 F
  25. #include <linux/module.h>+ c6 l" H: e0 l" C; @8 J/ s4 P; y# H
  26. #include <linux/init.h>
    8 T, _$ ^1 @1 k3 u9 r' @1 g
  27. #include <linux/errno.h>
    ( N9 B; P9 S/ C0 {9 B6 j2 Y  z) J
  28. #include <linux/types.h>  k% l  G- C3 Q/ i6 U+ W
  29. #include <linux/interrupt.h>$ f; V9 n- I5 g, _, y+ v, b
  30. #include <asm/io.h>
    ; R# N. i# i8 z! y# K: j$ l
  31. #include <linux/moduleparam.h>
    4 x7 r+ p7 ]' p
  32. #include <linux/sysctl.h>
    - L# j" ]( g: `
  33. #include <linux/mm.h>2 u) [" L) g" u8 o& s+ O% Y  y
  34. #include <linux/dma-mapping.h>- Y; M& z2 t) h5 b0 \

  35. * \) q+ Q% g& k2 l& r
  36. #include <mach/memory.h>
    " S/ w* U9 Y, R4 M& ~
  37. #include <mach/hardware.h>
    ' u, k9 D6 i- y! n$ x0 n' Q
  38. #include <mach/irqs.h>' v$ `( {# D0 P6 O6 O
  39. #include <asm/hardware/edma.h>& o5 j0 s: C* i' l7 L
  40. / }4 S- F* Z2 {- G3 s
  41. #undef EDMA3_DEBUG. `2 c/ a( |" @1 k0 M# ]
  42. /*#define EDMA3_DEBUG*/: U+ Z2 y  O; |- J3 E

  43. 0 F2 ?" Y4 A- v3 F5 F* K
  44. #ifdef EDMA3_DEBUG
    , r3 s4 b5 Z! H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 ~4 [# c0 Y* H) R+ Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  t; |9 N! U! a# z7 N( I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - m9 M6 Q7 h  Z1 J
  48. #else
    " ~4 r7 u4 @8 t4 N8 `1 ]( A
  49. #define DMA_PRINTK( x... )
    $ g2 F3 s4 l% ^+ V  _
  50. #define DMA_FN_IN
    . H! x3 q' H' ^) h$ d% W
  51. #define DMA_FN_OUT
    ! ]* g- ?1 u" ?! e5 K) z
  52. #endif
    & m- H8 A2 \' l4 N1 r  {
  53. 6 k# u# \9 o! ^* E8 y, Y: o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 D# ~: b, K9 t+ O
  55. #define STATIC_SHIFT                3; W5 B2 r. M: c/ y: Q" Y
  56. #define TCINTEN_SHIFT               20# e9 m, S2 P7 t/ Q4 w* J2 h
  57. #define ITCINTEN_SHIFT              21- h: A2 N, T" M6 ?+ ]
  58. #define TCCHEN_SHIFT                221 x  e  E! w1 G1 C- d" M5 C, W
  59. #define ITCCHEN_SHIFT               23
    ' n3 H0 \* N5 I( T: p/ |
  60. + E2 h3 s0 \6 r  k  {: n
  61. static volatile int irqraised1 = 0;
    * C( a1 t8 U! c' K( o3 E
  62. static volatile int irqraised2 = 0;( n8 `; c5 @; j, f
  63. % \- @9 X1 o: {- o/ i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' L5 [2 Q1 T/ J5 S! V+ W' [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) p( h; r. u6 A' r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ w% Y; f" m' a

  67. , j$ z! K* z1 K9 V7 e  w
  68. dma_addr_t dmaphyssrc1 = 0;
    : Z1 s, \5 H- \  U
  69. dma_addr_t dmaphyssrc2 = 0;! @+ {8 |/ Y' d
  70. dma_addr_t dmaphysdest1 = 0;
    9 b- P& U" H' ~7 }5 x4 ?
  71. dma_addr_t dmaphysdest2 = 0;
    1 n( b5 _" S* t9 p& O5 _) ^$ m

  72. * `9 w$ h  v  w$ f  `. T
  73. char *dmabufsrc1 = NULL;+ Z3 O( O, a0 V5 T) ]
  74. char *dmabufsrc2 = NULL;" @) a0 T$ F1 @2 l9 p
  75. char *dmabufdest1 = NULL;
    ' J) L, B4 g1 p5 @! @. h
  76. char *dmabufdest2 = NULL;: \( G) E7 j. I# _) M  T% N; K
  77. , \6 X- c8 v) z0 x0 Q" R
  78. static int acnt = 512;# U$ j; d5 ^- J9 s5 u# E1 X5 u: i
  79. static int bcnt = 8;
    . b: N4 m# J: a0 u& r7 V
  80. static int ccnt = 8;; `) L7 z2 O( q$ O- L* T. Z0 k% A

  81. ! W, q7 w; ^7 p
  82. module_param(acnt, int, S_IRUGO);
    8 I" d! n2 v$ L5 n1 C7 F2 ~
  83. module_param(bcnt, int, S_IRUGO);4 |, s9 @+ s/ m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) A. t* O5 r, T! C! w$ Z& I5 ~7 ^4 g3 M' k, e& P6 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ J5 H- H- U5 P; q- d; m: N/ o, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! `  U; `0 p# \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 R' i. F4 E' x

# }9 i3 \% y, g- r$ Q7 r
, N0 m4 {9 ]$ I2 L0 e: [; j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 23:06 , Processed in 0.039242 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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