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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. _- t4 }1 R- r8 t
  1. [code]EDMA sample test application
    - ^% w: H9 Q3 c* U
  2. /*
    ) Z3 R& t* M% o: o0 |& N7 r' h/ @4 ~
  3. * edma_test.c% q9 ^' w) n  [7 p' H
  4. *
    # G" Q% ]4 A6 T& U2 Q4 b
  5. * brief  EDMA3 Test Application* |0 z- f3 G" W0 W
  6. *
    - J. O& a& z  K/ }9 ]% M
  7. *   This file contains EDMA3 Test code.$ d! G  f2 C0 Y; Z2 d) Z, h
  8. *
    / @" p) t, p! C7 x! [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . D/ R; E4 ^- b0 E* U5 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 e# W6 U: A$ D# u- k
  11. *         TO CHANGE.
    / u6 K# u/ F/ j8 b& W, c3 E  d
  12. *
    * _4 K2 V2 o: R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 F3 e* {3 D1 ~
  14. *
    2 w. x& v. h  H7 t: Y% |
  15. * This program is free software; you can redistribute it and/or8 a5 X$ d, a: _. L0 k
  16. * modify it under the terms of the GNU General Public License as3 _" o8 o0 Y2 {" |
  17. * published by the Free Software Foundation version 2.& @5 _# h' p$ t/ o3 G0 o
  18. *
    3 n5 f6 ~" N; l2 v" k2 j0 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' k" a7 l" _" O. b( v5 ~
  20. * kind, whether express or implied; without even the implied warranty
    ! R- [5 z( i* h% K# o* B3 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  z4 t2 @7 j. K
  22. * GNU General Public License for more details.( m* {+ \: \, v* {5 t
  23. */. P; T" d( |1 A% m8 d

  24. 3 e, d5 [. n1 R! }# a; c: K
  25. #include <linux/module.h>
    ; P2 ?2 X2 R7 a( }- U) l
  26. #include <linux/init.h>
    " I, w$ I& W  e  c
  27. #include <linux/errno.h>1 a* b5 \8 B, t; O1 _9 V
  28. #include <linux/types.h>+ C' R) f. A# O9 g
  29. #include <linux/interrupt.h>
    , D5 e0 J7 y! I, A; G$ u
  30. #include <asm/io.h>& ^! e" f6 q/ I! m+ M
  31. #include <linux/moduleparam.h>
    ' m! g. D! f0 E) W: w, d5 y
  32. #include <linux/sysctl.h>8 }( M, M1 b1 c8 }1 ]' |7 s
  33. #include <linux/mm.h>% [: o  k: s9 b, V, Q
  34. #include <linux/dma-mapping.h>
    - U* j6 g  _! B: B8 i

  35. 2 O0 S% p* L! C0 U3 V( P
  36. #include <mach/memory.h>6 U# i) L# `2 S2 _" Z! I; r" e& @
  37. #include <mach/hardware.h>
    2 w) W. w# k/ x! c
  38. #include <mach/irqs.h>
    * J. C) n! Q, q/ v5 T
  39. #include <asm/hardware/edma.h>
    : i; q/ f. M: ^6 X  s' n; p. D

  40. 2 t' O9 U2 g/ C/ C! y3 j1 Y
  41. #undef EDMA3_DEBUG
    9 ?! n4 l; Z/ M& {* {6 J4 K, B
  42. /*#define EDMA3_DEBUG*/0 @% r3 t; A; h4 X
  43. ; A1 w8 ^& [$ }+ Q
  44. #ifdef EDMA3_DEBUG4 V7 P- }/ |+ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- x5 m- u+ `3 D+ y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / @3 o( ]  e) D- G( ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 |: G# @. U8 ~& o# l
  48. #else
      X- _1 g* I% I" ]+ I7 P
  49. #define DMA_PRINTK( x... )
      [+ X+ z) S* \6 i, I5 B
  50. #define DMA_FN_IN) {. g, A% \, X; e& Z9 P) D' N
  51. #define DMA_FN_OUT0 n& O6 h1 p  P$ ^: F/ p0 i
  52. #endif. G0 r, y( \5 t* {% j

  53. ; v; L( F3 U! C) i- b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 l" `" i9 n9 X. ^3 f  J
  55. #define STATIC_SHIFT                3
    ' ]; j; ^0 V' _+ q2 g
  56. #define TCINTEN_SHIFT               202 V% R3 W( R- [7 i4 l
  57. #define ITCINTEN_SHIFT              21
    8 c7 |2 }: J: `% e8 N7 ?
  58. #define TCCHEN_SHIFT                22
    : ~. `1 \% E5 x4 o
  59. #define ITCCHEN_SHIFT               23* R2 T( B9 O" `2 ^0 U6 Q; Y# g

  60. & E/ K/ ]& R8 R' ^5 @
  61. static volatile int irqraised1 = 0;  T4 r8 J) ~5 R+ \  w/ @2 T' U. d! p
  62. static volatile int irqraised2 = 0;0 I9 \" M: Y; \; k' m6 H

  63. ; R8 g' T' u# Y* T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& z: U2 O/ }, W9 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 [5 n7 R- v$ z6 u% k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + Z/ ^/ W8 [  r$ J- r

  67. $ j6 a) @: r! c3 o! u% U/ {) p
  68. dma_addr_t dmaphyssrc1 = 0;( D2 w" ?; l; g  _
  69. dma_addr_t dmaphyssrc2 = 0;
    ! a6 N& j7 @% A# r/ [2 Y! @6 o
  70. dma_addr_t dmaphysdest1 = 0;
    . C% b' q' C! a
  71. dma_addr_t dmaphysdest2 = 0;
    : ^$ _, X" W' |( E2 ]
  72. . Y5 }* k. D/ d5 m/ _
  73. char *dmabufsrc1 = NULL;6 u0 ]  w- X* s3 U
  74. char *dmabufsrc2 = NULL;2 N  r( n8 {+ a" x, m
  75. char *dmabufdest1 = NULL;& h1 \# _; H/ O# \$ z; q3 V
  76. char *dmabufdest2 = NULL;
    5 t9 U+ k" \) d7 G8 \# A" I
  77. $ |: M, }4 |3 o6 G7 l8 T: T
  78. static int acnt = 512;3 t* j" _( x) h* a( K
  79. static int bcnt = 8;3 T. V( W& O! y, y8 T! j
  80. static int ccnt = 8;# P2 r1 b0 a" N7 g* k( W+ C# d

  81. $ T# V; e/ T3 [) G
  82. module_param(acnt, int, S_IRUGO);; q; Q5 b' S: Y# S' h2 W  D( `
  83. module_param(bcnt, int, S_IRUGO);
    + t9 f" x3 r4 X& a& V, s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( N4 u& M# V7 O3 ~$ I% T! r" n1 u- K( E4 T. P8 j; M6 o$ k" I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) d) R. I$ \9 p. barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 }6 f" n/ L$ @7 n' y, S2 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 h/ S: C( e: t

2 N+ f* Z  z+ C" _5 _; n2 S) @" |1 o1 [; P6 S$ q9 e" h/ x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 19:29 , Processed in 0.051484 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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