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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 p) \" w1 Q8 Y- L
  1. [code]EDMA sample test application
    . M$ b" g% u, v; h
  2. /*
    . g& |) y$ x( p! @* j5 g
  3. * edma_test.c3 o8 V! G3 z1 z+ a2 W3 O
  4. *- a1 z9 q- i4 C0 N' c) R- K8 b
  5. * brief  EDMA3 Test Application
    . E: N% ^6 W9 }% j3 @7 U/ l+ p6 b
  6. *# p3 l2 Y/ C5 _# G  @9 a1 Q
  7. *   This file contains EDMA3 Test code.
    4 i# V/ l# Z! L' |7 @, B, o. ?0 V5 R
  8. *
    7 f3 L. m9 J+ t" A8 q2 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; y1 }2 f# L$ f) ]3 X# E: l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - E: D/ `: b# e( }
  11. *         TO CHANGE.* S9 {- P  P# r# W* S* ]
  12. *9 g$ ^5 o8 a7 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ J; M$ P& I3 d2 C# Z( G" g
  14. *
    ! n( M; h, c/ `9 D7 I  {- e
  15. * This program is free software; you can redistribute it and/or) ?0 r& p+ b. F& B# d3 R
  16. * modify it under the terms of the GNU General Public License as
    5 g  }1 F. K* \  G1 J: Y
  17. * published by the Free Software Foundation version 2.# T) R, F+ g0 k1 Z( p$ I
  18. *
    2 M( S! G  ^8 b, u6 n- T) S# C5 N# z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 M/ L2 `% z4 |: |, \
  20. * kind, whether express or implied; without even the implied warranty" O9 ]  o$ Y& B" J5 h5 Z( b2 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, X+ V) i7 H" Q' D' [) P
  22. * GNU General Public License for more details.
    " X: m% B, r# t: G# i5 S( B" V
  23. */. |/ v: a* j6 V; }9 L/ V( M; \

  24. , h9 B; M  M9 m2 Y* D& R
  25. #include <linux/module.h>! G. K0 P0 i( k& J; V. t$ h
  26. #include <linux/init.h>
    " `9 o6 k* g3 ?2 B' `& k1 D
  27. #include <linux/errno.h>; Z- G1 B( X' e4 G8 J
  28. #include <linux/types.h>
    * V, G# }. @% m
  29. #include <linux/interrupt.h>
    / H. c+ Y4 c- F. |4 d  i& e: b
  30. #include <asm/io.h>
    ; x6 V7 f( ~9 T5 V1 C9 [
  31. #include <linux/moduleparam.h>! R4 P( m" s8 [. d( L
  32. #include <linux/sysctl.h>
    / c% H+ b( Z* f4 e( `9 o
  33. #include <linux/mm.h>3 g# |) R9 X2 J( {$ }7 y
  34. #include <linux/dma-mapping.h>
    " k1 R' x- t: k3 U
  35. & _) {+ Y) L$ u8 H9 f3 ]
  36. #include <mach/memory.h>
    3 Q0 i! n; S0 C( O3 M
  37. #include <mach/hardware.h>
    $ I8 c9 z  k0 q: H( a( ]
  38. #include <mach/irqs.h># Y6 T$ {2 a9 o' x
  39. #include <asm/hardware/edma.h>/ Q" B( g/ q+ p5 K; C! o6 d
  40. * z. Q1 w1 i# ?
  41. #undef EDMA3_DEBUG) a9 J- Y$ a0 N
  42. /*#define EDMA3_DEBUG*/
    9 b: \) a7 J% L

  43.   s; Q: |' O* d, t
  44. #ifdef EDMA3_DEBUG
    ) ?! r  t, j) i+ H' g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 [% X1 e/ _4 `  T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - n& U6 N% H7 G. ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ M+ x, t: N' K5 P  R$ E. h
  48. #else8 v# i- `: n3 b, P& ?6 g7 b
  49. #define DMA_PRINTK( x... )/ s. A! [/ l5 o; I& l: P
  50. #define DMA_FN_IN9 I/ t/ A  `! Q3 I4 I9 ~1 u
  51. #define DMA_FN_OUT
    - E; v* Z. }) F0 P+ \8 E
  52. #endif
    : g4 E/ O+ `) i9 y0 P

  53. 8 j; l+ H4 a6 n$ g' E* `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & O" U9 ]9 p5 Y; H3 ?' @1 W6 |
  55. #define STATIC_SHIFT                3( B3 l3 r' M) K$ c/ [4 [! I
  56. #define TCINTEN_SHIFT               20) W. @/ r3 [  |6 d
  57. #define ITCINTEN_SHIFT              21
    - g1 O2 B  k4 A: q# Y6 g; f) o6 h4 V6 b
  58. #define TCCHEN_SHIFT                22
    5 d3 z9 n1 _* G$ g* ]+ j: p
  59. #define ITCCHEN_SHIFT               230 C! x4 _" j8 c

  60. / o$ f1 ~3 `4 O. ^
  61. static volatile int irqraised1 = 0;0 g- Z) J) S# F0 y- J1 B
  62. static volatile int irqraised2 = 0;
    ' q2 O' X2 V; m2 M

  63. . @* j! U6 H; @$ B/ n2 R" [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 C6 \7 k9 Z. ^2 ]3 ]/ Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ^5 a' Q. x- I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 _4 A- N# u& W* w/ u
  67. ! h1 L  h* Z5 y/ t! b  ~
  68. dma_addr_t dmaphyssrc1 = 0;
    ( `3 T6 a5 x. `4 K- N! q
  69. dma_addr_t dmaphyssrc2 = 0;, I6 [" S2 l* n. `' A
  70. dma_addr_t dmaphysdest1 = 0;: [1 u, {5 A- w, r1 _' k
  71. dma_addr_t dmaphysdest2 = 0;
    . c# S, v; q; _1 A+ P+ K

  72. ( U+ J9 [) r) A: L) i
  73. char *dmabufsrc1 = NULL;! g) p; g) k# S  r
  74. char *dmabufsrc2 = NULL;
    ( o: w2 u+ F& j% {
  75. char *dmabufdest1 = NULL;* n9 F1 D8 T* S$ c5 S9 L, E7 `
  76. char *dmabufdest2 = NULL;
    7 K2 W/ Y! |6 j2 ?5 I& ?

  77. ) u5 M1 u2 ~( x
  78. static int acnt = 512;8 h3 C, {0 n; S/ }7 r
  79. static int bcnt = 8;( s5 s$ R5 k1 j: n& @, ?: [
  80. static int ccnt = 8;
    , N- k9 F/ n$ z  U& a# y* a
  81. 4 t; k$ a/ J3 N& c) N; D* ^
  82. module_param(acnt, int, S_IRUGO);* D( `# J% Q" Q2 \3 I
  83. module_param(bcnt, int, S_IRUGO);5 y0 o+ g! [; {5 |8 M& o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 N+ r% t$ m7 p2 X* t
7 Y/ U, j  [7 o  K* [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! X3 D2 X1 P3 p6 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' E1 O, I/ Q9 E2 h7 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: E) R) x4 n: |# i# C
- Z- M9 x: B' M9 j" c& [# e& c

9 I, M. z  V/ C  p3 a* x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-9 07:53 , Processed in 0.039902 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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