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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 r) {/ a" S* G! s+ B
  1. [code]EDMA sample test application
    ; J  U- s4 }  F0 i, c0 ^7 l! Y
  2. /*" ]7 L: W/ v& k4 K3 z
  3. * edma_test.c9 x6 ~( B7 |+ V  @$ S, p
  4. *) p% c6 s* E8 U9 L0 {# j! a2 Q# @
  5. * brief  EDMA3 Test Application
    6 z6 v5 N/ c. X8 ^) Q; r) G" r
  6. *
    3 t! U6 R( h# _7 R" g
  7. *   This file contains EDMA3 Test code.6 [4 Q3 h0 G. C. {+ E# n2 J8 x
  8. *& H' p7 e" L! o7 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" r9 ^5 u  ^! B: Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& B" \% V( K" ?8 ]
  11. *         TO CHANGE.
    / C5 E4 K2 M/ H/ b/ Q2 J
  12. *
    ; v- }: m( f2 q! ?0 i( o) I" x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* G' I$ ^. C6 [5 O2 _& c
  14. *1 M8 u, e$ L4 Z- E
  15. * This program is free software; you can redistribute it and/or
    5 L0 a/ n+ o9 ]9 B7 K1 |5 [
  16. * modify it under the terms of the GNU General Public License as+ O' K" {) p3 A" k1 H: u0 J$ g5 v
  17. * published by the Free Software Foundation version 2.* ^1 J+ K2 V* I0 X/ q- o$ z
  18. *
    7 |# }  G( n% x, `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) T9 N! E# a& ~- e) f
  20. * kind, whether express or implied; without even the implied warranty/ Y2 [1 a  i8 A! \: z2 r  d2 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& b' u4 |! K3 w* K4 ~4 h8 S
  22. * GNU General Public License for more details.
    , f) R1 m9 a9 L2 U' |# G
  23. */
      ?- l1 B: g- Z5 e
  24. ) x' Y# a1 C1 F
  25. #include <linux/module.h>) q2 S% S" ]! B2 t2 a1 g
  26. #include <linux/init.h>' w/ l7 x/ I  E
  27. #include <linux/errno.h>
    * s' p0 F  f. d( y- V* U7 f; r
  28. #include <linux/types.h>: D+ H/ f, E0 a  D
  29. #include <linux/interrupt.h>
    . ]1 l  a; {) R+ }/ ~+ @3 S
  30. #include <asm/io.h>
    $ ^- c1 \2 j0 R6 c& W$ e
  31. #include <linux/moduleparam.h>. q( G' ^" l6 d2 u7 u+ A5 t2 @! s
  32. #include <linux/sysctl.h>8 I" s$ Q) q" O1 }" ]
  33. #include <linux/mm.h>; j, V9 O# }; a
  34. #include <linux/dma-mapping.h># {( m! U- q5 ~0 A
  35. , V" h; k. v0 q; [% z
  36. #include <mach/memory.h>
    , {7 R& U/ s1 i' z' U* q7 f1 n, {
  37. #include <mach/hardware.h>+ s* [5 U/ E' f! ?2 X! ~6 w0 w
  38. #include <mach/irqs.h>. v# g4 K1 S9 i( O$ _. [
  39. #include <asm/hardware/edma.h>
    & w# L* L& T" k! y$ b1 l2 {
  40. % [: G8 K5 u2 f
  41. #undef EDMA3_DEBUG; p* V% s$ j- A# O4 N/ r- j
  42. /*#define EDMA3_DEBUG*/# ~) m" n* Y) y

  43. + p2 m- N- }4 v1 p- b, r
  44. #ifdef EDMA3_DEBUG
    9 s1 z! \$ P7 Q4 G% N1 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * }0 c" y, y( d4 h: @  c# X& M( X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ Y) U5 V7 I1 N2 O3 C' B; B! J, _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 V! w0 t' e! }( w
  48. #else
    " J7 r( a" j6 P2 u$ k5 i: s- ]
  49. #define DMA_PRINTK( x... )
    5 g# c. b# T5 h1 f" A
  50. #define DMA_FN_IN/ t6 k* U, F3 Y) [
  51. #define DMA_FN_OUT
    7 H' n% L( y4 Z8 g9 g# `
  52. #endif
    1 K9 g- C5 V% L0 ]

  53. , S4 c. w/ a) Z& A3 f$ C. P% L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 ]( R% q! a6 Z& q- I
  55. #define STATIC_SHIFT                34 {  G; L: I2 R& s) @1 E
  56. #define TCINTEN_SHIFT               203 Z4 h3 t7 T. g  O/ a! U: q
  57. #define ITCINTEN_SHIFT              21% A$ x; M' @5 S9 }/ X6 l
  58. #define TCCHEN_SHIFT                22
    $ \. j! R8 n/ p+ ~! V
  59. #define ITCCHEN_SHIFT               23
    $ d0 N/ T, X) ~- w; V7 `

  60. 8 c% d6 l: _& N$ m
  61. static volatile int irqraised1 = 0;4 x+ U" Y3 _( k: T; p; E
  62. static volatile int irqraised2 = 0;
      M8 R/ f; e2 ^( [( L" r, [$ }

  63. ( Q$ I! U% d1 n9 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 s6 S0 B& n4 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 y2 v8 R, l6 ]" c+ _3 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- e7 K; R+ _* a
  67. & {8 T/ d, T* ?6 U
  68. dma_addr_t dmaphyssrc1 = 0;
    / J) g# I8 E" Q2 ]0 n% a
  69. dma_addr_t dmaphyssrc2 = 0;
    ! a7 R, @, N# b/ ~# ^* e
  70. dma_addr_t dmaphysdest1 = 0;7 T4 j  d2 _/ @2 t+ I6 q1 c
  71. dma_addr_t dmaphysdest2 = 0;
    + x" ~. g, M' o, n

  72. # W7 \. x4 O* _$ J, v) Q# a
  73. char *dmabufsrc1 = NULL;
    $ \5 Q& U6 E5 t1 F; l/ d# X$ x
  74. char *dmabufsrc2 = NULL;
    1 k. r! c2 B# L( Y0 V
  75. char *dmabufdest1 = NULL;! A; @+ H2 a5 P2 \; ?
  76. char *dmabufdest2 = NULL;
    . O% ?$ a2 S% S' {
  77. 4 {* S( X$ q3 Y
  78. static int acnt = 512;& I. l' q( W. U. B+ U2 d& w
  79. static int bcnt = 8;
    5 i) F* W2 x2 \  {# R
  80. static int ccnt = 8;
    8 }! t; |: b, n& ]4 Y& E/ v8 e

  81. , k0 ~" T. u( {
  82. module_param(acnt, int, S_IRUGO);
    - z; x1 D; D1 O# B/ D0 ?/ g
  83. module_param(bcnt, int, S_IRUGO);2 C! }. S* _1 D0 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ C, o& a( |9 k( K. W; f

. Z+ I" d; J% [: L% J: ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 {2 [! L0 M( n- D/ r) D# w1 y1 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: G: w: n4 L6 f! h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 }' [# I7 n; @. {2 [

; K. z& e9 {2 g+ j  B" K
9 h; R/ t) w  U& t. Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 08:50 , Processed in 0.039408 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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