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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, `* r, b. B! @% [% C
  1. [code]EDMA sample test application2 r9 Q  A* |! k  Q# ~$ G( c
  2. /*
    3 [. B0 n! X2 m0 t
  3. * edma_test.c
    $ V) P! n" Y4 v9 P. @
  4. *
      q0 H% }% b2 T9 P1 u
  5. * brief  EDMA3 Test Application
    ( Y" s2 m' U: f7 @5 ?! I
  6. *
    + `; w$ r5 Y) `- O6 \4 A9 c2 y4 U* ]
  7. *   This file contains EDMA3 Test code.& ~6 P/ Z- ?5 B6 W
  8. *- t3 l6 R( G, d# e! I. S! }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' b8 e0 ^$ q8 C# E1 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" A3 a8 B: H+ u
  11. *         TO CHANGE.
    6 N3 G8 T  _5 {5 n7 O" k  c* n
  12. *( z3 f( F$ f; n5 _. V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 O8 q( g) O5 ~; F
  14. *- Q3 g1 V0 H, s$ b0 y& s
  15. * This program is free software; you can redistribute it and/or$ m  F+ d: X4 b2 e2 }( T
  16. * modify it under the terms of the GNU General Public License as$ `; O0 X: G8 F3 z% m, S
  17. * published by the Free Software Foundation version 2.
    ' z. R/ L' L9 |/ D
  18. *$ W0 t0 m# R2 g! d; j2 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" _& R4 E. N  Y/ }, X* B8 P
  20. * kind, whether express or implied; without even the implied warranty) b2 n' z6 _0 C1 C5 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 ^, P9 ^; O6 c# s
  22. * GNU General Public License for more details./ J1 h5 [/ o6 |  [
  23. */3 f) k, ?  z0 I5 u& o
  24.   X& J+ O+ t; p: k* G2 v' Z2 A
  25. #include <linux/module.h>3 o1 R& U+ ^4 b
  26. #include <linux/init.h>
    % c# ^. G- G0 v7 z
  27. #include <linux/errno.h>$ {- \% O5 X  X1 `8 p% h
  28. #include <linux/types.h>) f8 z5 p& c* B+ N
  29. #include <linux/interrupt.h>  p" E2 o" f; e# o. m
  30. #include <asm/io.h>) a8 a0 y2 J1 y8 {
  31. #include <linux/moduleparam.h>
    , H1 K) ?2 G/ i! e8 }
  32. #include <linux/sysctl.h>% b! u9 d' b  [* P4 w5 L9 i
  33. #include <linux/mm.h>
    5 a9 c/ n* C6 L3 X9 d
  34. #include <linux/dma-mapping.h>
    8 `, M* _& @7 c/ d7 r3 f: B6 v6 M
  35. 1 a& r- e! g" i! L
  36. #include <mach/memory.h>! V4 [3 c& [' K# t7 ]/ Q! p, p
  37. #include <mach/hardware.h>
    % d1 o6 l. b' R
  38. #include <mach/irqs.h>
    8 G. h- N* r4 ~) A- s; C! E
  39. #include <asm/hardware/edma.h>: b. M! ^* X* d; J; p* G9 l

  40. - j7 O1 I  `* Q# |
  41. #undef EDMA3_DEBUG( u& u) O9 E9 `: N  N$ T" S& ~
  42. /*#define EDMA3_DEBUG*/
    # h1 U& f: I# o
  43. 9 \& F+ G. U- w
  44. #ifdef EDMA3_DEBUG& _' F. J# q/ Q7 d. b2 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 n: b+ o4 H6 Y0 b1 }3 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* d( L) H" R4 ^; `3 n/ s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 j6 p/ c  @9 o8 u
  48. #else5 h6 ?% g2 a$ K3 p
  49. #define DMA_PRINTK( x... )' f* p8 Q0 y* Q, A1 u0 ~7 E7 t
  50. #define DMA_FN_IN
    - S$ n- |7 w% ~4 }2 A: M
  51. #define DMA_FN_OUT9 ?8 j7 X5 T% |
  52. #endif
    9 N' d5 x) L3 ~" }0 |$ j: {  ?3 a
  53. ! ]: T. z, \% T0 a! B4 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). l" C9 z# J3 `  q9 t
  55. #define STATIC_SHIFT                3# o& N) ?' F4 A6 i5 ], r
  56. #define TCINTEN_SHIFT               20' p# [4 ?6 A6 W' g1 ^
  57. #define ITCINTEN_SHIFT              21
    & D5 L! M, Y6 }% I0 J
  58. #define TCCHEN_SHIFT                22
    " b4 g; {: N8 N5 V
  59. #define ITCCHEN_SHIFT               23# w  |+ [9 R9 b! z2 a

  60. + K. k' E0 a, h& ~, o! f: K
  61. static volatile int irqraised1 = 0;
    8 E  H* H" p* Y
  62. static volatile int irqraised2 = 0;( ^- Y8 ?# r+ L- u

  63. 1 s% d! b; i; p5 Z  v7 S+ }3 X- x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 G, _/ u: s& r* q% R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 \& e9 B& o! K& \. {) ]2 N0 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 x5 B1 s+ E. p  L+ L% d
  67. 3 q9 r9 w9 ]6 g1 K, q, }& F3 E4 v# E
  68. dma_addr_t dmaphyssrc1 = 0;2 Q7 b" R: q) b) q8 K
  69. dma_addr_t dmaphyssrc2 = 0;* t8 ]* `  `( t! j; a
  70. dma_addr_t dmaphysdest1 = 0;* Y" t1 k7 m& y2 b
  71. dma_addr_t dmaphysdest2 = 0;
    2 A; Y2 x6 e4 |2 L4 n/ [4 }
  72. + |9 }* H6 z' v7 Y% K
  73. char *dmabufsrc1 = NULL;
    - k& U8 Q/ S. p' y" d5 n0 A
  74. char *dmabufsrc2 = NULL;1 S7 ]: @  p& }' V$ z8 f
  75. char *dmabufdest1 = NULL;
    5 T2 C% S6 f5 w4 l1 x) t  Q
  76. char *dmabufdest2 = NULL;: ]' ^# D) A, O- `4 n% Q1 y* J

  77. 3 f6 [: C  _2 s7 p+ e" |
  78. static int acnt = 512;
    8 Y! R3 U" t) Y5 s4 J
  79. static int bcnt = 8;
    # K2 X' O  i9 x1 t
  80. static int ccnt = 8;
    5 Q/ L7 r% F3 t
  81. 4 s/ u& a0 ^+ D! ~- C: I
  82. module_param(acnt, int, S_IRUGO);: |6 w, r: g, `; Q
  83. module_param(bcnt, int, S_IRUGO);! M3 F. N4 s6 ?  E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 [8 u; e1 |, K/ ~# H! p4 T* W1 i; ^+ |1 Q/ Y+ p  y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) s" R2 o6 Y- c; U4 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. \0 |1 F/ g6 s; j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" `3 e2 ]4 w& d1 b) [+ D/ ^
. r. I/ {/ e; T  ]! b- G
/ Y! p8 h) D& O$ b. @% V- W6 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 17:22 , Processed in 0.039795 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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