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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: [1 U6 `* K  R) u, {. q
  1. [code]EDMA sample test application8 m1 ]+ _1 D/ `4 ]2 x4 H
  2. /*
    9 B2 R6 O  J, h7 J) `
  3. * edma_test.c6 P3 ]! @, _3 P( |
  4. *
    0 C% c7 e& U9 }6 v3 @
  5. * brief  EDMA3 Test Application" p5 v/ i7 z  T* S3 Z3 ^; A2 a* z
  6. *# j2 |5 X6 e; Y- i# Y7 C
  7. *   This file contains EDMA3 Test code.0 J3 B6 D7 g. M9 m- g% u! Z6 ^
  8. *
    * _$ e' @/ b) I! N; ~* L. J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  e& m+ {4 g4 @7 X* e' H6 ^3 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) Q0 U2 T- [" g& T' N* p( N) i6 {
  11. *         TO CHANGE.
    ! c. \& I8 D) o6 X  M
  12. *- l. E7 B1 p+ R5 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* p. @2 ?7 B8 W" Q
  14. *
    ( J  d: i) z( y6 j
  15. * This program is free software; you can redistribute it and/or+ k" u& f( M# I% C* M
  16. * modify it under the terms of the GNU General Public License as
    / m2 B' I8 Q& Y* I
  17. * published by the Free Software Foundation version 2.- h& G) k4 Q7 ^2 |5 }) c9 b
  18. *
    1 z" j7 i  U- E& w& t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& s( X) j) t0 n0 E4 x
  20. * kind, whether express or implied; without even the implied warranty( U" r$ ]. P- @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 R- x, _( @" ]" U
  22. * GNU General Public License for more details.
    ) w* i* d, l- C3 {# y" p' u2 E/ c
  23. */7 i' O$ E% y+ ~

  24. & k. D" W+ m; c& }: W
  25. #include <linux/module.h>
    ! c9 t& k' V- P/ G
  26. #include <linux/init.h>
    ' R: n* ~4 _# V0 T2 [1 X( M
  27. #include <linux/errno.h>
    - T+ f# F5 r0 p6 L' a3 c  c1 a; Z& j$ t
  28. #include <linux/types.h>
    / X3 W% ?, L+ M/ v" ^- G6 b
  29. #include <linux/interrupt.h>9 ?7 ], Q8 z: m* y3 p' b
  30. #include <asm/io.h>8 O% s" D. H" w$ W" @: d; A5 p5 y
  31. #include <linux/moduleparam.h>
    ; f4 W7 j. o5 o& `& i
  32. #include <linux/sysctl.h>% A! q) d3 q  r8 a
  33. #include <linux/mm.h>
    & W. R; ]# t9 a# n9 @" u5 I
  34. #include <linux/dma-mapping.h>  F" a/ ^$ G4 d; U/ ^

  35. - M9 m: v/ Y1 V8 u' v( n- B- g
  36. #include <mach/memory.h>
    ' A$ F' D/ Y* n% v; _9 z" a7 n- T
  37. #include <mach/hardware.h>
    5 e. b  o. F% _4 X% @# N9 r2 B
  38. #include <mach/irqs.h>
    ) f+ t* V( X, W. P8 P7 T( A! U
  39. #include <asm/hardware/edma.h>
    , j: c6 W  b: ]. c  |) F
  40. / h6 K% E1 b7 r0 a* f* w
  41. #undef EDMA3_DEBUG
    / i0 M* ^% u# T$ p3 n2 D" o
  42. /*#define EDMA3_DEBUG*/
    , s, ?6 ^) k3 }  N4 ^6 `$ c

  43. ) I( Q" ^; ~0 `; |5 D+ w6 U5 g
  44. #ifdef EDMA3_DEBUG2 b0 V- H- \4 f# P) ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# [6 x+ D0 P. v, g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ B8 |% c- y, c; b; w* k; w. v$ o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 u; Q9 m6 _, n. B
  48. #else
    ; u9 r9 w) [, [( o4 T
  49. #define DMA_PRINTK( x... )
    , T0 ~5 h( _' |4 i3 t8 `5 r
  50. #define DMA_FN_IN
    / O% {9 ]$ p% i+ a
  51. #define DMA_FN_OUT
    - ]4 h: K+ r7 j9 T* s3 t
  52. #endif
    ! Q3 B- \) |1 @1 W2 g8 G3 o
  53. : K- [/ y6 q  x" h: V- K9 T( n  r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" {; l9 y" [8 Y" R- _; d: U2 i
  55. #define STATIC_SHIFT                32 S* s2 f2 S$ ?, u$ @
  56. #define TCINTEN_SHIFT               20
    * p4 m7 {/ T4 ?9 b; i
  57. #define ITCINTEN_SHIFT              21( G8 L3 s5 E) d6 H. A+ L+ ?$ f
  58. #define TCCHEN_SHIFT                22
    & I& h4 }7 T' D% ^
  59. #define ITCCHEN_SHIFT               23
    ) P$ O  e) [+ E; R+ k) R9 Z  o1 |$ q

  60. ' Z  g; n9 L# p  D
  61. static volatile int irqraised1 = 0;
    1 W% y) ~/ {8 N# k( A2 a5 E
  62. static volatile int irqraised2 = 0;0 K6 [5 x7 P( M! D: g
  63. 3 [. J  ^! l2 X) h" M3 M& j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / r. q5 Y0 ^8 W/ d% y4 V2 a; c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; |2 h6 H# G3 v( Y- F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 M: Z# Z, O4 h8 ?5 H) X! s
  67. + O% v) j" C6 R% A+ R
  68. dma_addr_t dmaphyssrc1 = 0;7 E$ B7 e" r5 g; o' S% {  D  x
  69. dma_addr_t dmaphyssrc2 = 0;& T0 H3 n& \# e5 |5 u
  70. dma_addr_t dmaphysdest1 = 0;# B0 y+ W. x- `" b, J; b% B
  71. dma_addr_t dmaphysdest2 = 0;# y, I( {" j! n+ I  C7 p' U

  72. " ~6 v1 Q; B& o7 m) T% d) l
  73. char *dmabufsrc1 = NULL;
    & R2 l7 A" p8 P: N3 T
  74. char *dmabufsrc2 = NULL;
    / [/ K$ w  }$ r% L
  75. char *dmabufdest1 = NULL;
    1 r. S; ^4 ^1 I7 S# ]
  76. char *dmabufdest2 = NULL;
    8 ?. m, x& H; ]* g5 t7 e+ D' w
  77. ) q9 g( u8 a  D6 p! \& Y
  78. static int acnt = 512;
    ' x) s1 g3 W& V
  79. static int bcnt = 8;, p, [' a3 j/ _. a$ r5 `; E! [& v/ H8 m
  80. static int ccnt = 8;
    ! @) ^* l* V) i, `8 L4 H
  81. " `9 i3 e9 k- ~! [( z* E
  82. module_param(acnt, int, S_IRUGO);
    ; ]) ^  W9 T: i9 s, Z- D4 @
  83. module_param(bcnt, int, S_IRUGO);
    % t' n6 x* t, f& \& e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 P  K, o7 B$ Z. ~) Z3 b. m+ f* t+ ]! |+ [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ j( e- z$ g6 g; y0 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. ]' `/ i6 w3 d' J+ t. I& O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 A7 [" O$ S1 w0 m8 s, Q3 P

" |$ T, n  w/ C: ^. p9 f, U# r- U6 f' ~, l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 13:10 , Processed in 0.039522 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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