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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 i1 V9 G( ]  x; ?
  1. [code]EDMA sample test application7 l( @4 N4 b( W  p" r9 B
  2. /*
    * T3 b& p  Y) I. w( l" O# W
  3. * edma_test.c
    . Z$ w5 f8 M& w; V) z! J4 S* Z
  4. *
    ! {& v( s2 B6 U! X6 Y! H/ N; V
  5. * brief  EDMA3 Test Application
    6 l$ O/ j2 j  [0 W
  6. *
    ' B. i2 c9 D( h8 o: a
  7. *   This file contains EDMA3 Test code.
    : n& |/ l0 f! F
  8. *7 {- f. p2 }8 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 u" x1 x9 j  [$ `' T! Z' W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! g3 R* A5 u! D) ~
  11. *         TO CHANGE.
    * w6 G6 T( y6 b+ E2 {/ T; c
  12. *
    1 a- U8 {* g8 _% I: p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* Y5 |$ g; A& Q+ h5 J/ h) Z! b
  14. *
    $ I/ W9 {) G* R9 v- I9 |+ K
  15. * This program is free software; you can redistribute it and/or1 |. O# g! N8 }7 K
  16. * modify it under the terms of the GNU General Public License as- J% f# s$ ^2 d2 K  A8 o9 W* t
  17. * published by the Free Software Foundation version 2.3 G2 v# q) ~* f
  18. *0 ]. |# R, b$ V* s  _; Q( j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / F' w# t% g8 \; a% c4 w
  20. * kind, whether express or implied; without even the implied warranty
    # y3 ~' n- O- Y+ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ `: E' N# O* c1 X% W8 X: g7 N
  22. * GNU General Public License for more details.
    9 H  P: R8 P% V) r
  23. *// K) o4 r; \! a- b

  24. 6 {  [& J$ K' }# j, n& i) N* l+ T" |
  25. #include <linux/module.h>0 H, X6 ?0 V, u, a1 ]5 t
  26. #include <linux/init.h>* \1 a" B5 K8 L2 }: L3 d+ q% e
  27. #include <linux/errno.h>$ V2 @! o, P6 @8 [7 ^& O- Y
  28. #include <linux/types.h>
    * A* Q' Z* Z3 u0 J# M/ p
  29. #include <linux/interrupt.h>
    : }% W' r* c/ T6 L+ S
  30. #include <asm/io.h>1 q1 ~, g) \8 u2 {- i. B+ U
  31. #include <linux/moduleparam.h>4 K) W6 e4 F5 S  b6 W
  32. #include <linux/sysctl.h>
    ( o1 L! ~4 G( m8 ^% N: V
  33. #include <linux/mm.h>2 x' x" ]+ y3 Q! T7 z, }, k. E
  34. #include <linux/dma-mapping.h>1 @" f' `6 m! ?! a
  35. $ w- A8 [2 ~: l. b( `4 `( S
  36. #include <mach/memory.h>7 D1 b) N) m5 I% y& N
  37. #include <mach/hardware.h>- Z; o/ |1 E+ W( q* V; T
  38. #include <mach/irqs.h>
    6 A# F/ X3 m/ N  S6 @' Z' T& y9 f& {
  39. #include <asm/hardware/edma.h>
      @7 ^4 C9 Z2 C2 c

  40. 1 T; Q0 _( U3 i" |7 K5 O7 [1 N) I
  41. #undef EDMA3_DEBUG4 U( T: X; @# U* k: H
  42. /*#define EDMA3_DEBUG*/# I4 t7 e! K" `; Q" |$ ]

  43. ( l) P  G+ w  m% Q
  44. #ifdef EDMA3_DEBUG& \* U7 x' D1 j  }* x7 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % ^9 [) u" ^, N' d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! M9 T2 @; f& F' k4 ~3 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) Z2 H9 R6 \0 T  V5 x5 X$ m' d% x
  48. #else  J6 o9 T6 I( f- r: }1 w) A
  49. #define DMA_PRINTK( x... )  }; x/ ~% M3 Y- I* e
  50. #define DMA_FN_IN/ x# B& ?8 i; Z6 j5 g+ u8 `: S
  51. #define DMA_FN_OUT
    . E9 A% r% l! g9 x- y: x7 ?7 E! N
  52. #endif
    0 J( S' A6 c! T+ }  q
  53. 3 ^# Y/ T6 ~- P: E* j' ?, N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" R, r9 w# f( ?$ r: |2 R7 i7 t# ]# K
  55. #define STATIC_SHIFT                3
    , `; F  X8 L6 k0 e* ~6 y9 i* J; I
  56. #define TCINTEN_SHIFT               20( ?9 A; W. b% H1 L
  57. #define ITCINTEN_SHIFT              21
    & \% X# H( }4 t  \( s8 X
  58. #define TCCHEN_SHIFT                22
    1 Y8 v2 [0 A2 ?* F. s: }' F; C
  59. #define ITCCHEN_SHIFT               23
    9 Q1 u2 Z/ I$ t: G, ^/ R9 V$ @

  60. % l" T1 m$ n$ l
  61. static volatile int irqraised1 = 0;/ C; o+ f* i6 k3 I2 V% l7 t
  62. static volatile int irqraised2 = 0;
      \& I0 x/ U# N  q: x4 `

  63. ) _% @2 {2 k$ m5 @3 t( S" W2 o0 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 G" H8 R, U9 T+ j' T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ~; C+ E" r9 [9 l" h9 A+ v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; m% l0 k6 |9 p" {! h; R9 B
  67. - r: j5 g8 L+ _+ ]" J( M/ O
  68. dma_addr_t dmaphyssrc1 = 0;  q" |" J! N; ~  _! n2 e; |- S0 p! w2 X
  69. dma_addr_t dmaphyssrc2 = 0;
    # ^4 B1 M. L7 b' A: o" p1 ]
  70. dma_addr_t dmaphysdest1 = 0;& |5 }! Q/ k7 h0 o8 @0 v; P
  71. dma_addr_t dmaphysdest2 = 0;
    7 Y. ?, ?" N" T, u2 b

  72. ! [9 Y- I4 Y* S# T( B, p7 Q5 C7 L
  73. char *dmabufsrc1 = NULL;
    ' H: Z2 i# a2 t6 G/ J
  74. char *dmabufsrc2 = NULL;+ }1 D: @, \# K! H/ M. h
  75. char *dmabufdest1 = NULL;; @/ f" A2 ~, M9 [  V) t8 \
  76. char *dmabufdest2 = NULL;
    % T$ b# Z! i4 Q  D5 U, W2 {6 K! X6 g* J

  77. , R# |( ?2 c1 B; r. ^% P% g
  78. static int acnt = 512;  G% J- x, y$ e- N5 Q- _
  79. static int bcnt = 8;" ?  F) G, Y& r2 b3 I6 }4 ]
  80. static int ccnt = 8;
    5 @  `, w" Q) I# U2 a

  81. 1 ]8 C! Z* c% L, J  L$ B
  82. module_param(acnt, int, S_IRUGO);
    : u8 g' X! m6 u  K
  83. module_param(bcnt, int, S_IRUGO);- x( F2 s9 \7 ?: |2 \. M) \' W4 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 e  T/ g, p3 x" v( T8 t( ?% q5 f# V& ^, C8 s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 o0 ^8 `2 [# u1 i9 ]4 c, K9 U0 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 m4 l! Y+ H' n7 }. }- U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 \; M6 T" B* A6 Q: u. C1 [

; O3 n, Q5 Q# X* g
) S7 w3 J% \0 v. z9 H' M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 12:17 , Processed in 0.068214 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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