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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( }: k4 ?* J+ s3 p/ h  B' I! \
  1. [code]EDMA sample test application5 e' d$ b. _! n( X: L) T
  2. /*$ m; t3 j0 f( L
  3. * edma_test.c8 N9 n% K8 ^4 N" J' {
  4. *
    $ u2 w$ v/ C6 C4 e8 i- b& F
  5. * brief  EDMA3 Test Application) J$ X  M: h3 E6 S' D
  6. *2 m. I' C7 f5 _- |
  7. *   This file contains EDMA3 Test code.
    0 x3 y2 {  l( |
  8. *
    ) P8 L- m5 U0 f/ p5 P! p6 e) }6 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# h; J: U5 b5 d3 D& m4 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # l& Y6 a6 o, @5 ]- s5 s: _
  11. *         TO CHANGE.
    % r; ?3 c- l" ~! r: [
  12. *! c7 H+ W+ f8 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) W4 }, o/ A, }' L8 n, F: L5 Z4 a
  14. *! S0 o9 Q8 K. G5 f
  15. * This program is free software; you can redistribute it and/or& e( o% k& _. P" R) u) v/ U
  16. * modify it under the terms of the GNU General Public License as( M# A3 a3 {% I  C- _9 K* w
  17. * published by the Free Software Foundation version 2.
    9 O* T$ a2 D" d  G$ ^5 E
  18. *
    3 {" |4 {; J2 A" N& S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ L+ L& x/ d9 \" G5 o
  20. * kind, whether express or implied; without even the implied warranty5 h% E& P6 d3 x! V. r7 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / V# Z% q0 k1 \
  22. * GNU General Public License for more details.
    / _7 i/ q6 l4 f( V# b
  23. */
    9 D4 N) G: x) k8 j4 O0 t% k( U/ A
  24. 6 J4 O1 E2 @! B1 R& j! ~
  25. #include <linux/module.h>
    ; K) `; c# y, r3 U/ n+ i% d
  26. #include <linux/init.h>6 o+ M' S: z. z6 N5 m$ C
  27. #include <linux/errno.h>8 ?/ d* g$ a( R8 ~/ `+ v& y
  28. #include <linux/types.h>
    5 a3 q# \! b7 z
  29. #include <linux/interrupt.h>: x1 W5 t* a& R
  30. #include <asm/io.h>4 H* t) _2 u+ O2 s% t& h# v% U9 r
  31. #include <linux/moduleparam.h>
    . u+ P6 T- v& L7 {0 y5 J" k% m, L
  32. #include <linux/sysctl.h>
    3 n- T+ [4 ?( c- l  d! |% E
  33. #include <linux/mm.h>7 e2 x0 N- x( s. `4 [* B
  34. #include <linux/dma-mapping.h>
    0 q0 \1 u. N5 [% V
  35. - @: R7 _9 B0 \; i- X' m
  36. #include <mach/memory.h>/ j$ @; q& ]/ C% ~: d6 Z
  37. #include <mach/hardware.h>
    7 ]' t/ F6 u4 R8 l( g) \
  38. #include <mach/irqs.h>- ?  V1 y4 \& P' D3 d4 ~
  39. #include <asm/hardware/edma.h>
    7 ]" _3 C- b2 Q

  40. ( F# C0 n; U; Y/ |1 D% T
  41. #undef EDMA3_DEBUG
    ( q! p8 _# C; t6 a! \- s
  42. /*#define EDMA3_DEBUG*/
    3 C( D( \1 R3 A" V' K! X! {; M

  43. ( W# \5 a' i, A9 L$ C" S
  44. #ifdef EDMA3_DEBUG' R6 q" e6 g  ~+ j1 n' n# s  Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! Q7 c' m6 Q7 Q; u! t: ]( t0 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 `3 o% ~6 K1 Z3 j4 s" H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 o6 G' b3 s, X1 C; A/ U7 r
  48. #else$ u8 Y4 w' u. a4 A6 e4 m1 S$ N
  49. #define DMA_PRINTK( x... )+ S+ |# v  j. j8 P0 ~
  50. #define DMA_FN_IN0 A3 S; E9 [  K& M# C0 j: l
  51. #define DMA_FN_OUT
    ; _8 Z; N: H: |4 Y+ H: Y
  52. #endif
    , Y2 r0 Y! i" v3 F$ _( L
  53. ( a6 O3 R6 w" H  r$ G# j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # Q; F" I) ?6 u) Q
  55. #define STATIC_SHIFT                3+ z3 o0 k2 k" l; j5 z+ ?
  56. #define TCINTEN_SHIFT               20
    + v3 ?6 H, k! u3 t% w2 l2 g/ h
  57. #define ITCINTEN_SHIFT              211 |! L2 z+ O/ z3 O# }! ~3 a
  58. #define TCCHEN_SHIFT                22
    - v  u, K7 [1 Y, m
  59. #define ITCCHEN_SHIFT               23
    $ q* b0 l& ^: e( b9 w# g$ y

  60. : D: D* F, `' m! n
  61. static volatile int irqraised1 = 0;0 q+ ?  B/ c6 m' {2 L% L( m- v
  62. static volatile int irqraised2 = 0;, f$ s* y1 m0 O% V+ r- I
  63. , T2 ^- }* ^) E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# \! Z5 I, [, L4 D& {: n% z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 g6 Q3 b* o( \) M; \. ~) v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M# S" ]8 d: Q& ~

  67. 7 y0 c7 H" f( s/ a2 v
  68. dma_addr_t dmaphyssrc1 = 0;- m: P3 T0 f: d* l
  69. dma_addr_t dmaphyssrc2 = 0;
    ) u9 Q" K+ ^! }* m
  70. dma_addr_t dmaphysdest1 = 0;5 w" p. b: L/ l
  71. dma_addr_t dmaphysdest2 = 0;
    ; s' X# {4 H/ W
  72. % b' d" c- k, M+ W1 G
  73. char *dmabufsrc1 = NULL;
    ' D/ P" N1 c# }2 |& a6 X
  74. char *dmabufsrc2 = NULL;
    0 B( O8 D. g5 W8 H) O2 s. T' B" k
  75. char *dmabufdest1 = NULL;/ E$ C, E1 A1 V1 c0 T  ?7 U
  76. char *dmabufdest2 = NULL;" `% e$ M8 e3 X6 D( ]
  77. 1 c6 t' _- {/ k; b8 ~+ G
  78. static int acnt = 512;7 ^0 d6 h' a9 [6 @1 p
  79. static int bcnt = 8;! _# j& z7 n/ l9 A# J
  80. static int ccnt = 8;: L/ L& A0 Q6 y% m5 S* D& U

  81. - o( P1 `' H: o7 }, Z
  82. module_param(acnt, int, S_IRUGO);: e. y0 m, W" e; J" B7 ?* @1 r
  83. module_param(bcnt, int, S_IRUGO);
    ) s/ P  e: S: Q1 K+ A  h1 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, q7 Q6 t; y4 m' M1 l: n, l
: j4 _  R1 w9 d7 x6 O  r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( Y1 J" h6 [0 n" a4 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ Z: ]8 {3 c! |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* B9 }3 e+ }" ^! `8 Z8 @! w8 L  L) `1 [9 g/ ~9 f" K2 |

+ S/ m3 z( m! H  ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 03:18 , Processed in 0.038923 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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