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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 l3 l- D& O; r& [
  1. [code]EDMA sample test application+ o  h$ a( `, t" i9 O9 ~
  2. /*
    ) h$ \  r, N+ ]+ ]+ L
  3. * edma_test.c
    4 A3 ~0 n9 ]  \; c7 l3 Y7 U* e
  4. *
    / P" J' B# p2 y
  5. * brief  EDMA3 Test Application& B; Q7 X- l# O' T6 A/ _( q1 Y
  6. *1 `  ?0 F4 Q6 `) C4 e  n8 V/ i: m
  7. *   This file contains EDMA3 Test code.
    ! _; P* |: ^  ]! X7 A& \3 r
  8. *
    & E+ f0 L' h% E. p5 L  ]/ @0 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ v+ [. \9 S7 K7 F) F$ q* ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 [* Y. J. ~4 @3 A* }
  11. *         TO CHANGE.
    ; Y4 O3 c  Y+ r1 C$ U# N
  12. *
    5 u/ c3 v. x" n/ C7 |1 _$ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 m, o2 A8 W, r* i
  14. *
    0 h+ F& t3 E) ~# F0 U$ v
  15. * This program is free software; you can redistribute it and/or
    6 P+ i# R# U5 k# e* Z& ~: M$ k
  16. * modify it under the terms of the GNU General Public License as! B5 Z% M% y, {1 g+ V% |
  17. * published by the Free Software Foundation version 2.
    - A) X; [* x6 I7 U: O9 Q# {7 Q( P/ O
  18. *
    % g6 B. U8 T" B% u. P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 d( K' o. J+ L4 V4 p$ e
  20. * kind, whether express or implied; without even the implied warranty% U3 M* Y, L4 |* D, @9 D5 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 |; r# y2 t" K8 S9 e
  22. * GNU General Public License for more details.) [+ T5 G" b0 T! S& Z4 F
  23. */1 u7 ]/ t2 `- o1 a+ x2 \
  24. 5 Z% J( N2 t; R% Q) i; r
  25. #include <linux/module.h>
    , x6 k. U0 Z0 G
  26. #include <linux/init.h>0 U( q( b& F& N5 {) B1 c
  27. #include <linux/errno.h>
    $ ?, ^" \) t2 I9 |- T& `8 g$ ]! E
  28. #include <linux/types.h>
    4 ^! v2 ?; u- z% V* D: a5 C
  29. #include <linux/interrupt.h>
    / f+ a( o; R3 M5 M/ d! }, @
  30. #include <asm/io.h>
    , D& }  w2 Z5 k
  31. #include <linux/moduleparam.h>7 s; G. G9 A  Z: k9 V: ~
  32. #include <linux/sysctl.h>5 X& D( I# E; ~4 _$ O' |3 y2 I
  33. #include <linux/mm.h>
    1 Q% h6 H1 I- c6 p) Y  n+ K
  34. #include <linux/dma-mapping.h>
    1 }+ A5 f3 X) {
  35. 4 z4 B( {7 n! w
  36. #include <mach/memory.h># }- M5 m* A% L) R, f1 j
  37. #include <mach/hardware.h>9 Y/ Y4 G6 ~& A3 a  ?
  38. #include <mach/irqs.h>
    5 v% S, |9 `; k# V7 j' k
  39. #include <asm/hardware/edma.h>8 V* K  t+ f" P& W' _

  40. 1 ~- l- Q) V, `4 m: }! f
  41. #undef EDMA3_DEBUG
    8 U2 \) F7 _  Z- Q/ d
  42. /*#define EDMA3_DEBUG*/
      g2 w3 ]  Y& p3 L

  43. ; X) p/ y0 A% i: r
  44. #ifdef EDMA3_DEBUG( t6 \# u$ k- O# X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 J# T* }; b1 I4 \4 ]( G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( F% c1 ]8 Y& j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ X: K, B" C* g: b
  48. #else
    3 ]# n  K. A6 o! S
  49. #define DMA_PRINTK( x... )# w9 `$ p% c" a, l! v
  50. #define DMA_FN_IN! x) U7 z6 Q* M: e
  51. #define DMA_FN_OUT
    % R3 ]  z& k8 |% W9 V# b9 q7 F9 d
  52. #endif
    8 d1 X* C1 J, K

  53. - f* x" K" K+ d' t, h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- I2 S  B, E5 v! ]  u
  55. #define STATIC_SHIFT                3" `) H* g% ^2 Z
  56. #define TCINTEN_SHIFT               20
    + n& a& q# n3 F
  57. #define ITCINTEN_SHIFT              21% n0 L% t( q! J1 X5 T8 Y' Q* {9 x
  58. #define TCCHEN_SHIFT                225 q# T6 @" V- U
  59. #define ITCCHEN_SHIFT               23# U/ o2 Y6 Y/ N  x: _
  60. + K3 ^: A8 G+ x% v0 L
  61. static volatile int irqraised1 = 0;
    / G. X+ o0 V) S! f" |' e
  62. static volatile int irqraised2 = 0;) C5 N4 l9 O, g- ^6 W
  63. * S! E0 e4 |( l9 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; x# c7 A" J# S6 i/ T. d" W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 d# Z" C! ]- O2 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 f8 ~: V" Z. I- N2 n, g
  67. ) z9 U4 b  I7 }/ Y6 j. ?, ^+ L
  68. dma_addr_t dmaphyssrc1 = 0;
    # o  c: K6 N" `/ @+ w
  69. dma_addr_t dmaphyssrc2 = 0;+ N# X. C% R8 S$ m  o& Y
  70. dma_addr_t dmaphysdest1 = 0;
    # i; `8 @! l0 ?. U0 r
  71. dma_addr_t dmaphysdest2 = 0;
    + g$ D* ?5 n; |" G! @/ p: y

  72. # t+ `" |  {; a0 t" R
  73. char *dmabufsrc1 = NULL;
    5 o* ^9 {! Q- Q& |) ^( q
  74. char *dmabufsrc2 = NULL;
    5 A6 v0 e4 P1 K$ R; t, v3 \
  75. char *dmabufdest1 = NULL;
    7 x4 l- S% F5 x& `6 M/ G
  76. char *dmabufdest2 = NULL;1 S  m9 P5 ^; X$ v* z
  77. 5 D. ]' ?- Q7 |- e* g$ c* V! ]
  78. static int acnt = 512;
    5 M. a3 x( M; i! E
  79. static int bcnt = 8;
    7 P$ u  d* t4 ]6 h
  80. static int ccnt = 8;0 l& C  d- \# N/ N. ~

  81. 0 C: D- ^( o% Z: G
  82. module_param(acnt, int, S_IRUGO);4 E) {0 q4 d( P
  83. module_param(bcnt, int, S_IRUGO);, S) ~  L% A8 G$ {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 ~1 f5 _2 B" a8 D0 }+ _
+ |2 c" S5 T: f( F5 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# X+ J! a1 o3 s6 c% v; Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 A! @3 Y3 f. Z" I5 l" Z" P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 [- x0 _4 n1 m0 U8 ?$ }# |& x

* N0 k& K. d0 i
& L9 M& B: ?1 ^$ o' B5 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 04:08 , Processed in 0.038968 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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