OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; y' f. w% I( O6 }. n- z
  1. [code]EDMA sample test application
    . R. m3 g7 C: M0 d2 @; x% C
  2. /*
    ; D. @3 B  x! @& U
  3. * edma_test.c
    / \8 }  T& N) _  D1 E
  4. *
    5 ^7 Y+ k3 l6 Z$ b" \2 s% K
  5. * brief  EDMA3 Test Application
    / T; w/ O9 J" ?; W
  6. ** m9 z& h& ~) u8 b( H! d; c' L: X6 ]
  7. *   This file contains EDMA3 Test code.$ e' Y2 K! c' z% N  Q
  8. *
    9 ^- I* ?8 v* ^' m3 ]  L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. x; o: `* i7 \  T: ~+ A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! [. t6 \7 m$ i
  11. *         TO CHANGE.
    9 X" ?7 ~- |  p+ T: G
  12. *( M( w. q' p* A5 [+ a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . A3 y. t, V. v* E3 P8 i( d3 Z
  14. *
    + ^' u4 F$ P" p8 E# d
  15. * This program is free software; you can redistribute it and/or
    3 a4 V  P2 j) w4 z
  16. * modify it under the terms of the GNU General Public License as
    3 x7 V* l4 i. S6 }' r: [$ P
  17. * published by the Free Software Foundation version 2.
    * u- D- R( Y6 _2 M  e; |
  18. *
    7 W# K) o3 Q% v) t7 P) r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 f$ o- f% e! o% A
  20. * kind, whether express or implied; without even the implied warranty% x) T+ S5 d# p8 S9 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# e( T/ o$ ?% N8 f
  22. * GNU General Public License for more details.3 g3 ~6 N% D2 ^5 n& ]0 v. I
  23. */
    8 ?. e8 v! k* \" B9 J" v

  24. 3 a- a: f; P6 p) M7 `
  25. #include <linux/module.h>. Q9 _6 q( a" `6 k: z* g' B' A9 S
  26. #include <linux/init.h>
    : {$ R; K- Z5 ]; d0 U
  27. #include <linux/errno.h>5 \7 U3 }6 N2 ~2 T. p/ e2 a7 y
  28. #include <linux/types.h>
    : _7 H& f1 p8 T$ V0 A, O/ ^
  29. #include <linux/interrupt.h>
    2 T1 H3 x% n. E  _
  30. #include <asm/io.h>5 v# Q! \6 x/ z6 z& L# z
  31. #include <linux/moduleparam.h>
    . X% U& f8 m3 P- A8 D, H" s
  32. #include <linux/sysctl.h>
    8 h) t1 i: [0 W0 c& R- z
  33. #include <linux/mm.h>
    3 }6 f& a7 ~2 x/ H6 L' Y
  34. #include <linux/dma-mapping.h>3 P& G# R% l/ J# B

  35. - f4 s4 `( r: T
  36. #include <mach/memory.h>
    8 U9 y+ ?" z6 h8 K
  37. #include <mach/hardware.h>
    ' H+ o# E5 T9 ]  }
  38. #include <mach/irqs.h>) A7 ^7 {" V5 x9 D! @9 x
  39. #include <asm/hardware/edma.h>- V9 O' n! Y% H/ x; E) j# N

  40. % y) d' D" M* ^: n( U- L
  41. #undef EDMA3_DEBUG
    ! F( l4 c) A, C, n9 }1 [" V, A) F; d
  42. /*#define EDMA3_DEBUG*/* K% N3 s* G; x$ C% i( h
  43. & Y  M6 l" v: @9 Z0 I
  44. #ifdef EDMA3_DEBUG
    $ K( l# T$ z) b; z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 _. ]% x% b2 b: @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      i; E. k1 t- V3 N$ Q# a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # F( l" }: X7 L! y
  48. #else+ I# o* @* c& H( Z! G- Y" |6 l8 e- o
  49. #define DMA_PRINTK( x... )
    5 a+ H: q" Z% r# T0 C% O
  50. #define DMA_FN_IN
    3 B" Z3 J- N* ~3 y- z
  51. #define DMA_FN_OUT8 y3 s6 A3 s! K7 L0 \0 c% M7 `
  52. #endif8 P7 g4 ?* d8 K) _+ K

  53. % e1 x$ g% C; T) F% |% S2 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . J% D+ ]( W  w6 V' y
  55. #define STATIC_SHIFT                3
    : z5 S, _- a$ g* H2 c$ b) \
  56. #define TCINTEN_SHIFT               20
    & n) v" e7 f  N# I( A" ^
  57. #define ITCINTEN_SHIFT              21
    8 X( N4 m3 Y  v% j" }! V  F5 k! v
  58. #define TCCHEN_SHIFT                22
    3 l8 z- {9 M9 U' f* W
  59. #define ITCCHEN_SHIFT               23
    $ `1 k& N. ^& x0 h

  60. / h' v( _, }' x# g
  61. static volatile int irqraised1 = 0;
    $ B6 `& g3 z" l) m
  62. static volatile int irqraised2 = 0;
    4 L5 m) U6 j0 X4 _1 O& O+ c, u/ M

  63. ( X$ L; J3 T, Y) @) G/ V- y  I# U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 G8 T8 k; Z1 P/ @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 |5 r) w+ j& e% V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: X( F4 Z& N4 E' u5 z- l

  67. / J. _3 c& Q  Z. r
  68. dma_addr_t dmaphyssrc1 = 0;
    5 a4 m/ O  a% K
  69. dma_addr_t dmaphyssrc2 = 0;& Q% z) Y0 v1 i
  70. dma_addr_t dmaphysdest1 = 0;
    ; e% W* F; Y$ u& h5 z; v
  71. dma_addr_t dmaphysdest2 = 0;5 `( b9 d+ ^% h' K; ~8 i) `
  72. # R' P: z6 J, N  z
  73. char *dmabufsrc1 = NULL;
    ' h1 U, @; n4 n- O* m3 o: r" \6 [
  74. char *dmabufsrc2 = NULL;7 w3 F$ U' V% x$ a9 k
  75. char *dmabufdest1 = NULL;/ p0 n/ |' O+ ~8 D7 X. R  `' G* R; e
  76. char *dmabufdest2 = NULL;' [' U, a1 ]8 I
  77. * l; J: K1 Y: j! Z
  78. static int acnt = 512;
    8 V- f9 V: |# _% _2 B& e
  79. static int bcnt = 8;# i. G: m( M( e8 g5 `; \5 }, }
  80. static int ccnt = 8;1 J7 [4 l1 g5 D- M6 p

  81. % E7 \3 d  j( t& m. f8 b% K( c5 S9 `
  82. module_param(acnt, int, S_IRUGO);
    / G, ^8 a5 y  _! e
  83. module_param(bcnt, int, S_IRUGO);
    : j# r$ f& O' O1 s+ }& ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  H, V/ R! X& `) [

: |& e  O/ \7 e  [& q, ?; n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. |9 n/ ]) V6 G- R' W8 S2 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" J. M" S; P9 p+ z# j6 p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 O$ ?( C( {& Y
9 K0 ^2 K' B9 ~4 V4 M; _
# W9 e1 K: u3 @6 N! C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 09:51 , Processed in 0.050963 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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