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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. t3 i' z) |4 F
  1. [code]EDMA sample test application
    2 E6 U& M8 s6 `( R2 Y( c4 Z
  2. /*9 j# s" Y2 d% \' n- o2 ~
  3. * edma_test.c
    . M3 c& F) {+ l6 m2 T# Y
  4. *; W! o+ ~/ z  N2 c5 d) x
  5. * brief  EDMA3 Test Application
    + `0 T; W0 Y2 W) i
  6. *
    $ E. x. E& ~( @. L  o
  7. *   This file contains EDMA3 Test code.8 p4 I, U! d# j9 y# |
  8. *' K' v$ ?4 P. Z+ M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- v  p' Z6 C! T' @$ H7 x$ m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ A* ?- a- }- t) n$ ]2 n; g; ~+ X
  11. *         TO CHANGE.
    ! E, I- `* G8 w7 X, F2 r. {' R0 a, |
  12. *
    8 A+ M- V8 G0 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) @7 A2 N: e& k, A5 j# p- G
  14. *# V& y3 q8 \6 p
  15. * This program is free software; you can redistribute it and/or: C; m5 q. ^" T  h
  16. * modify it under the terms of the GNU General Public License as9 p" _4 @; [, D
  17. * published by the Free Software Foundation version 2.
    ! O8 Y9 l$ q; n0 J, |' M* B' n
  18. *
    ( P8 o1 h- ?7 Y1 N% X. R  R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & y9 t0 Z$ x& q* ~1 p: D# _  Y
  20. * kind, whether express or implied; without even the implied warranty. q! _  p  L, r$ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " D1 @( I4 e+ y
  22. * GNU General Public License for more details.
    1 N: s1 q1 @! H2 G/ w0 T5 x
  23. */. z% r3 C. b  y; J! j1 I) ^$ X
  24. / U) Z6 W  ~# o5 E. x, v1 h
  25. #include <linux/module.h>
    , b# x' D: F( P$ Y$ G# s# J* {! |- o
  26. #include <linux/init.h>' E2 `* N3 `8 @, m+ D. n
  27. #include <linux/errno.h>( g2 K8 z2 A; \' U- u3 ]
  28. #include <linux/types.h>
    # G& O- j, |, v' p+ m
  29. #include <linux/interrupt.h>' s, I+ L( t2 c6 [  P$ p% P
  30. #include <asm/io.h>' j2 O" h3 J, y) t; d
  31. #include <linux/moduleparam.h>  O( O+ g: l& M8 H' w  W
  32. #include <linux/sysctl.h>
    " y/ I9 ]' K8 {5 F9 W/ \
  33. #include <linux/mm.h>
    1 Q  b0 b5 ~# q( U/ c
  34. #include <linux/dma-mapping.h>8 Y2 L' s$ h# V/ n
  35. 4 l$ K9 e1 A$ v* u
  36. #include <mach/memory.h>7 y9 g7 F: b) H, [/ k- M( U  f1 Y
  37. #include <mach/hardware.h>2 S4 {4 q2 P# L! o
  38. #include <mach/irqs.h>: ~0 T0 b- A1 h
  39. #include <asm/hardware/edma.h>
    5 L3 O$ B8 o' {9 Q( q" G9 N0 n( o: B* B

  40. 3 ^. S; Z! O6 k+ g1 t2 k
  41. #undef EDMA3_DEBUG
    ! T8 N+ [$ H( ?3 A' c
  42. /*#define EDMA3_DEBUG*/) W8 s- M5 R, K0 T  T

  43. ! t6 X" E4 F9 e$ z6 o- F- Q
  44. #ifdef EDMA3_DEBUG
    / F. e$ G* k5 z( C3 A# w! i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); i4 H7 K# J- U# u' Y8 J. ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ?9 @8 k$ }6 s, o# d5 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): I3 @3 ~0 j! h6 P
  48. #else
    / R0 y4 l1 B9 z0 c
  49. #define DMA_PRINTK( x... )
    7 t0 z: Q% W5 d7 U3 T
  50. #define DMA_FN_IN
    5 J& t' Y) l% X3 W0 ?( ?
  51. #define DMA_FN_OUT
    7 e$ I" I- Z5 E, o0 o, L
  52. #endif, j0 J0 ^  Z  m, p, V
  53. ; s* B, ^# U, h& B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; P7 d& x4 E: w$ x/ }6 W
  55. #define STATIC_SHIFT                3
    - B8 A$ R. Q1 m7 R1 f' a- p
  56. #define TCINTEN_SHIFT               20
    ( r% ]1 X$ D& X4 m6 \6 X
  57. #define ITCINTEN_SHIFT              21( N8 r3 D/ ~2 N8 e: O
  58. #define TCCHEN_SHIFT                22
    ( a, `7 e* j9 M! Y1 X3 O
  59. #define ITCCHEN_SHIFT               238 u$ b/ s0 _0 q0 ]

  60. + S- q# M3 `7 q7 J! a6 r
  61. static volatile int irqraised1 = 0;
    - l) i3 B8 l+ i
  62. static volatile int irqraised2 = 0;
    & Z& q$ s  A5 q( [$ J3 e
  63. % M0 |% @: e/ c$ w0 a0 U4 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( B% g! b( J- Y* {$ z+ l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 i  i) V* [( d# ?+ k$ Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  I# }6 e) d0 d1 |5 \5 |

  67. ( ?  m- ~" w0 L7 e; G5 f
  68. dma_addr_t dmaphyssrc1 = 0;# Q4 d. c! I$ e( b
  69. dma_addr_t dmaphyssrc2 = 0;
    2 i$ j# ~. }* s! [+ `
  70. dma_addr_t dmaphysdest1 = 0;/ R& \  T% Y% c7 l) R
  71. dma_addr_t dmaphysdest2 = 0;- ~" X/ N( x2 J

  72. " w- W8 K) e+ p; {& j! K. i7 A0 z4 B
  73. char *dmabufsrc1 = NULL;
    # [/ o1 Y- Q4 o2 R7 x- n
  74. char *dmabufsrc2 = NULL;3 C3 G, C- H  @6 {1 Q5 x
  75. char *dmabufdest1 = NULL;6 h. e0 f/ _( _1 R  V1 m8 F
  76. char *dmabufdest2 = NULL;
    - F4 }! J0 [! V$ h: }9 ?" U

  77. 2 x, d4 p) @8 q5 }" D% [- G. B/ B
  78. static int acnt = 512;8 ^  i% n  ^4 n
  79. static int bcnt = 8;
    7 Y3 C- }, B1 u" f9 G
  80. static int ccnt = 8;6 J( o, b6 t8 n. W  @

  81. 2 m7 @& t  a* r) X. F: {- u+ j, ~
  82. module_param(acnt, int, S_IRUGO);7 x6 l, P% y/ m2 f) ?
  83. module_param(bcnt, int, S_IRUGO);
    # t7 K5 f# N/ b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 {" r9 k; ^0 H# o" Q
+ }2 k2 N& B& _: s* ]4 s1 T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 S2 }' p# f+ W9 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 v0 S, E3 P3 D' k# U7 b% C" x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 T3 ~) Q* A2 U# ^5 Z5 r

2 C% i+ U2 l/ ]( m' }
# V0 @+ A3 }/ L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 07:08 , Processed in 0.040603 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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