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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   x2 p5 y+ D& M; M) a( P
  1. [code]EDMA sample test application
    : g& ^9 Z6 D/ s7 Y( p
  2. /*7 k: f( c6 [6 y* p/ O* P2 a
  3. * edma_test.c  `) r8 Y- ~2 W/ f4 T) P/ `
  4. *. w; B2 B8 U& H9 |% H8 ~
  5. * brief  EDMA3 Test Application
    ' v" Y5 o% K$ s) ~3 |
  6. *
    / x" A# ]2 H$ D1 _5 \- |6 L
  7. *   This file contains EDMA3 Test code.6 ]' [& H& U$ r+ M
  8. *4 y. t& l* ]& A8 h# M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, T: i% n) B, h0 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; @- A8 d* H% ?! C. ^
  11. *         TO CHANGE.
    + Y5 }' l9 }' b( D
  12. *2 d6 X8 v/ b9 ~& o# ~6 `9 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# a4 f2 m! x2 V5 y  P! C3 o2 ?& p
  14. *2 t& ~- {3 `$ ?8 W
  15. * This program is free software; you can redistribute it and/or5 s9 V1 u1 c# K" I) d
  16. * modify it under the terms of the GNU General Public License as
    2 P2 F) l5 X* i4 A. r; U# a
  17. * published by the Free Software Foundation version 2.8 q# A% V7 }: a- K2 |& ^
  18. *
    6 T! v0 Z2 D1 J- A" l; w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & r' z- g' F  n' U3 y3 o3 @% \  q
  20. * kind, whether express or implied; without even the implied warranty% E! X# I+ c; @2 A' k/ C! g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) Z3 X  F5 m, }- Z2 H; \  p3 [
  22. * GNU General Public License for more details.( p6 B' B; v0 ?+ B' J( q. R( n
  23. */9 s! s, v3 A% R1 _6 ?0 L

  24.   p4 x# B4 N  [* Z5 A: W
  25. #include <linux/module.h>
    2 m: w. s3 x9 W$ o9 ~
  26. #include <linux/init.h>" p( X, ?/ N/ l2 @9 O1 g- c+ N
  27. #include <linux/errno.h>
    4 a1 C2 q4 Q& @
  28. #include <linux/types.h>( K) |. J. L! R' A& g1 N
  29. #include <linux/interrupt.h>6 N# e3 e  l% Y( E& n' ]% r
  30. #include <asm/io.h>
      g7 C  U" |( \, w& V
  31. #include <linux/moduleparam.h>
    ; _! @1 n4 Y7 G* U; W/ F
  32. #include <linux/sysctl.h>
    , F( v7 ]( K, U* v1 D6 M' k0 z* U
  33. #include <linux/mm.h>9 b2 g' b& C; F
  34. #include <linux/dma-mapping.h>+ m& {9 Q6 P( K4 u

  35. 5 s5 V! F7 C. N+ d6 |8 j: u
  36. #include <mach/memory.h>
    * j& X  Y! L. H+ r) Y  k
  37. #include <mach/hardware.h>7 b7 l7 O& Z) ]% C: s
  38. #include <mach/irqs.h>; n( \& {' i9 L
  39. #include <asm/hardware/edma.h>; M" \1 t$ n% C, x- C# L$ l4 u+ o

  40. ( O. O$ b, p# \+ J: p
  41. #undef EDMA3_DEBUG
    9 z, x/ \* b% L2 M
  42. /*#define EDMA3_DEBUG*/
    3 J- q5 i) |4 a. f

  43. ) B# `2 a; x- h  {1 i0 y+ N+ M
  44. #ifdef EDMA3_DEBUG7 w, N+ c# A9 S8 `' K. B! W9 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); L; \- e- {& s2 U8 C- E. a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ Y6 Y1 c- t" v! X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 `- l+ J5 d' x) F
  48. #else
    % S" l! [) p  ?9 @
  49. #define DMA_PRINTK( x... )# h- Y' m, V) l. E- `7 A/ M
  50. #define DMA_FN_IN
    # G8 Y! |- H0 w9 S5 j3 p
  51. #define DMA_FN_OUT
      H. @8 P3 L5 s* ]: R" h
  52. #endif( j9 f! \3 x7 M9 m; O

  53. % j3 d+ o* s* o8 A1 F/ U* X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 P. p' |6 G* Y- r6 `, {
  55. #define STATIC_SHIFT                3
      L" X8 u+ g* f  A' F( X) f
  56. #define TCINTEN_SHIFT               209 c% k- a/ r/ Z: a. f! e' n/ \
  57. #define ITCINTEN_SHIFT              21
    ( g3 C( H! T  U: W
  58. #define TCCHEN_SHIFT                225 w3 c' p1 z4 N2 I
  59. #define ITCCHEN_SHIFT               23! \- F" T" v3 @

  60. $ A5 \" _- Y2 e% A( L
  61. static volatile int irqraised1 = 0;
      N; e* G; b& x3 I7 I; u* A, D! V6 n
  62. static volatile int irqraised2 = 0;
    & R  D0 D4 J# L8 U

  63. . l( s& ?+ x6 D+ x( [! O) u1 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C5 F  t) S, o( [4 q9 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 t( Y" X& i" M* d, S: p  ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s! X" q6 c0 @( N% w
  67. ; r& ?+ J+ @' I& m# N
  68. dma_addr_t dmaphyssrc1 = 0;) @* l( t8 j- A! l' n& O
  69. dma_addr_t dmaphyssrc2 = 0;, T0 W2 T3 I& @6 o- P# ?, [
  70. dma_addr_t dmaphysdest1 = 0;  [8 o4 |& ?8 u
  71. dma_addr_t dmaphysdest2 = 0;
    - k5 ^4 M# u: r
  72. 4 L, j5 h2 d3 i/ J, I, ^$ X
  73. char *dmabufsrc1 = NULL;0 O0 }# }0 p5 w& }# [
  74. char *dmabufsrc2 = NULL;
    6 d1 u" r8 }6 i) A* N; o$ [
  75. char *dmabufdest1 = NULL;3 Y) D; \0 q3 _
  76. char *dmabufdest2 = NULL;0 r+ V. ?" H4 ]1 m8 N0 g  D
  77. 4 `! R" V$ N/ c+ A2 \
  78. static int acnt = 512;2 m9 N2 z) v$ T7 b5 W: C* w
  79. static int bcnt = 8;4 I% V$ K9 }5 J  X6 k
  80. static int ccnt = 8;7 T% ?7 g% k9 x4 d

  81. ( }: h+ _7 ~* b% g: R! h
  82. module_param(acnt, int, S_IRUGO);
    + o* J4 h0 d1 H8 b+ |: E! |
  83. module_param(bcnt, int, S_IRUGO);, A# M) R* Q5 [  g7 a+ i- ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 \2 p% O* ]8 ^0 ^# F9 Q
2 Z8 a) {& B! Q3 w( G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, I" b/ Q# Y( W( X" carm-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 ^: I$ B1 U/ u3 ^- K- k6 c  ?4 T- @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 l5 b1 S. P9 [4 v2 _

$ V$ X) Z/ e  G
8 z/ C" g! V7 e- e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 18:43 , Processed in 0.039152 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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