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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) r, `: w2 V' x  Q0 ]# ?, j8 U: |
  1. [code]EDMA sample test application1 P% C: C. U# N- T
  2. /*8 E1 G& Z# w  ]
  3. * edma_test.c- y$ s3 K: e( ^6 w9 J; l; v
  4. *" u+ j$ f/ c5 _0 T0 i
  5. * brief  EDMA3 Test Application. r# s4 U5 R0 {% i6 Z' G4 h
  6. *: N: h5 z; E; {7 Y, }
  7. *   This file contains EDMA3 Test code.- {) b0 g  V7 ]4 N8 z/ Y1 J
  8. *
    * e' b0 Q- B# _% g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 @0 T( _# t+ }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) Q, s% b6 v8 R: Y+ w
  11. *         TO CHANGE.
    . X! S( v. E/ E% M
  12. *: P' N; D- ]- b1 @4 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 q6 B/ u$ k. l9 q, J' z  j' i
  14. *2 T9 Z6 `3 q. f$ v
  15. * This program is free software; you can redistribute it and/or
    5 i4 V3 R# l6 @+ P2 H  z" Z8 u
  16. * modify it under the terms of the GNU General Public License as
    - h# X; p; Y5 e! k6 M; z! a
  17. * published by the Free Software Foundation version 2.# E1 X+ w% b( V* H
  18. *2 W/ m5 b% J# X  i+ I* p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % N. F1 f7 [1 }( J6 z: M9 I
  20. * kind, whether express or implied; without even the implied warranty, C- x* G4 o, a! L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( t) ~. b. B$ e( b* p$ B( T
  22. * GNU General Public License for more details.
    2 k- z0 g' e# b% M# ~
  23. */3 l; @$ Z- d, a+ f

  24. 4 z9 x: L$ ?# I$ Z, l; V% F
  25. #include <linux/module.h>+ V, M' u1 A3 ?# Z) ]9 O9 V* E
  26. #include <linux/init.h>* b5 {+ j- B5 K8 H
  27. #include <linux/errno.h>/ K+ R9 Q% L) x0 l8 w9 j7 p
  28. #include <linux/types.h>1 e4 x2 u$ q8 r" I$ R
  29. #include <linux/interrupt.h>3 h0 K9 S9 L1 g! q( j  Y2 r
  30. #include <asm/io.h>0 y* m6 g& b# O# d) J
  31. #include <linux/moduleparam.h>
    - w% @5 e, ?* Y8 {/ V7 q2 T: A: y
  32. #include <linux/sysctl.h>
    8 J3 y) D5 Z& ^' k& n
  33. #include <linux/mm.h>
      _' ?& q, E- [% c: _& A5 d! B/ h
  34. #include <linux/dma-mapping.h>
    $ g4 a1 h; K6 F. p

  35. 9 W9 H! q! `2 O, A' P. A: \* t
  36. #include <mach/memory.h>9 N( @4 O& O; Y! p. ^% g% e- j
  37. #include <mach/hardware.h>
    - {: j) G$ ?$ S$ j
  38. #include <mach/irqs.h>
    5 Z8 _3 k. T( O  [  Z
  39. #include <asm/hardware/edma.h>
    4 U  Y4 n0 r# ?  V, l- m8 G

  40. ; ^; E# H& Y) k! ?) ?- R6 Y- P0 [
  41. #undef EDMA3_DEBUG- v& n) F: r3 L8 R
  42. /*#define EDMA3_DEBUG*/4 O4 ]0 D; Y! B5 b' h* b9 x* H
  43. 6 h; H; O9 \: ]6 s' g
  44. #ifdef EDMA3_DEBUG
    - `5 G. e5 [! f# a; i  D  S- d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ L* v+ w- Y7 E& D% ~" d) M+ C6 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 f* @% i4 ~& V& ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / u6 A& Y3 v- q' k6 ^
  48. #else- y7 t+ I2 b" }8 D7 f6 |% ?- j% O& }, F
  49. #define DMA_PRINTK( x... )- |4 ^3 w% {! ]6 z
  50. #define DMA_FN_IN
    9 q% Z' K4 I# x$ v" G% S' n
  51. #define DMA_FN_OUT
    5 }7 Q7 K- U! I1 ?
  52. #endif
    3 _- [% O! |1 B9 O! W/ R' `4 V0 _- k
  53. $ O5 G. m. {- S% m5 b  e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 a: }! Y5 P7 u9 M* I& I
  55. #define STATIC_SHIFT                34 W1 V$ i7 K0 K, V
  56. #define TCINTEN_SHIFT               20( X5 l' {: B3 ~4 z
  57. #define ITCINTEN_SHIFT              21
    4 u. I: y5 ~! ]
  58. #define TCCHEN_SHIFT                22
    8 k; `2 w# V- E% L+ c
  59. #define ITCCHEN_SHIFT               23
    8 x$ G9 u3 w* s- R
  60. 5 _0 F2 Z+ S; o7 e, [! k2 t0 ?) I  k
  61. static volatile int irqraised1 = 0;& U9 P: y  h$ K' C$ @+ U4 B- u
  62. static volatile int irqraised2 = 0;+ }! W$ F$ i$ A: L) [* G( }
  63. 6 s% N7 k3 \9 C( ]; L5 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 e$ h* s5 _; M3 r! W' X2 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( e) N7 C! C2 ^; M2 @) c. v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * r: F! k! U( b) [& x- p3 Z
  67. % `9 t  G& _1 c! Q# _- B8 t
  68. dma_addr_t dmaphyssrc1 = 0;2 |' b2 |3 X. e. S
  69. dma_addr_t dmaphyssrc2 = 0;; ]7 q0 B+ @% ^9 P! E
  70. dma_addr_t dmaphysdest1 = 0;- X8 L- z( z' y, w
  71. dma_addr_t dmaphysdest2 = 0;
    & w- A' ~- V) t
  72. 3 g. U; ]* ?* K. _  d
  73. char *dmabufsrc1 = NULL;: c% ]- A, z% C
  74. char *dmabufsrc2 = NULL;1 \8 f6 J" K0 k& m
  75. char *dmabufdest1 = NULL;
    # ~9 |' Q# u! \
  76. char *dmabufdest2 = NULL;: K6 O/ Z, @$ U5 O
  77. 6 r; n2 N3 M, X# O& N2 f
  78. static int acnt = 512;
    ; h7 }% L; s! Z$ F3 V! u8 g1 `
  79. static int bcnt = 8;
    3 a( U/ b6 ^# D3 X  |, n% t5 y0 x
  80. static int ccnt = 8;7 g& L0 Y' q* l
  81. / v: s% A+ w3 s; A
  82. module_param(acnt, int, S_IRUGO);
    6 }7 l0 F; P- R1 N' p4 R7 ~  i! s
  83. module_param(bcnt, int, S_IRUGO);6 z# [" X% O( {& q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. W1 A* u5 z7 x& }1 @
4 }; m2 F; c& l/ t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 F' Q' z" Q3 i- D; e) J- n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 D" I+ h3 s1 a8 {% M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Y# A, l( f: q9 ~$ [' R/ s$ G& z
/ Y! P6 }! p! D0 y" l* S& Y8 d9 n3 l% m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 15:52 , Processed in 0.038177 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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