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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 S* V# g* N+ J5 z0 ^
  1. [code]EDMA sample test application
      [) e+ M8 ?* Z  @; T2 P+ `9 U4 r
  2. /*
    5 B5 i3 c; M+ u7 L, ?) P: ^
  3. * edma_test.c
    4 I1 q' i  |$ y& u3 {* @4 G
  4. *! o) Z1 g, ~7 Q8 H/ q( r" i: s2 l: @
  5. * brief  EDMA3 Test Application
    * o6 R7 t$ i! P# {2 f  f
  6. *
    1 M/ H: `8 }" U( e7 A8 o8 A
  7. *   This file contains EDMA3 Test code.7 Y( V0 B: v* A& G. O
  8. *
    3 Q8 w6 ]( [* \9 x' A9 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' Y6 H8 O% w: o1 ^- K# l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& [: P$ Q% y- v- A. N! X" y9 G% Q5 d
  11. *         TO CHANGE.
    7 V6 ~' @# Q% I; G/ w+ ~# w
  12. *
    & z+ R4 q7 I1 `$ z8 o9 L" N. K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " L, N2 E, |. H* r$ Q; |
  14. *& N! z' E6 l9 r6 ]; c5 L+ ^; G, [7 c
  15. * This program is free software; you can redistribute it and/or$ Y  `) Q+ K3 {- z4 W
  16. * modify it under the terms of the GNU General Public License as
    $ S* N8 v# ~6 ]7 m: C$ z2 ?& @
  17. * published by the Free Software Foundation version 2.% d& a- N! c0 @# g
  18. *
      ^7 [) \1 ^( {; A$ ^" m. u  m  t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" b+ W+ T' m% ]9 K0 D( `& r
  20. * kind, whether express or implied; without even the implied warranty
    ' I4 t  Z, p( [; L5 Y) Q; n0 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 M# S# _" r: N6 `  v
  22. * GNU General Public License for more details.% F. J: ~% A, [- y4 B
  23. */
    / P# P9 A) \& R* c

  24. 6 A# O% v/ ?0 P% S" z4 u
  25. #include <linux/module.h>+ v4 o" F$ J  c' B1 a6 A
  26. #include <linux/init.h>+ l' v2 o0 L6 Z3 M3 _
  27. #include <linux/errno.h>% t, ^5 q3 p3 \9 \
  28. #include <linux/types.h>; f$ S& l1 `9 X
  29. #include <linux/interrupt.h>; N: ?) ^& ^2 ^/ l( S2 t/ U6 i2 d  e! q
  30. #include <asm/io.h>( i  k: P' @: s- [0 ]$ j
  31. #include <linux/moduleparam.h># d' e0 Y5 f6 T' q* `
  32. #include <linux/sysctl.h>
    - u5 N1 G; X2 C# D& ]8 S
  33. #include <linux/mm.h>
      K8 T7 `  {! Q
  34. #include <linux/dma-mapping.h>
    ' n8 H  s" ?) l0 h: ?. L
  35. % s; Z' M% b; U3 X
  36. #include <mach/memory.h>
    9 J9 E, e( G& u% `6 X/ O9 Y9 E
  37. #include <mach/hardware.h>) _* E/ T4 F- O
  38. #include <mach/irqs.h>  h( u( S5 V1 q+ [. `
  39. #include <asm/hardware/edma.h>$ q. c- D/ [8 G# \
  40. ' ?1 S; T1 ~! n5 B$ F, `! T
  41. #undef EDMA3_DEBUG
    2 x  C; G/ e, x8 [
  42. /*#define EDMA3_DEBUG*/
    ! C% i2 k9 M& M( t6 J: d% z

  43. 7 \# a; \# ~% i  a  r
  44. #ifdef EDMA3_DEBUG1 B8 [# n* S4 G) f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) w/ z9 r! A& q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + G* h. p4 n; p# R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      |+ l0 h7 N/ e8 y$ r3 Q
  48. #else
    # z( }% S8 n0 k3 q1 x: }, X: Z
  49. #define DMA_PRINTK( x... )
    , K4 L- [+ B8 g
  50. #define DMA_FN_IN
    ) S! o( l, ~% S5 O; E% f
  51. #define DMA_FN_OUT3 B5 H3 \0 L" _
  52. #endif1 p. J0 Z& M3 H

  53. 9 V3 n9 U9 |- g$ W( ~" Z: p7 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 C8 n; D) b  v
  55. #define STATIC_SHIFT                3
    7 c$ V: P! A3 b: a
  56. #define TCINTEN_SHIFT               20
    0 @6 r4 ^6 l5 ?5 c) d/ q5 l
  57. #define ITCINTEN_SHIFT              21
    , r& V5 i- H+ `+ q6 B
  58. #define TCCHEN_SHIFT                22  J' g+ ~  \& p
  59. #define ITCCHEN_SHIFT               235 d: _; ]2 ]4 ?2 r% ?

  60. # r- P9 t& M# C  d! N
  61. static volatile int irqraised1 = 0;' c: B+ r; J0 Z" ?
  62. static volatile int irqraised2 = 0;
    6 m; X$ F- R' H. S8 A7 u  h
  63. 2 H. v3 q8 B  a. p% J* I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 y2 s4 t( T; g1 m! ]& N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ]: k2 X" R* ]3 E' [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 ~0 i+ O6 |, Y  }

  67. & _7 y  S& K3 e8 i
  68. dma_addr_t dmaphyssrc1 = 0;
    ! J4 }& D2 I; ^  |0 l& |& r1 P
  69. dma_addr_t dmaphyssrc2 = 0;8 h7 d2 ]( T, g( ^
  70. dma_addr_t dmaphysdest1 = 0;9 P* K1 B6 m& C% K0 X3 j6 x4 P( p
  71. dma_addr_t dmaphysdest2 = 0;/ z: G" D7 `4 ]1 [! p* ?, \

  72. & g4 h0 f' @- ^6 h" E
  73. char *dmabufsrc1 = NULL;' W; J" s5 p$ u
  74. char *dmabufsrc2 = NULL;; c7 c" S; y6 C% @) ?+ S7 ]
  75. char *dmabufdest1 = NULL;+ w6 e' g3 [( [" d  ]7 Q8 n4 v
  76. char *dmabufdest2 = NULL;
    8 Z+ O% a2 w5 @9 E. Y7 `7 V" h
  77. 5 M$ P4 Q; y* v1 }5 Z, D" w: _. o
  78. static int acnt = 512;
    / `" s* @' h3 P$ X7 g; m
  79. static int bcnt = 8;5 A- p& G4 r8 t3 ]6 ~
  80. static int ccnt = 8;
    , T& q8 w" R" D. \, F4 _1 x6 \# R
  81. ! b, A; l4 \: }3 d; s. l7 F
  82. module_param(acnt, int, S_IRUGO);
    + P  E# [% c0 b
  83. module_param(bcnt, int, S_IRUGO);# @1 `& _/ Y$ b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& Y+ ^$ i2 h/ l% M% z7 @, H& S

- |$ |/ {. x4 }  x- T1 `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& |7 Z& A: r& D/ j. h* q7 s6 P
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- j  G* _8 k  p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 |% A' i8 m! q7 S- ]6 Y' K
: ]) `' k1 y( u  _+ J3 i
% H8 M3 C7 ?4 _) @  }7 u9 |- ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-3 13:30 , Processed in 0.049051 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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