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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. W  j* I, a' |% x# K
  1. [code]EDMA sample test application
    6 Q! r4 d$ G( Q8 A: U
  2. /*
    ) _1 z6 p5 R! P/ U: C
  3. * edma_test.c
    % z: }9 W9 z( s9 e. _
  4. *
    + W! D6 ~) ^' F
  5. * brief  EDMA3 Test Application. g2 Q! B7 H, a+ C- R
  6. *
    8 Y+ u: N$ _7 \6 Q% q* i7 e  @
  7. *   This file contains EDMA3 Test code.
    : {5 L) B$ f; ]
  8. *
    ! U& w& \7 \% H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 G  o. N8 O# z2 K" u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ?) e  c$ ]* I
  11. *         TO CHANGE.+ B$ J5 [; a  B
  12. *
    & e' J7 D2 v% H! J$ V- E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 [5 Z) s2 w& ]
  14. *: l* P8 S3 W, q- f
  15. * This program is free software; you can redistribute it and/or( r& o* h' K) T, `
  16. * modify it under the terms of the GNU General Public License as. S! R+ H0 e* p9 M, Y/ s
  17. * published by the Free Software Foundation version 2.
    & D" Z8 j: C3 I, r; C
  18. *$ r5 x! ^$ [9 s# \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% N3 u8 J" D% X2 q+ ?5 e3 j' m7 w
  20. * kind, whether express or implied; without even the implied warranty7 O) l, j. ?: z! s4 Y8 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' G1 y, {& p' u' E; [( \8 b9 U
  22. * GNU General Public License for more details.& g$ }. P1 T) q' F/ U( H
  23. */* |  H0 \, B7 U# Q

  24. ' s' {& q) ]- F( @
  25. #include <linux/module.h>' @7 M  s7 f0 L# y
  26. #include <linux/init.h>
    2 L- V; o/ K- h. Q! F* Y
  27. #include <linux/errno.h>. N) i1 h2 g! U6 A4 I
  28. #include <linux/types.h>' K4 H/ U2 a. l( D! x
  29. #include <linux/interrupt.h>
    : j6 ]4 A, K5 N& o/ G
  30. #include <asm/io.h>' y9 U6 E; E# @/ N( c
  31. #include <linux/moduleparam.h>
    & R7 b4 }  f& M, s5 E# a/ {
  32. #include <linux/sysctl.h>2 v0 D: T6 r8 I7 d! G
  33. #include <linux/mm.h>) F' Q' R3 y. I9 _  p* j
  34. #include <linux/dma-mapping.h>6 e% V# ?8 x% U$ w; h

  35. 3 v5 a9 T* n- e2 e+ e% Z- V
  36. #include <mach/memory.h>
    8 t% H3 X9 }7 f7 S$ Y; ~1 ?8 S5 l5 x
  37. #include <mach/hardware.h>5 {# L& Z  O$ A6 N) ^8 A
  38. #include <mach/irqs.h>
    . t3 @- q) U; {' C9 _4 O5 H
  39. #include <asm/hardware/edma.h>3 \) N/ A) z4 R5 z/ f

  40. 2 ^3 }! d  q1 L1 [" b( M! h
  41. #undef EDMA3_DEBUG% s) `1 ^- p- v" F6 g; g
  42. /*#define EDMA3_DEBUG*/4 s. D" K: L$ D6 T' R
  43. ) b2 L( Q- ~. [. p( H8 t
  44. #ifdef EDMA3_DEBUG
    - ]& R8 l5 M$ ~' m$ G  q, a% L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; ]& B* d. W# a2 j- o; Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 `3 ~/ o9 C; w2 X* w. H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): d' O2 C' l, v' I  o
  48. #else" p( A2 g( Q/ n% @  c6 A7 u6 n# f! m
  49. #define DMA_PRINTK( x... )
    1 L% O. K. E' h9 o4 Y4 p7 @4 }
  50. #define DMA_FN_IN5 t7 O: O/ [, P, r, ?* S/ j: z+ j
  51. #define DMA_FN_OUT/ x- k) K" t7 Y2 i
  52. #endif5 v. E% E8 @# {% T

  53. 6 D+ v. Y! p- I( @/ x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ r! Z% |* k$ A; R. Z2 X2 N; z
  55. #define STATIC_SHIFT                3, X; x4 J( j4 n7 v
  56. #define TCINTEN_SHIFT               20
    ; b3 y. U3 j+ s' i  Q
  57. #define ITCINTEN_SHIFT              21& ~( g* P6 z5 v) g2 H- Y( V
  58. #define TCCHEN_SHIFT                22
    # y9 }. V; e( K& q% s, @2 T4 T9 r
  59. #define ITCCHEN_SHIFT               23/ H' {7 g. {' S1 L

  60. 8 X# u5 m  r% {6 @- O
  61. static volatile int irqraised1 = 0;
    0 D7 i* r1 _# c0 [* B  k
  62. static volatile int irqraised2 = 0;- R4 n3 ^: r2 h0 `
  63. 1 b# h3 ~: z9 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^; X: q+ c8 g) @, O# ^6 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 T/ H$ S# o; A! @& |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& R6 Q2 n( a# t' b" a$ e
  67. 1 ?, i* P5 o) V( [9 m/ L
  68. dma_addr_t dmaphyssrc1 = 0;, P4 ?1 |' b& g# m7 T3 t
  69. dma_addr_t dmaphyssrc2 = 0;5 w, o+ B4 _! A  s+ W  I7 L7 x
  70. dma_addr_t dmaphysdest1 = 0;  b' n5 Z" T. t; X$ C& j- \
  71. dma_addr_t dmaphysdest2 = 0;
    " |4 _# S, V% `: G" f& r- E+ g
  72. 9 c$ |8 z9 @' P% o
  73. char *dmabufsrc1 = NULL;9 n9 v5 F6 b9 l" i6 H2 f5 E
  74. char *dmabufsrc2 = NULL;/ i3 k) H3 R7 r$ R
  75. char *dmabufdest1 = NULL;
    , Q3 g6 m. Q# ?" U
  76. char *dmabufdest2 = NULL;
    & m4 t* i# Z( _- ?4 }- R, Q4 d7 u4 _
  77. : {& r7 V9 X$ x9 J/ G
  78. static int acnt = 512;
    ( D1 ?, m" u0 }4 t/ w3 n6 m8 H  }$ w
  79. static int bcnt = 8;! U" I- e# h; G/ s5 P! O
  80. static int ccnt = 8;9 H2 A& P# {6 ~! C! M
  81. # p6 N8 m7 L5 }2 c
  82. module_param(acnt, int, S_IRUGO);
    ' X, S/ r+ S& l- V; }5 s. N
  83. module_param(bcnt, int, S_IRUGO);5 n3 T) ^% `4 y% z* P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; [$ d' q5 G. n5 x5 R0 h: a3 _2 j' j2 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ u- v3 m/ I) L3 H" D8 R8 B8 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- Y) S; ?: o. W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 V2 m$ y5 j5 n( p

* \& |2 u9 E- d5 \
* s) ]/ s/ r. U* ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 11:32 , Processed in 0.038784 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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