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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ J( \3 l" P$ n9 T: {9 [7 i
  1. [code]EDMA sample test application
    3 X6 ]2 ^. t: s% C
  2. /*
    ; f% P  }; I3 E- T
  3. * edma_test.c
    # X; Y' L5 D7 B) ?. V6 k; S
  4. *
    3 \9 m9 u; k- a, d
  5. * brief  EDMA3 Test Application
    + x3 j) A  S# a* c
  6. *
    5 I: l0 ?, X2 z% P
  7. *   This file contains EDMA3 Test code.: E7 }3 I: q! Y
  8. *
      Q# |% K, t* V* V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 k$ C  @4 v' {5 Y* p$ R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ?7 T# _+ L1 _4 L
  11. *         TO CHANGE.1 _+ N$ [  I* @& G0 b+ d
  12. *; H4 c6 F$ o) |) A" R4 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 g9 O6 l- P- \! i
  14. *- d+ {9 y( b9 R, E. r$ P) j
  15. * This program is free software; you can redistribute it and/or# {) J! q3 @* X1 }' v
  16. * modify it under the terms of the GNU General Public License as+ ]0 ?, h' u$ y0 V6 Y0 s- D' V
  17. * published by the Free Software Foundation version 2.! Z9 Z# T$ S5 A1 m( i  L
  18. *4 Y( D5 G. v( e. z+ Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# K8 \: \; V0 l" a- Y+ M8 g
  20. * kind, whether express or implied; without even the implied warranty, @* c5 ~7 i6 j9 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - F( i3 l5 _  I4 n
  22. * GNU General Public License for more details.
    * _7 m3 ^0 s* S+ i2 u3 i6 j. [1 v
  23. */" w3 z) l% Q& `9 n: ?  I  C
  24. 5 Z. J  u$ M  S4 |! r3 T
  25. #include <linux/module.h>
    , Z! k/ @& F1 F
  26. #include <linux/init.h>
    / V& j, I: N* H) l4 y/ M7 a
  27. #include <linux/errno.h>6 L$ T' u+ s( W1 l: [3 ?* f
  28. #include <linux/types.h>- X! o" ]  h3 ^6 x' \& b0 F
  29. #include <linux/interrupt.h>
    # n$ D5 E# O1 q; h
  30. #include <asm/io.h>
    ! g2 N1 C# s: b; c! Z; P$ O
  31. #include <linux/moduleparam.h>
    5 e7 ]/ W( o+ t' E4 R* F% v
  32. #include <linux/sysctl.h>
    ; i  s+ \7 Z* ~3 w  y# B
  33. #include <linux/mm.h>+ T) v* G6 l, {) g
  34. #include <linux/dma-mapping.h>8 e" D) `/ c! v/ a; x# g) n6 q

  35. 9 X% y8 o9 k3 M: T- U+ r, g
  36. #include <mach/memory.h>
    9 d- ^+ s5 V4 ^- p5 B- W* V
  37. #include <mach/hardware.h>
    & s; R! a( O8 f
  38. #include <mach/irqs.h>
    : w5 {) `' {7 g( d( Z8 w+ d
  39. #include <asm/hardware/edma.h>' J( X, u, U/ j7 \/ i+ ?
  40. ( l) H" X" l8 u
  41. #undef EDMA3_DEBUG& \: y* h- p4 _+ e( ^9 ]
  42. /*#define EDMA3_DEBUG*/3 c" H8 q1 T+ F. m6 u6 E' ]+ F

  43. $ b8 j0 m7 M/ _" E; [
  44. #ifdef EDMA3_DEBUG6 i6 G2 o2 k8 N0 h! x8 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ T6 X5 w/ \' T5 Y/ g9 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), b: x+ P7 ^/ `: L6 S1 I! D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). n6 E$ K7 z$ U/ e" [6 {
  48. #else
    2 I& L: s$ p8 Z# V& k  V
  49. #define DMA_PRINTK( x... )
    " V4 I) Y/ e: Y9 s/ L  N' L
  50. #define DMA_FN_IN
    . |& X! _  d9 ^3 Z1 K! Y! A  _
  51. #define DMA_FN_OUT
    7 _! w' A, U% l4 c, c$ {' X
  52. #endif
    * t% y3 s8 o# n; B* f! H* F9 o
  53. 3 Q8 r5 e& S6 [. p' N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 s2 c, r! I0 c* j' f! x8 z
  55. #define STATIC_SHIFT                3! J$ g& U* ^- ^( j0 i+ U6 Y
  56. #define TCINTEN_SHIFT               20% [$ e8 O) ]& ?6 P: x
  57. #define ITCINTEN_SHIFT              21
    . k$ d. ]% Y' K! E
  58. #define TCCHEN_SHIFT                22
    ( l7 C: c( `4 ]/ ]0 f6 J
  59. #define ITCCHEN_SHIFT               23: K8 v; P. y7 ~6 D" J6 x% c" t0 Z
  60. $ I, _" _; S& Z5 T5 H( k% n8 K
  61. static volatile int irqraised1 = 0;
    5 v, v* V. p( z) p0 E
  62. static volatile int irqraised2 = 0;% ^( e' L3 z5 F7 R) g
  63. 7 U/ S0 f6 v% f: Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ~2 p; x* W& K" H$ \/ p; d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! f; F6 X: l- I9 W- S" n# u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 a. _1 u: @: Z# t
  67. + Y3 b; X7 Z/ g* M# Q$ w
  68. dma_addr_t dmaphyssrc1 = 0;8 f4 g9 }# ]1 m) `/ r
  69. dma_addr_t dmaphyssrc2 = 0;
    . M  {& R& y4 f2 E2 @8 l. E, r% [
  70. dma_addr_t dmaphysdest1 = 0;2 e* C/ P$ h4 d: H; I, t+ M5 m
  71. dma_addr_t dmaphysdest2 = 0;: p; _8 K+ \( O" y; ^0 K5 Z

  72. 1 ?5 C+ O$ [3 r3 W5 G6 P
  73. char *dmabufsrc1 = NULL;8 w- Q1 @" Q/ B4 i
  74. char *dmabufsrc2 = NULL;
    " V. k8 e" v( }5 k3 d9 Y
  75. char *dmabufdest1 = NULL;
    4 }6 L# B" \4 s7 e
  76. char *dmabufdest2 = NULL;; K. p7 Q; S2 }: ^: R
  77. 3 x2 E5 e( L% F: J4 |: J
  78. static int acnt = 512;
    % t; G( M3 _7 C0 J
  79. static int bcnt = 8;
      c$ {1 }9 r5 y# K7 K
  80. static int ccnt = 8;' {: x4 S) T) j0 S: _/ i# q' l

  81. : t( Y/ }) a" a* K$ |8 }- c
  82. module_param(acnt, int, S_IRUGO);
    3 l/ A% |0 P# J2 r9 p/ z& Q
  83. module_param(bcnt, int, S_IRUGO);
    & \# w. U% `( R+ n! @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 ]9 d4 O& h8 K* D
1 B1 j; [) `5 c* d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 x6 g# o5 M; s4 Y* c" y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ?$ |8 K# L4 m3 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  O: p2 M6 g- K7 _$ c$ \
8 B0 z6 X$ n! J$ {

/ {: K8 H/ N& v5 P- A" T# W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 13:50 , Processed in 0.039225 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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