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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & {' y& h# f& n) u5 O
  1. [code]EDMA sample test application
      t' U$ a$ ~9 k
  2. /*
    0 ~8 L5 k8 s( R( P  Z- P6 w3 r' _& o
  3. * edma_test.c
    3 c! |+ m. D, u
  4. *
    " I( G( p7 }) s. ]  H1 S6 v8 ?9 j
  5. * brief  EDMA3 Test Application  m& |- `5 o, C- Y% L
  6. *8 Y6 }1 v+ s2 Z1 y0 m# \% ]
  7. *   This file contains EDMA3 Test code.# T6 h7 g$ U6 |
  8. *
    / ~) q+ [& w0 x+ p/ R% V7 ]; a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 R1 |* ?4 w2 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- s4 ~6 A; q) Z2 y0 g- |
  11. *         TO CHANGE.% F2 g' a0 z1 E) i8 D( s1 b
  12. *' y+ Q5 \6 T3 _( j) m" U# w: M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, J" }+ N- v; \; u! Y- N
  14. *
      J! D8 Z0 [& F& X; b/ ?4 t
  15. * This program is free software; you can redistribute it and/or/ n1 ]# d8 \; a6 B7 O4 {
  16. * modify it under the terms of the GNU General Public License as
    ! H5 \$ V4 _  i1 o
  17. * published by the Free Software Foundation version 2.# }- X- J6 s5 K. Q' Q1 e8 R
  18. *
    1 A  F7 _+ [( f5 \$ v! L% p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 k0 H3 c' Z$ o3 D
  20. * kind, whether express or implied; without even the implied warranty
    9 \/ }5 ~; ^( O/ c2 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 Y& X/ G" J5 @4 Y
  22. * GNU General Public License for more details.+ _7 g1 ]$ P7 H7 {
  23. */
    . s4 D% f" |2 x3 v- @
  24. * [! x3 f6 I3 c% Q* G, {( d* V
  25. #include <linux/module.h>
    # ^6 ?, W! W: M: c
  26. #include <linux/init.h>
    5 n, A* _6 U$ J/ O
  27. #include <linux/errno.h>" \" W; x* B# W- u' Y# i( l9 B3 R& G/ R
  28. #include <linux/types.h>
    ( v# I5 t3 b/ x) Y8 v
  29. #include <linux/interrupt.h>
    " x: O; r& `; q( `1 O
  30. #include <asm/io.h>
    ; w5 t3 g9 J+ [$ ]- a3 X$ g
  31. #include <linux/moduleparam.h>: h+ E" |7 G/ P5 t6 g8 A
  32. #include <linux/sysctl.h>
      W  g  v4 [3 u* V8 h( Q
  33. #include <linux/mm.h>
    7 z; p" S! x- G# p0 Q
  34. #include <linux/dma-mapping.h>
    9 D5 p5 t) H: O
  35. . O0 r5 y( u1 K# }% P
  36. #include <mach/memory.h>
    9 @/ }0 v; |4 o* z
  37. #include <mach/hardware.h>
    0 t0 N1 V6 ], s4 y# W
  38. #include <mach/irqs.h>6 E6 w7 z9 h- N3 V& u& _$ \
  39. #include <asm/hardware/edma.h>3 W5 n( N& v, }# D# ~
  40. # [. s" r* x6 `, U" `; k$ Q5 n
  41. #undef EDMA3_DEBUG
    - h0 m1 C! x" B* N) n
  42. /*#define EDMA3_DEBUG*/
    - p: x, s# M* E3 ^) z
  43. ' S, M. p3 x* l4 n
  44. #ifdef EDMA3_DEBUG
      P' s, y; J: M5 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) G7 I0 Q+ v1 n9 B3 C% g" Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 p; m+ ?2 z/ ]6 A  {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 t  _! x6 {% \; u# ]
  48. #else
    + p: h0 W' H9 c" z4 F
  49. #define DMA_PRINTK( x... )
    ( R7 y7 J* e2 {7 W( v$ ~
  50. #define DMA_FN_IN
    % I. ^1 a: {: r$ k& Q) @
  51. #define DMA_FN_OUT
    , ^8 n$ Q3 y( a
  52. #endif
    ' ?" _6 H, n0 Y/ E& J

  53. ( o- ^' p" x8 q! H6 [8 t1 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 O% u6 r6 t$ L9 u' E# P8 b8 K% ]
  55. #define STATIC_SHIFT                3
    ' p; @# }7 m0 Q
  56. #define TCINTEN_SHIFT               20, U" ^$ `/ i: p
  57. #define ITCINTEN_SHIFT              211 Q! A+ |: h4 `$ G
  58. #define TCCHEN_SHIFT                22: d4 J8 W3 e3 c5 X. _( k
  59. #define ITCCHEN_SHIFT               23
    - g8 M  o, W- V' d+ w
  60. 6 t3 E% M1 Q  b4 L# n* I8 O* |9 h
  61. static volatile int irqraised1 = 0;
    ( v- n! F7 E9 _2 r
  62. static volatile int irqraised2 = 0;
    3 |9 s/ l; r0 A0 X' d- S

  63. 3 {4 _. _9 K- c# r: w. O; ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 U/ X, h% F0 q7 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) V% C9 Z+ M) x: D# n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  x' u+ a" P1 o- @. c3 p3 [/ Z
  67. ; {2 v7 j3 i/ U1 ?8 u* D' \" h  T, o
  68. dma_addr_t dmaphyssrc1 = 0;
    ' H6 c. L7 G; _! x' j, x5 m
  69. dma_addr_t dmaphyssrc2 = 0;* {+ z$ j* ?# e2 |' Q1 b) w( u
  70. dma_addr_t dmaphysdest1 = 0;
    . K0 b+ j6 g! E0 w- S7 P3 m
  71. dma_addr_t dmaphysdest2 = 0;
    % [& A! g! h9 E: d2 W/ |

  72. / E" F9 ^7 {% g: H
  73. char *dmabufsrc1 = NULL;  X" F2 R4 |8 ]# X
  74. char *dmabufsrc2 = NULL;
    - A  f; L( ?" B  G" B- i/ `  J3 R- p' W
  75. char *dmabufdest1 = NULL;0 i: g3 c6 R/ Y8 t4 l, O& o, a
  76. char *dmabufdest2 = NULL;
    " |4 D& @& L) e; i; N+ d
  77. $ `; h3 M. W' j" g+ h  Q0 E
  78. static int acnt = 512;, [2 n! f5 N, S5 _! M3 {( P8 J
  79. static int bcnt = 8;
    * N* }" l) H% |) d- |
  80. static int ccnt = 8;7 J/ `6 I7 R2 R2 n' N) a" V
  81. 8 J( f1 O) C5 M* H: B4 p  y4 ?
  82. module_param(acnt, int, S_IRUGO);; O5 L5 J7 v' F! d- b
  83. module_param(bcnt, int, S_IRUGO);) \' a  H- |/ G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 `2 a. Z: l/ b1 b7 c6 p* H
! H: @- ?! K' q  u$ V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" y6 P: ^; f3 m5 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 w, F( n) c- A' m; {" _% j: e9 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* Y  p  D8 q9 F9 r4 k6 H8 |4 U! K6 u: a% S. [6 y
: Y  U7 A& L. x. K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 04:53 , Processed in 0.039250 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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