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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " I+ M" ?$ t4 I: E& w& h0 F9 U
  1. [code]EDMA sample test application; ]! a6 t& N. U" l
  2. /*! y; m5 S( X6 n; Q& \% J6 G
  3. * edma_test.c4 x$ e$ P! {7 m3 P; P8 S4 `) v
  4. *
    + z9 O2 Y7 l1 |8 |! Q
  5. * brief  EDMA3 Test Application! s1 H9 b7 U& _( ?( k% k9 U
  6. *7 ]5 x& a& i+ ]4 y, c3 k% d% b
  7. *   This file contains EDMA3 Test code.- W" q# ]& |% ?1 X; I# ~! V
  8. *8 X0 x" y6 D% n; d2 X1 E! W- i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% _; z, s4 w. t% r5 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / F' _8 `" o3 y; I) X( q  Y8 T
  11. *         TO CHANGE.
    * w9 X. K3 b  J0 Q% q
  12. *( T: r, j  M( O! Z  \$ B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 y! @; u- ~  ]5 |# P9 e) H- y' y  j
  14. *
    / M! k6 }$ J6 g- N' w8 q  m$ D5 o. ~! I
  15. * This program is free software; you can redistribute it and/or
    * f( k9 J  ]$ m& k9 e9 B1 t
  16. * modify it under the terms of the GNU General Public License as
    , n0 ~2 X' T# H5 z3 o. O9 L* f7 q$ f
  17. * published by the Free Software Foundation version 2.: ]. e" X* o4 ]" Y& d8 _3 T* C4 R
  18. *
    / c3 I% v( i  b0 H6 D+ W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; J. ?/ _3 C  a1 o( ]
  20. * kind, whether express or implied; without even the implied warranty2 _: e9 u, l- I! _$ j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 I& x! ]6 @$ e# n9 R
  22. * GNU General Public License for more details.
    & J$ G7 U/ c4 _* R' K1 q& n. S
  23. */
    & F, @! h  Y" g! R
  24. " l6 t3 e7 h- m; T' B$ N6 A
  25. #include <linux/module.h>
    6 o4 G6 z6 [$ `- h6 S
  26. #include <linux/init.h># s  _, |/ q3 s
  27. #include <linux/errno.h>
    + I( f" |, z/ H: V" n3 P
  28. #include <linux/types.h>
    - r, h0 t& [+ I5 f9 M( N- [& Y' D
  29. #include <linux/interrupt.h>
    ' D3 P; z3 T7 p
  30. #include <asm/io.h>
    4 a! r5 @% X5 u) \
  31. #include <linux/moduleparam.h>: w3 c, M2 }- y5 e7 R
  32. #include <linux/sysctl.h>9 ^) i8 ]/ `$ ?, k3 `3 R# |0 T
  33. #include <linux/mm.h>
    ' s- D* z& ^& j5 g1 D! z1 s5 l" Q
  34. #include <linux/dma-mapping.h>2 A: w! h$ V5 Q' R2 m! L; }2 J, q

  35. ' ^* |1 A* e% E: r( @
  36. #include <mach/memory.h>
    6 ]3 E# A& ~& v. R% A: w- Q4 P& w" J
  37. #include <mach/hardware.h>
    . L/ c1 N8 X! f. f& f# H) Z  n
  38. #include <mach/irqs.h>
      A2 R" }8 @  V$ @2 |5 }. f, e: B+ ~
  39. #include <asm/hardware/edma.h>
    * z8 C* P, M6 h$ {+ z* D3 {
  40. ( Z5 W& p2 _( _: l$ Y* o" \
  41. #undef EDMA3_DEBUG
    + \, j/ g( M3 O7 M3 Q2 {6 a
  42. /*#define EDMA3_DEBUG*/
    9 M$ u4 B) T/ _) Z

  43. 9 L+ p& C0 m; v
  44. #ifdef EDMA3_DEBUG: I- E) s/ o/ D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): k& S4 b2 B) O' O( b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# h5 ^4 V  Z/ C- i' D' R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 b/ q: o' H$ Y0 h( ]
  48. #else
    % h+ x5 L" H. ^
  49. #define DMA_PRINTK( x... )* X" j( N7 ^+ g3 o' h
  50. #define DMA_FN_IN6 p# P8 d# i8 A. Z+ Y$ C- C6 z: p
  51. #define DMA_FN_OUT, U7 X3 ?; t0 J# ^( G# }
  52. #endif
    ; `) R) K8 ^: o( E+ w1 J
  53. 8 O+ `0 ^3 n8 J: F. q# w+ b( U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 V9 _! w" O" q8 J( v2 r
  55. #define STATIC_SHIFT                3
    4 R  w2 r3 i1 |
  56. #define TCINTEN_SHIFT               20
    * G' D- |/ q' S0 i3 t1 H) F
  57. #define ITCINTEN_SHIFT              21: ^& F" F4 q/ @* w  J7 V0 h% u  C
  58. #define TCCHEN_SHIFT                22* _: b! g5 r4 v& o7 C; K2 l
  59. #define ITCCHEN_SHIFT               23
    ! K$ s  l9 E, o# r  `

  60. 6 ~: v2 O6 v) F7 }; y
  61. static volatile int irqraised1 = 0;
    6 e, d) F1 g" L. h+ U+ f: b8 Y
  62. static volatile int irqraised2 = 0;
    - G5 @1 E( \( k; ^6 O, S- l+ ?7 ]$ e

  63. # K/ k4 g1 S5 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 }+ k5 W# e: B4 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 ^& O1 u  ?/ n4 D+ u0 r" Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ y1 s! u, M, ?6 C
  67. . ]" C' K2 l. [4 a* w
  68. dma_addr_t dmaphyssrc1 = 0;
      k) U( H4 J- y( ^4 s2 Y
  69. dma_addr_t dmaphyssrc2 = 0;
    - M# D2 \( H9 O& b# O
  70. dma_addr_t dmaphysdest1 = 0;  `+ }9 @. ]) R2 ^4 M2 e
  71. dma_addr_t dmaphysdest2 = 0;
    $ @  e. V% |, i) |) K
  72. - Q% e+ n# Q' T9 u- |
  73. char *dmabufsrc1 = NULL;) n7 B  h7 D6 E% P3 d4 Y
  74. char *dmabufsrc2 = NULL;8 R. c  s. ~- g2 I
  75. char *dmabufdest1 = NULL;
    5 @+ _$ K; s6 i3 w7 E
  76. char *dmabufdest2 = NULL;& d4 R5 E! q1 G  R: g
  77. 6 j2 T. b: j* a; ~% l
  78. static int acnt = 512;
    9 N* _8 L6 T0 ]$ _' i
  79. static int bcnt = 8;0 h6 k. o& I1 f- m) \2 |
  80. static int ccnt = 8;: d2 L5 E/ U0 d) h
  81. 7 e$ Z. E( g5 Z7 w/ z, X( u
  82. module_param(acnt, int, S_IRUGO);6 c& u7 O6 w& {: h
  83. module_param(bcnt, int, S_IRUGO);
    5 ?# K0 \- ]7 P% r7 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 H+ J4 t# }( i" b: R  V
2 i1 z0 h. k; ~1 V% X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% R" Z4 u% N, W- ]6 m' A) Yarm-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 J6 _' u' d6 I7 @" b  G0 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. _1 }# d. s6 J. G8 c: V

6 f" g) |5 F! l. m' w
) `- N4 q$ W$ x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 11:56 , Processed in 0.053079 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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