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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / k5 ~6 Q. `2 i
  1. [code]EDMA sample test application
    + X" l9 b; x2 D$ `
  2. /*) Z5 [* l% }1 _0 w2 x# l
  3. * edma_test.c5 T/ O+ A) n# w/ I
  4. *
    2 e6 t" Y# M) y2 _5 M/ F
  5. * brief  EDMA3 Test Application
    & H' i$ p% F) f3 E
  6. *" a( q+ ^8 E) r' z/ D
  7. *   This file contains EDMA3 Test code.
    ; i) [- f' N/ [5 S
  8. *( F% A9 }% U2 `! x3 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( l( u$ }4 d% y+ G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. p8 s. `) v/ T3 v+ P
  11. *         TO CHANGE.9 D. g  G3 t: h8 R0 Q
  12. *
    , l# w1 F' V4 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 \8 x# [( w) Z$ ?2 R; m! @7 P
  14. *. e5 g+ ~. Z: U! F/ Q
  15. * This program is free software; you can redistribute it and/or
    0 U; u: D2 f  @, g+ Y% h; B
  16. * modify it under the terms of the GNU General Public License as
    , }8 K9 u2 M; v- M; J: C
  17. * published by the Free Software Foundation version 2.& A/ B, T/ K: _; q' p9 s
  18. *$ J7 C* D( K' m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( F  G" K8 j* Z& q$ \
  20. * kind, whether express or implied; without even the implied warranty% ?* G3 h! Q: T0 F1 w3 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - {0 x2 h1 W) o& _7 Q) R
  22. * GNU General Public License for more details.& N1 `4 V9 R" J6 N
  23. */
    * z/ N. ?. `) ]. \
  24. ) k: F6 Y, C6 e/ c/ J
  25. #include <linux/module.h>5 _5 d) O1 l; B) R& O/ W3 p
  26. #include <linux/init.h>/ N" h" J( R( R& x' u
  27. #include <linux/errno.h>
    1 z) e7 b: A! K
  28. #include <linux/types.h>
    + x# U9 y% p' a4 e3 E4 A
  29. #include <linux/interrupt.h>
    3 K4 g& K2 l* \# ?' |0 X
  30. #include <asm/io.h>
    * @) O1 l$ a# S" H/ G
  31. #include <linux/moduleparam.h>/ |" T8 x/ p: y# C# S% W
  32. #include <linux/sysctl.h>
    9 ]( d& p3 R6 R
  33. #include <linux/mm.h>. A- [& ~0 F6 k: ]& i& F) k
  34. #include <linux/dma-mapping.h>
    4 J+ U  m1 h  |' t
  35. : l! f  |4 l! `! U1 }/ B
  36. #include <mach/memory.h>& L$ `) r! ]* L# k. L
  37. #include <mach/hardware.h>( b3 t. m+ j# u5 D
  38. #include <mach/irqs.h>
    + \+ q5 }  S. B1 x" ?
  39. #include <asm/hardware/edma.h>
    : x( b! h" ?  K  [" u( _3 _
  40. 0 v7 e$ m, D% y" [
  41. #undef EDMA3_DEBUG- j" u+ A4 [! y- g! @6 a
  42. /*#define EDMA3_DEBUG*/
    * L1 P$ J4 [5 e
  43. : E9 t+ ~  R0 J6 c. R
  44. #ifdef EDMA3_DEBUG
    ; q1 m) w' b- s0 w% S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( z% O7 U) o1 D" g# w1 N3 ]" _3 V  ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 \; W4 |* f7 x& f; g5 }2 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 K8 O1 G1 n4 o: P' @- s- @8 g
  48. #else5 j' Y& m+ N0 R9 B+ A/ c  e1 A/ y: c
  49. #define DMA_PRINTK( x... )
    * B9 G( D; b% k5 @) G
  50. #define DMA_FN_IN
    9 g2 ~3 X2 @. w9 ~
  51. #define DMA_FN_OUT: N8 f+ {& |# H
  52. #endif2 M8 t( N- A2 O' f! ]

  53. ( F) N; R9 G! \6 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      ?% E) d0 a$ Y/ J3 f
  55. #define STATIC_SHIFT                3
    * ?% j; `* R9 Q4 E% r( k. g+ L" {2 m% [
  56. #define TCINTEN_SHIFT               20  a0 x7 |0 Q# g: P' B. w
  57. #define ITCINTEN_SHIFT              21. Z  ]- O  s- g5 V
  58. #define TCCHEN_SHIFT                22
    ( P+ x' r2 v! z2 c/ {' j" [
  59. #define ITCCHEN_SHIFT               23
    0 P; a. j% H5 e9 x" \' g, x
  60. + n6 }2 d2 E) \/ t# z" c
  61. static volatile int irqraised1 = 0;
    7 c; M- C/ p! M# [/ L! F
  62. static volatile int irqraised2 = 0;
    $ q' ?. Z, v9 k3 f% S3 a- l

  63. 5 g. o/ B) ^( d  X. [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 z: N6 a9 U& v% k4 x; b8 [, w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! R  O* U! R) r# M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 \' {/ j/ G7 P+ }4 O' {% }  e" s
  67. , z- w5 ^: g2 F5 k( O
  68. dma_addr_t dmaphyssrc1 = 0;: b( F4 K! v% a# z$ o0 W9 r
  69. dma_addr_t dmaphyssrc2 = 0;
    $ D/ c5 Y9 [% W% S
  70. dma_addr_t dmaphysdest1 = 0;
    ; ^7 }# K5 a( A1 K/ b0 J) _
  71. dma_addr_t dmaphysdest2 = 0;5 U2 j0 x0 `' z5 U  f" a
  72. 9 s: T9 z* y( K; ^9 s7 W
  73. char *dmabufsrc1 = NULL;
    $ U5 g* r& _; V4 U4 T5 V' b9 u
  74. char *dmabufsrc2 = NULL;& p4 Y% j4 F* \- ?5 J3 M- N
  75. char *dmabufdest1 = NULL;7 z4 ]- @1 K4 t& a( X
  76. char *dmabufdest2 = NULL;- l) `5 y+ b; D+ [

  77. ! y6 [. {& ?/ u
  78. static int acnt = 512;
    ( f9 b5 ?. |! I
  79. static int bcnt = 8;7 o  ]' x9 N" I7 n: |
  80. static int ccnt = 8;
    3 \. [' b+ c' ]! B

  81. $ }2 \& l, n- E
  82. module_param(acnt, int, S_IRUGO);
    5 d5 D( }) M1 e$ `" _/ K) s1 d9 m
  83. module_param(bcnt, int, S_IRUGO);
    - P3 U9 }. ~, a; }: K2 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: a9 A4 Q$ ]; L# \/ c+ }  Z/ A3 d: c! k' A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. y& W. b6 S2 _5 x: jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& D( s( c. Y1 h& u4 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& s8 q, V# l) r. r$ {" T, `$ c* ~9 F
& E$ b8 |' l+ a, E+ `6 ~2 q
1 u4 x' M: v8 y3 k3 k1 ^/ \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 02:28 , Processed in 0.038397 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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