OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % ?! q+ k$ D! h3 _+ N# Y% H
  1. [code]EDMA sample test application, o) d3 p5 e: Q% ?1 ~
  2. /*% n( r5 E8 v) `3 T0 D" a  t
  3. * edma_test.c1 O0 \7 g4 d$ S: o
  4. *
    - P7 T% T+ y2 n8 C
  5. * brief  EDMA3 Test Application
    0 z- [& R# }7 g5 c
  6. *
    1 r% A7 z, I" s
  7. *   This file contains EDMA3 Test code.4 p8 F7 `" Z3 j: s
  8. *
    0 G7 E; Z7 g1 \1 C5 i, W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 v4 ]0 R. g( |  K# N. x% h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" D1 I# P, ?& |+ c; J
  11. *         TO CHANGE.* E& D: K3 ]% c0 N; s8 i' W
  12. *1 p# D: v% Q8 v# K" a0 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; Y; u( |4 ]$ ?2 ^. x' n
  14. *
    5 ~% k+ A% R7 B" f+ g# F5 w
  15. * This program is free software; you can redistribute it and/or
    + x5 c# n6 \" c
  16. * modify it under the terms of the GNU General Public License as6 |. V2 h8 ~% D/ f3 p- V  K
  17. * published by the Free Software Foundation version 2.9 |: }- b+ }4 X: i6 \
  18. *
    - U  q8 G* A0 n7 E4 ^1 n: r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 @. j; f1 N# u0 r# @
  20. * kind, whether express or implied; without even the implied warranty
    & f. d: a/ o$ P. c6 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' G0 F2 p4 Y/ A/ _% C
  22. * GNU General Public License for more details.7 y; D8 o+ c- j2 V
  23. */5 U- N( `. x9 l5 E4 _7 B7 }  H$ E
  24. , E9 ?7 g( i+ t% `, L* n
  25. #include <linux/module.h>+ X% x- u& j$ S2 u5 J
  26. #include <linux/init.h>
    ( Z$ _0 J6 `* j8 g
  27. #include <linux/errno.h>
    5 G/ K- c' O1 e9 a! U$ |% Y6 y% ~
  28. #include <linux/types.h>
    3 Q4 o1 t8 [) T4 R& P/ J' \
  29. #include <linux/interrupt.h>8 g- h& ^) s! c, u7 C+ S
  30. #include <asm/io.h>! C* d- z6 H6 t6 ~1 V
  31. #include <linux/moduleparam.h>7 f: G3 `& O! Y# I  C
  32. #include <linux/sysctl.h>
    5 o: f" z: @* N5 v0 I
  33. #include <linux/mm.h>
    3 X, G) q) k. R+ N
  34. #include <linux/dma-mapping.h>
    4 M  f- T& }1 U3 f! r$ m

  35. : @4 W, l/ V; a
  36. #include <mach/memory.h>$ o( {2 b8 x5 T+ h3 ?( e. I
  37. #include <mach/hardware.h>
    # i/ o% ]  ~' D9 h: S4 y" u3 p
  38. #include <mach/irqs.h>
      K7 q5 b- U6 o
  39. #include <asm/hardware/edma.h>. X9 `1 y, l' M8 n/ n* z

  40. ' s2 y1 s5 n- t1 I2 N
  41. #undef EDMA3_DEBUG
    - n9 m( R5 j: c) b3 ?, l/ C0 b
  42. /*#define EDMA3_DEBUG*/
    7 {8 T: H' a6 a7 ~

  43. ' O& U- P9 l, J. ]& f
  44. #ifdef EDMA3_DEBUG
    & B, f2 D, n' E* X7 b5 `; `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% E+ T6 k  d. V: c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 S3 U; ~) |$ y' ?) W, p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 B. q& }' L. j# h& v1 l$ X+ n
  48. #else* Q2 b; ?. W$ [6 Q4 @  g
  49. #define DMA_PRINTK( x... )# S( ?; M0 _+ x8 _) W8 o% Q! s
  50. #define DMA_FN_IN
    9 m( n' L! f7 w
  51. #define DMA_FN_OUT
    ! K4 M! z1 o2 A+ F/ q
  52. #endif0 y$ o$ @0 P8 S) c& f) A& y* t

  53. 5 @) e5 S0 I! e6 i9 B8 @9 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ J1 T& [; P; W; ~4 O3 i% y
  55. #define STATIC_SHIFT                3
    $ T" K& h. u( r+ o! h
  56. #define TCINTEN_SHIFT               20
    ! T3 H$ E; }. x5 {$ V, R
  57. #define ITCINTEN_SHIFT              21
    8 y/ ~5 R6 u( [/ F
  58. #define TCCHEN_SHIFT                22- b2 m5 L5 H2 f& W. H+ [2 o6 D5 w
  59. #define ITCCHEN_SHIFT               238 y2 \; Z9 e: K3 k, h5 I
  60. ( ]* d: k8 M8 Y
  61. static volatile int irqraised1 = 0;" s; `7 W3 C  e$ e, b
  62. static volatile int irqraised2 = 0;0 ]2 T3 _$ S. ?2 _+ ~9 }& @
  63. + i2 a2 v/ x- P& i- A7 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; n9 G& x% [% D3 H7 N0 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! P* J. \8 p7 H' y9 O  ?: q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, g' a0 a) ?- v; @4 i9 w

  67. , t7 c- l1 Z' n3 i+ S9 f  }& H- x( [
  68. dma_addr_t dmaphyssrc1 = 0;# l, Q$ X* b7 e# H8 v
  69. dma_addr_t dmaphyssrc2 = 0;1 R5 g  |$ ~% U& f2 D
  70. dma_addr_t dmaphysdest1 = 0;
    ; @5 {6 o3 A& ^
  71. dma_addr_t dmaphysdest2 = 0;- f! A* s) W! S
  72. . s/ @+ A! V9 D% }
  73. char *dmabufsrc1 = NULL;
    ' t* j( F; d6 i4 M2 ?0 F0 L. s
  74. char *dmabufsrc2 = NULL;
    ! t3 }$ {) n* q) N; \
  75. char *dmabufdest1 = NULL;9 z! y; t0 a7 O& K; _
  76. char *dmabufdest2 = NULL;
    6 b4 W# o, r$ M# f) i  c
  77. 3 s" r6 ~0 F# E" w9 b- l
  78. static int acnt = 512;! h# [6 b, F& B
  79. static int bcnt = 8;9 m$ |7 U1 h) \5 [$ t, i  S
  80. static int ccnt = 8;
    9 }4 b& `) R! e8 J5 o4 C

  81. % Z4 {& h% W, f; o2 P, R* K
  82. module_param(acnt, int, S_IRUGO);
    ( e: f! t# ~& |" b' ?
  83. module_param(bcnt, int, S_IRUGO);
    & p8 d2 m, a6 W$ w/ C2 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# [  ?4 F4 D4 ]6 z3 s

" y1 \% `1 O3 W  u# W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ^3 @2 @; c) @! U* W$ ]) R3 y8 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ v) m6 o- o+ v$ F/ B5 y3 \  l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 h  @9 S5 G0 M

8 ^. C) l  P" @9 t* T. Z) d3 K) _) P5 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 15:52 , Processed in 0.038636 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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