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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 _8 [' l8 A9 ~
  1. [code]EDMA sample test application( g. k% |2 [/ I) M9 \
  2. /*) `. }. L7 n2 c$ f
  3. * edma_test.c( x" u+ e- G& D- t' D. X
  4. *3 D% I% {/ ?6 u8 E! Y1 m. v
  5. * brief  EDMA3 Test Application
    ; _7 R+ K1 G  J0 l& x" P' v* O) Q' }
  6. ** F' |% @5 l+ A$ s. W* R
  7. *   This file contains EDMA3 Test code.3 X: P' C! n) R
  8. *0 X0 G0 R* Z- |6 g( ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 u& h/ a' r, H: q+ o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ?  ^* @- s2 U. X+ i3 b
  11. *         TO CHANGE.
    2 V$ @& f9 l5 S, U+ u9 s1 B
  12. *; G6 W+ i/ {4 P- K: t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( Q- O8 Z0 B4 H
  14. *. F# r" z* H$ i7 _( b7 L. H
  15. * This program is free software; you can redistribute it and/or
    ! _2 G* M6 W  E: z, A# F
  16. * modify it under the terms of the GNU General Public License as8 G3 A. a. a3 j& e" T( k
  17. * published by the Free Software Foundation version 2.
    & R8 u) d0 A! N
  18. *
    8 l! G. _5 a; `: g# W4 |5 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 \5 M+ L6 n7 K1 f' Y# h: L3 m# n
  20. * kind, whether express or implied; without even the implied warranty
    1 j' }" ?, k; W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ I/ z4 ]1 F4 b7 |  [
  22. * GNU General Public License for more details.
    % W4 N8 g$ e& L
  23. */
    4 \8 ~# b" @; m: n- r

  24. 5 ]3 j5 \9 q3 e
  25. #include <linux/module.h>
    % U* D/ B6 d. {0 }8 g* L6 @
  26. #include <linux/init.h>
    1 e5 s: x6 T: D& C3 W5 i* J! N
  27. #include <linux/errno.h>
    2 x8 \8 W- N; |) U! V" C
  28. #include <linux/types.h>
    ) h- `, P2 `1 X* Q4 D
  29. #include <linux/interrupt.h>! k4 p4 w! n9 P* G
  30. #include <asm/io.h>
    + t7 _) P9 R* ]. u3 {, V
  31. #include <linux/moduleparam.h>* q; S. L: `: ~5 _" m! d
  32. #include <linux/sysctl.h>
    ( ?% I" C2 B4 N! Q: E
  33. #include <linux/mm.h>
    , X$ a5 w( o4 W" _2 ?9 f
  34. #include <linux/dma-mapping.h>
    ' n; s. e, m8 a9 g# Z0 C
  35. , J' B0 B* \. v0 [
  36. #include <mach/memory.h>
    / `# G* H% I; R3 G. R  G
  37. #include <mach/hardware.h>
    1 V4 p2 {6 a! e7 c+ `' Z
  38. #include <mach/irqs.h>
    % ]! d: W) b5 ]- `& L
  39. #include <asm/hardware/edma.h>
    , R( B5 F! T: W2 ~
  40. , V. h2 x5 U$ U0 ~
  41. #undef EDMA3_DEBUG, r% I* X8 t* @. C% b0 N5 f
  42. /*#define EDMA3_DEBUG*/; z+ l. `4 P- O% h; d8 k) y0 H$ j& G
  43. + [. N; q* J/ o% H
  44. #ifdef EDMA3_DEBUG
    * s' `0 G9 M8 C+ f) B2 M6 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# T% `1 h: W. a$ r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / j' ]' ^/ R, A* w( p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & B8 @2 n0 J1 [
  48. #else3 t; `- M) m4 ?
  49. #define DMA_PRINTK( x... )- }5 _: `+ g# \5 v8 k) g
  50. #define DMA_FN_IN' }9 g7 ^! s7 Y
  51. #define DMA_FN_OUT& w6 ^* n& j: H3 H" |
  52. #endif
      S" L; d! i' m# T3 S- V
  53. ! q; `1 L5 L6 J) E( [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - S1 S5 U8 R. h1 e9 ]
  55. #define STATIC_SHIFT                39 X* @! f) d& Y4 C/ m" w/ {3 @; z2 ]
  56. #define TCINTEN_SHIFT               20
      X$ R+ X2 p( C: w
  57. #define ITCINTEN_SHIFT              21
    $ q' E- E. M& u' W+ C0 w$ k) M
  58. #define TCCHEN_SHIFT                22
    " L! c* X/ r, H' j& u# p
  59. #define ITCCHEN_SHIFT               23
    7 p' q2 Q) l# ~
  60.   Q3 X" s/ p5 Q7 l( n2 s* M2 L4 G- K( G
  61. static volatile int irqraised1 = 0;
    4 H* b  U. l- S) p
  62. static volatile int irqraised2 = 0;
    ) D) v8 w) w4 O5 v; n. A
  63. , q  R" V* M. I& D0 S4 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- J, e( z7 i6 Y8 R- n$ |# _' L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # w* i+ f, Q2 @& h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ d8 L4 p4 H/ N/ q

  67. 7 {# m2 ~2 D* I" X
  68. dma_addr_t dmaphyssrc1 = 0;
    * o  ?# |  Y, B; ?5 {+ n0 }
  69. dma_addr_t dmaphyssrc2 = 0;3 z+ K' g' X3 g! t) N
  70. dma_addr_t dmaphysdest1 = 0;& T2 h& s4 p' h  f: X# g( s
  71. dma_addr_t dmaphysdest2 = 0;3 Q; P, X) m, }( u7 s2 g$ Z
  72.   V0 [! ?8 }; F. K4 A& `
  73. char *dmabufsrc1 = NULL;! s8 |/ V0 a# Q( s+ v) D
  74. char *dmabufsrc2 = NULL;
      [( P1 Y1 f  {; Y  n6 h
  75. char *dmabufdest1 = NULL;
    1 t' P% j  I) v5 k5 Y5 p
  76. char *dmabufdest2 = NULL;$ p% l$ H! ]2 B' V
  77. / `1 N" W4 q' p7 G5 T5 t/ E1 N
  78. static int acnt = 512;
    1 |* Y% m7 E. {$ Z6 a% |' }4 d0 h
  79. static int bcnt = 8;& o7 t. K8 v0 J  t
  80. static int ccnt = 8;9 A" D5 c: h" M/ y$ M. N) z2 k

  81. 7 B( o4 R6 m) t$ i% b" k' g
  82. module_param(acnt, int, S_IRUGO);4 p* s: j  u; O, P6 j: q
  83. module_param(bcnt, int, S_IRUGO);
    / R9 Q7 y: r, l& y! T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- ?, B# z: c5 Z2 l1 L1 k  c) D. B( e) y3 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ E* V5 q) Q" [2 C9 s" ]8 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Z( t$ h4 V% X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; Q" w9 Y8 @* G, H: A
* Z0 P8 P: z0 `7 J

) I  @# z. X0 T0 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 00:59 , Processed in 0.038945 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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