OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 u" U+ d# G5 d
  1. [code]EDMA sample test application) d9 O- Q, H8 i, @2 I# h" C. J
  2. /*/ l/ R, H$ ~: F, u
  3. * edma_test.c
    + K' s, V- b; w
  4. *
    1 b- ?; m+ H$ K1 S5 d
  5. * brief  EDMA3 Test Application; l) \, i% \7 m5 X
  6. *% S* X, L: q8 j
  7. *   This file contains EDMA3 Test code.
    ( Z- F  N5 O9 I, y
  8. *- S2 |& ?$ u$ Z8 S4 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 R. R; k1 R. O& x/ I2 t6 q8 ^* W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 }( o, {6 `0 e$ }
  11. *         TO CHANGE.. m2 k5 w. B# f- p' V" B2 z, e1 p5 Q
  12. *! y  l! _: q. u9 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , ~( v5 B, A# \' E2 h9 M
  14. *
    ) u: r0 D. f" [( \* O% e* r! q2 F
  15. * This program is free software; you can redistribute it and/or
    2 Y$ D2 ?4 }2 y$ J5 R
  16. * modify it under the terms of the GNU General Public License as5 L  E! n; T7 A4 [$ B. a9 @
  17. * published by the Free Software Foundation version 2.; m6 k7 n6 X) \0 q) k- U
  18. *& R  f; O. `  j5 p( s1 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + D. F, w/ z9 o* @4 ~
  20. * kind, whether express or implied; without even the implied warranty
    + D" h  \' {/ K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 i1 I2 D$ U% ~7 N3 [8 b1 w( o1 s
  22. * GNU General Public License for more details.
    $ R% A. _5 I0 C: q3 R5 u6 s
  23. */
    ! m/ T/ ]8 m2 u7 I9 X

  24. - ^8 |0 j: b/ n4 k+ Q! P# N" B
  25. #include <linux/module.h>+ p+ W/ N  t) R/ s8 ^
  26. #include <linux/init.h>! i9 s+ o6 P& U8 W/ l) u; g& x( A
  27. #include <linux/errno.h>9 }1 @" c8 r+ X, L
  28. #include <linux/types.h>1 k6 f/ b8 r9 N2 j
  29. #include <linux/interrupt.h>6 f% U; w5 f8 J' A2 Q( n4 m. M
  30. #include <asm/io.h>% l: S' @4 c* B5 S! N# I1 D
  31. #include <linux/moduleparam.h>
    7 {" K8 R$ C# i6 W1 K& [  z
  32. #include <linux/sysctl.h>
    $ S1 Z' P2 {+ v1 ?& c% u" N
  33. #include <linux/mm.h>% N6 J  v& V  \
  34. #include <linux/dma-mapping.h>
    , ?! N) s' G; ~7 E

  35. 7 ^# C$ r7 i: A1 R- X
  36. #include <mach/memory.h>' H& v  @6 t7 M/ Q" d: _+ R' E8 i
  37. #include <mach/hardware.h>' h' r2 f* {& r7 ^& a
  38. #include <mach/irqs.h>: e: q1 N! Z) k7 h
  39. #include <asm/hardware/edma.h>
    2 U( x5 F8 p! k0 _1 f* D

  40. + \2 H" T( Y- w  `
  41. #undef EDMA3_DEBUG! x8 w* E& ~) P$ Z; {
  42. /*#define EDMA3_DEBUG*/- N; E8 E# G$ s

  43. 6 A& F" W# t' Q& r( m: K! j& X
  44. #ifdef EDMA3_DEBUG
    0 L( Z0 I2 d0 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& E& M0 [/ r" f2 x3 x( R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 O7 [) n+ V8 S8 c& v( X2 i2 g# o" c: N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ |( H1 ~( c1 j- D) W
  48. #else
    # l# U* @$ l7 ]' R
  49. #define DMA_PRINTK( x... )
    ! B4 W2 I! F  R2 T0 l
  50. #define DMA_FN_IN
    2 b7 B# [4 }+ S( m6 O$ B$ v  ^' g
  51. #define DMA_FN_OUT# ^. u1 O. r7 d1 H) r
  52. #endif
    " J- s  H. O$ t# m$ e, Z
  53. " V, O; Q/ \1 a6 ]4 u$ o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): e' S+ \6 t% M3 Q4 _8 I
  55. #define STATIC_SHIFT                3! ~; v( N" Z" Y9 f) E
  56. #define TCINTEN_SHIFT               20
    ) h: z# t9 r" d1 F
  57. #define ITCINTEN_SHIFT              21* P! m# ]! _: T5 _% `: u
  58. #define TCCHEN_SHIFT                22
    ) {2 W2 `2 H3 R7 f8 u
  59. #define ITCCHEN_SHIFT               236 w% n$ ^( x( o* V  Y" n

  60. 8 }) }+ Q' k# S2 r5 m' Y
  61. static volatile int irqraised1 = 0;
    " }2 Y/ J9 d) Y( u# |) E
  62. static volatile int irqraised2 = 0;
    % _' V: V  s6 B2 n0 N8 j- `- k3 I. M
  63. / \, O# A1 B9 z2 q7 e7 m5 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 |' T; I. F) r. D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* _% U; ~! q5 h& q% ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : F- E8 _4 A0 H$ U4 z

  67. 9 `0 j' X5 Q% T+ X7 c! l6 Z7 i& U. Y
  68. dma_addr_t dmaphyssrc1 = 0;
    4 ^1 X3 O7 v; ^$ `( O+ L
  69. dma_addr_t dmaphyssrc2 = 0;
    - b2 s5 \/ n, S4 g
  70. dma_addr_t dmaphysdest1 = 0;/ R, y1 ~% x& J, G: a7 J. L$ B
  71. dma_addr_t dmaphysdest2 = 0;! U# }2 p' d6 K. V

  72. : M2 l4 U3 @+ m! h. f
  73. char *dmabufsrc1 = NULL;
    # @, x+ k! Z' E! a
  74. char *dmabufsrc2 = NULL;
    ! f7 [! _$ d8 i. o- t1 l. a9 @% E
  75. char *dmabufdest1 = NULL;3 h& F7 h0 ]1 V0 I+ }0 L
  76. char *dmabufdest2 = NULL;* Q: k5 d+ S! g+ D' b/ ~

  77. 3 ~- C& @! q# x2 B* M; x
  78. static int acnt = 512;' m0 u! h# Q0 D0 I7 i- O
  79. static int bcnt = 8;
    - g6 Y2 l8 e* T+ J% k, `) Y
  80. static int ccnt = 8;
    6 O) j' Y7 i4 r) y
  81. 8 l2 T$ \* G# y6 K: Y
  82. module_param(acnt, int, S_IRUGO);
    7 x; U0 r. z( X8 F
  83. module_param(bcnt, int, S_IRUGO);1 J: n" @" N: k" ]" B# ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ L7 t- R" \( c
8 y1 Z; T) b5 W$ t* P7 Z, C- G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( Y. H+ N3 O6 L3 h! X! `+ n0 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 P/ V4 }& K% {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 s, w5 ~# F2 z9 X, \, U

6 u9 u" P6 D" s. a4 O. q* W" ~6 S  [# ?% g1 V/ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-19 14:51 , Processed in 0.037375 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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