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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* [4 h4 I# @% [  a
  1. [code]EDMA sample test application& G3 Y- n$ R3 v
  2. /*
    7 o$ s6 S+ g/ T7 {( T9 U  e  ?+ G
  3. * edma_test.c" J/ J7 C4 U) T5 j% f
  4. *' e( e" Y, V3 w( e' Q8 V
  5. * brief  EDMA3 Test Application
    * z; C9 S" ?& B8 o0 u& q
  6. *! `  L( M( {3 Q: r' O) D
  7. *   This file contains EDMA3 Test code.) b% q8 V$ K5 q' U6 [
  8. *
    ( M/ Y3 p" c7 `$ [+ X6 Q4 x4 U+ w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  o. e! |) k! U# O9 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; E4 P1 T+ V  ?" I$ P& s
  11. *         TO CHANGE.$ _- y  S% T, N2 V- D5 c
  12. *. c0 h, M# ]. k! g% T4 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      H- e  X) ~9 i7 E* M
  14. *
    2 y# I5 K+ E1 B+ ]. O0 z
  15. * This program is free software; you can redistribute it and/or
    ( z1 g* e7 C% J1 V6 F! v# \* h0 D" S
  16. * modify it under the terms of the GNU General Public License as
    9 i" H! Z' j" z( m' N+ x1 k, Y7 F
  17. * published by the Free Software Foundation version 2.
    ) x9 w% t! }8 ^! A1 W1 H4 ?* Y
  18. *
    ; g8 Y7 K( s& g; K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# G+ U+ n6 L* ~# i# u; \5 Q: Z
  20. * kind, whether express or implied; without even the implied warranty
    & ]# t& C) l6 q* _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. @8 @2 w/ F+ n1 P$ {" Y+ y
  22. * GNU General Public License for more details.8 ^$ F2 a4 I2 r2 g- n" V& i8 Y& R+ s
  23. */
    9 ~/ Q# `6 O, m& Y$ i( Y" n2 }

  24. # F1 z( a, `. ?
  25. #include <linux/module.h>
    ! ^! k( ^3 Y- \' N9 n
  26. #include <linux/init.h>( Z; q! I0 F; N* h$ y* ]
  27. #include <linux/errno.h>
    ; B& h3 i/ [) `2 w" t) \# t
  28. #include <linux/types.h>
      e. n, N' p; b: F2 L; L
  29. #include <linux/interrupt.h>
    ! @6 D) l2 q  d) F
  30. #include <asm/io.h>. K  I  ~9 v. W! ]: H: e$ x+ U
  31. #include <linux/moduleparam.h>% B" A- V/ J& h$ U  d* f) w. s9 r" g8 W; D
  32. #include <linux/sysctl.h>; W7 B3 A. q( M5 u$ m' O
  33. #include <linux/mm.h># p# J8 q8 _) `% a' j
  34. #include <linux/dma-mapping.h>
    ( h1 `/ m. Z; `( ^( M) C& \: G* h0 @( ]

  35. 2 E( O3 q6 N' }5 M& J: m/ N2 k
  36. #include <mach/memory.h>+ C2 Y1 P  W4 i( o6 J
  37. #include <mach/hardware.h># T, W1 g0 h9 d4 u  `# [1 V
  38. #include <mach/irqs.h>
    6 ^7 q; H$ X7 |" E% I7 Q+ j! j
  39. #include <asm/hardware/edma.h>! \; ?6 r) N; _7 i+ Z0 X& i

  40. 9 V7 s  K( Q' k! g, M' q& o
  41. #undef EDMA3_DEBUG3 K' m1 A) c2 y* t, I$ R- q
  42. /*#define EDMA3_DEBUG*/
    6 @/ U" y' j0 ?$ N; M" J+ _
  43. * _9 I7 {4 ^! p" ?
  44. #ifdef EDMA3_DEBUG- o. `/ e2 D5 _, _9 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      T2 Q8 S0 W4 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ v% e$ E" L1 Y) l6 `( b; Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( V3 P$ K# j% b% a7 I
  48. #else
    0 g, [+ M" B: G  b, h5 P, {
  49. #define DMA_PRINTK( x... )
    . T3 i. a) }5 }; q
  50. #define DMA_FN_IN( S" s  v* v  r3 w+ a2 O
  51. #define DMA_FN_OUT7 J3 c: B! k2 _, `% z
  52. #endif3 B( E. W' b  C
  53. 2 I+ B8 q# E4 d0 a5 H/ o7 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 l: N% P8 _! k9 Q! G/ M
  55. #define STATIC_SHIFT                3
    * m8 ]8 E0 g6 h) s# u6 e7 ~1 g
  56. #define TCINTEN_SHIFT               202 q# a  K8 ?' F% E- `5 e
  57. #define ITCINTEN_SHIFT              21
    3 }. [1 ]9 ]. Z" s: ~* W( p, }7 l
  58. #define TCCHEN_SHIFT                22
    , W# F- }/ w0 Y2 X2 R+ M
  59. #define ITCCHEN_SHIFT               23
    ( R2 T( p0 }' `

  60. 7 C. l( T! k8 d- L' W4 t
  61. static volatile int irqraised1 = 0;9 J  h  [8 H5 f& J6 _# Y7 D1 j
  62. static volatile int irqraised2 = 0;- n/ W1 R( R* \) F" C; b
  63. 1 a) b( t! y' i$ O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  @7 p/ ~. Q, ]0 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h7 `0 s. V: _+ @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " |) r# M4 I: x
  67. 2 Q  S9 a6 m( M/ ^6 a. q( @
  68. dma_addr_t dmaphyssrc1 = 0;0 [1 u; w6 f4 m* J$ R5 H
  69. dma_addr_t dmaphyssrc2 = 0;1 ~# f. B  w2 I+ S6 r& D+ k& L
  70. dma_addr_t dmaphysdest1 = 0;( b$ J& K; B& y
  71. dma_addr_t dmaphysdest2 = 0;
    ( n: {  b3 g5 X6 U9 M
  72. . c4 T) a  b! G! L2 P: d
  73. char *dmabufsrc1 = NULL;
      {* q/ ~! I7 \4 C/ V4 I
  74. char *dmabufsrc2 = NULL;+ Y7 Q6 u$ s5 ]& ?2 `
  75. char *dmabufdest1 = NULL;- O( H3 }% K! ]
  76. char *dmabufdest2 = NULL;
    8 G3 J4 W& H& ^9 G% S
  77. 6 ]# d! R/ Z/ y6 e* J
  78. static int acnt = 512;
    ) M# D$ ^" f7 H8 d- ~
  79. static int bcnt = 8;
    . F1 C+ P- o: A; z3 _! S: G
  80. static int ccnt = 8;
    7 d1 v! b* `+ }

  81. 1 R6 m2 y' ~" I
  82. module_param(acnt, int, S_IRUGO);/ I! Z) U& T1 t# q6 V! i
  83. module_param(bcnt, int, S_IRUGO);( Q0 Q* a2 k7 L$ [+ I) K, m9 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 O: G# k: j9 N5 y
5 X' X" B; S8 A4 z: J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 r/ N" Z, O9 {/ m8 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; t: W, B; O0 b& c; S; K: Q8 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ _+ z* K  D8 P* H8 H, }: t2 B# V+ Z  u9 c1 [' ~- f* M

" E5 a) i, T3 @' X! F1 N% h1 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 23:32 , Processed in 0.038053 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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