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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / _  z+ m4 B1 U
  1. [code]EDMA sample test application
    ! j  a& F# x4 ?
  2. /*
    . Q* j/ v$ C2 ]- X1 r! U: r$ L9 F' v
  3. * edma_test.c
    ) l% n' E4 O* G
  4. *
    ; c! o9 U% o4 z$ i& V* }* e1 d4 K$ U( f
  5. * brief  EDMA3 Test Application
    4 `5 `9 n2 C1 ~4 n, W
  6. *: z: Q, v# n9 ~! b* a
  7. *   This file contains EDMA3 Test code.' n9 b# Z1 v7 p) k
  8. *
    0 a! b- q! M7 C3 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# q( D& |0 D, a5 }+ ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 g  i1 i1 Z# T; U* R, _! g
  11. *         TO CHANGE." E1 S( u" P7 N/ C/ G7 W* y
  12. *, }5 a; J" t) M4 u2 Z0 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: J5 k8 y  ~) L! j
  14. *8 S- A6 o( K( M8 c
  15. * This program is free software; you can redistribute it and/or
    2 q" \0 Q& H# o. M; q  N9 d
  16. * modify it under the terms of the GNU General Public License as
    ! ]# |9 L' M$ U# _, J9 q7 [" u
  17. * published by the Free Software Foundation version 2.
    7 D  R& f8 b% ~- J" B
  18. *
    , D. P" \! C9 r6 J& T' ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 j- N+ L+ l2 i% I' j9 d2 R
  20. * kind, whether express or implied; without even the implied warranty( B( e6 @0 D, m) M: ^! J- L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 i0 }9 \0 l( z4 W. a; k
  22. * GNU General Public License for more details.
    # i! h5 g, J  y  v, M
  23. */
    + M% }: w9 g: W7 z/ [5 m3 c

  24. 1 _9 A& v3 r2 X8 G9 ]+ Y  W7 _
  25. #include <linux/module.h>: |- H+ q% V( @7 K) v6 t9 n+ V
  26. #include <linux/init.h>8 d+ K, w% d+ h* I
  27. #include <linux/errno.h>
    9 _  ?! f" e1 E) c, z
  28. #include <linux/types.h>
    6 ], d) U  @+ m
  29. #include <linux/interrupt.h>2 e6 z$ P4 D0 Y) k1 S
  30. #include <asm/io.h>
    # f" T( S6 n7 ]
  31. #include <linux/moduleparam.h>
    + h; {/ z+ s" U" r) N+ V! T* K' d
  32. #include <linux/sysctl.h>. D3 Y) _/ g  ?$ G- {
  33. #include <linux/mm.h>
    : ?0 s2 k2 V) |1 Q% X1 N- Q& l( T
  34. #include <linux/dma-mapping.h>+ f. y: k- s0 R. Z

  35. 7 I4 }" K  _5 M5 n1 l# |
  36. #include <mach/memory.h>
    / e" P( F  r# }8 E! A
  37. #include <mach/hardware.h>! D2 d  z$ j% T! K8 K* q
  38. #include <mach/irqs.h>) f$ ]: I) u. U" M$ a
  39. #include <asm/hardware/edma.h>
    8 r. i$ y# I5 G0 Y$ ]" b

  40. 7 Y( {+ [; U& u: i1 ^) |& `
  41. #undef EDMA3_DEBUG
    ' {- m0 P( D0 O
  42. /*#define EDMA3_DEBUG*/, F! X  f0 n8 ?3 O8 e
  43. ! y: L- K2 \7 W* F
  44. #ifdef EDMA3_DEBUG
    1 t  O$ S) b! z$ x. ]7 i: \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 g# a' ]6 ~1 I1 _- j: ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' k# t. ]" K1 `- J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 ]; p" ?* V* J* A. t" A4 P
  48. #else
    7 P# d7 }* {0 ~$ Y$ Z
  49. #define DMA_PRINTK( x... )' E6 C5 T, _& a" }
  50. #define DMA_FN_IN6 p7 Z  n! o6 [1 q2 v
  51. #define DMA_FN_OUT; r! m) y& w* P8 y+ z1 T/ |
  52. #endif! u* D9 Z( K) R

  53. % w" w) M- U$ A9 E( q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), j! n7 D! d% t/ T* l
  55. #define STATIC_SHIFT                3( L( z% e: C+ u2 n/ s' f3 N
  56. #define TCINTEN_SHIFT               20* g( _$ j5 w' C( k$ U
  57. #define ITCINTEN_SHIFT              216 G! R/ b( P. K* ?7 U  X! r
  58. #define TCCHEN_SHIFT                22  a9 a( s" V: h
  59. #define ITCCHEN_SHIFT               23: I( z7 `/ c* l" s2 m

  60. 2 X8 r% a9 C9 x
  61. static volatile int irqraised1 = 0;
    ; ]+ f; d( }5 a  B
  62. static volatile int irqraised2 = 0;
    9 l- H5 s  u9 t: d3 {3 [$ [
  63. ' `4 h  W, W8 q( o* X/ D# D% T# W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# J$ [1 F; J! I- Q  A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 {2 u+ f5 _+ }4 \* ]: k+ z% O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ?7 _- J# R1 U5 C; D' [
  67. ! v- A0 E8 X) _! g+ \) z* D
  68. dma_addr_t dmaphyssrc1 = 0;
    4 [' U( t- F5 D8 c; Z( j  W
  69. dma_addr_t dmaphyssrc2 = 0;
    0 e+ w( I' r7 }& M* k
  70. dma_addr_t dmaphysdest1 = 0;
    9 ^6 _' k9 W4 I3 k9 w4 Q8 D
  71. dma_addr_t dmaphysdest2 = 0;
    ) O9 E% Q5 i+ y9 F3 y
  72. ; G9 z' ^. c$ M. l2 t
  73. char *dmabufsrc1 = NULL;( t& G7 E0 F7 W: F3 z* m& B; [
  74. char *dmabufsrc2 = NULL;
    # l  l2 a% B5 c3 V2 Y3 P" [. u
  75. char *dmabufdest1 = NULL;
    3 f3 v1 ?  i1 Y" Y' v: z
  76. char *dmabufdest2 = NULL;( }8 v. [/ d1 s4 K
  77. : M4 a/ H# `* a# M! c' X" V0 @
  78. static int acnt = 512;
      p' r$ S) v" d3 c! M  F% P
  79. static int bcnt = 8;
    0 t/ u' s& t( ^1 V& `3 l
  80. static int ccnt = 8;, J6 ?# `# `1 I" s
  81. 2 w7 l  @! W! @6 J. _! Q, ]
  82. module_param(acnt, int, S_IRUGO);1 A* D1 h( D/ n& \
  83. module_param(bcnt, int, S_IRUGO);
    + \: s1 z$ r9 h3 J" e" Y9 v9 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' f* t4 p: D. U  h9 s% t
+ v: z8 p/ k) g. p" @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 y* n0 A% L2 t1 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& G8 H/ ~5 [6 [4 [- P$ n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 t4 z1 Y/ v& h/ A* U
! S) i: |7 T, Y4 ~  j9 J9 s4 X# l" }7 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 16:28 , Processed in 0.038491 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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