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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & B1 k' S" Z  g* q2 I" O# Y* h" k
  1. [code]EDMA sample test application
    - r% c) ?6 ]; u) w
  2. /*
    . F3 T: @. M$ i6 }( x
  3. * edma_test.c3 t+ _+ l/ n' ~$ T
  4. *
    0 p( P" a0 v) r4 g5 S5 Q0 U' U
  5. * brief  EDMA3 Test Application
    5 d$ u. [) c: u4 b( k+ U4 x
  6. *- M0 t2 ?' `6 z- _' I+ E0 p$ Q# o
  7. *   This file contains EDMA3 Test code.
    6 g5 v- k- i! M* I! D, r
  8. *" L" m4 ]5 {8 L: l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 n7 f1 j- Q) }/ C4 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 e, H: A. Y' a- c0 A- g
  11. *         TO CHANGE.
    5 m* [- p) I# b3 ~% x
  12. *
    ; e9 Y& g9 K( {3 V$ F3 ]7 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 A8 e! H1 d5 E9 X1 T
  14. *1 c" N( t/ I& [$ I; Q9 Y/ o% e, j+ D
  15. * This program is free software; you can redistribute it and/or+ r7 @) A! \. I
  16. * modify it under the terms of the GNU General Public License as0 j* _* j! g3 R  N5 U* a8 ^
  17. * published by the Free Software Foundation version 2.3 P  V2 {8 h: c, o
  18. *
    7 \; y8 e) v+ E; N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 k2 y# K& W4 ~9 h7 b
  20. * kind, whether express or implied; without even the implied warranty% B& Z) n1 H3 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! v: V, E2 R* S" G. O# t
  22. * GNU General Public License for more details.5 Z8 n6 L! \' T2 w$ ]% B# _0 z
  23. */9 x% {+ e" P; M/ ^, B
  24. # l! M) B" z, P
  25. #include <linux/module.h>% T2 _7 r1 Y% G: U/ I, v. x; w  T
  26. #include <linux/init.h>. t1 S. z1 g! n5 D5 B: ^5 J
  27. #include <linux/errno.h>
    % Z6 I7 Q; U6 M3 t7 J
  28. #include <linux/types.h>; k2 p- i1 J5 ?8 h* _' Y2 K
  29. #include <linux/interrupt.h>' o9 S2 P% y  u6 U) X
  30. #include <asm/io.h>2 e* ^- A# g/ O5 u6 k2 @$ w( A
  31. #include <linux/moduleparam.h># w2 G5 j1 Y4 j
  32. #include <linux/sysctl.h>
    * a1 G4 h0 g  [( O6 V! b6 Y
  33. #include <linux/mm.h>
    : x( Y. Q! U& r' @$ |
  34. #include <linux/dma-mapping.h>" i- V8 T& _8 [% N! M( B5 y
  35. ( a( ^  Q& O' a1 N" g
  36. #include <mach/memory.h>6 \. B2 E' h5 d; b2 k1 b$ p
  37. #include <mach/hardware.h>
    0 s0 s# c# X; f: g7 g" U
  38. #include <mach/irqs.h>
    3 [/ K3 o- b1 x) N" N( b1 D9 Q
  39. #include <asm/hardware/edma.h>
    * V6 _) D+ f8 u6 O# M( `
  40. - ?4 z4 ]" H$ P4 u
  41. #undef EDMA3_DEBUG) R# T/ x- \/ p) P3 }* ^0 i- C
  42. /*#define EDMA3_DEBUG*/2 r9 t" P: O  |  L$ v! t( l
  43. ) o* Y8 t; b) a0 M, |6 {. ?
  44. #ifdef EDMA3_DEBUG$ {# G8 U0 Z) h8 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # T! x0 ]% g/ p3 u% T2 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + V& r2 |) ], ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 U* m3 C" K6 [5 x
  48. #else
    + ^1 H5 A7 {! ~( x
  49. #define DMA_PRINTK( x... )
    5 Z. L( Z2 }: T6 w  R
  50. #define DMA_FN_IN3 C5 s7 a2 Q$ G' L
  51. #define DMA_FN_OUT
    8 L0 ^5 i- M: ?3 K+ Y* K$ T: T% ~
  52. #endif
    $ M& Z8 p7 Z) F4 {$ g! `

  53. ' x& Z# ^% l3 \" A  v" e$ f+ O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + @! y; ]* I& @  |
  55. #define STATIC_SHIFT                3
    / m, {! J' Y7 V4 f% P3 I0 p7 C: ?$ B
  56. #define TCINTEN_SHIFT               20
    & S+ V! h/ I$ i
  57. #define ITCINTEN_SHIFT              21
    ' ?. L/ V( s/ U& C" [
  58. #define TCCHEN_SHIFT                22
    . e( Q2 _9 L0 X7 c3 ?
  59. #define ITCCHEN_SHIFT               23
    . p( N8 @. y; E5 q) I0 m

  60. . b' d1 `" D6 w, B( y& Y7 c
  61. static volatile int irqraised1 = 0;5 d1 ]* \3 I3 p. u
  62. static volatile int irqraised2 = 0;
    ! P( [/ T5 G5 L+ Y- q" G

  63. ' T# x" G8 W. a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " r. C' m1 R4 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r/ A! v/ U: N5 g: V# |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 i1 A5 w. G5 J1 n& f

  67. " L0 Z" u, Z' G' ~" X0 r. O( @
  68. dma_addr_t dmaphyssrc1 = 0;) b! g. p! H7 }! K
  69. dma_addr_t dmaphyssrc2 = 0;8 Q0 k6 u$ `% ^$ s# i
  70. dma_addr_t dmaphysdest1 = 0;
    2 c8 H7 O. ^  w3 h8 a. q
  71. dma_addr_t dmaphysdest2 = 0;
    * _% |! e' P0 `. y7 z9 k1 D6 p( ?
  72. 9 F, l1 W/ x6 e* ~  S6 r: d
  73. char *dmabufsrc1 = NULL;
    - Q) Y( I) e: ~8 X+ e
  74. char *dmabufsrc2 = NULL;& }8 e: Z$ a# Y: P. N7 w3 ?- [
  75. char *dmabufdest1 = NULL;6 B! w6 K7 h4 k) T! x1 X4 ?1 R
  76. char *dmabufdest2 = NULL;! N" {8 ?, O, p1 z+ \# ]8 u
  77. 7 B6 U7 Z& j; Q' S5 _* e8 M1 h: Z
  78. static int acnt = 512;
    7 i/ D8 a* p  E1 y5 e# K: |/ P
  79. static int bcnt = 8;
    - j4 J9 _9 G# D* R
  80. static int ccnt = 8;( ^+ F. Z% t0 ~% N+ {
  81. 5 s5 `# n7 d6 M  q& j% r. [
  82. module_param(acnt, int, S_IRUGO);
    ; P; |6 @7 e! L
  83. module_param(bcnt, int, S_IRUGO);
    + }- {. Y1 C0 \* o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 m- G& ~3 T* X+ U
$ x" T" k4 H  w- d; e9 Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 {# @3 `& L8 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 Y! {7 W" T- N2 B9 p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 C8 X+ W: `! r  ?; C
2 h6 @# k& B$ Y4 P, e/ g
! m" T. Z. f) r  G7 }" A  p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 04:01 , Processed in 0.040002 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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