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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # s# @' Z9 q& ~$ o
  1. [code]EDMA sample test application. Y6 i* L/ x0 ]4 A& b3 z! {# n
  2. /*
    + v9 M! r6 o( a$ Y" p- x
  3. * edma_test.c
    % K( ?3 U4 u! }5 Q
  4. *$ m, a. A; Y4 S! C" Q- X& }
  5. * brief  EDMA3 Test Application
    % [# e. G7 H8 j+ a* q5 W  Q
  6. *
    0 ^0 S; Q( z  A" T: S
  7. *   This file contains EDMA3 Test code.
    0 R" P& X0 H; ^3 O0 J. @9 X; j) @* l1 x
  8. *
    " j! K" k9 _- I) Y! x! F4 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 s9 w9 Y# R2 C) j. t( D( [/ [) R0 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; b/ e# [, B5 e& @5 J, v4 A1 Z
  11. *         TO CHANGE.
    6 z7 p6 M1 I$ U
  12. *, f$ w  X- \+ }7 ~' @& H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 u1 W  u* d* v2 ?) R  X# ?
  14. *
    : V( C& I: Y: _0 m, v/ ^
  15. * This program is free software; you can redistribute it and/or
    ! q; \5 R- x6 ~4 m
  16. * modify it under the terms of the GNU General Public License as( Q6 u9 E/ u, X0 F
  17. * published by the Free Software Foundation version 2.
    " S9 g% r5 K, h
  18. *
    8 ^. p! @. q6 f& M5 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: O$ {# }) r8 A: K( t* M; p% d
  20. * kind, whether express or implied; without even the implied warranty
    0 w1 [6 [( }+ ~- x, A  j) e$ i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: u6 t$ `3 b* w, ^" m# N; [
  22. * GNU General Public License for more details.7 ]2 w7 r& C" s  R: K6 h8 m! E! M
  23. */
    4 O! b: G  s9 x1 N* z6 t, h

  24. ! K0 _" M2 ?5 P) F3 x' T
  25. #include <linux/module.h>3 W) v' [+ p# a
  26. #include <linux/init.h>
    : l! M$ F+ G. ^, x% O9 e- ^5 T8 v
  27. #include <linux/errno.h>
    # P& l- |+ q) I* T' L# o
  28. #include <linux/types.h>
    1 N" `$ n+ X4 l1 H
  29. #include <linux/interrupt.h># y: T, P8 w* l
  30. #include <asm/io.h>
    8 V# ^) m" k6 b$ b2 p3 d
  31. #include <linux/moduleparam.h>0 W3 a$ x* w/ @( r
  32. #include <linux/sysctl.h>
    6 ]+ o2 p  t. k
  33. #include <linux/mm.h>
    3 w! o8 i* v1 }- [0 Z
  34. #include <linux/dma-mapping.h>
    0 X! m; r' u9 O# ]7 M$ [
  35. - B7 e* @' R$ U
  36. #include <mach/memory.h>
    : K5 A5 W8 n3 r# {8 N, z* A
  37. #include <mach/hardware.h>$ Z) C" N2 W" L
  38. #include <mach/irqs.h>
    # R+ V4 p$ @" Z
  39. #include <asm/hardware/edma.h>% H9 o3 }' x! ]! g  x6 w

  40. 6 T$ J" a- X- H' N( T
  41. #undef EDMA3_DEBUG
    0 {  {0 k7 |9 i1 b
  42. /*#define EDMA3_DEBUG*/, T/ \0 Z8 q. s5 ^# z2 _, u5 [
  43. ) l. C+ K& H: p+ G; T
  44. #ifdef EDMA3_DEBUG  P5 c" L4 V3 t6 M6 I5 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 S7 P  L( k4 o+ S+ D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / N$ V7 D+ H2 ]- n+ H. Q! p* c+ l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 M4 S) b2 L( t( H' ?5 f4 A  k2 }* I
  48. #else, Z$ }! ?. R7 ^7 y
  49. #define DMA_PRINTK( x... )
    / H/ x4 x4 u8 A4 F9 W) `8 G, b
  50. #define DMA_FN_IN
    9 ^9 U1 y- Y& ]0 ]* q4 Y3 v) |
  51. #define DMA_FN_OUT. }. n, x/ m2 [; Y. @/ V
  52. #endif
    2 ?% c- u! u( D
  53. 9 r; V  ]. w7 F  J, x$ i5 C3 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 i' k. {4 y" e- D% @4 z2 _
  55. #define STATIC_SHIFT                3. C. ?+ i  n2 J1 m8 S) u' A
  56. #define TCINTEN_SHIFT               20, y1 J- s+ X/ J  G% _$ T9 y' n
  57. #define ITCINTEN_SHIFT              212 H2 x& R: f0 q# l0 o: R0 H
  58. #define TCCHEN_SHIFT                22
    ' l7 {- Y  S: S9 t- g
  59. #define ITCCHEN_SHIFT               23' l2 v$ B; T: P( ^$ \/ H5 E; }

  60. 4 _$ X. N0 O0 g/ j  T& V1 f
  61. static volatile int irqraised1 = 0;, b6 g: j+ h6 _0 X- X; t  f" Q
  62. static volatile int irqraised2 = 0;) j8 V3 F, S& R+ S! u. \$ u
  63. 0 M/ l( x; L; ^$ e% N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Q& f% x! r& g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % q+ N7 i2 n# m) V' p' f# `6 s! I. e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + C! `% ]0 E+ w6 w+ \
  67. 9 _3 ^) u! i+ Z: O. E4 x8 u8 l  o
  68. dma_addr_t dmaphyssrc1 = 0;
    * }3 g: U! t' D2 d2 p: ~
  69. dma_addr_t dmaphyssrc2 = 0;
    ; E" e& t& Q- ?1 Q4 t; o$ R
  70. dma_addr_t dmaphysdest1 = 0;
    4 i0 _# x- f# Q5 q  L4 {  z; e! I4 W
  71. dma_addr_t dmaphysdest2 = 0;6 K: A6 k3 {2 ?- _4 Z* ?
  72. ( \/ N  v. c$ W% ]+ A4 w- H
  73. char *dmabufsrc1 = NULL;
    9 p- ~) M. W& q& R& D
  74. char *dmabufsrc2 = NULL;4 T/ U6 I1 d% `% U
  75. char *dmabufdest1 = NULL;
    , v" k, K. G2 o/ W
  76. char *dmabufdest2 = NULL;  s. V# D$ _# S. d: u

  77. % p3 u4 J) I) d" k/ k3 D) K
  78. static int acnt = 512;
    % Q: h* X7 w7 {5 }
  79. static int bcnt = 8;
    , I# S: K3 ?# d+ Y
  80. static int ccnt = 8;
    1 I  q* E+ n! g) D

  81. . f9 p! [4 h& Z  p
  82. module_param(acnt, int, S_IRUGO);
    " w* K. F( G3 d% k4 l; q9 u
  83. module_param(bcnt, int, S_IRUGO);
    $ X  g; [2 g9 M5 T; ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 I- L) |- q% l
2 D3 L  f% B1 ]! j" `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 d. g+ ^, ?' U' U* c3 s7 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: B0 p( s: L7 I' u/ Z) [- y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! V& ~; l) \/ R. h/ F
3 s6 W* Q- K4 C# i7 ~3 p# N4 b( W1 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 07:43 , Processed in 0.040558 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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