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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . _0 D$ \# u6 M0 M5 `
  1. [code]EDMA sample test application# M2 Y, O4 S1 j( S3 ]
  2. /*" t6 ?& G0 Z6 q) Z4 C  `
  3. * edma_test.c4 i9 L# N+ G. Y) K. x
  4. *
    7 c8 j& Y& V" T  r& G
  5. * brief  EDMA3 Test Application
    & A  M% X- o& c7 `: @
  6. *
    2 `' h% S9 Z7 T6 j9 n: ~/ n6 f9 u" {
  7. *   This file contains EDMA3 Test code.% n0 m. ^. ?: w2 @. o& N  b
  8. *( @/ A+ V; Z3 N7 {( \& Z) ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 C: k2 |' z( U& a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 |/ [( N4 h1 u' O2 D
  11. *         TO CHANGE./ i) v+ b! C; r0 S! ^; n, L
  12. *
    ' S* ~7 i4 M+ d: _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 {% V) r4 j" q% w, }* u
  14. */ Q4 L8 T' _1 d" R4 k6 g
  15. * This program is free software; you can redistribute it and/or
    . q/ Y" b4 ?: C1 B
  16. * modify it under the terms of the GNU General Public License as
    4 h% v( B, t3 j
  17. * published by the Free Software Foundation version 2.
    2 U1 [7 L' N0 D' U! H: H3 x* T
  18. *! t3 T+ i5 r- Q* H0 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 G* R% |8 D5 S+ r9 R: G
  20. * kind, whether express or implied; without even the implied warranty
    - r- s- g& C# z3 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! x- j- I1 U( x  @5 S
  22. * GNU General Public License for more details.
    2 V5 T6 \( O  t/ [4 T/ {
  23. */
    * {+ {: U; W; w2 H4 R$ [
  24. " f0 t7 D, Y, t! N' q3 |, P/ R
  25. #include <linux/module.h>7 I, T3 r- L' h9 D4 n  o
  26. #include <linux/init.h>. l. G. {$ r# _+ F  b* F
  27. #include <linux/errno.h>
    / G" m( Y% m; W7 Q$ {- D
  28. #include <linux/types.h>
    0 d* |; e. U- c1 u9 t, B
  29. #include <linux/interrupt.h>: ?' q7 Y0 |$ I: b& Q7 Z
  30. #include <asm/io.h>
    + }$ u. ], ^4 d: T2 a
  31. #include <linux/moduleparam.h>
    2 M! C. I" X& S1 f0 `. w
  32. #include <linux/sysctl.h>
    # l( d4 r. s. M- D
  33. #include <linux/mm.h>
    9 c7 A3 C" ^* a8 G
  34. #include <linux/dma-mapping.h>
    ( E5 b: H) I- \: ?. f8 Q
  35. 2 z2 u, r6 q6 E9 @
  36. #include <mach/memory.h>
    " ~/ W- f# R4 s& `9 |, O# ]
  37. #include <mach/hardware.h>
    ' ^% M, G, a" j2 s% n5 b
  38. #include <mach/irqs.h>$ {, H; o1 d, m  n" T' K$ B7 w
  39. #include <asm/hardware/edma.h>6 ?" y; j: k2 y/ j
  40. ! u' G/ `4 i! E5 @+ X- D
  41. #undef EDMA3_DEBUG
    0 A( T2 G5 c3 |3 F3 j2 Z
  42. /*#define EDMA3_DEBUG*/; j: F% W7 T4 i7 o% c

  43. ; M# `! A- N4 P
  44. #ifdef EDMA3_DEBUG
    + {" Q! o) I6 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 E" }- z( ?& E# y- w8 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ [2 u5 z& a) E" p5 n( b1 o7 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! F) V* d4 M1 w6 Q  R5 L- D
  48. #else
    4 R# b4 v+ u4 I6 ]9 G
  49. #define DMA_PRINTK( x... )2 F3 K% V6 I. ?( l# t# T
  50. #define DMA_FN_IN
    : S& ~% n+ i% L" }
  51. #define DMA_FN_OUT. Z2 V. a) V: T* M9 f
  52. #endif
    9 P, y" E5 b3 G, X
  53. 1 C4 K( d- n' I7 B/ m. O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; u, U) S2 r- M+ b7 v6 ?- B
  55. #define STATIC_SHIFT                3
    - R8 D; j+ N& u) A
  56. #define TCINTEN_SHIFT               20
    9 A6 L. Z! E/ S2 J' A) B1 f
  57. #define ITCINTEN_SHIFT              21
    5 |! q* E0 L. h+ }1 P
  58. #define TCCHEN_SHIFT                22" C( ~# |) L% X  [* b8 s, b
  59. #define ITCCHEN_SHIFT               23
    9 ^. k+ n1 f# e; M/ h
  60.   \4 a+ b- s" J1 h
  61. static volatile int irqraised1 = 0;
    ' b* G7 s, U" `9 F+ ^8 B+ g# G9 ]
  62. static volatile int irqraised2 = 0;
    $ k: _; q& n5 i  q
  63. 2 M, y7 c5 U" Q: m, s7 u% j+ S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 n7 W0 Y1 }, q. s9 A. z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q1 y  E9 b4 F- h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : B0 r- D4 k: _6 c' b
  67. , _1 A7 W$ r( S, E
  68. dma_addr_t dmaphyssrc1 = 0;( L' u5 H9 i' A. u0 U; ]
  69. dma_addr_t dmaphyssrc2 = 0;
    ' Y# g/ z( [. h- J; Q& |9 D8 |
  70. dma_addr_t dmaphysdest1 = 0;7 p$ }0 @1 H+ s4 d( O
  71. dma_addr_t dmaphysdest2 = 0;& P( ?$ [1 P$ g7 t
  72. - D5 e4 |0 O& m! v" k+ r$ E8 R
  73. char *dmabufsrc1 = NULL;
    , ]: K" W" Q. r' f6 H. h) H. Z
  74. char *dmabufsrc2 = NULL;+ Q! Z% k8 V" m3 R2 o) }
  75. char *dmabufdest1 = NULL;: W* \' C* F" t4 Q+ Q
  76. char *dmabufdest2 = NULL;6 s8 B% N% j% R$ d+ ^- j) ~& T! @) Q

  77. ! ^. ]4 H: }# C4 r
  78. static int acnt = 512;
    2 h& {0 f0 J: h6 p: p: k
  79. static int bcnt = 8;2 H$ O, u4 q9 x+ S7 b/ M
  80. static int ccnt = 8;
    ) f& s5 D5 _% i
  81. 9 n. x4 c! p) x8 I4 k! G3 f
  82. module_param(acnt, int, S_IRUGO);6 W4 X* Z7 u# R  C5 F, b
  83. module_param(bcnt, int, S_IRUGO);
    . D0 k/ X/ K/ H; j9 f3 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ u% A2 T- b: K2 S/ R
2 K  m, u" ^( y9 |* @% M2 T, s. j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 j, l7 |! K! o6 I- u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& W' C9 U& X8 R* N. P( |& d) `" p; q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 G) z. Z9 t: U9 S  \$ H( l3 w- I- V

. ?  ~! g6 X7 C' C# l- h: f* @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-21 11:46 , Processed in 0.047626 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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