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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  c: D; p7 }. q* |+ O$ L
  1. [code]EDMA sample test application9 h3 e+ f0 B5 {+ m* O) C  L
  2. /*
    # y" Y1 A+ B: C. G
  3. * edma_test.c" `: n# X( e/ n' a' D) @
  4. *
    * |$ {4 v$ C% y1 T5 O
  5. * brief  EDMA3 Test Application. _) ?/ ~: T9 o' a3 f- y
  6. *% u$ t' [  y) \/ O; F3 c  p
  7. *   This file contains EDMA3 Test code." W9 D. e0 K* ^- A1 i6 j# Y5 P/ w
  8. *9 E6 e/ D  G9 }4 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 I) `$ Z2 a1 M3 T/ x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& ]1 V. z4 _( C6 J4 I
  11. *         TO CHANGE., I# K5 F  r6 q$ c: W# L' s- ?
  12. *
    2 [3 U: {( e3 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" |  T  ~7 j4 G# w! }6 g& N
  14. *
    , a+ A3 b( ]: D# }: J! d
  15. * This program is free software; you can redistribute it and/or) W3 O, X2 x: C" F
  16. * modify it under the terms of the GNU General Public License as
    ; N2 r& N9 {' }5 _; h) w5 S
  17. * published by the Free Software Foundation version 2.
    , L2 n: o9 `. u$ b
  18. *
    7 m! l; {/ d% P: U) N, S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 \8 m* h- d1 V# f/ E3 b
  20. * kind, whether express or implied; without even the implied warranty+ h8 G! L2 T3 t1 \% E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ i0 K0 O- q4 @  v! x
  22. * GNU General Public License for more details.8 s6 m4 {8 Z* b$ ~
  23. */
    ! W9 f5 w4 N# z2 q

  24. / G! n$ z' i8 \# Q* |
  25. #include <linux/module.h>
    ) C2 H- {3 n$ T5 o- l1 A- K$ U
  26. #include <linux/init.h>
    ! L8 b# Z4 g( R6 X" Y' q
  27. #include <linux/errno.h>
    : a+ n0 ~$ ?3 ^1 i
  28. #include <linux/types.h>
    2 h6 C% t4 m% b
  29. #include <linux/interrupt.h>
    , U8 G. B' P3 j
  30. #include <asm/io.h>7 s& F/ m2 Z0 t% g/ j. l+ A
  31. #include <linux/moduleparam.h>0 g8 ?/ O# B4 E; W& F; S
  32. #include <linux/sysctl.h>
      n5 g! Z  S1 U' B' E! G
  33. #include <linux/mm.h>. f* \# n  G- K
  34. #include <linux/dma-mapping.h>
    / V( _6 o% d& v0 U9 n- r# c( A  w

  35. 6 m8 H7 N+ F% f! F
  36. #include <mach/memory.h>
    2 k4 U  J3 q+ f9 ^
  37. #include <mach/hardware.h>" A  x5 X% w4 Y! ]) {/ D3 d0 l
  38. #include <mach/irqs.h>6 h( J5 U) I) O2 u+ C. w/ O$ W
  39. #include <asm/hardware/edma.h>
    7 k6 ~; \6 G6 `5 [% r

  40. 4 O: \7 Q0 {% D/ [# }
  41. #undef EDMA3_DEBUG
    5 x. a2 z0 ^% f
  42. /*#define EDMA3_DEBUG*/2 f7 G9 B8 x: g0 G
  43. ' u* _; a; c/ f4 f
  44. #ifdef EDMA3_DEBUG* W" A! v. o3 ~. `( Z1 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) S& Z% v* l# H2 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 O4 G* E0 w- E" c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) T, ~# `* d" Y6 x* u- I/ C
  48. #else
    " f3 u6 j, C& A' {) _$ x: N
  49. #define DMA_PRINTK( x... )
      W% L7 k; n" Q
  50. #define DMA_FN_IN
    ; y9 x6 ~$ @0 s9 m( `* m8 W: k7 F) D
  51. #define DMA_FN_OUT
    8 V& w+ C- y% a2 w5 @9 S
  52. #endif! I2 U/ J1 s5 E

  53. - P9 H  ^  Y% [) ~# [) Z; U: E+ W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 y" t8 z& H7 z( S& s
  55. #define STATIC_SHIFT                32 X; `1 t  q+ ]$ n; O
  56. #define TCINTEN_SHIFT               20) e' V9 o0 e9 c* P
  57. #define ITCINTEN_SHIFT              216 C" p# L) n$ u: q
  58. #define TCCHEN_SHIFT                22
      q0 A3 q0 u5 N& F
  59. #define ITCCHEN_SHIFT               23. p1 w5 z" C- t& a5 H9 L
  60. 0 S, l7 O1 T% j  E* ]" v9 Z
  61. static volatile int irqraised1 = 0;
    ) L+ L- K7 O5 {/ I% j) Y6 g1 [4 @
  62. static volatile int irqraised2 = 0;
    # n% o# n2 B# Z8 t& D$ [

  63. ! k  Y* ?7 Z+ X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 D) t4 f; F1 k  [/ g6 M# T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* C5 \8 C; V/ [7 E* W( K- i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- I4 O$ A8 S8 L# S
  67. / i7 T( m# j2 [( r, f/ l3 Z5 }
  68. dma_addr_t dmaphyssrc1 = 0;
    ' X. p9 I& k" I+ [) _
  69. dma_addr_t dmaphyssrc2 = 0;0 Z3 U2 L8 U; Q+ f
  70. dma_addr_t dmaphysdest1 = 0;
    0 r9 @" c9 M& G/ V1 ~1 D. b2 Q$ @
  71. dma_addr_t dmaphysdest2 = 0;
    5 P: m! e9 G4 z
  72. 6 f* A/ y: E1 P( d, {' ~" v
  73. char *dmabufsrc1 = NULL;1 j3 W- z" w3 J4 L! y9 g
  74. char *dmabufsrc2 = NULL;4 f$ V! h) ?' ^5 m3 r
  75. char *dmabufdest1 = NULL;. `2 z/ ]0 ?5 i) g3 X
  76. char *dmabufdest2 = NULL;# ^1 M9 ~' a1 v3 @1 {5 D$ R
  77. 8 y" Z  ]$ q7 S; B* Z5 F
  78. static int acnt = 512;- b/ u$ m3 j9 {% K& C
  79. static int bcnt = 8;
    : F' Q: I5 n! F, ?
  80. static int ccnt = 8;
    1 J( r1 ~1 `4 E" o3 c
  81. # H( q0 W% l  i6 _  I
  82. module_param(acnt, int, S_IRUGO);
    2 L0 ?( c, \% y2 _( X5 U, M/ f
  83. module_param(bcnt, int, S_IRUGO);8 H/ I7 M" R  V4 h& P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& _. C9 \' u0 d0 X# E0 E
* S" @# ~* G& X! U3 y) r& r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. ~& f; K2 A2 G( y- W6 H/ o& s/ Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( h- n+ F: v. d3 J; `- y( S7 R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" L/ C5 p. O) A. h1 f" T, ]9 }6 L, }6 M6 v0 v/ W

  F' s' w) S; e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 21:50 , Processed in 0.039685 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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