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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ m" |% S# w. @
  1. [code]EDMA sample test application7 [/ _. R6 {4 y/ R
  2. /*% ?) ~2 Q% h/ o- Y
  3. * edma_test.c
    ( b5 D+ H1 @/ w! `# m; W
  4. *
    5 ]0 _9 |* g" F" o  w
  5. * brief  EDMA3 Test Application
    5 i) I( Y  b4 [
  6. *; R. _9 }6 |- B& I
  7. *   This file contains EDMA3 Test code.
    # Q) F, N5 j. l
  8. *4 j1 e# \# Q4 ^; k0 l, M) R/ Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ Q  u) E; v2 ~2 {) D# S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 B5 W: e. `: A% T# g; n2 o
  11. *         TO CHANGE.
    4 e4 B2 B7 {4 C: D% V5 s
  12. *' [! L4 b3 X: }$ z$ Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 b/ \' T+ F) p( [5 V
  14. *
    6 h% f' L. o7 \8 ^; _  A. }
  15. * This program is free software; you can redistribute it and/or
    : k- _  k% k4 ]
  16. * modify it under the terms of the GNU General Public License as
    * t7 O6 L* }5 c1 b* p6 Z
  17. * published by the Free Software Foundation version 2.
    # Z" B& O  \! D1 Q; ]# e% `: _
  18. *
    0 R/ }. [% D- f7 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ g) [& f0 J( }+ S8 N: K5 X0 R9 F/ @
  20. * kind, whether express or implied; without even the implied warranty
    . ^. P$ b8 D  u9 i/ p+ d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 ~0 b9 q$ |* G" z' w+ ~" m
  22. * GNU General Public License for more details.
    4 F: n1 h/ a% _7 b
  23. */
    - x. n$ d( e* x. l8 v

  24. ' g* w, Q( ?8 ]6 Z) k+ _
  25. #include <linux/module.h>
    ' P- r7 n+ j1 l, k8 ]: z- i. \# f
  26. #include <linux/init.h>
    ; Y5 m+ @& g. H- Z# k3 {4 H: x
  27. #include <linux/errno.h>
    & Q/ T4 q3 t4 i- K2 n
  28. #include <linux/types.h>
    , t8 y% K6 c% W9 Q- Y- Q2 p
  29. #include <linux/interrupt.h>$ V) C  l8 a& a4 w* G. s3 a
  30. #include <asm/io.h>/ a3 {9 O* z" t& |- I
  31. #include <linux/moduleparam.h>
    : w- O# \2 M% o
  32. #include <linux/sysctl.h>
    ; i  V1 R* A: ~# W5 k$ f
  33. #include <linux/mm.h>
    * _# `2 A+ i) G( J/ o( O
  34. #include <linux/dma-mapping.h>
      l0 p' X+ w# |, g; u% [$ m' D
  35.   T( S  h& r1 ]) x2 \
  36. #include <mach/memory.h>
    : B# J' d8 W1 v* y0 M6 k0 b' z
  37. #include <mach/hardware.h>
    ! S2 K) z& J5 ?
  38. #include <mach/irqs.h>
    ! y  j; q8 K6 \; p7 ~5 @
  39. #include <asm/hardware/edma.h>0 t' U7 U& q) o6 A& Z* @  ]
  40. % D/ }$ z. @0 \/ N( o* \) E/ [
  41. #undef EDMA3_DEBUG
    : C# t$ E4 f' h6 ~7 C1 [  F" @
  42. /*#define EDMA3_DEBUG*/7 Z$ P, l/ `" \5 Q  f9 z4 K; X) L5 r3 @

  43. : h6 ~+ l* y6 U# f8 h, y/ h
  44. #ifdef EDMA3_DEBUG
    9 q6 M* x/ e& J, y  I5 {: K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( H& l: r% m# ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * J3 V% Z2 ]5 S, s9 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 N) d: S9 a+ ?/ C4 ?
  48. #else
    5 {6 E. L( Z0 c& j" X
  49. #define DMA_PRINTK( x... )" H4 {8 _' F; t  {- e, B
  50. #define DMA_FN_IN
    ! f+ p* o4 X8 G1 k6 B, F8 X. b
  51. #define DMA_FN_OUT
    * j% l$ X+ F1 Z! X9 m$ d
  52. #endif* N# i9 D) t% m2 ~) E

  53. / t* Y* e0 T7 _6 y8 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ z" O1 V/ |( b: I
  55. #define STATIC_SHIFT                39 X- u$ F: m7 m& @! I1 G
  56. #define TCINTEN_SHIFT               20
    9 T% q: U4 T. n! D+ r$ f2 S
  57. #define ITCINTEN_SHIFT              21
    $ |0 y9 [2 m4 e! \
  58. #define TCCHEN_SHIFT                22
    " Y4 J& W# }$ t! M: m! N6 }  [
  59. #define ITCCHEN_SHIFT               23
    # }9 F! c; s; O

  60. & V  l3 ], r( j1 p
  61. static volatile int irqraised1 = 0;* G5 N- z. F5 n( B
  62. static volatile int irqraised2 = 0;
    * A9 c7 g3 z% G% Y9 c" \
  63. ( m% a* n% Y5 Y& Z4 ^2 Q, F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, m: Q0 [0 j! k. I* a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 l9 x9 [& q+ ?# K6 X6 G( l2 @  w# y, o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  d, S' T* j# N9 T# x. ^( @
  67. 8 k$ Q& Z6 g5 J0 `8 W7 q+ J8 ~/ V
  68. dma_addr_t dmaphyssrc1 = 0;' [7 u! v4 E+ b" y$ N
  69. dma_addr_t dmaphyssrc2 = 0;
    7 P% k- h: N+ `( V5 K
  70. dma_addr_t dmaphysdest1 = 0;$ D: Q+ Y& M! _( c: p" E4 h) \6 e0 Y
  71. dma_addr_t dmaphysdest2 = 0;" e4 u' O6 d1 p3 d

  72. 4 V& V6 s* q7 G5 U
  73. char *dmabufsrc1 = NULL;/ }# q% y+ ?* r3 h; [
  74. char *dmabufsrc2 = NULL;
    ' E0 ?$ i5 M& q; m0 i; a
  75. char *dmabufdest1 = NULL;1 \$ m0 j7 ?& m7 D- Z/ Y1 c( x
  76. char *dmabufdest2 = NULL;
    9 {, |% t" a0 {- Q& e0 a

  77. - k/ s7 x/ D% o# g9 F& b2 J
  78. static int acnt = 512;( u5 F/ D5 {7 m3 @& [) b, r
  79. static int bcnt = 8;
    & Q, m$ }9 k3 x  V" R, X/ B* u
  80. static int ccnt = 8;' X7 t& l& }; h. M
  81.   d( R3 l! c! i6 Q5 X, e% Z
  82. module_param(acnt, int, S_IRUGO);
    ) @8 m+ a! s4 W( ^8 Y# [) w# v" g
  83. module_param(bcnt, int, S_IRUGO);
    2 q$ J1 u9 H( z# D, V9 l; K( B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 R8 D- A7 j& \( f1 E: V8 C& g
7 Y) e8 E3 O' X4 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) H! e+ M, L# I6 u9 f6 e" h) r- c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 V% R0 ]& ]7 a) `/ L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  }0 |9 ?7 L7 M. Y- P* d% v' H
" B& M% a0 T, M; B
; q  H% g5 T+ p" g0 u+ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-26 02:34 , Processed in 0.043735 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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