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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - k% `2 }/ _5 i1 c5 g  q0 ^
  1. [code]EDMA sample test application
    % F, X1 ~: p5 E2 L% d* c
  2. /*
    5 e9 k* k" G$ ~3 f
  3. * edma_test.c" X: i# y$ L8 H* ^
  4. *
    : H0 S) ^8 H$ ]" C9 C  z6 ?, \
  5. * brief  EDMA3 Test Application
    3 j/ e0 N( f0 A3 ~: m% k! s
  6. *" N) V7 n9 v* n
  7. *   This file contains EDMA3 Test code.
    , `2 q6 X; L( y4 o1 G
  8. *- ?: _  G) s& |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 g3 p- V& j) F$ W: N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 B0 D/ Q; P( K$ ?) E2 M
  11. *         TO CHANGE.0 }! G9 B+ W1 C
  12. *
    5 e2 R$ Y4 |7 f0 `# l! w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 b6 H, D, E" B% E
  14. *
    6 J1 i: A) t. V
  15. * This program is free software; you can redistribute it and/or3 F( T( F$ f" z4 C, Y
  16. * modify it under the terms of the GNU General Public License as5 G" k4 U. b& [2 g% \
  17. * published by the Free Software Foundation version 2." r9 e0 Y2 X; n. I: a
  18. *5 o5 X# p2 ^/ }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / k7 U4 g5 c. ~; i- Z# ^
  20. * kind, whether express or implied; without even the implied warranty; z: t5 d$ U, ?2 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 B4 }7 T) c2 B1 o# }  c) V
  22. * GNU General Public License for more details.
    6 c- T( Y. m& {2 l: [. p
  23. */
      R' Q) R2 j8 U! w- L

  24. + ]' ]: M7 H* z  v/ m
  25. #include <linux/module.h>
    2 r& B7 z8 O0 U. {
  26. #include <linux/init.h>) u' B: c# E2 }# q
  27. #include <linux/errno.h>$ t; P5 L8 v9 l( E7 T
  28. #include <linux/types.h>
    6 T: l% j" x+ i5 J' A
  29. #include <linux/interrupt.h>
    $ |: H% B3 G- l1 [' n6 g( N7 Q2 n
  30. #include <asm/io.h>" x$ U: g9 a  z0 f3 t
  31. #include <linux/moduleparam.h>
      f4 F$ y, V  }8 r0 y; N
  32. #include <linux/sysctl.h>
    ) }) i5 W# a+ D4 y: `5 o& P
  33. #include <linux/mm.h>0 e8 B# ^% Z# _# D) C
  34. #include <linux/dma-mapping.h>
    1 x* E5 |% r7 {9 r) J

  35. 8 K1 F/ {) n- g7 L4 _& O8 E$ a( h
  36. #include <mach/memory.h>; c: C  \# Y8 c  G! F$ C
  37. #include <mach/hardware.h># ?2 s3 o( z8 J+ L7 d- s
  38. #include <mach/irqs.h>- ?$ G/ L8 V/ Q0 S
  39. #include <asm/hardware/edma.h>( [; n  e7 `0 {. g

  40. 3 O" ]. o  R& r0 S8 ?
  41. #undef EDMA3_DEBUG
    : M4 U1 j0 S; K
  42. /*#define EDMA3_DEBUG*/
    . V* ^# `+ ?9 F/ a
  43. & g$ {0 o, y$ [
  44. #ifdef EDMA3_DEBUG0 H' d, f2 T7 ?! ^7 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ C; h" T$ S! n8 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , ?: G; P3 c# C+ R2 [2 v$ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , u/ r7 P  T( D: i# F
  48. #else
    . R$ ?/ ~- K" }8 X! m5 c( I7 ?* U. V
  49. #define DMA_PRINTK( x... )
    ' s: T% C6 D* I, G# g  G
  50. #define DMA_FN_IN% W: W, v/ j. _* s
  51. #define DMA_FN_OUT
    1 t6 z1 O+ b- `; e& c" R
  52. #endif
    % x* [$ R  V/ N! ]5 e; w

  53. / k2 E3 f+ D7 g/ O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % ?0 a8 U$ B3 o4 p  \9 C* o! y
  55. #define STATIC_SHIFT                3
    ! b  E8 T2 s8 c% X* w) \) [
  56. #define TCINTEN_SHIFT               20
    : O/ q, W- H9 P8 I
  57. #define ITCINTEN_SHIFT              21
    1 f; f! t* a* M1 S. p
  58. #define TCCHEN_SHIFT                22
    - z- a* t0 S' D1 S7 N1 o: G0 @
  59. #define ITCCHEN_SHIFT               23" x0 |/ ~2 z& o! @5 B4 |/ B" M& r0 @

  60. + P7 K% t3 j! u
  61. static volatile int irqraised1 = 0;
    # }; T! ^1 O. m
  62. static volatile int irqraised2 = 0;; b; @2 ~4 j1 N. S) i0 @

  63. & b8 H, [1 a) Z/ f3 ]" x# G2 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ^* F) d- P6 B- z- d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 e! f0 U4 j4 K7 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! p: J. _% l' \! g# z+ X

  67. & H. n$ Y6 D! [6 o0 {2 h
  68. dma_addr_t dmaphyssrc1 = 0;
    & K; y. Q7 C: o) E
  69. dma_addr_t dmaphyssrc2 = 0;/ d( }+ _6 E( h- \  z
  70. dma_addr_t dmaphysdest1 = 0;. I& k, d2 ]; q( t# M7 o
  71. dma_addr_t dmaphysdest2 = 0;
    : m- v# _. t& n4 C. n: M& O
  72. & @, j- P, c; {) T
  73. char *dmabufsrc1 = NULL;
    ; _! l) ?1 ]8 \
  74. char *dmabufsrc2 = NULL;
    0 [2 V7 P. W) g6 J, T" r9 W9 j9 R2 C
  75. char *dmabufdest1 = NULL;, G% Y) ~  B( _$ R% L# g! ]
  76. char *dmabufdest2 = NULL;
    & K. u3 E9 A& n; r

  77. - p4 K: j8 Q4 r! M- p$ q
  78. static int acnt = 512;
    ! @" o7 l3 ^4 t7 K7 V( Y
  79. static int bcnt = 8;' Q( g+ G9 |5 |: K0 }
  80. static int ccnt = 8;
    ) c( Y# |, O  L$ d

  81.   k$ j( x; x; i" Z/ y
  82. module_param(acnt, int, S_IRUGO);
    * z( o! @( p. w# Y
  83. module_param(bcnt, int, S_IRUGO);! W3 K, S" Y# L$ Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' z/ O- ~! W1 l: k3 ^  {% t! k, l4 _- |2 ?, N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 T/ a1 J1 {+ v1 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 i9 {4 S0 U7 Y0 }9 x# q% R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 @* E4 ^  k  s' M8 ~. E0 S3 y9 |+ B0 g- `! Y# I9 q5 S" h
/ s! c2 V# F/ A& _; p4 ~: P# u1 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 10:07 , Processed in 0.037724 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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