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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, @7 E- K1 y5 _' l$ t( H
  1. [code]EDMA sample test application, R4 x4 v& }) _$ }9 ]
  2. /*
    / q& e) {9 S' ~, e9 O
  3. * edma_test.c
    ; _( R5 U* z3 @# B& A
  4. *5 k$ b* V  J* |8 y# }
  5. * brief  EDMA3 Test Application* `( e6 o7 i5 ]6 ~& D
  6. *9 j4 I' w, ~9 c
  7. *   This file contains EDMA3 Test code.0 p3 ~6 s. r1 m0 @- q1 x$ q  N
  8. *; |3 x1 z2 L  |+ X4 h& c# L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . `. s0 n& u$ y% h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 n$ n7 x* S+ i" n
  11. *         TO CHANGE.
    6 m2 I  L; b9 u6 k% K( Z
  12. *8 V. `  C* S6 i& R/ {# k/ D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' ^7 Y9 z) H9 A  D: z, t* s
  14. *
    1 C+ ?- J& w# Y6 `, P5 E# t) n) v
  15. * This program is free software; you can redistribute it and/or. @, a$ c8 M3 \- ^; v
  16. * modify it under the terms of the GNU General Public License as" k; [2 S" C! `4 P1 r' q
  17. * published by the Free Software Foundation version 2.* ^0 Q9 K+ B) S% H
  18. *& f8 e% ?1 J6 ~/ j- ?  T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 x, c; r) @7 f5 Q* C# H! U2 @
  20. * kind, whether express or implied; without even the implied warranty
    ) [, }4 k: ^' B) }. z- r1 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 P; _) F( j( z- k2 j
  22. * GNU General Public License for more details., g+ ?7 f. ~" V& V4 B$ `- L
  23. */. `3 P% ~( G" F/ R+ t  T
  24. & m5 Y  D5 T! X
  25. #include <linux/module.h>
    & B4 u( @5 q; [& K# S2 Y. y
  26. #include <linux/init.h>
    % p( Z' x7 `4 V: @" D1 L2 Q2 H
  27. #include <linux/errno.h>
    % H: B# M% _# P" X: \, O
  28. #include <linux/types.h>
    ) v! q8 L/ C5 V2 h+ W; v4 z
  29. #include <linux/interrupt.h>9 t7 K# {! k# p' ?  {1 E% ?3 P& i
  30. #include <asm/io.h>' O7 o# y5 J( c) Y1 K
  31. #include <linux/moduleparam.h>
    ) t0 W/ v% q, l& X8 A* u9 Z  \! u
  32. #include <linux/sysctl.h>0 p  ~; t0 M: N+ E0 x2 F9 }
  33. #include <linux/mm.h>& v3 A. f% Q* C& f$ b5 A# @
  34. #include <linux/dma-mapping.h>: d2 g  }! c) |1 k3 }; L1 n
  35. ; P/ j8 `+ H# R9 b  T+ b+ h
  36. #include <mach/memory.h>5 r) c$ S2 \0 ?7 v- P4 d8 `2 J
  37. #include <mach/hardware.h>
    $ L5 T- M9 x# a/ p" p5 N
  38. #include <mach/irqs.h>9 m; Z0 _4 T8 e# Z7 W, h
  39. #include <asm/hardware/edma.h>
    $ x& v) _) f# X7 ]
  40. : O1 {2 n9 v- H+ V# J/ |
  41. #undef EDMA3_DEBUG
    ; y5 U, w( N; a# C& Q
  42. /*#define EDMA3_DEBUG*/
    ; X) Y/ m( H* u1 c& s# ^& c6 Y
  43. 4 y  X) C% R8 q) L. s* u
  44. #ifdef EDMA3_DEBUG
    5 W. y# b5 M! K0 Z  t% `& Z' o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( v: b' w7 `% [, A8 o: A! B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! Q; S7 ^( w, A8 c7 _9 ^' D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& `% ~1 j, Z; _& x
  48. #else
    1 Z( h1 D" A  G& j) T" {
  49. #define DMA_PRINTK( x... )
    3 }$ u* m) r0 B7 H+ C
  50. #define DMA_FN_IN
    + A3 f) s4 b" f7 m) O  l. x2 S
  51. #define DMA_FN_OUT: J: t' L8 `8 W, f1 O
  52. #endif
    / g- X  |5 v0 W( @1 b5 P8 N6 q
  53. 6 v, X9 w) q; |- W  S# h7 q$ S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ `/ K* j% m: N
  55. #define STATIC_SHIFT                32 M) ^( r. m) Q8 C
  56. #define TCINTEN_SHIFT               20
    * y' n$ O3 W) k, D3 P8 B/ ^2 @, H7 x5 B
  57. #define ITCINTEN_SHIFT              21
    9 B  n6 c1 {, c7 l8 O
  58. #define TCCHEN_SHIFT                22
    2 A4 Q3 P1 S' l- g% h  l
  59. #define ITCCHEN_SHIFT               23
    & ^: w7 w0 E3 h! W

  60. 1 ^  h) G# C. _9 l2 u7 G% z
  61. static volatile int irqraised1 = 0;( O# T( x9 f' V. F) L8 v
  62. static volatile int irqraised2 = 0;2 E* G0 d; [( I$ E
  63. # U$ h; J4 |- G- ?) K4 Q% A& l5 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 O9 E+ T0 P2 w6 f. P- c1 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " h8 g# L% n9 ]2 [& u! |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( d3 j0 P9 R6 j4 M9 h
  67. # T( Q- P9 s% F, }" }6 L
  68. dma_addr_t dmaphyssrc1 = 0;# J7 P7 D# p/ o. F+ D7 f! `7 @
  69. dma_addr_t dmaphyssrc2 = 0;
    9 g- q9 a* ^! g
  70. dma_addr_t dmaphysdest1 = 0;
    1 p" [$ N8 x5 I+ b' i7 r: i# V
  71. dma_addr_t dmaphysdest2 = 0;
    ) e1 _: g- E6 k# V2 u0 j
  72. ! |. X/ w- s; E! T# }- v! f+ U
  73. char *dmabufsrc1 = NULL;
    # ?% u" L' ^7 G5 U
  74. char *dmabufsrc2 = NULL;
    . V: R0 j* X1 l$ S" d. r7 @9 m; E" b5 u
  75. char *dmabufdest1 = NULL;2 T5 x, t9 O# o) q) |0 g; O5 o
  76. char *dmabufdest2 = NULL;: h/ b5 ]( u( r

  77. ! `  l' s; T! D: U9 N+ c
  78. static int acnt = 512;
    % L0 `% B* [  _0 k! a
  79. static int bcnt = 8;! ?! N5 j0 J& X4 d2 {) }/ @' h
  80. static int ccnt = 8;
    2 B) a! _7 B7 a4 C& @" y" i4 M+ q
  81. / K+ \' `, i. U/ M
  82. module_param(acnt, int, S_IRUGO);; \6 n( Z  q9 m; C6 v  J* j8 X
  83. module_param(bcnt, int, S_IRUGO);" G9 x: V* ?/ d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ P8 N# L$ x' G6 `- r3 _

8 ]1 A3 j: ~3 K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 {5 u" ?/ k- @/ rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* R8 z& Y3 K) }# ]- C4 a4 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 M7 E) }: Y- I$ ^! \3 d% n) J  n% f

8 a+ }7 m% S; i: s% s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-9 04:35 , Processed in 0.045849 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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