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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : I8 {$ C1 Y; V. Z) }
  1. [code]EDMA sample test application
    ' y; I8 e3 f) D- T
  2. /*1 I8 z3 b) G% A4 B( o3 n
  3. * edma_test.c) J- ?6 v4 v# C+ _! f
  4. *
    . O; ?; b4 Z  R( |
  5. * brief  EDMA3 Test Application' s, m; ?  E, u0 ~6 H. r
  6. *
      @, ?* h; l! J& [& ^9 d
  7. *   This file contains EDMA3 Test code.
    + c- s! X# P! q7 E
  8. *
    9 M( d) g6 `( _- r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; `+ I0 D% @1 f: k1 K1 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % t7 H* [! i7 F- ]" X: Z7 R: Y
  11. *         TO CHANGE." C. {+ m/ Q" \) [# v: W
  12. *8 d) Y* _0 S% X7 i* v) @. Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// a0 d  j' l, c$ \' L; c3 C5 z
  14. *
    & U6 Y% o/ S8 i/ Y2 O
  15. * This program is free software; you can redistribute it and/or
    8 B2 R* I! |2 @. O. x
  16. * modify it under the terms of the GNU General Public License as7 F1 ~8 o' N/ v" d
  17. * published by the Free Software Foundation version 2.4 M1 v) W+ x. \0 o/ s
  18. *
    & `7 W1 ~  E' |" d$ \& V- o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 f1 }) x6 O2 A# N$ t
  20. * kind, whether express or implied; without even the implied warranty) b  V8 b" w$ z! V: k: h& w  L. [6 M  R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 w  L) A) Y: G" b- [+ G
  22. * GNU General Public License for more details.
    % r: I8 \/ q' _
  23. */% j! h6 H. U' y% Z% n6 t
  24. + w7 J% v0 Y9 n' X9 H3 v
  25. #include <linux/module.h>8 O. k, V" z' R) o; K2 V: g0 y
  26. #include <linux/init.h>6 c% v1 d: s- F2 Q% B
  27. #include <linux/errno.h>2 Z& S# Y0 S, c7 y2 k; @, J
  28. #include <linux/types.h>
    - P+ T3 L3 L: ^0 _% c$ V& W7 n
  29. #include <linux/interrupt.h>  N2 h4 J: c! p6 G  ~  v
  30. #include <asm/io.h>: g' s( f4 B. Q
  31. #include <linux/moduleparam.h>+ F& |* J! K( A5 h) H
  32. #include <linux/sysctl.h>
    $ c1 R6 l7 D: b- C5 y
  33. #include <linux/mm.h>
    ) f1 q, H: M  u
  34. #include <linux/dma-mapping.h>( u* |2 a/ U  D1 f/ d" X
  35. 6 T1 B* V( P- m6 z% _: |# @# o
  36. #include <mach/memory.h>+ u1 v% G: Y' ]- U0 k/ [
  37. #include <mach/hardware.h>
    / L+ Z, A- [) X/ \
  38. #include <mach/irqs.h>
    $ b! n, U* a0 ~: H6 S5 m
  39. #include <asm/hardware/edma.h>
    2 g; M% u0 m" l" X  [+ J& f* T

  40. 8 ^- s+ a; k7 U! s
  41. #undef EDMA3_DEBUG6 E, Z( t+ v9 a" j
  42. /*#define EDMA3_DEBUG*/9 G( B/ }  z1 X9 u6 u4 ?
  43. $ Z$ r8 z6 J- t: C2 z* z: m
  44. #ifdef EDMA3_DEBUG" W7 t# A. k4 S4 t' r/ s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! A/ }2 W0 @( f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  \; v3 z5 J6 ]( q, x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 n. |8 [2 b- |  A: k7 \
  48. #else5 U3 u" K: r; V. H. E4 V! O
  49. #define DMA_PRINTK( x... )# ^" Z% \" [9 P- R: W5 V9 B8 Q
  50. #define DMA_FN_IN
    ( D# W  o) H$ u; `. ?* C& b- k! J
  51. #define DMA_FN_OUT1 j$ u+ }% M+ V" M& X% N# _
  52. #endif
    ; X. G, `0 P- o  `; |
  53. . r5 `) @7 F) }8 r3 I' ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 @& P  T4 M- Y" `# v: U5 l
  55. #define STATIC_SHIFT                3
    3 c: h8 ^& U& X
  56. #define TCINTEN_SHIFT               201 f& Z# t! R8 I
  57. #define ITCINTEN_SHIFT              21
    * }8 ?8 r  k) f4 x) w+ [5 A
  58. #define TCCHEN_SHIFT                22* e" j$ l8 ?8 @6 B  E
  59. #define ITCCHEN_SHIFT               23
      ~% F( A# O' R& y

  60. # E! S& D, q/ Y* }, f" ^
  61. static volatile int irqraised1 = 0;
    2 L7 E% v( X' x; y: i% F  ~" Y
  62. static volatile int irqraised2 = 0;
    : ]# h! `9 ^9 q( `0 w4 F
  63. ! l' m. U/ X1 b3 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' {/ Y3 L" P+ b, s8 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 i# F% x" r& {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 y4 j+ m) h, C/ R

  67. ( e# z- S8 @: ]
  68. dma_addr_t dmaphyssrc1 = 0;8 B! t% l7 h- @0 Z& J3 E6 _
  69. dma_addr_t dmaphyssrc2 = 0;3 o$ e. y2 O; I6 K3 g/ r1 d
  70. dma_addr_t dmaphysdest1 = 0;8 d9 l! m- @: [$ {4 I
  71. dma_addr_t dmaphysdest2 = 0;
    , }% N4 b6 p; F$ k9 a, \
  72. % i6 x" q1 Y8 W# Y4 |1 e& Q8 [/ G
  73. char *dmabufsrc1 = NULL;
    & n/ F; q/ l( ?. ~/ V2 ^/ g  [9 R
  74. char *dmabufsrc2 = NULL;
    ! s+ D$ U8 k8 q& T  e$ o
  75. char *dmabufdest1 = NULL;/ R  o. a+ H7 Z
  76. char *dmabufdest2 = NULL;$ w2 @; g% K/ Z7 }) D

  77. 0 o# O, x8 w2 i5 \6 C7 a& J. Q
  78. static int acnt = 512;2 C) K9 W, V* d3 J
  79. static int bcnt = 8;  l0 T" ?+ ~- D5 I+ {9 e$ |
  80. static int ccnt = 8;
    & n1 z5 l, j5 B' P5 l# F

  81. , X5 K& {+ T: s) i' N
  82. module_param(acnt, int, S_IRUGO);
    6 v7 A  T* s! ]2 v
  83. module_param(bcnt, int, S_IRUGO);5 q$ `$ A1 F6 _# h2 u) Q! d+ Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; U  z9 Y4 A! a# P% B  P

$ J* Z9 H4 Y# B0 ]7 Q% T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" ]$ H- j* @2 [. {' W& G7 `2 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 S: _- a$ \4 s' U3 I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' J6 v$ F7 h, v9 V* j$ s
5 L+ |. P0 P. T
5 G& ]5 p$ A* |$ }- L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 14:36 , Processed in 0.042794 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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