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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 M5 k7 m! M3 k0 C5 o
  1. [code]EDMA sample test application
    5 [' b5 d3 D* y# |7 U# [: r  Z
  2. /*
    2 Z1 Y! P, s- L4 t9 ~0 R
  3. * edma_test.c8 a0 J% P$ P1 ^1 B
  4. *1 P; R2 D. @; ^7 ^! B4 ?* G% Q& [
  5. * brief  EDMA3 Test Application
    $ y  I" }9 S& j8 z
  6. *
    - ]9 w5 @4 ^+ |
  7. *   This file contains EDMA3 Test code.7 u% x0 x  z4 W  c
  8. *
    : K, u. c& Y* _) j& @6 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% ~$ d5 l+ A: a- ~" @3 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * X/ ~  ]4 I+ @: u3 `
  11. *         TO CHANGE.
    1 A) E* l; H) F
  12. *
    8 n# O- U9 m3 f( u0 ?) V0 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 r8 n& c+ W! s6 k$ H. l
  14. *
    % c) q) ~, m! T
  15. * This program is free software; you can redistribute it and/or
    0 R! X1 m% w/ A6 T8 S! w- b: F
  16. * modify it under the terms of the GNU General Public License as
    6 E; V. b( u; G6 B% {. {* d
  17. * published by the Free Software Foundation version 2.
    $ @  t! x5 [; ^! P2 P
  18. *+ F3 @8 i0 _  f. R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & G3 r  R3 e5 @4 ]0 |9 H
  20. * kind, whether express or implied; without even the implied warranty
    ( s8 F) C; ?. H+ L( F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& u& ~* y# G# D# L! v: K/ S. Y9 D2 C
  22. * GNU General Public License for more details.2 e! Y+ K3 ]8 V/ I2 c& K" }; D4 T$ {6 ?
  23. */6 R" I2 J* B% ^3 v
  24. : H' J* @8 h3 n( q1 X+ u# N" Y. j
  25. #include <linux/module.h>
    5 a& f. J1 M' r! J9 P8 B7 J
  26. #include <linux/init.h>
    / @5 q' a! s! u3 W
  27. #include <linux/errno.h>1 j2 n: |1 z1 ^  Q1 U/ [8 Q5 P
  28. #include <linux/types.h>
    ; K0 k! P5 w8 @2 J
  29. #include <linux/interrupt.h>& y$ s# R$ d9 i  k) p
  30. #include <asm/io.h>
    . r7 W# p5 ^; x: q
  31. #include <linux/moduleparam.h>
    + s" _: g- d' R
  32. #include <linux/sysctl.h>  B* K9 }* u9 j/ L8 ]2 F8 _
  33. #include <linux/mm.h>
    7 u# J" j  E* W* x
  34. #include <linux/dma-mapping.h>  P5 S" S, @6 `9 P5 K/ r) N6 |% m2 E
  35. 9 T2 b+ \- j- Q, }
  36. #include <mach/memory.h>* t, |9 `- O. t4 K9 w
  37. #include <mach/hardware.h>
    # \* B& y1 c3 |' ^; Z
  38. #include <mach/irqs.h>
    6 g  Z  W; J* X
  39. #include <asm/hardware/edma.h>
    1 K  @0 y# i3 c. ]& b

  40. 6 \# ?: m( h' d8 r5 o
  41. #undef EDMA3_DEBUG0 b9 R' A4 @4 E: [' X" ~5 b
  42. /*#define EDMA3_DEBUG*/
    2 U. o" ~8 _7 |& a7 g, }

  43. 9 G" _& d+ ?5 }
  44. #ifdef EDMA3_DEBUG- A$ M# F9 i2 v/ Y- |5 O8 S" Q$ P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! w* l: u8 V- B' f/ C+ ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ Y6 b. O/ G* n4 R) ?, D$ W) M) _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' B1 U7 t/ r7 D
  48. #else
    8 u& P8 o% J, W8 ~
  49. #define DMA_PRINTK( x... )
    3 M0 O9 a3 A- [
  50. #define DMA_FN_IN1 p1 d( o: |6 G2 J
  51. #define DMA_FN_OUT
    $ B! J$ w/ H5 Q6 k
  52. #endif( ^! [% y) o2 l$ z4 V
  53. " X  |) d6 T) ~6 h: u7 }. @# G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " i9 N5 J' x1 W' P& m) P  O
  55. #define STATIC_SHIFT                3% b; G* x. C* R9 m2 E  Z+ r5 b( R5 u
  56. #define TCINTEN_SHIFT               20% a) X4 K) l+ u# l
  57. #define ITCINTEN_SHIFT              21
    % Q. m4 k% x3 ^2 Z' m
  58. #define TCCHEN_SHIFT                22
      \. ~. {6 `/ L: s. B
  59. #define ITCCHEN_SHIFT               236 D" Z' ]2 V6 f8 f

  60. 8 x; L0 O; [5 Q% n* d* W. [7 Y: A
  61. static volatile int irqraised1 = 0;
    ! f7 X, c3 I7 T' Z0 X0 N3 K
  62. static volatile int irqraised2 = 0;
    % ?, N1 F' c1 @8 j* {' d
  63. 0 C" o( i! G! N. g: [$ M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 y; g  v. L, a& a2 G1 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 [9 ]+ [% [2 n5 D( i1 j3 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ]1 b, l# U/ f) r" C: b" u; M0 V& G

  67. # [2 \1 |! r' v! m
  68. dma_addr_t dmaphyssrc1 = 0;! J$ Y1 j" y! S1 T5 h' G* B
  69. dma_addr_t dmaphyssrc2 = 0;: y# r, b( H) }
  70. dma_addr_t dmaphysdest1 = 0;
    5 A8 x( x' ?8 o' w: ]# P
  71. dma_addr_t dmaphysdest2 = 0;" a- D, Y1 S1 h) U

  72. 2 |7 e, H: L, d$ x8 d* R
  73. char *dmabufsrc1 = NULL;8 W# ^2 ?2 S* Y# g' _6 }5 v
  74. char *dmabufsrc2 = NULL;  |' j1 m& l+ v( k& i. S
  75. char *dmabufdest1 = NULL;
    / R  i; c' d( \$ u, W7 i
  76. char *dmabufdest2 = NULL;
    ! z$ ]# \, L" E% U
  77. 8 c5 l7 i; z0 _7 Z' D
  78. static int acnt = 512;
    4 i2 V& v, t- @6 w8 B7 {
  79. static int bcnt = 8;
    % h) R& ?; p% w8 B2 W, _! J9 q
  80. static int ccnt = 8;2 K; b7 L( Y& j; g% |+ k

  81. 5 k$ N  X: L- L+ }8 n0 N+ }
  82. module_param(acnt, int, S_IRUGO);
      r4 F2 ~* w$ T) j6 Q
  83. module_param(bcnt, int, S_IRUGO);
    4 r+ Z8 b) d) u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; t' z1 A+ g$ n4 g

) b( f/ I9 b* _$ _! a7 I0 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 i6 @. r* T3 O) qarm-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 L: P4 g( o; m- |4 a1 y! J( o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 t% i) @1 W4 V# W- T, u& m5 C. R$ M& _. l6 ~. _  D; }- _) S

0 G; _3 y: C0 ~  [; K. ^# n- n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 01:35 , Processed in 0.041472 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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