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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  h% d/ M% }, c: Z* k( _7 L7 i! G
  1. [code]EDMA sample test application
    4 ]1 s" h) B3 x
  2. /*, c) c8 Z5 w0 A* n
  3. * edma_test.c6 }2 K- |* G, Z! U6 S
  4. *. }" r% y5 h0 Y1 p7 w' @: ~7 D, r
  5. * brief  EDMA3 Test Application' \& R5 S/ n6 |4 I5 \9 i
  6. *
    & K5 b4 N7 w. o# c/ p+ q
  7. *   This file contains EDMA3 Test code.
    4 @3 K9 x# m" j( P/ T9 e/ F! t
  8. *
    ' w" ]: l% z' l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % w. t- g2 {6 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / z! w9 @' h* U
  11. *         TO CHANGE.
    - H9 i, V& r+ a; R9 H2 \1 P) L2 g
  12. *. Q4 I( I# u* n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & K! b1 W5 o" r9 F! }8 l. d5 C
  14. *
    0 [9 w9 R2 p, j8 D; s6 o! c
  15. * This program is free software; you can redistribute it and/or
    ( G4 [$ r2 E4 n) T0 @
  16. * modify it under the terms of the GNU General Public License as' A. U7 m7 N/ A% \% y& Y
  17. * published by the Free Software Foundation version 2.
    & e! G- c  t3 G- \  U) p' z" x
  18. *! m3 I# l/ @' q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; s. B$ `) l+ h; v# X
  20. * kind, whether express or implied; without even the implied warranty
    2 f" n/ L7 ^! z( m. I" [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 V6 H1 _( m/ M0 |* `
  22. * GNU General Public License for more details.; P* `5 U  W3 R& J- N& s
  23. */8 t9 w9 r4 g1 C9 a6 |1 x% K7 q

  24. 3 j# j7 F# u+ Y% h
  25. #include <linux/module.h>
    8 {: P5 E; S: S$ \
  26. #include <linux/init.h>
    & {4 j' Z" [9 u) S: x$ G1 |
  27. #include <linux/errno.h>
    ; u8 u+ _) U, A5 A
  28. #include <linux/types.h>
    + r/ V' @9 S6 v, H+ p: z
  29. #include <linux/interrupt.h>0 x/ X9 P5 _  [2 v& @+ V
  30. #include <asm/io.h>4 F6 k! ~5 Y9 W, N* t0 O) p
  31. #include <linux/moduleparam.h>6 J4 R2 @6 a9 f- \2 ^6 N
  32. #include <linux/sysctl.h>) k3 L, Q- G: H. y4 a  }2 f
  33. #include <linux/mm.h>
    0 T, Y7 F1 \7 x
  34. #include <linux/dma-mapping.h>
      Z' |. ?( e* L# P* t# {
  35. 9 k: E4 f3 z  m' A( P
  36. #include <mach/memory.h>
    ) b6 H; a8 U7 I1 T
  37. #include <mach/hardware.h>$ l& _1 k' s$ a2 B& l
  38. #include <mach/irqs.h>0 l" a! a, |- ]  E: p) o: V
  39. #include <asm/hardware/edma.h>, m/ B& b& {- s# Z* o/ Y

  40. ! K9 G$ `5 \4 }5 {
  41. #undef EDMA3_DEBUG
    1 j. h" v8 O2 {# p4 o
  42. /*#define EDMA3_DEBUG*/
    5 l1 s/ t* {2 x  }2 t; B! @
  43. $ s! ~% p9 u' c6 Y: a- o
  44. #ifdef EDMA3_DEBUG
    2 H- K+ @; M  e: T1 J; k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & [! s+ E' u$ }* V: [% p$ G; \' a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 k. c5 ]* P, K) f& l# b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# x  C( ~% _, J5 m" X. ]3 _
  48. #else! q7 i* i% I) f$ ?
  49. #define DMA_PRINTK( x... )
    , X) n% Q! q; w; a
  50. #define DMA_FN_IN
    6 j7 F# e5 S* @0 h) n7 Y
  51. #define DMA_FN_OUT
    . u4 d- _! a; S+ I2 e0 @
  52. #endif) N0 Q( x: P; P9 D* T; Y5 R5 |2 C, Q
  53. ; c4 }- e& x4 B: n; N- [% d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " |8 s# z# }5 j7 M6 `
  55. #define STATIC_SHIFT                3' e/ r& {. W/ Y
  56. #define TCINTEN_SHIFT               20! _" }& L3 S  _  m( M/ ^
  57. #define ITCINTEN_SHIFT              213 ]% ?- D8 x4 V4 V
  58. #define TCCHEN_SHIFT                22
    0 w, s( G! i1 |
  59. #define ITCCHEN_SHIFT               23# d  _5 [+ o0 K3 X* B1 F4 Z1 s, o1 `

  60. 1 J. U3 ^! }  U
  61. static volatile int irqraised1 = 0;* p2 K% k9 N+ }1 h) v
  62. static volatile int irqraised2 = 0;
    ' G9 C; _  C$ F4 i% Z) m
  63. & M9 @8 v  e1 w( l9 p* m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- l7 Q* H, j# h0 Q/ `5 r3 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + m8 f. q; F) J. |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G/ @$ L# }9 b# o

  67. + y$ }: q2 X; M7 V# b2 }
  68. dma_addr_t dmaphyssrc1 = 0;+ N, P1 I( J2 c" u& W8 C4 H
  69. dma_addr_t dmaphyssrc2 = 0;
    * r/ K9 e) t1 p% R# B
  70. dma_addr_t dmaphysdest1 = 0;
    8 W5 _9 C' C3 c$ c& T7 X
  71. dma_addr_t dmaphysdest2 = 0;& _5 A+ n. m+ `8 [, @

  72. ) o5 h. {  w4 y$ @
  73. char *dmabufsrc1 = NULL;% ~: n! m' _, F3 b; v! u. v1 p
  74. char *dmabufsrc2 = NULL;
    5 v; G$ r4 K, |
  75. char *dmabufdest1 = NULL;
    2 }, g% y0 I9 @- v
  76. char *dmabufdest2 = NULL;- v. @' P0 W+ a! e/ A" g# i( r
  77. # Y0 X* a& s( S6 F
  78. static int acnt = 512;
    , h6 z3 l  x3 A  W
  79. static int bcnt = 8;
    1 r1 J7 B3 B3 K# A4 R5 U* z
  80. static int ccnt = 8;
    + Q1 f- }+ f/ H, ~
  81. " s3 P1 V, V* r4 {' K
  82. module_param(acnt, int, S_IRUGO);
    8 G; \3 K5 K4 n9 a
  83. module_param(bcnt, int, S_IRUGO);) Q; D4 _5 v2 Z, M9 {3 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 S8 Z* \. P" [  H" L5 G. \  i# _- B
9 E1 p, c* I: \+ n2 u4 ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 `5 C9 O# \5 j8 e8 J. F* S, g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* P+ D/ R! U) D; I- c" a& G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& }8 L4 h/ Y( k: h8 y8 s, `
% ]! G- B6 h) [9 q8 u: J, I

1 A9 b4 }' D1 _$ Y* p# o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 02:45 , Processed in 0.039150 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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