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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 W) Q( n2 u, v, x' q, z
  1. [code]EDMA sample test application- b. ^2 r9 p1 N8 C7 s/ N
  2. /*: s! G/ `" ^* Z- Y! A4 j
  3. * edma_test.c* c. `: p* _3 v, I$ b
  4. *% b4 [* Z) e% T" k7 N
  5. * brief  EDMA3 Test Application
      Q$ i1 m# i* r: c; A" m
  6. *( I( @8 k9 L6 k& E* T. h$ K+ J* e- J
  7. *   This file contains EDMA3 Test code.
      Y7 ^9 |) p& J& ~3 _
  8. *
    8 @" r: C/ O$ ]2 E' f  C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' Q" l2 Y( n- E' N- U$ {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! ~$ T. L6 C9 N0 {0 t( G) o
  11. *         TO CHANGE.: J& E2 f% k' k- j; X. Q# o
  12. *2 E8 j% w& F) Y+ t, m: P9 N/ x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 B' J( U% `1 i& p- V
  14. *
    : X( ?3 A* Z9 T6 D6 ]
  15. * This program is free software; you can redistribute it and/or
    & i1 T9 X/ z2 K% p8 o# w: x
  16. * modify it under the terms of the GNU General Public License as
    9 ?4 _0 C' q& L
  17. * published by the Free Software Foundation version 2.$ \# n! b( Y- U2 y2 [  }
  18. *: [2 l9 Z- d  J1 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ D$ e8 G/ j1 X$ [3 O
  20. * kind, whether express or implied; without even the implied warranty7 F' _. b3 a: [! F4 c# W6 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 p' d, k! d) d/ z
  22. * GNU General Public License for more details.
    - S% Z  b  ?' ?  a# r7 `  e! P( t  g1 E
  23. */+ T+ T6 P& |8 d# M5 _8 Y5 N# V
  24. , Y& q$ J, g" @$ j4 c
  25. #include <linux/module.h>
      {3 ^# d" I& p2 x
  26. #include <linux/init.h>5 J) W# B- o' c1 Z$ g% z
  27. #include <linux/errno.h>, p# g  R. b9 t6 j* t* ?  A! T$ S$ O
  28. #include <linux/types.h>/ ^: `9 M- H1 E$ D# K( r
  29. #include <linux/interrupt.h>! i9 n: P8 @3 w6 {% }
  30. #include <asm/io.h>- \) |$ C+ q9 ?
  31. #include <linux/moduleparam.h>7 [" P6 @! F# g1 @- M, |
  32. #include <linux/sysctl.h>
    2 x# `" D% I5 M# J, t, v1 u8 ^
  33. #include <linux/mm.h>
    / K7 M! \3 }; y. T9 b9 q% O7 y1 X
  34. #include <linux/dma-mapping.h>
    5 L; N+ K, l1 L/ \, d% X
  35.   ]$ t' t6 |( }& ~
  36. #include <mach/memory.h>. x' B" O; k& N2 [. _
  37. #include <mach/hardware.h>
    2 a* M& C0 G4 f) ?- E, h8 r
  38. #include <mach/irqs.h>
      m$ C! ^; b0 ~- y3 X5 u
  39. #include <asm/hardware/edma.h>
    . }( m& i( D; N' s
  40. * Q$ F/ r" Q1 R4 ?0 v
  41. #undef EDMA3_DEBUG- Y  V! Q$ v3 Z  J  o$ u& n
  42. /*#define EDMA3_DEBUG*/
    * e) Z/ n5 c- _% p: a1 P$ |, E" d
  43. ! a1 t) f  Y- @3 S. g0 I5 X2 G8 n
  44. #ifdef EDMA3_DEBUG6 A8 A8 L2 m  x6 q5 x+ O3 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 j; X6 `. w# [1 m+ h( b% G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ \9 b* l) u7 k8 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), v8 P, L  ~7 Y9 d3 l
  48. #else0 P4 U- P( i3 c' Y; L9 q8 \
  49. #define DMA_PRINTK( x... )" b. l* o, @. z2 h
  50. #define DMA_FN_IN
    ; I" L$ V# Z" [0 {
  51. #define DMA_FN_OUT
    ; y7 s( r+ v- _  |( P2 u
  52. #endif4 ^; c' M7 S: f) E! S' Y+ K( ?
  53. 0 |2 P9 `3 k6 y4 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  o; ]2 V) }$ m5 W# _0 w: ]
  55. #define STATIC_SHIFT                3' f- D7 q- b/ d: a) J1 }
  56. #define TCINTEN_SHIFT               20
    % H" f) y3 r, P2 A9 {. s* n# V
  57. #define ITCINTEN_SHIFT              21' o3 L$ M& c$ W6 b5 O/ y0 T: b
  58. #define TCCHEN_SHIFT                22% s2 k- F2 h# U  ]6 Q/ U
  59. #define ITCCHEN_SHIFT               23
    3 {3 I) C) j( E8 w' ?7 Y
  60. - ?6 D/ r9 G* T' Z% r
  61. static volatile int irqraised1 = 0;4 J3 P$ `$ C$ f  v) B6 `
  62. static volatile int irqraised2 = 0;
    0 G) J" V3 x. {: b* h% r3 G
  63. ( U/ |: n3 W6 ^$ ^  |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # m. Z/ D1 A# B( o% y& {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 E  r9 r9 `( u4 v$ O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 P8 _3 H. W" z5 z$ N+ F7 E
  67. . M% }' M& [3 ~# E* g0 }% w/ M
  68. dma_addr_t dmaphyssrc1 = 0;
    ! J, D9 Q4 z; n$ j% i. U
  69. dma_addr_t dmaphyssrc2 = 0;
    . V! W/ z- z* F# X3 h; D
  70. dma_addr_t dmaphysdest1 = 0;
    . D! X4 C# H2 e, [; ?/ j. |1 F
  71. dma_addr_t dmaphysdest2 = 0;
    : S5 V2 q8 f7 y* u+ h

  72. . G! w  C3 @5 t! t2 U
  73. char *dmabufsrc1 = NULL;- o3 _2 V) W% R; F4 g' f4 n
  74. char *dmabufsrc2 = NULL;
    9 n% R1 d$ Q7 U( W! O  q0 C
  75. char *dmabufdest1 = NULL;
    $ e% |) n' p/ I8 ?" ~5 _% t
  76. char *dmabufdest2 = NULL;$ H0 i) D! u$ E
  77. 4 x* w, {9 `1 i$ ~( Y1 L& H7 l
  78. static int acnt = 512;1 V7 C% w# `1 m  L5 s; u# [) D
  79. static int bcnt = 8;
      e1 _8 i$ h! _6 @
  80. static int ccnt = 8;
    ) ]7 d+ V: P! \& O

  81. ' o6 J" S  Y0 o
  82. module_param(acnt, int, S_IRUGO);% I& L' F7 w- a5 a1 i
  83. module_param(bcnt, int, S_IRUGO);
    ! m) v+ m9 h# X. S/ |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* w1 B/ R+ {! U6 W0 M/ q9 c0 R
, I1 |  ]7 Y0 i) R* N3 e' H, E# e4 j; Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* s3 Y4 x8 s3 X6 o1 m1 C( e
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 @) q) \' H' ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- r) B. j$ v  K- i
: B$ R) _! X) s& v. @* i7 }* D
; \# A/ F5 r3 T, [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 02:25 , Processed in 0.038812 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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