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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: C' f8 V4 r; E! R0 ^" \0 ]% p
  1. [code]EDMA sample test application# `  e- e* _  _& u! n5 J
  2. /*
    0 V$ ~1 T4 D% L. S7 [5 q
  3. * edma_test.c4 }4 y7 V1 ?' A
  4. *
    & D8 S# m  l1 |' |$ m. d; u
  5. * brief  EDMA3 Test Application
    8 j! l" V" H; E  |/ c# |. n' n7 ~' u4 Q
  6. *4 j+ s3 u3 k# w0 k- r' U1 o+ u
  7. *   This file contains EDMA3 Test code.9 P% j/ x7 n2 b8 p+ |8 G7 _
  8. *1 c4 A% l; H7 c/ i6 k/ ~# w4 a7 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! H( _7 l% S+ \# j$ ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 V6 l$ \, y& `8 G9 K+ D0 {7 Y# m
  11. *         TO CHANGE.$ C0 R" F" F, E/ A: L- _
  12. *9 t7 }% Q) w, p* P8 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 v0 i9 c9 f$ [, p) u1 d
  14. *" z- H- c8 H* @* K
  15. * This program is free software; you can redistribute it and/or
    0 }: j$ q5 e6 Y. \& R: S
  16. * modify it under the terms of the GNU General Public License as6 ^9 p- E/ g8 b, v! F# n+ A
  17. * published by the Free Software Foundation version 2.( _* `0 L$ ]7 \
  18. *8 \* A, E. t+ N! Z6 J! c# }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / }. f, i2 m  t* P
  20. * kind, whether express or implied; without even the implied warranty
    0 f  Y( C/ p5 F( Q5 r' ~  S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - s' a9 r9 Q' m6 i$ L4 i/ ?5 ?
  22. * GNU General Public License for more details.
    ! v0 f6 c4 h+ E( T8 t5 v$ J9 k; m
  23. */$ M; F6 b2 E/ ~  \

  24. # q; ^" [  l5 f5 H" G
  25. #include <linux/module.h>! {/ S' W' m. q1 r. Z: N
  26. #include <linux/init.h>! c/ t/ Y, [+ G! y
  27. #include <linux/errno.h>
    8 k. ~2 i. L# z* n) J
  28. #include <linux/types.h>; c/ e* K: X! V
  29. #include <linux/interrupt.h>
    ( Q9 }) Z% q) E4 S
  30. #include <asm/io.h>
    : g3 e- W( E! Q8 k- D
  31. #include <linux/moduleparam.h>
    # T" v- b- u7 a$ Z$ U1 r
  32. #include <linux/sysctl.h>
    2 k# G# s- b9 v. E# f: `- O
  33. #include <linux/mm.h>
    5 R3 F. Y- r) O  ^+ F
  34. #include <linux/dma-mapping.h>; l2 m4 P) z- T8 ?) y9 g" B2 {
  35. ; U( @8 e, {1 B! b& R
  36. #include <mach/memory.h>3 j2 w1 S% I8 T- V/ B
  37. #include <mach/hardware.h>3 w0 O/ F1 S6 I% m
  38. #include <mach/irqs.h>0 N/ k2 U3 A' k7 C! d7 R
  39. #include <asm/hardware/edma.h>( y3 }! z4 K3 H/ I, @# S, Y

  40. ) Z: G" r" I4 l  I# j. Q
  41. #undef EDMA3_DEBUG
    * I0 w1 G( u- H) |3 T3 \& C
  42. /*#define EDMA3_DEBUG*/
    5 e% L! i( }: s) Y  K+ n* Z

  43. 6 `) V5 i, @9 G) v$ ], |+ v( B# c4 N
  44. #ifdef EDMA3_DEBUG
    + i3 v! v) U3 J. Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # G3 Q* i  n& l$ v$ @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) ^" z. K0 [) E0 N% d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % N( o5 o9 U# w- \% S6 I
  48. #else
    - p5 |7 E$ l$ k. r- d! _
  49. #define DMA_PRINTK( x... )
    8 a% v* r( F" e. i0 R
  50. #define DMA_FN_IN5 d' D3 w7 M/ t2 u5 T
  51. #define DMA_FN_OUT" _  ~4 W4 {9 e: J0 `1 ]
  52. #endif
    9 [. M" l' }5 s% b+ T( @) i9 x+ Q4 T
  53. / M- Q5 n- X- N, m! h+ V- T; t6 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( U  f: @: u$ R! j5 [, b
  55. #define STATIC_SHIFT                31 v" {& y7 Q# B6 ~
  56. #define TCINTEN_SHIFT               20: H" C9 Z& F, ?6 m% ~* W
  57. #define ITCINTEN_SHIFT              210 W  g# M" M$ C  w3 Y
  58. #define TCCHEN_SHIFT                22
    - `+ P, K: f6 z' g& r3 T2 G
  59. #define ITCCHEN_SHIFT               23
    # T7 Z( ^% g& J7 X  g

  60. ' S' m1 j1 W( q1 N
  61. static volatile int irqraised1 = 0;
    , {' b0 l, j* \3 N! n- \
  62. static volatile int irqraised2 = 0;
    , G7 A+ K  c0 a8 h" \& \" r

  63. ( m- u$ t( E  D" }' t( U5 x/ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- M7 n6 q+ s- Y8 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 @* F+ x1 y, g/ E9 f3 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " g! m! U8 w: G1 k- p* ?

  67. * Z' G) Y7 m- _1 ], E
  68. dma_addr_t dmaphyssrc1 = 0;. B0 C/ |& M9 I6 \+ V
  69. dma_addr_t dmaphyssrc2 = 0;
    * c+ P  u, l" |' m: F
  70. dma_addr_t dmaphysdest1 = 0;1 `5 U( e0 G8 m" t5 i
  71. dma_addr_t dmaphysdest2 = 0;
    # @# k' k/ E# g1 e6 x- M, d: w
  72. ! _) f3 d  ?  e
  73. char *dmabufsrc1 = NULL;
    . B, v) V: X6 a# N4 r7 g
  74. char *dmabufsrc2 = NULL;. R' `5 w2 T2 G4 i8 b. X! w) _
  75. char *dmabufdest1 = NULL;4 J" W8 y$ h4 Z7 \# i
  76. char *dmabufdest2 = NULL;9 _3 W( Q8 y! h" x1 ^- s/ h* a2 o4 P
  77. 3 ~; _7 r  h( ]  r) E8 c
  78. static int acnt = 512;- q2 s4 ~0 N( b7 @$ W
  79. static int bcnt = 8;
    ; B- Z- W0 T* d- d: }
  80. static int ccnt = 8;
    : {1 F" U& x6 h
  81. 2 w. o4 r7 Y3 ]
  82. module_param(acnt, int, S_IRUGO);1 V" H! u6 p' P( {( d
  83. module_param(bcnt, int, S_IRUGO);
      z8 S& j3 [5 K* ?/ A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& H" \! H8 |, m& q  _+ o& A) M# J" Z7 ]( _# W0 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 {/ w% E2 d6 m0 f. D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. E7 Z$ o. i( h4 S' i+ y& R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! \, |# Z& T/ i2 D* }! ?) r7 I. Y, {2 E" H  |

1 y: M$ S) j3 R' Z( M( Q9 @! Z7 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-15 17:43 , Processed in 0.038421 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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