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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 H. ?+ I* ?4 u  _' e
  1. [code]EDMA sample test application
    ( x8 f3 [' m, O& b3 K; }/ V# w7 @
  2. /*/ o/ I$ u+ L7 |3 X
  3. * edma_test.c
    $ a% X2 p9 }& `$ M* L8 }0 Y
  4. *+ W1 }; R# X/ _7 ~5 Y+ X
  5. * brief  EDMA3 Test Application* G! A: w: k9 p7 g  P/ Z8 `1 d: q; ~
  6. *# z7 E; \3 @- q' t$ D$ ~4 E
  7. *   This file contains EDMA3 Test code.# a0 z/ {  V3 n+ ?. F
  8. *
    4 \. Z& Z& x0 l& u+ J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . b: h* I" y* ^! S$ ?) t* K' e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  `/ U! {$ {6 O8 V$ p- s; W
  11. *         TO CHANGE.8 Y1 j- G  T2 s/ Q3 Y8 R0 ^( s
  12. *
    : }# s( m9 M" T1 F( a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 Y, b2 Q. m4 {& T; t4 d" |7 B
  14. *
    $ x! U7 x1 C/ u8 u* o, b
  15. * This program is free software; you can redistribute it and/or
    " l$ e* N$ j' Z' q& s% ]) q
  16. * modify it under the terms of the GNU General Public License as
    # n# X$ N% `" o9 X; d% i
  17. * published by the Free Software Foundation version 2.
    ; c( ]/ Q# _" \9 R! Y
  18. *6 j9 f& \3 V% }9 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - N0 a  i3 f7 @3 s, b
  20. * kind, whether express or implied; without even the implied warranty1 ?3 [" m: f: F# D, ]5 p$ d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 Z- k: L. I" O  g
  22. * GNU General Public License for more details.
    ! f9 o7 `' G6 a% I% ^* Y
  23. */
    $ L( _  T, J" J0 C1 P

  24. # e$ j9 o, B  u6 R5 d
  25. #include <linux/module.h>
    - I( f' C  Y0 }4 g8 F, p
  26. #include <linux/init.h>
    - ]; e9 v' W8 a$ ?$ t! H
  27. #include <linux/errno.h>
    ) l# G$ g: f3 R
  28. #include <linux/types.h>
    ' z) l% v( H2 ?: I9 \: W( ?
  29. #include <linux/interrupt.h>1 \0 T6 M. C9 O" J
  30. #include <asm/io.h>
    1 i9 |. W- v& }# X; b
  31. #include <linux/moduleparam.h>  \4 z& ?! e( P0 F
  32. #include <linux/sysctl.h>
    2 S) ^& G, ?% n) f& d
  33. #include <linux/mm.h># K' _  d9 A& Y: ~5 B$ n
  34. #include <linux/dma-mapping.h>: `* W7 f5 [# ^* L
  35. ; k% O8 N2 p0 M2 D. `) g
  36. #include <mach/memory.h>6 e9 _6 I' b6 q; ~. k  j
  37. #include <mach/hardware.h>& H- L% z2 ^* ?* B+ P
  38. #include <mach/irqs.h>. F9 O% J# }) A+ k8 ^( t6 K
  39. #include <asm/hardware/edma.h>2 ~( u. v  R: s& L
  40. % o( y7 R2 t* q3 o# }5 a6 R0 ?# s
  41. #undef EDMA3_DEBUG& h, f; {8 j3 X' I
  42. /*#define EDMA3_DEBUG*/
    . b+ o7 E9 x- r4 A1 H# r: v* c
  43. % Q( ]& l( ?! g
  44. #ifdef EDMA3_DEBUG
    : }0 a) ?( i! u7 [2 b8 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), v) _, G9 _( ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); T- ]! B& Y3 X( W; O) x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). G0 |+ r7 c: S* j
  48. #else
    " R4 ~7 c, a7 d. B9 I& n: C# v
  49. #define DMA_PRINTK( x... )& `/ ^" |0 f& ?% d. k
  50. #define DMA_FN_IN
      m8 a2 w( `9 V  w. ~
  51. #define DMA_FN_OUT' D6 a; U, c$ S
  52. #endif! T9 T/ x$ I; P' S3 _7 h0 R5 s

  53. 0 \, G( @, [! r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 f+ p1 q/ U! @: |! I6 s
  55. #define STATIC_SHIFT                3- k6 @: d& `" ]) B6 v$ x
  56. #define TCINTEN_SHIFT               20
    0 ~, D/ c. E+ H# U$ v4 e
  57. #define ITCINTEN_SHIFT              21
    ! o! C! C% m( z8 V7 V, d
  58. #define TCCHEN_SHIFT                22
    ; o- E1 ~+ S; ?  H; J
  59. #define ITCCHEN_SHIFT               23
    * F+ {6 x. x- j* W9 D% {- \
  60. ) E4 B  P4 x4 }  C0 f+ H* ?8 v
  61. static volatile int irqraised1 = 0;1 v. o2 W6 @3 Y  M
  62. static volatile int irqraised2 = 0;7 C/ \/ v8 K" F& L7 c$ q/ t6 [5 L

  63. 4 Y  Y% Z; c  s8 x( I  @, S9 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 f4 w* x# x) Z# M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ E! D( O2 M0 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + W, O) u4 @' m0 l7 c  f

  67. ; l8 V/ g: }; V, p
  68. dma_addr_t dmaphyssrc1 = 0;
    5 X6 s5 |0 P: _
  69. dma_addr_t dmaphyssrc2 = 0;
    ( ^% a4 S/ D, _) l' ]
  70. dma_addr_t dmaphysdest1 = 0;
    1 ~: j7 l7 V5 @; A" ~: [, X1 x. \
  71. dma_addr_t dmaphysdest2 = 0;' L5 ^, J( Y7 l

  72. : H1 `9 y3 D# a$ D8 F0 }; _
  73. char *dmabufsrc1 = NULL;9 t8 B9 h: W/ G7 o* y; k
  74. char *dmabufsrc2 = NULL;
    - b$ U5 }# I9 h2 C/ C; p
  75. char *dmabufdest1 = NULL;
    ; |( E: K/ a$ V" n" [! q# K
  76. char *dmabufdest2 = NULL;
    * Y1 L7 @" j3 _2 B) S
  77. 7 v2 {7 N- K. [: S% z$ a0 Y
  78. static int acnt = 512;  B, Z: w: c# X! x. n
  79. static int bcnt = 8;5 b) }. a* v! {) [+ Z
  80. static int ccnt = 8;: U8 X0 j9 J/ }: T8 X9 o# l9 a/ T

  81. , u% {+ A) b8 ^2 |; N$ x6 s, C
  82. module_param(acnt, int, S_IRUGO);% b/ H4 a6 V7 f. ~# x/ o, v
  83. module_param(bcnt, int, S_IRUGO);
    1 A* S. W/ ]7 o1 w% z6 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 D7 t# }& o- S1 A: F, {# s$ p- s' [. C- n, D1 N& f/ X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 q9 Q3 X) e* c" @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; y) v7 h; O( @; V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 P6 J8 r' c9 d: I$ y0 P

$ e' y. h, n) e& F% T8 Y! F  ?8 G5 f0 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 06:57 , Processed in 0.040218 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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