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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& {. \1 A/ |0 \0 Z- Y% d1 c! {, l
  1. [code]EDMA sample test application
    1 f& |1 s, c$ ]5 r. b
  2. /*3 h' a  s. \' \4 B* F+ w
  3. * edma_test.c) A+ A7 w- L( Y2 N& v, Y$ |; e% U
  4. *
    3 H; a1 Q) D, Y: f% G: b  @4 N
  5. * brief  EDMA3 Test Application/ u2 J& O* C# `9 s4 o$ l- C
  6. *
      K! t8 L" r3 v: `
  7. *   This file contains EDMA3 Test code.* _4 Y' s" F9 D! J1 r/ H- c$ s: c: U
  8. *
    0 h- A5 u/ @8 v% k4 m' X( v: g. r% j7 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 e6 x6 x  w8 z, W) i. s$ ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, |0 A: q! Q: O
  11. *         TO CHANGE.+ ~6 i( d# K- f, v* d9 K7 q
  12. *
    5 \5 A4 Z( d% y, |( ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. B/ N. u$ K! C0 f4 L" F
  14. *
    8 _# H! F2 Q* |, U3 R: y
  15. * This program is free software; you can redistribute it and/or
    ( {; e' D$ |5 \- E
  16. * modify it under the terms of the GNU General Public License as6 x6 a; ~* r: @, U# @6 I- }% O
  17. * published by the Free Software Foundation version 2.
    : N' N. y, _; {9 o2 Z
  18. *3 {3 M( w& y$ T( p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + F1 I( f4 T' ?3 I  W
  20. * kind, whether express or implied; without even the implied warranty
    ' N" {% e5 P; @) Y2 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 \3 P- I+ c2 Z( t, ~& H8 ?5 R
  22. * GNU General Public License for more details.* R" f  I1 E0 J: S# t
  23. */
    6 S4 t6 K  X; E4 U9 Q

  24. ' ?6 N0 U! C$ ~
  25. #include <linux/module.h>
    ! n) U( E8 K7 U" e9 }- g
  26. #include <linux/init.h>/ g, s9 l  x& G% n& Y& Z
  27. #include <linux/errno.h>9 c/ f, x% m+ d% B
  28. #include <linux/types.h>9 y9 Q6 g' _- c% l" D
  29. #include <linux/interrupt.h>
    4 r. b1 s; K( M% X6 R# X6 p
  30. #include <asm/io.h>( n. |# ?" h4 f" L1 h; F: O& _
  31. #include <linux/moduleparam.h>3 \' B8 f0 S8 B9 E
  32. #include <linux/sysctl.h>; ~  \  R- d, o1 T
  33. #include <linux/mm.h>
    : i! P& _- X$ |! Q
  34. #include <linux/dma-mapping.h>  H: s9 n6 n% r. @' w" T
  35. 0 c, A  k8 n! v" ?# ?  \
  36. #include <mach/memory.h>
    . n& c( C+ c4 I. X6 X
  37. #include <mach/hardware.h>6 {& O- _( Q  h% r6 ^2 |% d+ E
  38. #include <mach/irqs.h>
    * I  b# ~  \; R" |2 V9 A
  39. #include <asm/hardware/edma.h>* @* Y9 X! N4 _9 ?, S  Z

  40. * x# d: {6 i7 R5 E
  41. #undef EDMA3_DEBUG
    # H# \2 B( s! m. E! \! E
  42. /*#define EDMA3_DEBUG*// Y0 i# A& ^1 b9 o% X& q+ {) ^7 P

  43. % {3 Z$ |, w2 `& O- O: \" D
  44. #ifdef EDMA3_DEBUG! b0 Z7 `$ k, D* U) L2 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 @  N* W7 h9 \5 y$ X' j( z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  e* D1 V8 i6 w( G0 ?0 m' q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 |9 w* j' u- ~- n  |: X
  48. #else( e9 Z/ j$ L4 b- _; I
  49. #define DMA_PRINTK( x... )0 |4 \& \5 n2 ~2 c5 }9 d
  50. #define DMA_FN_IN
    , e% o3 `- @- b, d+ N* v# {
  51. #define DMA_FN_OUT
    0 [2 o) |$ s' w/ {% H
  52. #endif( I6 \# f* Y8 D5 i/ |+ m$ Y% k
  53. - q$ i, x% I, a( u' Z2 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) V9 G& ~/ H9 Z+ U! C) K) u
  55. #define STATIC_SHIFT                3
    5 M' }1 F. t& B2 d/ ]3 l8 C
  56. #define TCINTEN_SHIFT               20
    # K: t! u0 z2 @9 K* ?4 _4 z! ~" x9 b
  57. #define ITCINTEN_SHIFT              210 Q3 H' O6 z8 B6 r% n5 i
  58. #define TCCHEN_SHIFT                22
    / W& G( Q+ Y1 T) J( C% m- j
  59. #define ITCCHEN_SHIFT               23
    8 j/ v& p0 a8 q9 t/ |' L, ~( o6 x

  60. 3 M/ O) x7 P& }2 ~
  61. static volatile int irqraised1 = 0;! g$ V4 a/ s* k/ [8 S8 [9 S
  62. static volatile int irqraised2 = 0;
    2 m- }$ q, A- o9 Q
  63. $ t' Z, n7 o& \% j& H$ m7 |4 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      X6 B, G7 ?. k0 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 g5 P/ Y# _$ Z" X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; z  S9 Z+ i6 h+ h' u

  67. * P3 \* P0 \& }) Q; q  |# P9 f  }
  68. dma_addr_t dmaphyssrc1 = 0;  t  M7 p7 z1 X5 m% _: ~
  69. dma_addr_t dmaphyssrc2 = 0;0 f, D2 o: J) `
  70. dma_addr_t dmaphysdest1 = 0;
    6 x1 a, X! W+ n: y6 M3 o9 u
  71. dma_addr_t dmaphysdest2 = 0;
    ( d. }& L, m4 T; y- s$ @5 k

  72. ' Y+ v7 l7 f( L; C( e$ @3 p: l' h
  73. char *dmabufsrc1 = NULL;
    ) y7 W- S" l4 r3 ?% K' l
  74. char *dmabufsrc2 = NULL;
    ! J! r/ }' k) w1 O
  75. char *dmabufdest1 = NULL;/ d; K1 h& D- j' h
  76. char *dmabufdest2 = NULL;5 w+ ~1 w. t' W/ h- B- f+ n8 }

  77. ; D3 Y1 c, h  p
  78. static int acnt = 512;/ ?2 v' ~# G3 X' i) ~
  79. static int bcnt = 8;. j/ O3 o1 ~9 E" A( Q% v" V) L
  80. static int ccnt = 8;8 M1 q1 d/ W: g( r/ }

  81. . i2 l' B, M- s( V0 ^2 \. V
  82. module_param(acnt, int, S_IRUGO);7 T# E5 g- g) Y  F" J6 y6 I
  83. module_param(bcnt, int, S_IRUGO);7 x  G. R, P7 [' o4 T  {+ e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* G2 c3 Z6 m. a  y7 ?0 S8 E/ M4 Q5 t  d' c% n1 x" P; S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o! |% f9 J# x3 S, O% `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# d7 X, r0 d  n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, w2 e9 `8 X% n. ?
- U, G# j/ g; @4 k, S$ F' h- j8 q" C4 C5 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 21:08 , Processed in 0.040036 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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