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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( q! a& n7 @0 ?3 j5 u$ L
  1. [code]EDMA sample test application
    / i: I0 z9 \" Y9 D. J3 I; P
  2. /*
    * Z  e; z& X0 r0 Y  X2 H
  3. * edma_test.c
    " x3 K1 S9 v+ u! U& l
  4. *" C' }. ~6 H! A7 E3 X  R2 i  }
  5. * brief  EDMA3 Test Application
    4 L& j% u4 e1 x
  6. *
    ! H: {' W. X1 Q* Q  f+ n9 Z
  7. *   This file contains EDMA3 Test code.+ q. P! ^! M2 j; T# [3 B/ i
  8. *5 {0 ^' V& L' \% J8 g9 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 B  X0 d' ^8 ~$ u4 A( M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 L% I! i4 H  F" W( s! E- ~: C) Y, m
  11. *         TO CHANGE.
    " y# e4 T1 i- o5 p- r5 E& \
  12. *- k1 n! S+ t4 q4 {- ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 c. ~. {/ s2 ]8 G4 d+ `
  14. *
    0 Z; m& N- Q4 S5 c1 E) Y7 T
  15. * This program is free software; you can redistribute it and/or- ]# z: B/ q5 N* s/ h# g/ D- U
  16. * modify it under the terms of the GNU General Public License as* j& T* \; M$ D" Y8 y1 d
  17. * published by the Free Software Foundation version 2.: U) E) a- V8 _, ^: j5 |# r
  18. *- d/ y, N3 f9 ?# f1 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 v' T; D, U+ n- N
  20. * kind, whether express or implied; without even the implied warranty
    : J( p* }! p7 F( R6 N6 K8 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 m4 t$ g" M2 r" t1 z: U! |
  22. * GNU General Public License for more details.
    3 o/ p- u; q. `, z: _1 n
  23. */6 n9 ?  ~0 s3 v2 C

  24. 7 K4 y$ \# j7 ^" u- c) d% O6 y
  25. #include <linux/module.h>
    # [7 W( p, t  C9 t+ K) {' _) ~
  26. #include <linux/init.h>3 w3 p4 ^) D$ N2 S# t2 y
  27. #include <linux/errno.h>
    1 G" q9 D! u0 V) |" r
  28. #include <linux/types.h>' [( J, x2 S  x/ f9 q; w$ x5 C
  29. #include <linux/interrupt.h>) f5 |8 L/ v. O' v
  30. #include <asm/io.h>
    / V& L( @; B6 Y# ~+ n! W% r
  31. #include <linux/moduleparam.h>
    ! s, t+ W: [! h, f' i
  32. #include <linux/sysctl.h>
    % R0 C' ^1 ]; u5 A% R( s- q" ]
  33. #include <linux/mm.h>
    0 D3 f$ Y" m  b* C
  34. #include <linux/dma-mapping.h>$ u9 G  }, b; f! J5 ]' g. o

  35. . M7 l$ U: R( m( d0 T
  36. #include <mach/memory.h>
    6 d: X4 P0 g3 Q$ N2 n& ~2 M
  37. #include <mach/hardware.h>1 B) n5 _( x, r
  38. #include <mach/irqs.h>
    * ~7 t5 f  L6 E* c# k, Q
  39. #include <asm/hardware/edma.h>
    + V$ [+ r; U9 {7 ^

  40. 2 L! Z# c# {8 O9 ]9 L$ ^/ j6 A; j
  41. #undef EDMA3_DEBUG( c! y$ z( L7 V
  42. /*#define EDMA3_DEBUG*/' O  s% x: n4 R
  43. $ I" Z6 u, O1 T) }2 s# O1 e" {$ B3 @# W
  44. #ifdef EDMA3_DEBUG
    & Q! v; Q! d0 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 d: p% T0 H) |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) K  P: g7 W, u% q5 F$ K4 H8 Z+ o  a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) }* H- c# _% P7 T0 x# j
  48. #else% N0 i$ S) y6 z
  49. #define DMA_PRINTK( x... )* ^3 `2 l/ ]; }8 V
  50. #define DMA_FN_IN$ c6 d. I1 v# S  t2 _, ~9 }' R, W$ m- e
  51. #define DMA_FN_OUT4 T* r% o% Z  l/ Q, d
  52. #endif
    / @. ~+ m* w3 V# u$ ]) W; `

  53. 4 `- a8 @6 c+ {/ S8 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* t9 D6 x5 @! [' e
  55. #define STATIC_SHIFT                3. V" z$ y" Q  o. R  Z( m) I
  56. #define TCINTEN_SHIFT               20
    7 ?: V: [1 r. a0 r4 C+ R6 U8 t
  57. #define ITCINTEN_SHIFT              21- ^7 ~& V" }0 w
  58. #define TCCHEN_SHIFT                22! d% z- o( M! ^& t/ j% Q2 {/ F/ [
  59. #define ITCCHEN_SHIFT               23. A6 B; u+ `3 V3 r/ ]$ A/ W

  60.   N2 l2 E/ Z; U
  61. static volatile int irqraised1 = 0;
    + p6 Z0 h/ E2 O2 H" `# N
  62. static volatile int irqraised2 = 0;- }, b3 O8 n+ [- O/ E. ~& [

  63. 5 a$ Q  O" C. k/ d% r" x! ]  N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 Y) ^5 u6 S# @; y6 f5 l2 B) v4 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 n' i% [! x* L$ a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' D1 p, @! Y: q

  67. 8 B) [. o1 D4 A, x7 L8 O5 \
  68. dma_addr_t dmaphyssrc1 = 0;
    2 a+ k. M+ l- y( ~
  69. dma_addr_t dmaphyssrc2 = 0;6 T# X9 G$ N+ \! s- d
  70. dma_addr_t dmaphysdest1 = 0;# a0 ^: R, j! k' U' o* j6 b: G7 A
  71. dma_addr_t dmaphysdest2 = 0;  ~2 ?9 O7 y# h! ?! y2 P) F

  72. 3 b2 n( w: k' K! G% V5 f
  73. char *dmabufsrc1 = NULL;
    & g' F9 y  [. R
  74. char *dmabufsrc2 = NULL;
    $ A0 ?4 C* d) w: f# I
  75. char *dmabufdest1 = NULL;3 L* l1 d# D7 y+ r, f9 v: B
  76. char *dmabufdest2 = NULL;  T6 h; T9 \* ]- B3 J
  77. / _5 [: k9 Q7 `# ?3 y" Q4 T3 H
  78. static int acnt = 512;
    8 z8 V$ O) }1 }( W; n/ N
  79. static int bcnt = 8;4 s5 ~. Y8 i+ ?& x; ?' J, }- e
  80. static int ccnt = 8;7 s+ \9 Y3 Z" K8 s, G" l0 ~

  81. - `* {8 t( W+ I6 L% H* h
  82. module_param(acnt, int, S_IRUGO);
    1 n$ I: J) B+ F2 S
  83. module_param(bcnt, int, S_IRUGO);
      `  @7 w  Q# [& d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, h7 x: O: u2 F1 _" I$ ?% C  U! u3 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  K! O5 F+ t  Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 r" Z/ X6 h9 g! r) d! O, V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- D$ k8 M$ e: @& v  u

( ^6 f$ \9 M$ M- ^1 k. U2 [- ]8 _, c- o0 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 07:27 , Processed in 0.038931 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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