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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; J% V5 s  U6 S$ S, P
  1. [code]EDMA sample test application; `+ h0 I6 D7 I7 [& A
  2. /*4 s2 ?1 q% {" e# w4 L
  3. * edma_test.c
    4 F, H/ u6 K) P; l1 V& A+ d
  4. *" b2 Y( U% G, R# N9 z  g3 n& y8 [: d
  5. * brief  EDMA3 Test Application# b) k: H, K0 R2 \
  6. *
    * b# @, U- v  P) J; f9 K
  7. *   This file contains EDMA3 Test code." ]1 {) g# U4 I" B2 ^# Y1 j# t
  8. *
    4 n. K2 }; s( @" |( d1 U/ t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* e2 U: ^7 G5 P' s+ F1 [4 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + F4 k$ e7 Y, F( F8 ]
  11. *         TO CHANGE.
    ' l9 {  S4 A9 u' x  @
  12. *
    $ b0 C6 \+ Z0 _3 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 Y" ~$ V( f  F. A
  14. *
    / H; A8 G  X# w* H
  15. * This program is free software; you can redistribute it and/or
    ' }, c: O# V% K2 b3 ^
  16. * modify it under the terms of the GNU General Public License as- P- o" U. k) D) W0 S' l
  17. * published by the Free Software Foundation version 2.
    & ]( W: F# v" i9 i2 S/ D, P
  18. *3 K6 {6 E) k# X+ \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, P# j2 B8 g5 Z
  20. * kind, whether express or implied; without even the implied warranty. Q/ z' t& `/ _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; f% N  }# n- ?$ Z2 n
  22. * GNU General Public License for more details.
    0 K* i/ V7 ?" U7 o. b
  23. */
    : C; N* P7 o4 A" p! S) f; u
  24. # X/ o" C. U  o' n4 @
  25. #include <linux/module.h>8 \) F+ K* O- D6 u& Z+ l
  26. #include <linux/init.h>
    + r; g, T/ t+ {1 ]# R2 I
  27. #include <linux/errno.h>, \6 x" o! o! U  L1 i
  28. #include <linux/types.h>$ Q  F0 m$ w) @7 m
  29. #include <linux/interrupt.h>
    4 U; S8 ^" f6 N" |
  30. #include <asm/io.h>
    5 f3 U: f7 u% o; L8 m
  31. #include <linux/moduleparam.h>
    $ q! H4 p* Y- [* N5 S. z
  32. #include <linux/sysctl.h>
    ' M7 |& r5 D, e6 a4 p1 S
  33. #include <linux/mm.h>
    ; K2 G6 h, P6 V9 r  ^( s: [( i: |
  34. #include <linux/dma-mapping.h>7 ]! ?) i. f& l2 v* r/ y

  35. % R/ R: Q! v5 ]8 X5 t
  36. #include <mach/memory.h>- n' X) R$ ^  _6 S! |' m
  37. #include <mach/hardware.h>* k4 x4 m* i& n  o  w  {
  38. #include <mach/irqs.h>
    0 A1 a1 e% o3 W7 f# G1 b- z  a
  39. #include <asm/hardware/edma.h>" q' `$ _! ?* P- o( k' P3 ]( n
  40. . Y1 r4 j/ l3 o. b
  41. #undef EDMA3_DEBUG& B5 t5 W4 n5 @  W5 l8 A0 C. Y. M
  42. /*#define EDMA3_DEBUG*/
    / w5 ^! }& Y% R' |* V7 V- Y; K% M
  43. 4 v6 i8 ^+ e4 g# y& A
  44. #ifdef EDMA3_DEBUG
    9 n, T+ B3 P6 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 o9 M7 D5 [# S# h+ c! c& S; {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), K: f2 F4 K- ]. o6 y% b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Z* o- \' C# l
  48. #else
    & ]2 e6 v9 s" j' F2 x3 w0 X/ |
  49. #define DMA_PRINTK( x... )
    * V5 @: G2 a6 j( Z; C+ F/ ~2 ~8 Z
  50. #define DMA_FN_IN, J9 U# Q; r9 k1 J. z
  51. #define DMA_FN_OUT% v3 y: }: x9 m* Z' O2 f% g1 [
  52. #endif
    0 L' [) P6 {4 {; i0 B

  53. 0 D$ }2 w  G% j/ W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): l- ?. i9 @; A4 p
  55. #define STATIC_SHIFT                3
    / `, ~& t4 a" P4 C
  56. #define TCINTEN_SHIFT               20
    2 A8 |0 S8 G3 q- c( {% t% u2 W
  57. #define ITCINTEN_SHIFT              21+ y4 L( f0 n" V
  58. #define TCCHEN_SHIFT                224 _9 |9 G" e0 D& U+ @1 F
  59. #define ITCCHEN_SHIFT               234 K, [( a: P( U. _8 Y

  60. # w; Q* L0 I4 L2 F
  61. static volatile int irqraised1 = 0;
    8 d0 S! R2 K" X. y8 W3 C5 S
  62. static volatile int irqraised2 = 0;; N4 G& |! |& u- ]
  63. % W5 x2 Q) G7 }; Y" m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: V( |9 K* N  {; e+ J7 X* s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + H1 ^' r; T6 `4 v9 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , H: R1 [1 \/ d$ O& E, B4 H

  67. * g: L2 |# L3 s6 P% N/ H
  68. dma_addr_t dmaphyssrc1 = 0;
    $ l- q  }  m7 K. T. ?+ |# x6 E
  69. dma_addr_t dmaphyssrc2 = 0;
    : I+ \2 [" T* w7 B' p2 \2 j
  70. dma_addr_t dmaphysdest1 = 0;
    , D+ ^& n8 [. [5 w: I/ B
  71. dma_addr_t dmaphysdest2 = 0;
    * w- k2 L$ x. }% h0 S, x
  72. * Y" ?, h1 f7 h. [3 r
  73. char *dmabufsrc1 = NULL;
    $ [8 l7 O  t6 {1 Z$ J6 `1 u3 L% ^
  74. char *dmabufsrc2 = NULL;
    ; z3 z( \% b6 Z
  75. char *dmabufdest1 = NULL;- p. W# ]! W: d$ l& b0 N
  76. char *dmabufdest2 = NULL;
    & ], i( O, H( e$ u- ^
  77. ( O6 y3 ]2 G8 K# n  J& t5 r
  78. static int acnt = 512;/ b3 k. q) ]# z6 v5 W
  79. static int bcnt = 8;3 Y5 Q# M! z! @  f$ U( S7 c
  80. static int ccnt = 8;; W; d: }$ j4 a/ ^, w, n) ~- D
  81. 4 k' Z7 {. H6 \
  82. module_param(acnt, int, S_IRUGO);
    ! H/ _0 X7 X- Q, c
  83. module_param(bcnt, int, S_IRUGO);
    0 {0 P: d1 b. i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 ^* h, S4 h, K+ T- r3 K! S$ e7 N8 T+ F; [% Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 `7 Y5 C) O% i3 `% Q- s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 M- ?. v: b" _# y& N6 S  x% b: A! S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, X4 w, h: j/ ]6 r7 W% C
+ [& E  @0 ^, E+ X5 a, R% V% Y/ s" c8 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 10:06 , Processed in 0.036414 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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