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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 e$ _+ y' E8 ?7 p
  1. [code]EDMA sample test application: f# X4 v$ D9 E
  2. /*
    7 o3 N) _3 Q- t0 N! Z  Q
  3. * edma_test.c& F: Q/ G1 j3 \9 U  P+ Y) c7 r
  4. *+ X' g. c$ X. A" b
  5. * brief  EDMA3 Test Application4 L2 ~: a# i, ]2 I! v/ d* L
  6. ** \2 h$ |) \9 p) ~1 l
  7. *   This file contains EDMA3 Test code.4 t- |- f  y, a/ L& a, q
  8. *
    + F3 \" j6 N# z6 _; [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " @* x; {0 q6 N9 U% A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 m4 z( Y; ]* ^% z$ p( _9 a3 ~
  11. *         TO CHANGE.
    ( E  }$ \# I8 _7 R6 Y: c
  12. *4 E+ s+ O! m$ m) x3 h) t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 f  I' R8 r; c6 ~+ c
  14. *# n0 s+ K1 e6 v6 g4 w
  15. * This program is free software; you can redistribute it and/or
    $ J/ _( G" |+ Q! ?" w
  16. * modify it under the terms of the GNU General Public License as+ x2 |- d, Q( y4 w+ W1 ^
  17. * published by the Free Software Foundation version 2.
    9 g7 K: \8 S" E7 ]  g0 S; X
  18. *
    4 A, s( c% f, i+ V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 i, o. [0 d$ R- r
  20. * kind, whether express or implied; without even the implied warranty
    * `$ f% j0 s5 B5 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 O& @1 ?4 O5 s6 Z# h" r# \  B- {8 f
  22. * GNU General Public License for more details.% x9 f" {6 z1 {' a5 s9 B
  23. */  y4 w8 c$ v/ u( w
  24. 0 q3 G& Z- G! y8 y
  25. #include <linux/module.h>2 a8 g% s  g9 b( A+ L
  26. #include <linux/init.h>! R0 j) x* K/ W2 w7 n
  27. #include <linux/errno.h>
    8 l  x. a) n3 s' s$ j3 ~: O
  28. #include <linux/types.h>
    ) X; p! ?& ?# U& C& L% p
  29. #include <linux/interrupt.h>( v% n* R- P9 D
  30. #include <asm/io.h>
    2 V, i/ U% s# c/ k3 W: Z0 E
  31. #include <linux/moduleparam.h>
    7 Y- R5 X8 ]/ L+ C
  32. #include <linux/sysctl.h>5 f) N1 |7 i9 q3 T( ^4 c
  33. #include <linux/mm.h>
    - C) }) i2 J/ V7 r
  34. #include <linux/dma-mapping.h>) I' ^  }9 l; q- w; W2 C: R6 D# r# e
  35. 9 e4 |+ m( ^5 |7 u
  36. #include <mach/memory.h>
    ; H2 \! y3 f3 M/ E2 ~0 R
  37. #include <mach/hardware.h>
    ; m' Q1 J* K) P
  38. #include <mach/irqs.h>
    2 M; Q0 }. g# [; `( \0 V
  39. #include <asm/hardware/edma.h>
    $ K8 r1 x( _5 x

  40. 0 R: v* p6 @2 S6 M" K$ r9 q, K
  41. #undef EDMA3_DEBUG% H* {3 j; L4 j- k
  42. /*#define EDMA3_DEBUG*/8 n5 o/ K# O- {+ l. b+ |. X

  43. 2 k% j, c9 a! o$ l  u0 |0 Y) j6 g
  44. #ifdef EDMA3_DEBUG
    , S! K( t7 u+ x' A+ X5 u) m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); ~7 K1 ]7 T% P' K# D6 }# ]) r7 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 }8 J. ^* }. ~2 s" x7 }5 }8 M7 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* Q% K- {% n  c) ~
  48. #else+ y$ ^9 d, u  y+ i0 R" J3 k
  49. #define DMA_PRINTK( x... )
    3 L8 o$ n  e0 m+ [6 \6 u. g9 Y* x
  50. #define DMA_FN_IN& |3 f3 d/ X$ q' H; \+ a) S& R' w  E& |
  51. #define DMA_FN_OUT% s5 m3 x6 A. J7 o3 F
  52. #endif0 U, i% Q, o% D/ D: K' I* K

  53. 6 G0 B0 s! q% r8 h4 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  g- |1 A" C' `  B* b9 R
  55. #define STATIC_SHIFT                3& R- l/ O0 k6 v' D+ M: O
  56. #define TCINTEN_SHIFT               20
    5 A" y% p. I  d9 x: P
  57. #define ITCINTEN_SHIFT              210 q# |. f  @) k( ^% W
  58. #define TCCHEN_SHIFT                22
      X( T$ P8 ~* n3 l; T
  59. #define ITCCHEN_SHIFT               23
      u  L2 ~9 H& M% l
  60. 3 m) {% s. H3 U
  61. static volatile int irqraised1 = 0;4 V# h- n: G% K% \
  62. static volatile int irqraised2 = 0;4 c2 H4 Q) w5 U. x6 Y

  63. / z! K/ a4 ?. N0 o+ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # T. w3 [) h. L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: f% g  C. I& E" _7 s: @% X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + k+ a& A! N/ [7 e3 g5 w/ f

  67. 9 {0 K8 D8 ]& A: o) f) Q
  68. dma_addr_t dmaphyssrc1 = 0;
    , `- t' b7 q% Q+ M; n
  69. dma_addr_t dmaphyssrc2 = 0;4 y' H1 {1 A. T! v/ M# T9 a
  70. dma_addr_t dmaphysdest1 = 0;
    / D) p, V2 L8 C' H
  71. dma_addr_t dmaphysdest2 = 0;
      W2 B/ H# |: ?$ k' M$ D
  72. ) d0 |* l: F' I1 ^7 x) `! C" C
  73. char *dmabufsrc1 = NULL;3 I/ d: Y) S& a8 L
  74. char *dmabufsrc2 = NULL;
    4 j- F+ I7 \, I: S( v& o
  75. char *dmabufdest1 = NULL;/ b2 O3 }. ?# ^3 V; u1 [6 g* H
  76. char *dmabufdest2 = NULL;
    ! K+ M3 G4 l" C
  77. , l. }1 t8 s5 W# K5 k
  78. static int acnt = 512;
    * |  U9 Q" \# E# j* R7 n
  79. static int bcnt = 8;2 o. q  T" s2 z5 z
  80. static int ccnt = 8;
    3 m. c9 |+ v" _

  81. 2 `8 {  ]9 c9 w2 |4 X! t) w
  82. module_param(acnt, int, S_IRUGO);5 z9 t4 S1 G. i( n
  83. module_param(bcnt, int, S_IRUGO);
    1 V8 I1 R1 r% P% P( P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 f7 N9 b' A0 L$ `4 L) k% Q

  V  z- v; L, z1 H( [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# B+ k7 k, D. j  v' H; barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( h/ }: J+ f+ t; A6 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 n; H0 N7 t: `. D# A4 O- e
, O1 u3 F# f( g" o2 D6 @3 j+ B( [6 `: t! [/ q& J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 16:19 , Processed in 0.041802 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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