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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( z2 k8 |# Q0 G( v7 y) b
  1. [code]EDMA sample test application' |/ x5 y  e' R7 U2 i2 A
  2. /*4 |+ ^- p4 @  W4 H
  3. * edma_test.c* {5 N; B/ X0 n1 {5 L' _
  4. *
    : U" N. E4 q+ b- V# }4 U( T% g
  5. * brief  EDMA3 Test Application
    1 \$ ^) K; a" s! m- s
  6. *
    # \+ ?! T0 U/ W: o! P
  7. *   This file contains EDMA3 Test code.1 ]/ X' t) P7 _7 W% T
  8. *
    8 g% z! Q7 i9 t* h+ S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ V2 S& v/ w, P  `* u( }: f; b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( J* u: I/ o3 G0 k" B
  11. *         TO CHANGE.* A8 Q( Z: \/ ]4 B# X
  12. *
    ( j8 i, u& J+ Y0 Q6 ^$ |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 N$ E" v  |+ s8 }! D
  14. *0 {$ P- {' ~( }
  15. * This program is free software; you can redistribute it and/or( v% E) k) ^/ k! h6 i  B+ m
  16. * modify it under the terms of the GNU General Public License as
    0 u, p) C6 h' B# _1 K! i1 v
  17. * published by the Free Software Foundation version 2.
    8 e& J$ T1 L" K+ d, `* g
  18. *0 R7 y, b4 f4 j5 F- `% @+ z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! \9 s0 A: a0 C0 I3 K6 r8 g
  20. * kind, whether express or implied; without even the implied warranty
    5 u  n$ [9 V. _, u3 f+ w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * [+ M+ j! A' H/ D% G) T8 T7 V
  22. * GNU General Public License for more details.
    3 i3 N! R. R5 |3 h  D
  23. */
    ' z# r. m" x9 _( r. {
  24. * h' v" M' R! _2 c0 i2 J  R
  25. #include <linux/module.h>! R* V! E! l8 Q; f! Y- b! ^. v
  26. #include <linux/init.h>
    ' j9 {. h5 z! e( H0 j9 a, S
  27. #include <linux/errno.h>
    / m4 e3 V. s4 h5 D
  28. #include <linux/types.h>; K: K( _$ }6 o* r
  29. #include <linux/interrupt.h>" a  M6 G2 q( e' V3 A8 ]
  30. #include <asm/io.h>
    ( B: C8 `$ O( R" c, i1 J. l, P
  31. #include <linux/moduleparam.h>
    ; m% U$ U9 K- F5 J& ?6 \) y
  32. #include <linux/sysctl.h>
    ' r$ ?; Q" G& b, P9 m  }, ]3 x
  33. #include <linux/mm.h>1 [0 j3 P" y* t* Y. J
  34. #include <linux/dma-mapping.h>0 @& L6 O& O7 y9 ^7 o9 {
  35. * L( K, h" ~7 z
  36. #include <mach/memory.h>
    - C6 l5 ], I+ ^/ e9 j2 B
  37. #include <mach/hardware.h>
    9 |5 t9 o$ N4 p- C  }
  38. #include <mach/irqs.h>* y' Q! E1 L: p! T5 z4 W& z
  39. #include <asm/hardware/edma.h>  R0 Q1 H7 y$ G' _

  40. 5 e/ S4 [6 D6 M8 D, @4 N0 Q5 M, h
  41. #undef EDMA3_DEBUG5 F* [+ [( i/ A, w
  42. /*#define EDMA3_DEBUG*/
    + C+ ?* B5 w1 k! U

  43. . H! W! \2 u- j% D- F9 i6 d' ^
  44. #ifdef EDMA3_DEBUG
    4 t1 W! y( M: E# [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 s% O) h3 D. l3 G9 M8 c5 |: s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ q( ^' u0 ^* R5 `# B8 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # x7 k' V- G. B8 L5 f7 Y8 p
  48. #else
    2 r3 c1 Y4 X& b- ]& [$ ^
  49. #define DMA_PRINTK( x... )1 k2 T4 A! m: {4 N, t
  50. #define DMA_FN_IN
    " `/ j) _$ p2 R6 p  A' s
  51. #define DMA_FN_OUT
    . B$ F8 m- l1 p6 R/ R) n; t, T' H
  52. #endif
    6 M, q6 m6 }6 X: Y

  53.   S5 B4 ~3 P0 L) o: A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( X  G5 O) w5 H2 D& b
  55. #define STATIC_SHIFT                3  `. c. z- ^4 N6 a7 @
  56. #define TCINTEN_SHIFT               20+ [3 E- _7 M$ G& l
  57. #define ITCINTEN_SHIFT              21
    & \7 t- {" L- s9 R( ~- C/ ?
  58. #define TCCHEN_SHIFT                22
    8 ^1 s6 e, J7 Y% X2 D
  59. #define ITCCHEN_SHIFT               23
      |% k& X6 G9 H) C3 C

  60.   p, v# K6 Y  c" m
  61. static volatile int irqraised1 = 0;! [$ a+ |9 E3 ^! o7 A8 J1 s
  62. static volatile int irqraised2 = 0;% U  J" W/ H" ], b& P0 G$ w

  63. ; C+ Z' E8 I# Y% \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 j' n' B! `( j4 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - y, f7 K1 e/ E; K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' Y, q0 X3 x3 r0 k
  67. 9 g2 f& d5 S) i3 C7 F+ ~. N
  68. dma_addr_t dmaphyssrc1 = 0;% v* U$ m0 S9 R5 E7 @
  69. dma_addr_t dmaphyssrc2 = 0;
    + G1 k. |9 j5 q4 e6 b. V- {/ M! _
  70. dma_addr_t dmaphysdest1 = 0;
    # F6 L' K7 z9 S/ F" w$ {$ E
  71. dma_addr_t dmaphysdest2 = 0;
    & ?: @5 _$ e9 l
  72. 4 I3 |) ?& K( R2 \* r9 j# j4 O2 `
  73. char *dmabufsrc1 = NULL;
      l# s- v% u% \+ U/ C" ]
  74. char *dmabufsrc2 = NULL;6 t% n9 ]' k" M! D7 c% X
  75. char *dmabufdest1 = NULL;+ X+ y3 I1 `% Y8 _) I
  76. char *dmabufdest2 = NULL;* l, ~1 w) O6 o, P% i% j
  77. 0 k7 Z& h8 o7 E; d
  78. static int acnt = 512;
    ! ^, L1 T7 W7 Y6 z/ B
  79. static int bcnt = 8;
    ! A2 p3 R$ d% r' c
  80. static int ccnt = 8;3 M. K+ r3 e) n. u9 B5 ~0 e

  81. 5 Z8 S; X  D/ B
  82. module_param(acnt, int, S_IRUGO);- e) w7 ~* y5 c- u$ z  n
  83. module_param(bcnt, int, S_IRUGO);
    " Z- p& \  R* E3 R! g; f: j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 [& ~# [) R  J
  [! J& v9 |( ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 l4 {7 J9 b( v: b6 E2 k/ L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 M1 ^" B+ T- n( x' K( O' L) n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* l! Y5 O* x. ?3 e3 ~0 w6 V$ s( N6 @8 @4 \

5 P/ x( z# ?* L5 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 07:53 , Processed in 0.040630 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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