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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ]) e6 K' o6 ?
  1. [code]EDMA sample test application1 i7 D* G, P  d6 r
  2. /*
    6 g6 Z0 `9 s- }1 S+ t# v" o
  3. * edma_test.c3 |9 g' c  R4 n( e
  4. *
    5 ]4 Y7 Q( V9 T% \# I# g
  5. * brief  EDMA3 Test Application
    # Q+ K8 `$ I* `) C, _5 W& }' f; ~
  6. *
    , W; W3 F3 k. d) W
  7. *   This file contains EDMA3 Test code.
    3 k" J4 g- m% Y+ g! p( @
  8. *
    6 R5 O9 @# J% k0 _( _2 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) }2 [3 f" N! r5 L: ]3 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' F0 {: k) o8 W( `  b1 \% K/ g* w
  11. *         TO CHANGE.& X5 h. v/ \4 q& u! a( C  J
  12. *$ S2 N- T# u6 Z$ G/ _+ H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( e5 C2 F) U; g0 Q( `- J- H
  14. *
    9 Q: Q, J3 B- w# T  i! }
  15. * This program is free software; you can redistribute it and/or5 Y% y% L% b/ ]( v
  16. * modify it under the terms of the GNU General Public License as" O/ z3 o% c# r  X7 W$ P$ b
  17. * published by the Free Software Foundation version 2.
    / E; c. L. ~$ T9 ]" j- k9 o8 {
  18. *
    / j+ @0 a$ k: p- V* ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      }, ]) s' G6 b+ P
  20. * kind, whether express or implied; without even the implied warranty( O; _% l$ F: g" y+ c- e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! {) z6 g. }9 {+ G. u
  22. * GNU General Public License for more details.
    0 z) w0 w; g$ S: w/ P9 X* ]% R( t$ Z
  23. */
    : G* A, D! l! i4 j/ ^

  24. 6 s2 s; z. u  a
  25. #include <linux/module.h>6 H- l" X' G7 p0 L
  26. #include <linux/init.h>$ f' U  C1 {* {/ ?
  27. #include <linux/errno.h>
    $ |3 s  @7 o; T7 e
  28. #include <linux/types.h>: ?; J7 _/ x4 _( ~
  29. #include <linux/interrupt.h>
    " P7 [9 g# Y* Y# J: J
  30. #include <asm/io.h>4 @/ P1 j8 U3 R0 J9 i
  31. #include <linux/moduleparam.h>
    8 T- ^; s' l. u0 I# n
  32. #include <linux/sysctl.h>
    ; O) D* b  |* Y* H
  33. #include <linux/mm.h>
    : _  @1 D# o6 j* [& ~8 D
  34. #include <linux/dma-mapping.h>: v! S2 ?/ A6 A: _  Y) o  ~1 b

  35. / K7 |" T! G" Q4 m& A
  36. #include <mach/memory.h>+ f& q; ^! c- c
  37. #include <mach/hardware.h>
    7 o# b  Z& W0 _/ z
  38. #include <mach/irqs.h>
    " _9 q/ s% f" k% i6 z3 ~+ s
  39. #include <asm/hardware/edma.h>; n3 g; Q, M0 O$ }9 @% a, F5 C
  40. / q% `' K& p) m9 s. Z
  41. #undef EDMA3_DEBUG+ M9 Q/ ^4 O9 R" V) ]
  42. /*#define EDMA3_DEBUG*/
    1 z5 I0 h3 }  N" m
  43. ( F* e8 ?$ _; B5 }1 b  g0 ]5 }0 M, ^
  44. #ifdef EDMA3_DEBUG
    9 E# u' f9 s  M& a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). t; K) X1 _7 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ `2 T0 U& H$ M' ?  E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . _+ v7 u! [! s6 Q5 p5 N
  48. #else
    . `4 Y. l; V& M* b4 u7 q& R# R
  49. #define DMA_PRINTK( x... )
    5 ~9 z7 A4 G/ S; ~
  50. #define DMA_FN_IN- Z3 l: E- s+ u; X, o( V4 y  g! {
  51. #define DMA_FN_OUT+ I4 _- n& o+ `# T0 ], T+ I% X3 l+ P% U
  52. #endif8 K; ^; O& N" z9 n8 S
  53. 9 Z$ C- J8 F% h2 W2 Q" R" G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), t/ j% \- v% I1 C( W
  55. #define STATIC_SHIFT                34 z9 M5 X7 r; @8 c2 X1 r
  56. #define TCINTEN_SHIFT               20, B0 b/ u  `- W* E
  57. #define ITCINTEN_SHIFT              21
    8 ~3 M. L' g/ @% G" J# K9 n4 m. R; L
  58. #define TCCHEN_SHIFT                22/ r0 O1 q* h6 \( u$ }6 P7 X
  59. #define ITCCHEN_SHIFT               23
    ( [, A  Y3 g6 o1 p+ }- l! P2 _

  60. 3 Z: X( }6 u/ N; @7 |/ f  s) a1 J" F
  61. static volatile int irqraised1 = 0;
    8 r2 L+ u1 s% A- H/ S8 D
  62. static volatile int irqraised2 = 0;
    & k5 j6 M6 h' w& d+ D. h
  63. / f% ^9 @. [2 f) M" @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! v9 E* T) X) R, t+ a; G3 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( C9 @1 Q6 O( r% }1 u" M3 \+ p+ k) R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& R; a5 E5 Y0 k6 q# `
  67. 2 l; ?5 O, Q$ Z5 x" r/ s
  68. dma_addr_t dmaphyssrc1 = 0;) ^4 Z1 \; D; e, @
  69. dma_addr_t dmaphyssrc2 = 0;
    8 K) Y" q6 u& `6 |8 k
  70. dma_addr_t dmaphysdest1 = 0;
    / Z& E$ n4 ^2 ~/ T# Y' V  z& s# ~
  71. dma_addr_t dmaphysdest2 = 0;
    / k3 E$ v2 A$ j4 ], b8 R7 b* }6 `

  72. ) j0 i" O$ G4 U! {7 g3 I" n* ^# W: h
  73. char *dmabufsrc1 = NULL;7 |1 @6 \% F) y# U. p6 o: v' `
  74. char *dmabufsrc2 = NULL;
    3 t7 E6 c" C- k/ A
  75. char *dmabufdest1 = NULL;
    4 Z4 e9 e' u% h4 Y8 ~
  76. char *dmabufdest2 = NULL;
    ) |2 p: i9 @: k3 D, ]. ~/ v
  77. 6 M2 N. m* E5 s0 g- L; `7 ~  v* s
  78. static int acnt = 512;
    " o# {% k6 }: l3 k
  79. static int bcnt = 8;3 m- U1 p) a5 F/ H2 l+ f5 p5 [' C
  80. static int ccnt = 8;
    9 j+ y! o! T$ b
  81. $ l4 i2 V9 H$ E- Y5 x5 ?% @
  82. module_param(acnt, int, S_IRUGO);! \0 d2 o8 t$ L2 z
  83. module_param(bcnt, int, S_IRUGO);* P9 `. z" Y1 d0 e( C9 M8 ^, f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, k* A8 L4 c" _* m
. V: c2 _) k  F8 J$ k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" O+ {4 H0 i# m1 w/ l2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 v* `& G1 V$ C* F0 v" g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ S/ s2 d8 a: F# n
4 F+ P$ N- r" D+ x

5 _. T( x! _6 S$ V. K4 Z$ I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 03:26 , Processed in 0.039545 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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