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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / H" y0 D/ g/ j& h" k5 x
  1. [code]EDMA sample test application+ k) ^2 ^- V: o; P6 }
  2. /*- s: J$ F4 d2 T8 @
  3. * edma_test.c
    $ r* C" Y* G$ `5 T8 z3 V
  4. *
    & I% Q! a1 `; a/ @5 I; C
  5. * brief  EDMA3 Test Application
    0 p- _% o9 T$ L3 B9 L5 y; z
  6. *& h7 f' ]+ Q& g/ G$ b6 E9 h+ F. }! C
  7. *   This file contains EDMA3 Test code.) _6 x% M: R$ `- Z3 v
  8. *: G. S9 F+ ~: J; J$ T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 D2 L, p+ q7 l6 Q( k/ e0 J  ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; k5 D0 @" p3 J: d' ], F0 ^
  11. *         TO CHANGE.
    # F1 z' c- n% R0 W$ ?
  12. *( |8 G' T. z. F. p. L7 V+ v! N( J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; c; v, ?5 B- N1 _. B6 P4 n
  14. *
    # R0 @0 D- H4 t% N" ?0 Z
  15. * This program is free software; you can redistribute it and/or2 y- [) g/ L, \7 L
  16. * modify it under the terms of the GNU General Public License as" _$ h2 _+ v2 F* I6 E3 Q
  17. * published by the Free Software Foundation version 2.
    : b* G0 D& O: S4 j9 m  [
  18. *
    : T" Q. @! s$ M7 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- J1 d" f; e- k6 o" v0 q
  20. * kind, whether express or implied; without even the implied warranty
    5 }; v' y% A) f" m5 M* e- }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( J$ ?# j; p: L: S: f
  22. * GNU General Public License for more details.
    ; ?5 H* W/ \% T
  23. */$ ]( |, `0 J: L+ j

  24. . b* c) @# H* N6 \
  25. #include <linux/module.h>- H* o+ V' D2 Y
  26. #include <linux/init.h>
    - q! K( y/ ?  p: r, F9 f
  27. #include <linux/errno.h>* W* m4 @2 A4 m. O
  28. #include <linux/types.h>5 w& r& \& h) H( }- |
  29. #include <linux/interrupt.h>
    ( \$ b2 n! O$ H* S: ^) c+ J( b
  30. #include <asm/io.h>  m$ B0 [4 x; Y2 @( h
  31. #include <linux/moduleparam.h>- l2 n# M1 J: c/ \& h
  32. #include <linux/sysctl.h>4 \( E. S; F0 L( g
  33. #include <linux/mm.h>2 K' |7 W9 A: F" N
  34. #include <linux/dma-mapping.h>2 V1 H9 c4 U/ }

  35. ) L6 ^5 t) l. M2 l
  36. #include <mach/memory.h>8 U6 c8 g% v1 _
  37. #include <mach/hardware.h>- J, U" O4 [9 E; ~- H; I$ O
  38. #include <mach/irqs.h>* B) [' ]  \+ l9 s1 }; ~) r
  39. #include <asm/hardware/edma.h>  e1 v. O5 G) ]/ Y2 R3 o! L

  40.   a$ O! |* M, I; D: d
  41. #undef EDMA3_DEBUG; Z8 d6 b( }9 k
  42. /*#define EDMA3_DEBUG*/
    ' I4 @# y0 q* T* B9 E& P

  43. * t" a) |5 p; K, J! @
  44. #ifdef EDMA3_DEBUG
    & ~( W: W/ @' L0 j# c$ I2 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - v2 I$ d. ~/ @+ [! i1 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) V! K" E2 n" L8 {  h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 N- G! Y) N8 F4 E' U
  48. #else% S" _+ A9 G& ?% m6 ^- O
  49. #define DMA_PRINTK( x... )
    - j: w2 x+ L4 T9 g) z0 p3 g
  50. #define DMA_FN_IN8 G& [+ J' l& W& h2 m9 T
  51. #define DMA_FN_OUT$ q. y: [5 X0 s# ~" W* V
  52. #endif( N! @3 m( }8 V4 U
  53. 1 c# w. s7 W2 ^6 @3 y8 U# F; K: K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 a; i8 P8 X" S. q$ \
  55. #define STATIC_SHIFT                3
    ! K. M5 |2 ]* c3 a6 a
  56. #define TCINTEN_SHIFT               206 G( U9 h; S* m  U5 i7 b
  57. #define ITCINTEN_SHIFT              21
    # R- H! O9 m* S
  58. #define TCCHEN_SHIFT                22
    : R2 H6 a! W5 g) |6 k, W2 X9 u' _
  59. #define ITCCHEN_SHIFT               23
    ( J3 U9 a4 q$ S" C) R
  60. 9 o! M% ~) s$ N0 x
  61. static volatile int irqraised1 = 0;
    . c' J3 E' p1 ], S# L4 K
  62. static volatile int irqraised2 = 0;2 _5 V! Z& q* Q  Z  L

  63. . V: z( H0 H) j( C, g6 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 f0 s  w. R2 v- `: f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * J" {. T: I6 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 r7 ?4 w+ ?8 Q0 H5 E2 N  u# I" I

  67. 7 J! d. }* ^, N% V. U" _& s1 ^
  68. dma_addr_t dmaphyssrc1 = 0;, v3 y3 q* L1 k; {+ v( e
  69. dma_addr_t dmaphyssrc2 = 0;
    ' ?1 s9 m" u( J  J+ |
  70. dma_addr_t dmaphysdest1 = 0;
    9 h" p: P/ c9 a* `9 q; {! `
  71. dma_addr_t dmaphysdest2 = 0;
    7 ?2 V4 `' F4 E+ W) d
  72. 1 X/ G; ~+ R+ x% [4 X
  73. char *dmabufsrc1 = NULL;
    8 A2 f" G' [( |+ u6 L
  74. char *dmabufsrc2 = NULL;
    * i0 E9 W& e$ |: T! Q
  75. char *dmabufdest1 = NULL;
    ! n$ R' I# r7 O, m9 i9 n! y
  76. char *dmabufdest2 = NULL;" r, K! k. b0 ~% Y6 e6 _! E

  77. 7 c; ]. A4 h, Q. j& H; _  N) K( p- q
  78. static int acnt = 512;
    . d) b* _% b. ?* L. Y! D1 o
  79. static int bcnt = 8;8 Q8 L8 ^" c8 {6 `; z/ O
  80. static int ccnt = 8;
      Y9 C( ]* C/ d$ M; @8 p0 F& W

  81. 7 M/ e8 T1 a( ?. {7 {& i5 u7 g1 U4 e
  82. module_param(acnt, int, S_IRUGO);; ]" D2 a) {" D
  83. module_param(bcnt, int, S_IRUGO);, U, G+ a* r6 c/ b4 O, {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! I2 s8 y" D- f, a! B  C. N; c9 ]" w% S1 E; ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' O1 y4 d2 H$ h, f0 W3 H+ v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& _) x0 r- \5 `" n' g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& B7 T& W6 d" v" D" B0 ]5 a: G% N
3 p; F3 m* _9 z9 a2 l" k9 T  g2 W

) u. h; d/ \" c; t7 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-15 08:07 , Processed in 0.039533 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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