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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- Z& s  q2 r2 x4 i3 P
  1. [code]EDMA sample test application
    ) o  E# U1 i( V
  2. /*/ L& G# n7 p! @0 _- |$ j
  3. * edma_test.c& r2 ?' f6 ~( S& e( H* }
  4. *
    ( Y. ?/ x. M5 ^& d  ^$ q1 s9 X
  5. * brief  EDMA3 Test Application
    " _' V- ]1 m* ~1 T$ n
  6. *. Z% ~5 h! T$ w# }% l9 b* Q+ `
  7. *   This file contains EDMA3 Test code.
    2 ^3 E1 h: g+ ~3 x, J/ o8 U+ @
  8. *
    , F5 a; M2 V2 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" \& S! Z5 g; {& ~9 @+ {6 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " D. h; z% `1 R
  11. *         TO CHANGE.8 y" k2 K, |- n9 b
  12. *
    3 o& e. Z9 `) `# {2 S' |2 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& [+ a5 j2 g. e
  14. *0 C' r8 y4 ]" j: V- q1 u2 M4 D
  15. * This program is free software; you can redistribute it and/or* F* i& o' t3 I/ d% S) j# ~; q2 F
  16. * modify it under the terms of the GNU General Public License as+ a% ^  s8 T1 D8 d  v: ~
  17. * published by the Free Software Foundation version 2.
    3 k0 O& u% f% b
  18. *5 {/ h$ H4 L& ~2 {3 m( U; O# r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 K$ B% X% S, W9 a2 `# j3 b
  20. * kind, whether express or implied; without even the implied warranty
    8 S! {  m  @& w# V# u; w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 }  D9 V: H" G0 t$ K: `% y5 n
  22. * GNU General Public License for more details.% x% p4 D# \/ W  p% E, D
  23. */1 [: p! ]6 M5 z: b) e% w/ [

  24. * J, n+ m+ Q) r& k( m5 D! c: Q
  25. #include <linux/module.h>' |7 o0 R, a$ R( r+ d
  26. #include <linux/init.h>
    ' L: Z6 ^# o. q+ Q4 x
  27. #include <linux/errno.h>6 d4 w" W. `, C5 L$ }( H! p- y, E% K
  28. #include <linux/types.h>' C6 O% x1 ?$ a: ^/ ?2 \8 t8 o
  29. #include <linux/interrupt.h># o5 S# r( {; p
  30. #include <asm/io.h>+ O6 Q/ }9 U& o& g( Q
  31. #include <linux/moduleparam.h>
    / O8 {9 F& V! F
  32. #include <linux/sysctl.h>
    / C" d& @4 C/ I0 w8 C7 U/ Y
  33. #include <linux/mm.h>
    6 N) z* J) @6 }- S1 Z( P+ }
  34. #include <linux/dma-mapping.h>, _- _# X/ q+ ^( c5 \& C# i7 U
  35. 6 ?2 G  }5 F( W
  36. #include <mach/memory.h>
    0 t2 s) \4 n9 l' n) s/ F- P
  37. #include <mach/hardware.h>
    * u3 Y6 A; j( o* W( q; o; t
  38. #include <mach/irqs.h>: S: X( B$ a: O' `$ K- p! t+ e
  39. #include <asm/hardware/edma.h>
    3 q9 C0 s  o7 d0 d5 P& k. Z

  40. 2 L2 F* Q* [0 c& s
  41. #undef EDMA3_DEBUG" d" p4 V( m0 ^. o1 U0 L
  42. /*#define EDMA3_DEBUG*/
    $ U6 ^8 k9 w' v- W) ?

  43. ! y9 u3 T* C8 I' T
  44. #ifdef EDMA3_DEBUG
    3 y7 P+ i( X$ z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( X4 K' c8 {: m% o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ d( r6 v1 i4 q4 F% W% d/ B1 o9 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# q7 D( a0 b/ g  j3 I6 [4 ~
  48. #else$ h8 K" @9 Y6 L% P1 M0 t
  49. #define DMA_PRINTK( x... ): ]3 v1 _$ M( R! \0 w* E
  50. #define DMA_FN_IN9 P0 K. @( @: W0 l
  51. #define DMA_FN_OUT
    : k) t# H( `: i: T  N) A9 M- ?
  52. #endif% p! ?5 R/ ?/ s  ]. m8 U1 ]2 T

  53. 0 |& {$ e, _. ?9 {* v7 n2 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): B9 K1 W7 i# {( X, X
  55. #define STATIC_SHIFT                36 z# L' Q0 J2 ^
  56. #define TCINTEN_SHIFT               20& r* x! k# L8 L
  57. #define ITCINTEN_SHIFT              21& ^* A# N7 B7 t3 g* W/ x& _2 {5 O1 j
  58. #define TCCHEN_SHIFT                22
    3 ?2 A6 p0 y5 L; @; m1 w
  59. #define ITCCHEN_SHIFT               23; {' v# C% s# |

  60. - f) `% y: ]+ h6 K6 x9 \
  61. static volatile int irqraised1 = 0;) ]( M4 D5 ~% J3 h9 E/ M
  62. static volatile int irqraised2 = 0;
    ! ~# |  W% N* ], ?
  63. . c& {9 }  j% b' J8 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 b$ l+ p  q6 w$ D9 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 P: Y  p/ @+ a! a0 c5 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & K- o) k0 [5 d  Y' c* X
  67. ' E/ @  [0 M6 R: H% }- ^6 J2 b
  68. dma_addr_t dmaphyssrc1 = 0;
    9 A# i$ {; u8 g. O5 J+ c7 u
  69. dma_addr_t dmaphyssrc2 = 0;
      `- p' f  B5 t
  70. dma_addr_t dmaphysdest1 = 0;  s, R4 i0 ^+ `3 f9 K8 F0 \
  71. dma_addr_t dmaphysdest2 = 0;2 j$ M9 I3 y+ f6 b- Y

  72. " |0 P* a. W+ i$ w. y7 d5 F
  73. char *dmabufsrc1 = NULL;" S& Q- X/ z% Y5 U4 A% N* F
  74. char *dmabufsrc2 = NULL;
    & s+ Y1 U5 |; T6 B" k! g! `1 e, I
  75. char *dmabufdest1 = NULL;
    " x, |) J! g4 J. J# l, }- N1 W, a' F
  76. char *dmabufdest2 = NULL;
    6 i/ m7 P+ Q& J7 X
  77. 2 e  B8 l/ \- k5 p# s: P  s# ]5 Z
  78. static int acnt = 512;
    # }: Q0 u: Q; Z! W+ M9 }
  79. static int bcnt = 8;2 e5 F, [" h# E# _
  80. static int ccnt = 8;
    * G" L; T1 g- X' n. ~& k# V
  81. . M" ?) o. S$ S. |# p, d3 A7 p
  82. module_param(acnt, int, S_IRUGO);
    5 d$ H6 t+ l( }7 Z! G
  83. module_param(bcnt, int, S_IRUGO);/ t7 }% l; `7 I! q' q) a: N+ q) {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; e$ g+ l8 Z4 Y& P3 p% C, J  s  ~

. B$ U! i  U/ F+ |) y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ r! ~- K3 N0 i" H$ Q" u' S# q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 W3 v1 _# v2 v$ C- Z) D: N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ y% j) w$ d- V! D
$ B& C1 f$ k" c# E
9 O1 X  p, J3 A1 A% x- G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 16:07 , Processed in 0.038160 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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