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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' V* J8 S7 d$ R8 x/ c& s& W& W& D: d  {
  1. [code]EDMA sample test application
    ) X2 T8 K! X; Q! \, d  b& k
  2. /*0 @0 @& F! Z3 s7 ?9 w
  3. * edma_test.c, Q+ c$ ~( G  a6 T/ l9 H
  4. *
    0 O8 _( V/ H: q+ y) R
  5. * brief  EDMA3 Test Application) I: W) D* e7 p/ N
  6. *2 X% Z) B& M% v  F( o
  7. *   This file contains EDMA3 Test code.
    9 p6 C- g% _$ \+ v$ u- e3 c
  8. *
    5 \" V1 ]9 a  q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 n0 L& }' ]' \0 l% A; {. V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, j# o8 x2 g4 a* s: }
  11. *         TO CHANGE.
    8 C, g8 `$ J8 I) u6 [2 H) P
  12. *
    % i6 o( {* Z/ J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 E  _* H  }7 d8 @9 T
  14. *+ q! {, H5 e7 J+ l1 W# x
  15. * This program is free software; you can redistribute it and/or
    3 p( t1 ?" v& }2 G4 F( k$ q/ T
  16. * modify it under the terms of the GNU General Public License as9 p3 J+ i2 C7 _7 B  n
  17. * published by the Free Software Foundation version 2.
    : V, |, h0 J1 Y: \# s! r, L/ j
  18. *4 V7 x# }' e" t& {3 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ~3 o+ b% r& ^  H; j% }
  20. * kind, whether express or implied; without even the implied warranty) M9 m" W$ n# O0 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 m4 ^# M6 x% Q% K* j9 O; t( G
  22. * GNU General Public License for more details.
    # X  `+ Y+ Z" I" j2 N7 l) A) A
  23. */0 a- [" @9 X: }* o0 q

  24. 7 x+ E8 \$ R6 y% n' f
  25. #include <linux/module.h>3 W7 a) ]' v( ]3 y* M8 n+ W
  26. #include <linux/init.h>
      X" Y1 h* d! x1 @
  27. #include <linux/errno.h>* w2 e3 v0 U  D. q
  28. #include <linux/types.h>
    ) S$ q8 `) R1 L
  29. #include <linux/interrupt.h>
    ; V* ?% y0 O* a, H! q1 A! _4 ?
  30. #include <asm/io.h>. @+ s, @& C: \8 }% T: D( L% T" s* S
  31. #include <linux/moduleparam.h>, x) l' K: {& x" g" U+ ^: S
  32. #include <linux/sysctl.h>
    . B( |# l( I; k+ V9 u5 M) l
  33. #include <linux/mm.h>. P# }! I* x' g8 L
  34. #include <linux/dma-mapping.h>+ O4 r! g' _0 ?! g
  35. * f2 n. u% E( |3 i
  36. #include <mach/memory.h>
    1 c8 ~# z; z! F$ ]0 `$ m
  37. #include <mach/hardware.h>
    4 U8 v" b1 K% ?" v$ |
  38. #include <mach/irqs.h>
    0 ?, M/ W! a6 `& v8 a7 V8 S- M
  39. #include <asm/hardware/edma.h>
    4 e$ N2 g- M& e3 X

  40. 5 d0 [# y7 @0 x/ R5 ~& j/ b: B, A* Z
  41. #undef EDMA3_DEBUG+ ]3 G+ L' l) h; r3 U3 W) c: M2 w
  42. /*#define EDMA3_DEBUG*/0 V5 n- W# ]. ?! ^; {
  43. 8 W: {. B2 k& Z2 |+ W, X
  44. #ifdef EDMA3_DEBUG
    7 o0 B( X# f% W$ J  [! p# V7 ]) @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # D! o( V0 V$ m' u0 D; Y6 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + X6 b: X- I4 \. z. G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  h9 @$ Z* v: w& g4 Q' i
  48. #else
    4 b2 s3 j9 |' Z- W' [
  49. #define DMA_PRINTK( x... ). P# q1 @/ r! ]7 I
  50. #define DMA_FN_IN
    5 V7 L  n" ?+ ~' W* t+ t
  51. #define DMA_FN_OUT
    " \: ]' s' C0 \5 o' i' e4 l! k# h" a
  52. #endif
    ! k. y1 Z4 z5 y! q* ?
  53. 5 M+ o2 e7 L) J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' R* m1 G2 Z0 d  ]6 x  c
  55. #define STATIC_SHIFT                3
    2 Y% e" a9 Y6 Q
  56. #define TCINTEN_SHIFT               20
    # h. M0 N) a4 B3 L6 h$ g7 B
  57. #define ITCINTEN_SHIFT              21- ^7 t3 S, p$ @# l) ^. E% z/ f7 Y
  58. #define TCCHEN_SHIFT                22
    % b* ]( S0 Q' d$ I5 ]
  59. #define ITCCHEN_SHIFT               23& e" q- U, B: S
  60. ! K. j& x, _2 Y
  61. static volatile int irqraised1 = 0;% A! k/ F- Y3 I6 b, @. x) m
  62. static volatile int irqraised2 = 0;
    - c+ Y2 v6 [7 @- U+ V% H) h  o

  63. ) Q& [, k! S0 P7 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 w- C, ~. e# [+ S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 W2 B; m/ m4 h- }; ^6 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! {0 p" C) X- C+ y
  67.   z8 q' C  ^. c, V( T* z
  68. dma_addr_t dmaphyssrc1 = 0;2 w" ]  K/ B; @6 ^  a$ p1 G! e
  69. dma_addr_t dmaphyssrc2 = 0;
    + n, K$ e' [/ d* P
  70. dma_addr_t dmaphysdest1 = 0;% V- u3 ^8 b0 U6 M: @* Z
  71. dma_addr_t dmaphysdest2 = 0;
    ; c+ \, i+ y1 B7 Y
  72. " s/ q" O' T- \, g1 }1 e
  73. char *dmabufsrc1 = NULL;
    & P7 Z# ?) h; P2 g$ [
  74. char *dmabufsrc2 = NULL;$ M9 n4 M% O  q
  75. char *dmabufdest1 = NULL;
    . A/ `) d" `5 m
  76. char *dmabufdest2 = NULL;& S: B) l8 o3 M0 \6 z

  77.   n0 p! S/ C, K1 G0 z2 t/ L8 A
  78. static int acnt = 512;9 Z: m2 q+ E+ u5 d% O
  79. static int bcnt = 8;( f2 e3 Y- }5 F- I' U8 [
  80. static int ccnt = 8;
    7 L) ~* c8 b6 J& [5 ]

  81. 1 y/ l( x: t6 W% m: I# {6 t4 q' e, F
  82. module_param(acnt, int, S_IRUGO);
    ( P0 F/ M' p% K- ?  f# Z0 W
  83. module_param(bcnt, int, S_IRUGO);
    : Z7 Y& {' l9 H4 j8 L  [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& O0 Z5 S' r, T! e
- s. X) A' L  B& N- T1 }( ?/ H2 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ n% P7 {, V" l1 s# G7 L- zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 `+ w  W, C. @5 V3 S8 {' Y+ U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ h7 W: ?4 W! A
& }! \* c& ^5 }. V% i; l1 n4 l: w  }* x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 07:13 , Processed in 0.037652 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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