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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . S$ S6 @7 F* b2 l
  1. [code]EDMA sample test application
    0 }7 p, e2 A; P  V  W
  2. /*6 v$ P+ W  r6 n  o) L+ T& q. W
  3. * edma_test.c7 {! g+ ~  W, r- D
  4. *% v4 ?& b* ?( h" p9 y( o
  5. * brief  EDMA3 Test Application* x8 b/ Z! |5 p
  6. *7 y2 O0 `2 h3 }
  7. *   This file contains EDMA3 Test code.) ?' S9 J/ V. b# ~( }4 ]
  8. *
    + x: H# N" |# p1 T# R8 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 g4 }0 d6 C+ U. R7 g0 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% s1 X( [$ x* _( v# N4 x- C
  11. *         TO CHANGE.
    ' P$ R0 ~3 s" r/ O8 q( r3 w) i: o
  12. *
    " \; H" c* [5 O$ ?* _) h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * o4 s0 F. t* M2 U
  14. *3 R7 D3 T) z0 l1 s! n' ~7 {1 ~
  15. * This program is free software; you can redistribute it and/or
    8 \/ `7 I& H& @3 }9 z! n( @
  16. * modify it under the terms of the GNU General Public License as9 Y. ?0 b1 T  R, A$ H6 Q
  17. * published by the Free Software Foundation version 2.8 V+ \& y" e1 ~7 B
  18. *# I8 Y( Y1 G- w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 N9 U, T- V0 y, R' Q
  20. * kind, whether express or implied; without even the implied warranty
    2 P. a' R1 A: C6 i* b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 m3 d4 V  y5 `& B# Q0 b1 b
  22. * GNU General Public License for more details." ~- V3 Q" o) D1 S) `! k% z
  23. */
    ! ?* d  l7 Y2 E  C3 }5 |+ B' q
  24. . Z7 x  `1 n$ O- e' I' ]
  25. #include <linux/module.h>% {/ i5 {- \  x3 V( {
  26. #include <linux/init.h>% ~, m; z1 _/ c# |8 H
  27. #include <linux/errno.h>* G5 D7 E* f9 `; K& B
  28. #include <linux/types.h>
      x9 e+ i) u5 i8 X1 t- X8 O) _
  29. #include <linux/interrupt.h>
    ! @6 o8 F/ \2 U' Y; g
  30. #include <asm/io.h>3 X* j3 S0 u$ f
  31. #include <linux/moduleparam.h>
    * v9 q( K- X& A% b' Y* U& h  S( k& i
  32. #include <linux/sysctl.h>* j4 p+ ]3 Z8 f: c% p' q
  33. #include <linux/mm.h>
    . ~4 E$ ]4 g( g4 }0 p
  34. #include <linux/dma-mapping.h>' X6 r& V# Q- m4 b

  35. 3 W2 |& {- O3 _
  36. #include <mach/memory.h>4 X: s; {; `# X9 H) d) l
  37. #include <mach/hardware.h>( W4 d' M2 d5 Q7 X5 H+ D0 F
  38. #include <mach/irqs.h>
    1 x- o% j% N; n, }, N
  39. #include <asm/hardware/edma.h>" ]( s, s8 f, `; [- D, w& \9 j

  40. 0 n  u) \! j9 R
  41. #undef EDMA3_DEBUG
    . C* m; x5 c8 s+ h' B
  42. /*#define EDMA3_DEBUG*/
    % Y* U9 q! h7 \  e3 H

  43. 2 X$ U* N4 i7 ]. B, n
  44. #ifdef EDMA3_DEBUG3 B) b0 P# L/ X5 `$ W, ~6 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . h' N4 n) T8 \! q( L  V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); j3 q' \; K& d% t0 t9 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) s+ z0 k1 P( ?  o- p
  48. #else1 z0 u. W. z. K5 K9 g  W
  49. #define DMA_PRINTK( x... )
    $ P9 D1 K$ W$ |# o
  50. #define DMA_FN_IN
    + v# H: ?6 ]9 s$ @4 [' {" Y
  51. #define DMA_FN_OUT
    / T0 M; M# k& \0 i4 ^* Q
  52. #endif
    / c8 U. }4 i! F9 g5 ?0 |0 p  C# C

  53. / `& c' ^. W5 }" c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 C! A  g! Q2 N5 [/ D/ q- H5 Z  R
  55. #define STATIC_SHIFT                3' K' ?/ k: {- P7 a$ E" b% O6 C
  56. #define TCINTEN_SHIFT               20
    ; e3 J* V- z! `  H9 `
  57. #define ITCINTEN_SHIFT              21  t4 f6 X* V  m+ F
  58. #define TCCHEN_SHIFT                22
    ! K6 s, l+ H) E8 o
  59. #define ITCCHEN_SHIFT               23
    . h( j; g0 ]: J' M# q

  60. ' |* g& r, _3 v' t4 @0 W
  61. static volatile int irqraised1 = 0;
    + O4 N, E5 ~4 t3 P, o
  62. static volatile int irqraised2 = 0;
    & @2 g6 }/ x- S- d" {
  63. $ r$ k5 u: e3 r. Q* x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( K) f4 x3 m; F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & L! @( c+ t- v9 U4 G5 [0 t: a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 X& l5 z- g! K% I8 {
  67. " v; L4 Z. i+ @' b3 v4 X
  68. dma_addr_t dmaphyssrc1 = 0;- p' c% g+ b! p1 i" X
  69. dma_addr_t dmaphyssrc2 = 0;: ?  _3 {! T7 k# U9 r$ ]" k
  70. dma_addr_t dmaphysdest1 = 0;
    & k$ C1 X0 ?) V" f' \
  71. dma_addr_t dmaphysdest2 = 0;( y1 m- Z. T. Q1 x% r' i6 m
  72. " q, U1 @) a- d6 k1 g9 K# S
  73. char *dmabufsrc1 = NULL;
    & \' F9 ~* E& V+ }
  74. char *dmabufsrc2 = NULL;2 d1 B( m' r" p6 n/ W
  75. char *dmabufdest1 = NULL;4 U: ^) g0 g  O7 L5 K% k3 x
  76. char *dmabufdest2 = NULL;
    ; d0 C' m+ t" ?$ z9 [4 A4 {7 r, a

  77. 9 p( ~* H  a+ i" A6 l$ l. _
  78. static int acnt = 512;
    % _+ o2 G( R, M! `* h
  79. static int bcnt = 8;
    / p2 g( k2 D! L
  80. static int ccnt = 8;
    0 M) T+ a% A1 R, E: ?( N; T

  81. % Y- }6 I2 p6 R0 J
  82. module_param(acnt, int, S_IRUGO);$ V5 ~. I# ]. q+ g8 v" [/ n
  83. module_param(bcnt, int, S_IRUGO);. N% ~+ {4 q% O- D8 W: Z, e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( n  H5 S, h' w) R0 Y6 J
& v3 Y7 F- D' J/ n2 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 b" M9 Z9 I, h3 D) parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- {  s, o# m. g) P9 G7 }. w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 V" T3 j/ q4 I1 B5 Z& x

0 E) s' P5 n+ K( B
! d  n7 \# j- O. {# s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 14:05 , Processed in 0.041391 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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