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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! j* R" k& |+ q
  1. [code]EDMA sample test application& r" T/ a8 s6 a' [6 q/ O
  2. /*- k, j4 Y( U9 b  W) j
  3. * edma_test.c+ N, ?, V8 K" n3 o7 n/ I
  4. *8 r: }% g1 u9 w5 `9 o
  5. * brief  EDMA3 Test Application( b: O( i1 j: j7 x  ]
  6. *
    . [. W: e) |+ A7 s9 A  K- P
  7. *   This file contains EDMA3 Test code.8 [, O0 }& A9 V7 P- ^
  8. *
    # c2 x+ W) A" f+ b- O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( B3 J, e+ f  u% w! P( q7 O. @8 O" G. f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 ?2 O8 t2 m/ A* h; ~2 M
  11. *         TO CHANGE.& A5 M8 C: N) _& W% t
  12. *4 D) z7 d1 N* Z( w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # B+ e1 g3 S* S
  14. *  F# C! Y( p- M& j# V
  15. * This program is free software; you can redistribute it and/or
    % o' |; ~: B. C6 R* I
  16. * modify it under the terms of the GNU General Public License as4 E5 E2 Q4 X7 l( B
  17. * published by the Free Software Foundation version 2.
    $ c( Y. [. n' G! C
  18. *5 M! q0 L+ q; P3 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& s6 u' L( G/ B2 [$ @6 r( J" N
  20. * kind, whether express or implied; without even the implied warranty
    * q1 W' o7 Z" S, x9 T% j: I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 a! ?  ~( E: Q# }# X5 F% J# q  e% u$ _/ p
  22. * GNU General Public License for more details.
    . w2 n; o$ Z( x1 s: C
  23. */  t$ {( Y  E& p! m
  24. . w5 e, c% K3 P) `  {: S* l
  25. #include <linux/module.h>
    # R, ?" e3 @$ @, T: m5 C/ O, w
  26. #include <linux/init.h># h3 T9 c4 S$ e- O. [5 w
  27. #include <linux/errno.h>
    " W' J3 r5 h, X! n7 }6 v: {
  28. #include <linux/types.h>/ y8 H5 m2 `1 n7 h+ n5 K# S
  29. #include <linux/interrupt.h>
    ! ?+ A- Z! k* B  i  Q
  30. #include <asm/io.h>
    - C/ \+ b: u3 l0 N$ F9 \
  31. #include <linux/moduleparam.h>
    8 ^8 n6 v, V9 q+ H5 M! L5 z
  32. #include <linux/sysctl.h>
    # |$ E( f/ p- W% u. A6 U
  33. #include <linux/mm.h>6 Q% C( l0 a8 X5 v
  34. #include <linux/dma-mapping.h>
    7 _5 L& p6 q8 O9 p& F. \4 |  Y+ e
  35. * W$ A5 a6 y. R, I) f8 e+ z
  36. #include <mach/memory.h>4 V/ O" l  _) y* A: c: c
  37. #include <mach/hardware.h>9 Y! C( x( p6 E/ e
  38. #include <mach/irqs.h>
    0 U$ b3 [/ Z; F, O( f3 O4 s1 J
  39. #include <asm/hardware/edma.h>) S# \+ S* a* {

  40. . F* n' k/ e. q" x7 ~* c+ V
  41. #undef EDMA3_DEBUG! R' U$ |5 u' D" y: c
  42. /*#define EDMA3_DEBUG*/( z0 D  A9 _) `! J, z/ |8 N+ U3 m. F
  43. # u( y% Z5 U; w% |) ^+ g" w. [
  44. #ifdef EDMA3_DEBUG
    ) L' ~* R* F/ R. {* |+ e3 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  `/ t( J# a" l1 m8 Z4 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) {1 S* {' Q- u3 V* j8 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % l3 f& u0 ^$ z- P4 ^
  48. #else
      r# ^3 |, @! `- y
  49. #define DMA_PRINTK( x... )
    # a9 O, o' g5 _- b, t4 v
  50. #define DMA_FN_IN6 T/ X  \- K% l; S
  51. #define DMA_FN_OUT8 F- a& `0 j3 z4 w( v1 F  q
  52. #endif
    9 Y2 j) @2 Y; q
  53. 2 t) Q0 A2 S$ N( X1 {1 ^/ O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . E- Y1 V% |* z/ s( n+ @2 R1 E
  55. #define STATIC_SHIFT                3
    4 C- l- S& }1 g$ K$ c$ o5 x' y
  56. #define TCINTEN_SHIFT               20
    & w7 G  F! O( K5 b
  57. #define ITCINTEN_SHIFT              21
    * {" X8 B, }+ E3 a$ z; l/ M
  58. #define TCCHEN_SHIFT                225 X5 b$ z) v* B3 n( u
  59. #define ITCCHEN_SHIFT               23
    8 F3 e2 r, L9 q; [

  60. 0 f; a" j. ]6 G& W; X: [& ~
  61. static volatile int irqraised1 = 0;& l6 A- a, s+ L7 m1 k8 ?
  62. static volatile int irqraised2 = 0;3 K2 w: r: v+ z
  63. + b  z; d1 c( d4 ^' `2 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q' \2 u  b: m9 e1 S& g8 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # V0 O, L" V6 i- v/ l4 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % z# m3 T! P6 }1 }6 c
  67. 1 A' r1 Q* @0 G' u+ d$ J
  68. dma_addr_t dmaphyssrc1 = 0;' ~/ u9 W9 t! r  i
  69. dma_addr_t dmaphyssrc2 = 0;
    $ B0 `7 r  v* e, e: o' Q* W$ j9 u
  70. dma_addr_t dmaphysdest1 = 0;$ p( S2 w" I6 j% p' Y. N# A
  71. dma_addr_t dmaphysdest2 = 0;
    3 {" D9 v8 X' F
  72. : r" D0 Z" V. x# D' {  I5 [
  73. char *dmabufsrc1 = NULL;
    7 U8 E% _* G( s4 s/ p
  74. char *dmabufsrc2 = NULL;
    6 O: D  B: \  ^* \8 `9 _" F0 Z
  75. char *dmabufdest1 = NULL;1 B$ [( F" f9 w3 L- ^  I
  76. char *dmabufdest2 = NULL;
    3 d  l+ U  `) H& I. x7 t
  77. , s1 d% W. m/ _# }
  78. static int acnt = 512;. L, m/ z+ y- h7 ]5 L+ L3 |
  79. static int bcnt = 8;: ?* T& o3 \9 J6 m) x% ?, w& g9 m
  80. static int ccnt = 8;1 X  t# E" F7 X) Y/ u% j9 u1 q

  81. : R0 h% i; k: G: a. m: j$ \
  82. module_param(acnt, int, S_IRUGO);" G. }2 i+ B6 i) O; O# n$ [( Z4 j' _. [
  83. module_param(bcnt, int, S_IRUGO);5 e2 U2 _' M# [% e" ?# B" J0 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. N: o8 Z  r+ F7 B) I

! M& Q# j* G3 D5 p0 g, t  K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) d+ I" R" C& }  n1 |' G, Y+ y& O8 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: T( y# {/ I% `8 D. ]0 e  J$ V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ j* S" s7 j8 g' _# @7 ?9 v% X7 l- @3 ^8 U* y
: I+ x5 n: \# T3 J, F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-18 01:51 , Processed in 0.041112 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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