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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' g2 X) ]1 y7 L6 z4 o
  1. [code]EDMA sample test application8 X( p+ e, h* \9 H& C. \
  2. /*
      |$ c' u' P) O) g8 Q- M
  3. * edma_test.c( x! b! L8 ~1 b/ d. L) ?
  4. *
    , I1 v$ E% g7 Y2 ]  T
  5. * brief  EDMA3 Test Application
    . ?3 m- H$ j' _- U3 @
  6. *
    6 C  n/ N7 {7 }+ H% o1 [6 n  O! D
  7. *   This file contains EDMA3 Test code.; f  I$ Z) ~2 u0 A% d6 N4 c* U
  8. *
    , ~9 B$ R& \  l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 S3 B& b4 h! I1 y9 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 D$ h- {' X( J3 j# N9 C- ?8 c
  11. *         TO CHANGE.. F5 Q5 ?+ I  z- S* P# m
  12. *3 ?- [" y+ d+ y( Q, |: q$ z+ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ g$ B1 t3 K; S$ d, C7 g
  14. *
    # L9 _2 R7 O; }( X; h
  15. * This program is free software; you can redistribute it and/or5 m8 L2 Q0 N. H2 e! _. W
  16. * modify it under the terms of the GNU General Public License as
    ( p/ V& U' c" p, }8 B- z
  17. * published by the Free Software Foundation version 2.
    7 a; q% U3 M. ?$ v
  18. *- [. p7 u9 s! B/ |" v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : v# ?3 H; g  f3 @4 _  [' w/ S
  20. * kind, whether express or implied; without even the implied warranty) D& ^8 u  a9 G( Y! S" r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! l" P3 t4 q5 i4 {' a" D9 l1 M
  22. * GNU General Public License for more details." g( C" u/ z: y; f6 w
  23. */
    9 D& S3 P& \9 c( V7 f) b7 d  g/ r8 u

  24. + Q+ }. ]$ f2 N" ^' ^
  25. #include <linux/module.h>) t! ^* x( g+ C5 Q! h
  26. #include <linux/init.h>
    8 `% X. {6 R) ^: U# X
  27. #include <linux/errno.h>' E$ V1 S& v( O+ h7 |' n
  28. #include <linux/types.h>
    3 l3 r2 R( ]( e% ?5 k- O+ F' h. A
  29. #include <linux/interrupt.h>+ x( \9 r. d( D0 D0 V
  30. #include <asm/io.h>5 Z* g* ]& _8 M5 p& s+ G
  31. #include <linux/moduleparam.h>' j" }: s1 w  w1 x& T9 ~
  32. #include <linux/sysctl.h>
    $ R. c  N' B4 f
  33. #include <linux/mm.h>
    & C2 L" W4 s! R; r$ c9 U7 n
  34. #include <linux/dma-mapping.h>
    6 @" `4 `- K2 n- u( ~8 L) j& q

  35. # w" j( P6 Q" u
  36. #include <mach/memory.h>; z4 ?1 o7 p( A. B4 K2 K& [- M0 C
  37. #include <mach/hardware.h>
    1 X9 w) m9 N- m  E
  38. #include <mach/irqs.h>
    - u& l! Z! K% S4 f/ I! i+ U0 b( P
  39. #include <asm/hardware/edma.h>' r; W0 \9 ?4 T6 @: E

  40. 0 d, n& x3 k; n7 H5 E9 J8 R! c
  41. #undef EDMA3_DEBUG
    ; k/ X7 l$ {7 W9 Q5 \6 X1 _8 E
  42. /*#define EDMA3_DEBUG*/" B5 Y7 o2 U2 R3 V7 g6 [' W

  43. % ?( [$ C& o  V3 g& r" U! _
  44. #ifdef EDMA3_DEBUG# P+ Q9 P2 a( q5 Q! a, ^3 ~# p( v3 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 }3 y5 B6 {- i- O2 D' z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( E+ q. U" u: `% F* f( I2 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 A4 j0 [8 u! d+ L* c! E
  48. #else
    $ `8 s: `2 p, Z  e% n: m: r
  49. #define DMA_PRINTK( x... )
    : T  E6 w4 {  A9 I
  50. #define DMA_FN_IN) D" S6 C7 s- W+ [+ t* U" J0 L
  51. #define DMA_FN_OUT
    6 l" `% ^7 |: a) M3 V$ ]2 X
  52. #endif& p4 e' ^  v% q; }
  53. : S$ D! a9 e- O; W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 W9 y* I- g8 y
  55. #define STATIC_SHIFT                3
    * _) c  o; l2 o3 |6 B2 V
  56. #define TCINTEN_SHIFT               20$ z% b2 T; Z( e" T+ g, q
  57. #define ITCINTEN_SHIFT              211 t! z  h6 X5 D. m
  58. #define TCCHEN_SHIFT                22
    . i% V; a: u. k  p9 Z& B
  59. #define ITCCHEN_SHIFT               23
    7 y2 c: W0 Z& M. N  E8 i

  60. 5 J: Y* W/ y$ L
  61. static volatile int irqraised1 = 0;
    1 L/ i( }9 P7 w
  62. static volatile int irqraised2 = 0;; m; p9 [1 `* N, f. a
  63. ! u+ I  J5 A' Q' d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' u( k/ Z" X3 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' V9 {# x$ ~$ c5 X4 Y: Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ |( c9 J* W& d5 c5 D5 Y* J

  67. . D1 Y, t& ^; C" [3 U$ O
  68. dma_addr_t dmaphyssrc1 = 0;
      R9 k! I1 y0 O
  69. dma_addr_t dmaphyssrc2 = 0;' P0 l4 i2 c! b: i7 D
  70. dma_addr_t dmaphysdest1 = 0;" i6 G5 i: n7 f* i
  71. dma_addr_t dmaphysdest2 = 0;
    % T" N7 z% G% W: r- n' G! Z
  72. - [  \& l6 ~4 V! F# J5 f
  73. char *dmabufsrc1 = NULL;' v6 p0 V: g& G2 ~0 d0 E
  74. char *dmabufsrc2 = NULL;$ |3 a8 L1 u  i1 F7 L  G3 O
  75. char *dmabufdest1 = NULL;8 h# o- g  D1 A: W# ~2 X
  76. char *dmabufdest2 = NULL;; j6 y9 ], N8 c: w

  77. ( `+ D( M9 I, H# n
  78. static int acnt = 512;6 r$ o; {' a/ ^
  79. static int bcnt = 8;
    & q8 u; s) b3 u
  80. static int ccnt = 8;
    , h9 D$ M% r1 G" _9 Q9 [' H
  81. 6 r& s/ G+ k* A$ I# f( c: Y
  82. module_param(acnt, int, S_IRUGO);: N& `8 d& ?* B% }; `) M! ?1 e% o
  83. module_param(bcnt, int, S_IRUGO);/ Y* l/ T9 W2 k+ H! j& Q8 l; E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) Y9 r% |8 E1 h- ^: f* F  T( b

9 S0 a: B8 t% @: t* G- }* V! H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ Y8 P9 o4 _+ J0 B: b' U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! ?( I; s4 h; u6 p6 p# Q, P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' ~5 [5 M* D3 s& a  _

; M' D, V. E. z) Z
: o5 R" S" e; ]" [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 19:45 , Processed in 0.038305 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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