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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 s" ~9 z. ]& H
  1. [code]EDMA sample test application
    + ?1 K& Q7 [( }
  2. /*# G; @7 X4 z, X- M
  3. * edma_test.c
    1 e/ w2 O* f% {! a" a; q
  4. *$ I' N+ A4 b8 ~) L7 }
  5. * brief  EDMA3 Test Application
    ' x, ^, Q& N5 R8 T
  6. *$ \0 ?0 }9 b: @4 U( T: J; q
  7. *   This file contains EDMA3 Test code.. `4 m, B( D0 v' r# \1 x
  8. *: N! H: m: [9 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 m. |3 t- h# }7 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( \7 I* t! C; q; m) o3 ]0 ?
  11. *         TO CHANGE.% a% _; f2 R$ u4 X2 j' @' H
  12. *$ w# `5 E7 a: C8 V2 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 s2 b; h+ R+ J* u) J" R1 U0 b, _
  14. *5 q" W2 O( ~7 r: l' F) B2 W% I( a8 c$ L
  15. * This program is free software; you can redistribute it and/or
    ( v: k5 Q8 l3 I! [, Q. Y+ [
  16. * modify it under the terms of the GNU General Public License as5 L! C& G# `' Q3 A8 q# \
  17. * published by the Free Software Foundation version 2.
    ; H. U3 R9 K9 L* I9 J1 z3 x6 X
  18. *- H4 n. w3 N) h4 e) I& ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 q$ R' {) L7 E3 S6 [8 l
  20. * kind, whether express or implied; without even the implied warranty4 v% @) T! j1 T: M% C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& w. F4 ^( G- `# q" t$ a
  22. * GNU General Public License for more details.9 @5 g8 m$ }0 L  T
  23. */
    9 h( a2 U- h9 P' Y! d3 ^+ j2 P

  24. ! \1 i5 A" \/ p* {8 Q
  25. #include <linux/module.h># y7 n* N2 |4 X
  26. #include <linux/init.h>& o! T+ _3 _1 w
  27. #include <linux/errno.h>( x. _6 l; V8 n% h
  28. #include <linux/types.h>
    : K0 v+ U) f4 ]( u9 u5 v  U
  29. #include <linux/interrupt.h>5 C' b1 T9 W. R/ T# @; C
  30. #include <asm/io.h>) g  r' R5 b" m$ G8 a7 X4 J. n2 b
  31. #include <linux/moduleparam.h>
    + W8 L/ F, u6 M7 E( N8 e: p; y) \
  32. #include <linux/sysctl.h># J* d( u: |$ D  d& c8 g
  33. #include <linux/mm.h>
    $ ]$ |9 E, I4 }1 w& o
  34. #include <linux/dma-mapping.h>8 l8 F; n, T5 g" \& G) Y

  35. " h# Y; y" l/ ~. i  _
  36. #include <mach/memory.h>' l6 ~. P& C4 x3 F1 ^9 R. b$ F
  37. #include <mach/hardware.h>; N' l: i' s% F5 D4 S
  38. #include <mach/irqs.h>" g6 w8 k. c9 z4 k$ D3 R
  39. #include <asm/hardware/edma.h>( n+ `4 k& K5 j& |7 j' V% C
  40. $ c9 k4 r; ]  S' ]& P5 k
  41. #undef EDMA3_DEBUG4 [1 K' c( g9 v6 v
  42. /*#define EDMA3_DEBUG*/
    7 F/ r7 z1 {# A3 Y9 n5 Q; v; W5 l

  43.   [+ {/ Z$ ~+ z7 N0 z8 G
  44. #ifdef EDMA3_DEBUG
    % ^. I) v- f$ u) G  f2 x6 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 R8 q( T$ z& C( x2 b* ~6 {/ n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 l6 Q2 k1 {0 {2 f) z& ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 j8 A9 t0 j& X' ^  a
  48. #else$ `6 `5 m. w/ K5 G1 i$ d: o
  49. #define DMA_PRINTK( x... )
    ' V1 H3 m' w* o, f* i
  50. #define DMA_FN_IN
    : e5 H& Y/ O  I
  51. #define DMA_FN_OUT
    . k1 G( X5 K2 t
  52. #endif/ o2 j, M0 B/ x

  53. ' X4 a6 ]1 Z7 x0 p: Y2 d' v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : Q6 N  i* u$ Q% u. b
  55. #define STATIC_SHIFT                3
    * N6 k; h7 ^$ P' P+ R
  56. #define TCINTEN_SHIFT               20
    3 m' B* D" p" a
  57. #define ITCINTEN_SHIFT              21
    6 s0 @& {3 h$ B
  58. #define TCCHEN_SHIFT                22' j4 U! F) t$ X* q3 a( B
  59. #define ITCCHEN_SHIFT               23
    6 C$ V. r5 h% a9 g  ]% ~

  60. : v, Q  G- f$ u2 F
  61. static volatile int irqraised1 = 0;
    & g& P' `7 B' [/ t5 r  [
  62. static volatile int irqraised2 = 0;
    ! p+ j' O1 ~$ b. j' U' Q
  63. 7 N* i5 M+ D6 p* }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , N) b$ v* o6 A1 ^3 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H5 y$ g. ?- g- F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% C: Z" K! y8 N0 O, t
  67. # A- K2 k1 H) Y9 ~  O+ p
  68. dma_addr_t dmaphyssrc1 = 0;; f# w- i' x1 ^+ X
  69. dma_addr_t dmaphyssrc2 = 0;' `! Z7 ^% I* d& M/ S
  70. dma_addr_t dmaphysdest1 = 0;
    4 v$ c  K4 ~6 \1 n8 c
  71. dma_addr_t dmaphysdest2 = 0;" U1 ]5 l1 K& {: i. t; L

  72. # ]1 }5 ?  b  h# N6 d/ Z8 i3 }; t6 s. d
  73. char *dmabufsrc1 = NULL;; j7 r& U) P" p2 r# K9 H
  74. char *dmabufsrc2 = NULL;' ^$ J$ k, S. T3 @
  75. char *dmabufdest1 = NULL;
    8 n- R2 ?' j+ I, i. m; u
  76. char *dmabufdest2 = NULL;3 k) C" _2 {  X1 |
  77. , N7 Y/ C1 E+ \: {3 W
  78. static int acnt = 512;& j) Z) m- A# M0 w  Z
  79. static int bcnt = 8;
    7 g  u% S2 O4 I. Y
  80. static int ccnt = 8;2 _- f( N1 D9 B0 q

  81. / @" Y( X' `% n8 Z6 e2 M
  82. module_param(acnt, int, S_IRUGO);% m* p# ^3 J$ h) P7 ?* B
  83. module_param(bcnt, int, S_IRUGO);! L  T/ f! t; v" M4 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 Q( F5 B5 u$ ~. {& ]3 z
# T) J1 L+ ~! W7 \! b. o% A2 I! d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' n) n$ M; m" \6 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# h8 ]4 v1 p0 T8 C& I/ Q$ R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ p! \. m) ~, y8 ]3 g
4 \2 }  e0 Y, X7 M2 b7 y
1 |' G1 N7 r. x9 g+ V7 j: X8 |/ f2 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 05:52 , Processed in 0.038831 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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