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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # A( |" R5 Q( h/ f0 Q; q; @& {5 p
  1. [code]EDMA sample test application
    ( b4 W. X: L6 E. q' ^  r6 c+ j1 B
  2. /*: s8 {' R- K$ n* H' O  K) Y
  3. * edma_test.c1 q. W5 `! k$ A: l& U* ^
  4. *
    / Y. A) \4 `* i' ?& u
  5. * brief  EDMA3 Test Application
    $ @7 e: w* y; V9 x% W; J
  6. *: J) t' A0 Q/ y- I9 |
  7. *   This file contains EDMA3 Test code.
    3 X8 l: K1 V2 |6 w
  8. *
    7 |$ ]' y( ]! Q( L6 y+ f/ g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ C. N. \( q: U! U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: W8 J2 z" o. F
  11. *         TO CHANGE.
    , O6 h- g3 [! K! Z! l' k! D
  12. *9 }  E: s# d5 z  s% R) {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 `9 w& y8 P# w0 w5 @! ]
  14. *
    + s4 F. |3 f! F( _
  15. * This program is free software; you can redistribute it and/or- D, j4 R& C) {7 \7 i/ }' q
  16. * modify it under the terms of the GNU General Public License as+ A& A/ V3 V4 V
  17. * published by the Free Software Foundation version 2.
    2 g: Q. `! H$ F1 g5 _' x9 H
  18. *
    # @1 V3 ?; d& x  {1 c! D  I! j' @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) U0 ~( v2 A9 @! X/ Z& }# F* `- M
  20. * kind, whether express or implied; without even the implied warranty1 `: q& U' p' K- {! A1 _( M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; l/ C* Q! W4 L: m4 p! X! S
  22. * GNU General Public License for more details.
    & l* F& k6 m- a8 j8 h3 ^  t, u
  23. */
    , `* i! E; K: x# B7 a$ j: q

  24. 6 y$ F" g" Y% ~/ p
  25. #include <linux/module.h>
    ! k6 z+ U3 L( G4 H$ T. y% ]
  26. #include <linux/init.h>
    9 K& Y3 p6 O& D
  27. #include <linux/errno.h>! v5 B: u0 S! D, J
  28. #include <linux/types.h>
    + {( ]; [! \2 W% h) K! S
  29. #include <linux/interrupt.h>- k- u& b6 L5 ]4 `; L5 U
  30. #include <asm/io.h>, J( p* }& x- p  A& J5 C4 ~
  31. #include <linux/moduleparam.h>3 d7 I: R% K% I3 z  A# l- E& a, C
  32. #include <linux/sysctl.h>
    5 Q, f; s0 {2 B5 l
  33. #include <linux/mm.h>
    - Q1 A9 x, b1 x( M% {: }  y- s& c! c
  34. #include <linux/dma-mapping.h>& s, n7 w/ V! T' H& |

  35. # J$ G* x% @2 {
  36. #include <mach/memory.h>6 J+ |5 V* D( b% B, ?& R
  37. #include <mach/hardware.h>7 k" {; U& E1 [+ Y) Z
  38. #include <mach/irqs.h>2 C1 _* M- ?1 v& R2 L
  39. #include <asm/hardware/edma.h>
    * u4 [5 I5 G: q; `; j
  40. 6 }/ y; R1 X6 E& ~: q# ]) K
  41. #undef EDMA3_DEBUG
    6 X$ n' G' d& ^& v2 C
  42. /*#define EDMA3_DEBUG*/
      ~3 I2 ^* y+ i8 z4 b  D4 K1 f' r* c

  43. 2 S+ A% ^) c) t& U2 k. q% x
  44. #ifdef EDMA3_DEBUG0 y) o5 t+ `$ u3 s* c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; i) s2 c1 b# h+ G: y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . h$ W( n, r% E9 g8 M) _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  B. {9 }( E# L" [5 a. F6 Y+ K
  48. #else
    # Q( m* j. n( o2 X
  49. #define DMA_PRINTK( x... ), Z3 a9 ~( A% E7 I7 W
  50. #define DMA_FN_IN
    ; b2 y* L# {8 N4 V6 f$ n; h% e: K
  51. #define DMA_FN_OUT6 }0 N5 E; F) m' ~- ~% q
  52. #endif& p$ ]1 W& P. y

  53. 9 h' p. n' o  C, [$ Q$ T) L: Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 I( e: M7 s1 r  M5 g9 M
  55. #define STATIC_SHIFT                32 _& W* s" G' ^2 K% z$ [
  56. #define TCINTEN_SHIFT               20
    . k& m+ P9 ]6 Z) j: p
  57. #define ITCINTEN_SHIFT              21
    3 @& P. g( p$ h0 h) q
  58. #define TCCHEN_SHIFT                22
    " K$ c7 y: M0 T) A' U
  59. #define ITCCHEN_SHIFT               233 o, n3 T0 A* P4 ^3 G/ K: |
  60. ( r' d  s" b6 }0 V; G
  61. static volatile int irqraised1 = 0;+ e5 g+ _  G6 z, r* F
  62. static volatile int irqraised2 = 0;7 c7 V" F% }4 G- l6 u1 e9 S

  63. - G( V$ o0 m3 l, u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! t1 o8 ]6 I6 }2 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 l" t0 T( V) M: Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 B8 f/ e7 w3 ~' V- M3 T
  67. 4 {5 m* e" q% U! M& |
  68. dma_addr_t dmaphyssrc1 = 0;
    # |! U& Y: F# i2 F2 |% k+ o% E+ I
  69. dma_addr_t dmaphyssrc2 = 0;
    6 |* l5 K5 M3 t7 u, @1 P
  70. dma_addr_t dmaphysdest1 = 0;
    ; ^2 d6 j0 e6 g# Y
  71. dma_addr_t dmaphysdest2 = 0;
    & I0 i/ q6 n6 x1 Q
  72. # i0 e9 ?* z5 u" `
  73. char *dmabufsrc1 = NULL;! d7 L$ h) g5 `
  74. char *dmabufsrc2 = NULL;. k0 B# \; m1 g1 ~4 i- Z
  75. char *dmabufdest1 = NULL;3 \" ~/ l+ u2 Q) L
  76. char *dmabufdest2 = NULL;5 _" j* {: J  f

  77. ! \: ?" Q3 ~9 G- l, j6 {
  78. static int acnt = 512;
    & \0 a, |& d  Z* o
  79. static int bcnt = 8;/ U, u0 H& z. n" ^
  80. static int ccnt = 8;
    % E& n. I& N9 O" e( ]
  81. ( R& t/ x" W9 {2 n8 G
  82. module_param(acnt, int, S_IRUGO);" H% E3 k) G' y2 C1 ?1 \: X5 P5 @/ ~) s
  83. module_param(bcnt, int, S_IRUGO);% h" M' u3 s7 z/ L& N$ K9 p9 m, \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 S7 V" k" @; Q2 T, c
; ]8 a! B8 E2 G1 h  K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 S# f$ V5 n% l- J1 f( yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 }" K/ c5 z2 U- L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& l8 b: ^7 ?0 c7 Z0 r6 l& m1 p3 v) D
5 r3 x; a# H8 D) C

9 D* a3 U1 _( V* S! ]3 P; X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 23:27 , Processed in 0.039102 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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