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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' V. S. {8 n5 ~/ r# m4 k
  1. [code]EDMA sample test application+ h3 F; E4 M8 e+ I  m8 T/ H  i! [
  2. /*1 R0 f4 z0 |& L) p
  3. * edma_test.c! h% h( P4 N+ u* G
  4. *
    0 y! c4 R* S& I7 n
  5. * brief  EDMA3 Test Application
      L* V1 c# a1 m0 Q8 U! y5 ?
  6. *1 t$ V* {  ~( |- V$ c- Y
  7. *   This file contains EDMA3 Test code.
    - Q7 G3 |8 ~: r6 A! j4 S
  8. *
    - Q& X& J4 R! X) v( S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - ~, o, \5 e$ s9 k# t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ A4 T3 q, T4 G
  11. *         TO CHANGE.6 z8 ~1 y+ T1 i) A
  12. *, u- z  w# m+ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 ]  p3 F( P, k/ q8 W
  14. *
    . ], a' e6 i) b" G9 Q
  15. * This program is free software; you can redistribute it and/or2 L4 C' u% r$ ~% v+ ^5 f9 M# U
  16. * modify it under the terms of the GNU General Public License as0 w0 Q& ?* n- R0 ]) o6 t3 U* I8 x
  17. * published by the Free Software Foundation version 2.2 `. |0 u% L# R2 A
  18. *( V/ p, @/ ]# }) w1 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & L3 c7 V% K6 \: {5 |" h
  20. * kind, whether express or implied; without even the implied warranty, Q1 h2 k% a/ o3 Q! N! \! Z7 u5 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ Y( ?% W$ |" @- U
  22. * GNU General Public License for more details.5 f) v+ Z) {2 n3 Z
  23. */
    $ x; y2 L2 ~* A8 F% K4 o) ~
  24. % U$ E8 c, F+ X1 J% ?6 l
  25. #include <linux/module.h>! f$ _2 G' J2 g2 t8 C
  26. #include <linux/init.h>+ Y0 ?# y8 J, C" R% I% D4 L
  27. #include <linux/errno.h>
    9 a% z( D# I6 V/ N. o
  28. #include <linux/types.h>" j" X: f( }, C4 H8 {
  29. #include <linux/interrupt.h>( |. l5 X$ f2 _1 T1 b( s
  30. #include <asm/io.h>  k+ s, {! @7 |6 Z" ?
  31. #include <linux/moduleparam.h>) b7 D0 [6 w2 x$ X5 P! P
  32. #include <linux/sysctl.h>
    ) g5 _9 }( }" m% L- W
  33. #include <linux/mm.h>
    / H& s4 w# \/ w2 F4 P
  34. #include <linux/dma-mapping.h>4 S% y. \+ w! T; Y0 z& i/ q
  35. ! w' f7 M6 [9 |, _/ @/ V* G" O
  36. #include <mach/memory.h>) Q" z5 E( q7 e2 r7 _; z" Y
  37. #include <mach/hardware.h>2 H) ^) Z/ L3 g+ e
  38. #include <mach/irqs.h>$ G2 l0 M6 p1 x
  39. #include <asm/hardware/edma.h>0 f, F' G" k$ K/ Y
  40. ; b) Q2 F* s- T" U# W8 z
  41. #undef EDMA3_DEBUG
    . K3 }  w  ~7 u5 k) v1 C
  42. /*#define EDMA3_DEBUG*/
    " |2 _* S, H1 n8 e. ]8 Y& j

  43. 5 N6 H- }, R0 G8 V! A" o1 j8 o6 i# j/ `
  44. #ifdef EDMA3_DEBUG4 D$ m7 @2 a* K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ^% E) }) a! o, S, |9 O8 p+ t: u. V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      ~% O& X0 N; p0 m" \9 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% l% |6 N+ n0 b6 p% R. a
  48. #else( {9 s/ D" E: }: k# ?# ^
  49. #define DMA_PRINTK( x... )( b; U& R. C9 g9 y4 K# ]
  50. #define DMA_FN_IN
    3 z' y# M2 O9 ^
  51. #define DMA_FN_OUT  J9 }+ Y  `) C* X
  52. #endif
    % u' e- V* F$ T0 w( Y
  53. 4 F+ f) Z( g  `& n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 J4 D- b' S3 b+ N# S/ e) G
  55. #define STATIC_SHIFT                3* Y% L; I: m$ j$ ~0 w/ B" K$ I5 X
  56. #define TCINTEN_SHIFT               20
    4 `1 W: i& z; o, n
  57. #define ITCINTEN_SHIFT              218 u, a9 d5 k. j! P) m5 T4 M4 ^0 g! V
  58. #define TCCHEN_SHIFT                22
    5 _8 a1 g1 e# Z. a9 }
  59. #define ITCCHEN_SHIFT               23+ C/ i6 \% ]4 Q, J

  60. & o9 J, U8 p/ D. R! r% f/ |& S
  61. static volatile int irqraised1 = 0;
    8 v" ]  N, P" {# k' a( V
  62. static volatile int irqraised2 = 0;
    " E0 ]6 J" Q  r0 S4 J' f

  63. 3 \; a& e' ?! @: A; F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  C9 H; Y8 `1 g6 W0 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 R; q7 y' u6 ^% k& {0 A/ Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ?# v7 c  E: G" g" c

  67. + o% ~+ k9 C6 Z; M8 D
  68. dma_addr_t dmaphyssrc1 = 0;- X: \3 g( u* s6 \9 z. n
  69. dma_addr_t dmaphyssrc2 = 0;
    ( ~0 J  A  H% f: `& K4 w
  70. dma_addr_t dmaphysdest1 = 0;
    9 I9 k' \+ v# O0 W& r0 e0 G
  71. dma_addr_t dmaphysdest2 = 0;
    : g! G6 ?, f9 h. V* r2 C
  72.   P) b; B7 S- R! V; \' H8 d* `
  73. char *dmabufsrc1 = NULL;5 S$ D: P' W* f6 ?# Z, Y7 o4 b/ O! |
  74. char *dmabufsrc2 = NULL;6 v4 t! f5 g; S4 W+ W  |0 @
  75. char *dmabufdest1 = NULL;
    ' }# B5 C9 q9 C& r
  76. char *dmabufdest2 = NULL;4 R* L! J4 I2 u) ~

  77.   [& f$ C& A, l: h* M
  78. static int acnt = 512;
    5 T( r3 ?2 Y2 u- @' N
  79. static int bcnt = 8;9 W% [1 T& m( l9 G% v
  80. static int ccnt = 8;0 G: y1 W' b5 V  Y( _9 I

  81. ! V% }% H: f# y7 e2 ]
  82. module_param(acnt, int, S_IRUGO);
    5 d4 H! @  T1 N- q1 t5 l6 s+ m/ i
  83. module_param(bcnt, int, S_IRUGO);  x. a9 r6 X) R4 X( J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  p* q8 J) j+ I! D1 Q

) a2 q' P  _' j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 H& {7 R1 U. T/ @
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, A( S% X) Z) u# i" I' A9 i6 O9 d. x% A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! F' \: l/ [( I. w% n+ F% b+ O" y; ^$ m! C; [& @/ o" C3 A
& x+ c+ M3 M+ ]9 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 12:47 , Processed in 0.041054 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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