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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 z+ w: r4 Q: o' s+ b2 w; X
  1. [code]EDMA sample test application
    2 j5 C7 i7 j9 B3 M
  2. /*7 Z6 ~# d- V0 M* j3 E/ y7 ?% u
  3. * edma_test.c3 @9 P& W  M3 _8 k
  4. *) L9 {4 S: M; c  o; f( {3 \
  5. * brief  EDMA3 Test Application
    6 G9 j' w# O3 m! n2 V  W6 U8 i
  6. *$ ~: _$ G8 L' k( T
  7. *   This file contains EDMA3 Test code./ ^; s# I' y- B# }2 g( q
  8. *0 k% u  y& m) v# s- D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 |; r/ s  u4 {. n3 O7 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * q; H3 `/ c+ J$ Q9 @- `( J- A) b
  11. *         TO CHANGE./ g7 z% C4 a8 E( i' {. Q
  12. *
    . ]( t2 j1 O' A3 T  B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 B/ ^3 O- P/ I1 Q+ k. S
  14. *' H* m. \( `+ s7 O: W; a
  15. * This program is free software; you can redistribute it and/or8 B7 q5 c1 w" j! T/ c
  16. * modify it under the terms of the GNU General Public License as8 \( a" R1 n6 l! \5 s
  17. * published by the Free Software Foundation version 2.
    & L4 |( W/ A5 ^
  18. *
    5 v  C; B# e0 B- y9 m# w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 V$ w* ^3 L( i7 L2 d( d
  20. * kind, whether express or implied; without even the implied warranty
    : D9 Y0 F' B4 Q! h( S; B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* ^* P0 K' r& r2 q3 C: G+ A
  22. * GNU General Public License for more details./ p' ?# p" a; X; R# ?& \' J8 t
  23. */6 M2 E- Y; n! Z8 z' Z  D1 w+ P* \

  24. , n  [. R( Y: S7 S) O
  25. #include <linux/module.h># B( o  W) Y" E2 p6 h, Q" ~, M
  26. #include <linux/init.h>! `4 Q0 E4 q4 `% J4 T
  27. #include <linux/errno.h>7 i  n  B+ k0 @$ j: N( ]0 G- t
  28. #include <linux/types.h>
    : f* H( J+ Z8 J, P5 Z  t9 m
  29. #include <linux/interrupt.h>
    % k& i! b& _  y; N/ s! j
  30. #include <asm/io.h>/ y: k. [* M( a( t/ L1 E
  31. #include <linux/moduleparam.h>' s4 S! l4 O5 }& _; P/ [
  32. #include <linux/sysctl.h>. r  x1 V' g& G7 x4 I, @: a
  33. #include <linux/mm.h>& s+ ^- n8 ]0 ~1 |2 d' q
  34. #include <linux/dma-mapping.h>
    8 F! W; n# v) E: _6 _/ ?
  35. % b: o0 ?* O- r2 v: D
  36. #include <mach/memory.h>
    & n/ [2 I/ p+ \& g# h0 X
  37. #include <mach/hardware.h>
    ' F7 [5 |. @, Z
  38. #include <mach/irqs.h>
    7 c% }/ @/ g; X7 ?2 ~: ^  p
  39. #include <asm/hardware/edma.h>
    ; d( U& J" i! H% [

  40. * i! j* h* Q6 w: X3 ?& E: Y
  41. #undef EDMA3_DEBUG" C/ s- E) e4 g, W/ w
  42. /*#define EDMA3_DEBUG*/0 ?, M( H+ m# Y8 c. ~6 @
  43. 9 A  U: Y1 j5 n0 ?8 D7 {- \5 f  w
  44. #ifdef EDMA3_DEBUG. X, Z0 Y5 B: v, ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % q% S# h6 ~4 R4 U. y# y/ U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ B2 A  y  K- c+ _/ c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 L& G4 m* ~& ^8 A8 X9 H. t
  48. #else
    ! i6 A. A( P5 V9 [) d
  49. #define DMA_PRINTK( x... )5 h% H7 B, G* x
  50. #define DMA_FN_IN, X' S" q* D$ c" D$ K- [8 r
  51. #define DMA_FN_OUT
    " t/ H5 b2 x" @6 e
  52. #endif
    ) _' h' A& ]1 W9 d
  53. 0 g8 f  S: e7 H6 V/ b5 w6 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# t3 _$ k7 }$ u5 z$ H! [
  55. #define STATIC_SHIFT                3
      Z( P, O/ {; q! I
  56. #define TCINTEN_SHIFT               204 E7 b, u6 _  i; P( F+ n6 d9 E
  57. #define ITCINTEN_SHIFT              217 ~( O1 H* w7 N0 x
  58. #define TCCHEN_SHIFT                22
    ; X9 ]: R$ e# B+ x4 U  L
  59. #define ITCCHEN_SHIFT               23
    ) R8 A- h1 c8 M( \; t1 H+ }
  60. * \2 Z, a' M) R# z) U7 K
  61. static volatile int irqraised1 = 0;% g5 T9 X% L; U4 z
  62. static volatile int irqraised2 = 0;
    2 p7 i) H1 B5 I
  63. 5 P1 K9 r; l* m0 o  {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ L' K9 ]  f3 E4 C: z; ^7 A1 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Y' ~- b, e+ W) Q7 y% G! @9 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 U, u" m' H4 |6 Q) j
  67. % Z0 H6 \- m+ j6 V4 f
  68. dma_addr_t dmaphyssrc1 = 0;$ [' V1 Y) j9 g
  69. dma_addr_t dmaphyssrc2 = 0;
    & ~  J4 h! K1 }) t- r. c7 b
  70. dma_addr_t dmaphysdest1 = 0;
    ; v; P+ \1 |4 y& U# U
  71. dma_addr_t dmaphysdest2 = 0;
    2 e  Z/ w, s8 O: K
  72. # [" R# K5 P0 I1 o
  73. char *dmabufsrc1 = NULL;, Y1 ^9 s2 a% _  y8 H) {; e
  74. char *dmabufsrc2 = NULL;: W) H$ _6 P- V$ M
  75. char *dmabufdest1 = NULL;& P( X. O' ~; p" m( Y' U
  76. char *dmabufdest2 = NULL;
    3 W- D& L- I, g0 f! f
  77. 6 o7 J  `0 p% u; ~1 j
  78. static int acnt = 512;/ x% e$ p- `. B* _* O0 ^2 v. S" x7 j
  79. static int bcnt = 8;
    . j3 @; g2 S  n- I. h( e3 {5 e
  80. static int ccnt = 8;
    5 \& ]1 Q  T$ w( \1 b

  81. 2 R& h& s# @5 K, ^8 ~% W5 |$ E
  82. module_param(acnt, int, S_IRUGO);' }3 @2 ~. V( P& u8 P
  83. module_param(bcnt, int, S_IRUGO);
    2 J- q3 B5 ]0 o7 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# T' ], G, c- E$ ^" f0 a+ ^- [, G" O9 @4 P$ ]* x; R1 L7 P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 ~; u( W% q3 X* j0 }# karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& T' R  @8 V! a* k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 C6 S, P3 n4 ]% N2 [* H0 x
. j8 S2 C5 F& `( a" j1 x6 t) d2 b! L
) K+ h% h. G7 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 03:03 , Processed in 0.040274 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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