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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . U$ }* `( N- @2 O$ h
  1. [code]EDMA sample test application
    - V- s4 X- L4 ?" C% R" l: D; L
  2. /*
    3 e/ H/ B& {# |5 R& {8 k9 D% l
  3. * edma_test.c/ N9 y- L* f2 L& y* k1 {7 H' J
  4. *
    $ X1 I  L# ]; X. d$ W; `
  5. * brief  EDMA3 Test Application3 E; ^2 m+ j- o$ ~2 D6 U+ h6 O
  6. *# ^5 p& W: U' W7 d7 ^% i4 V0 e4 O
  7. *   This file contains EDMA3 Test code.
    ' Q/ `9 a. g' N
  8. *" [- c- `- l+ ]3 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" R7 A$ [2 q7 G% D# K6 @. P- _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' k% Y3 ~& d# P7 A4 U  m4 W, A3 O
  11. *         TO CHANGE., }6 \4 F' m- R8 V7 t, J6 `
  12. *# E' b% C; {7 u3 a5 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      s3 X5 Z1 b0 B/ e9 n% t) D* e0 }
  14. *
    9 ]( E2 T/ n  f0 c2 o1 J3 q3 t4 H
  15. * This program is free software; you can redistribute it and/or" h4 a6 x0 W( v2 _$ y! }9 a
  16. * modify it under the terms of the GNU General Public License as
    ! `) o* K" X% M, J  C* ^
  17. * published by the Free Software Foundation version 2.4 }" `' l. M( t; A$ F7 V
  18. *
    - r; d4 ]; G6 p9 x' \- ^, x) R) n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  l0 o- A( g. {2 Q
  20. * kind, whether express or implied; without even the implied warranty
    - q4 r' D* o, l5 e  O8 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % e2 m0 u( G. c, h
  22. * GNU General Public License for more details.
    2 z6 [/ ~+ P" T8 J
  23. */1 o& n0 U! [+ u5 o6 O  _0 q

  24. " z5 {6 P+ L0 E; T3 \
  25. #include <linux/module.h>9 X6 u/ d1 I/ C4 j! r
  26. #include <linux/init.h>
    & i" O4 s4 m  |% D! o
  27. #include <linux/errno.h>5 I+ e& L# ^' Y& L
  28. #include <linux/types.h>/ H  o; ?' c' X  S  @' q  H
  29. #include <linux/interrupt.h>5 c5 w& |, {* H$ c7 I4 A
  30. #include <asm/io.h>0 z8 w% {& k; O1 A6 ^& R
  31. #include <linux/moduleparam.h>
    3 ~1 V' q% f2 s: q$ F+ s' E; M
  32. #include <linux/sysctl.h>7 P3 v  q( D. V2 z# @. `
  33. #include <linux/mm.h>
    4 o+ `6 q! ~( Y" M8 Q0 [
  34. #include <linux/dma-mapping.h>
    & K  I% _) d% o" h+ U
  35. . [# R5 y# e! y: l2 I
  36. #include <mach/memory.h>: ^' y8 K( b, d. @% ?: f
  37. #include <mach/hardware.h>
    # `8 W6 E( C7 L1 Y% n' ^% h2 V  u
  38. #include <mach/irqs.h>
    / `9 `4 [: L- D* q( g7 x
  39. #include <asm/hardware/edma.h>
      N: x5 x  E6 i& U! ~" h) ?
  40. . D+ _& ?. u3 P" C& s
  41. #undef EDMA3_DEBUG- H7 c2 e9 }6 O2 I
  42. /*#define EDMA3_DEBUG*/
    + N2 M- h2 e: S4 X9 ]0 H( x  Q

  43. 6 U# l5 C" I$ Z- ~; G- p% d, L) }$ w
  44. #ifdef EDMA3_DEBUG
    4 ]0 ~( \5 \  y) \- J# \3 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 J( S, d% l! B# Q1 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & `" ^; B5 Z" h2 o# A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 ^: E* X1 e: Z6 _% f8 p
  48. #else
    ( M* D! @0 f( M1 ~* ^: s! j$ t4 R0 o9 @
  49. #define DMA_PRINTK( x... ): x5 v# H; Y3 ]
  50. #define DMA_FN_IN
    4 C% a# i7 n/ [( L- M& e4 ~. [; j
  51. #define DMA_FN_OUT
    & B  A, T* l6 R
  52. #endif
    + [' ]; {3 R0 w  d
  53. - s! X5 Q. J4 L" m2 _! ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 o5 d) @7 O/ F( k; I8 \4 m
  55. #define STATIC_SHIFT                3
    0 ]* v- l( O: J2 q" Z" u4 U
  56. #define TCINTEN_SHIFT               20# X% I' Z: a" Q8 Q& ~& `: ^# f
  57. #define ITCINTEN_SHIFT              21
    7 @2 T" l, O0 t9 Z1 i
  58. #define TCCHEN_SHIFT                22) w  }4 s! i1 o7 e
  59. #define ITCCHEN_SHIFT               23
    # U5 A" K: r* Q0 ^, {( l
  60. 4 I, ?2 n7 P" A* ]! [: h! k
  61. static volatile int irqraised1 = 0;3 n, \6 r) B4 W0 y+ l5 T
  62. static volatile int irqraised2 = 0;
    " ?& [$ N- V) Z: `* Q$ o& n

  63. ; C( t1 T- ~+ ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % l1 A) w  ]: R; e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; v- f, N/ C0 J* z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - J. d: m9 A- n; G* S
  67. ( J# u# I8 x* K, E
  68. dma_addr_t dmaphyssrc1 = 0;
    $ Z& o! W5 c/ \/ Z7 v; U
  69. dma_addr_t dmaphyssrc2 = 0;  M, k9 h& [/ h9 d
  70. dma_addr_t dmaphysdest1 = 0;% p( Y1 [9 L, I- W" f: |
  71. dma_addr_t dmaphysdest2 = 0;
    9 j. o' n; m- u4 Z) `
  72. % W, z9 t* @2 E$ _6 d$ r1 ]
  73. char *dmabufsrc1 = NULL;4 A4 F; _$ g/ a2 S  d% g
  74. char *dmabufsrc2 = NULL;
    ( P4 p+ o) ^% k
  75. char *dmabufdest1 = NULL;2 R' w3 ]$ R4 N3 s3 o
  76. char *dmabufdest2 = NULL;
    8 z$ B6 G" r# I0 K
  77. % _: t/ J. A( @$ A. X$ _0 z, D4 m
  78. static int acnt = 512;* r2 W9 L% E3 R1 I
  79. static int bcnt = 8;- N. A9 g2 W# ^1 _- s
  80. static int ccnt = 8;
      ?9 |& f2 Z  k& s

  81. & ^& n/ D8 m" ~# ]- U& b
  82. module_param(acnt, int, S_IRUGO);0 t2 O: r3 [1 T) Z2 ~9 P
  83. module_param(bcnt, int, S_IRUGO);
    : V6 J! ~0 U: t! n8 p3 H+ n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 R3 d* W; z- I
& x) Q( d! J# W. K0 {% b2 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; J. p+ D1 t3 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 T8 y: v4 W0 i% d. a9 z3 O* W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 D' d4 h' ]4 R7 T8 N( V, N
* i! p% P- L/ \8 }7 x# c; N  `; V% C6 J$ [! @/ S1 D& x) j" p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 01:52 , Processed in 0.041631 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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