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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 b$ N/ S5 P* D% w+ V% y8 H
  1. [code]EDMA sample test application& T$ M8 ^1 v, E! k2 u7 x1 r5 P
  2. /*: E- S* m" e8 V. r0 p7 X: `
  3. * edma_test.c
    . b' u" U8 Q$ b
  4. *
      a$ p4 \/ t9 c1 y* E
  5. * brief  EDMA3 Test Application
    . b  Q# p5 W, \7 n- W
  6. *
    ) |/ s, k4 f0 `, [* \8 ?
  7. *   This file contains EDMA3 Test code.
    $ V4 M' x+ A) |$ U+ {1 d
  8. *5 q3 f3 e$ X/ ?7 v  v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 P5 ^' s$ m7 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ I  S9 `) B# F! _3 p8 N
  11. *         TO CHANGE.
    . W& m) F' {9 ]/ X: c4 N+ P
  12. *- |' e& u# H" }7 N+ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' m9 x8 K- y) Z: H  Q5 M) U
  14. *8 C, B5 [8 c. b8 g. i
  15. * This program is free software; you can redistribute it and/or  g" ]/ e" D( n
  16. * modify it under the terms of the GNU General Public License as" F" b9 u2 d$ G" h. n, j
  17. * published by the Free Software Foundation version 2.* ?( H$ ]6 D# }' C0 a
  18. *. ^3 E6 a. O4 u( h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / E) [7 I6 l# [6 h
  20. * kind, whether express or implied; without even the implied warranty
    ' i3 G" ]# b! v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ R2 C  N+ t. d( @( b) d
  22. * GNU General Public License for more details./ D7 Q2 X$ M3 b9 S* Q
  23. */
    3 Z' S. x1 t8 h6 \2 y
  24. ( L* U3 w! `6 \6 y8 I: [
  25. #include <linux/module.h>
    6 n% Z/ j& {3 H* ^: D
  26. #include <linux/init.h>* a/ }$ `3 O4 Q
  27. #include <linux/errno.h>
    0 S/ O6 d, R( s9 [4 B5 K% p
  28. #include <linux/types.h>
    0 ^4 y) D4 J6 Q# l
  29. #include <linux/interrupt.h>% [) i# i5 w: m- y
  30. #include <asm/io.h>; z; f1 s; Q' k1 h0 @
  31. #include <linux/moduleparam.h>
    ' D; S5 A* n) e7 v
  32. #include <linux/sysctl.h>
    ( @& d- x: x' p: I( o% y5 Y
  33. #include <linux/mm.h>. M* P: e( R0 V7 @. \8 z- n
  34. #include <linux/dma-mapping.h>
    5 g  Y) ^; v7 z" f  O
  35. 5 C$ Y: ^1 P" ~5 w: o* V
  36. #include <mach/memory.h>/ T4 W7 N; S4 _( S8 V; x2 S; ]" R* I
  37. #include <mach/hardware.h>4 S' a' d& u* e2 c' H& A. U; ~
  38. #include <mach/irqs.h>$ n9 _; A( D. @- Z; q% e
  39. #include <asm/hardware/edma.h>: ~3 a0 t5 }! }

  40. % ~- `8 x3 P$ v
  41. #undef EDMA3_DEBUG. }. q( \. O9 r6 @: y
  42. /*#define EDMA3_DEBUG*/
    2 t% d5 z) g3 r$ {6 G  Z
  43. ; _* \& |. ?0 o. A
  44. #ifdef EDMA3_DEBUG
    + O" E. H- @! F0 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ w6 G; K$ y5 n* f+ I3 N6 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " C. J9 }# A. C& r! G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " T. h8 E; M* J9 l) v3 c  ^1 h- ?
  48. #else7 \, g& L* m! b' D
  49. #define DMA_PRINTK( x... )
    1 ~$ x% H2 N" C3 r2 R2 `( {. I3 k. h, q
  50. #define DMA_FN_IN/ ?" _' P8 X5 J( Y2 \
  51. #define DMA_FN_OUT
    6 p$ Y3 O5 R7 F5 X/ {" p
  52. #endif
    / V6 @' X( i. Z7 k: V

  53. + P  C1 N) {7 S+ V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / t9 f0 L1 ?' A6 _+ I  R/ W
  55. #define STATIC_SHIFT                3! ]& D% S+ C' _  L" @. V
  56. #define TCINTEN_SHIFT               20( t* L, f$ _( v5 ^' J8 e
  57. #define ITCINTEN_SHIFT              21/ @5 h* R* z$ M$ f, A6 ]
  58. #define TCCHEN_SHIFT                22
    9 O, R' U" L: O
  59. #define ITCCHEN_SHIFT               23
    . [5 [& }0 j1 D. V8 M
  60. - k2 y" z' [6 F# E- x6 V0 J
  61. static volatile int irqraised1 = 0;7 _2 N* n" g3 R; Y& k; K
  62. static volatile int irqraised2 = 0;  N' |/ H# N  P* ^, J
  63. 2 G( p' w* v# w- D* A0 b$ \$ j1 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 \( a) _: k6 h# ^/ Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; v% b2 o, \1 A# {" L& f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , M: u4 K2 H8 m0 S* u% k
  67. 4 e6 o  {% b& u
  68. dma_addr_t dmaphyssrc1 = 0;# w0 W- q8 K4 ^! J
  69. dma_addr_t dmaphyssrc2 = 0;0 K& x% x) m2 w1 s
  70. dma_addr_t dmaphysdest1 = 0;
    " G# u/ v' S  b9 L/ S, n) T
  71. dma_addr_t dmaphysdest2 = 0;
    . L8 N. C" N* l# s

  72. 9 L# {. c. i  Z6 j
  73. char *dmabufsrc1 = NULL;
    0 A1 V+ x! W0 _: I6 A) P+ x. U5 R
  74. char *dmabufsrc2 = NULL;4 @( m0 Q% P. Y$ b
  75. char *dmabufdest1 = NULL;7 I, C$ M0 ^0 X4 j1 P9 a' }
  76. char *dmabufdest2 = NULL;% w# A2 V% ^$ B  t# p1 |

  77. 6 Y0 f8 _* W7 |1 D( R/ S% z- N9 I
  78. static int acnt = 512;
    8 |8 O$ y/ {4 N5 B
  79. static int bcnt = 8;( y1 d' ~" }9 _5 V+ o
  80. static int ccnt = 8;* m. E  M2 S: C% g( I

  81. . d+ A4 y3 a6 e# ]6 ]- ]/ E. U
  82. module_param(acnt, int, S_IRUGO);# ^! }1 J6 Q1 \. }# {; ^0 i2 Q$ v
  83. module_param(bcnt, int, S_IRUGO);) P/ f. t0 Q  K+ b# c) q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( _( L, a/ z# @" I7 t* y
- q4 l7 `, n, C9 f9 R1 m& x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& K+ G" S! V" p2 \  _( j6 g' F- F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 N7 w1 D/ C0 Z/ ^4 b4 X( j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! s' F7 F' Z% z+ l2 a2 j
$ n; a: |& C8 Y
$ D& t! m' p  T% M' e' t5 A4 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-1 09:50 , Processed in 0.046845 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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