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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( a# ]4 d* a2 x: o2 n) N% Z( b
  1. [code]EDMA sample test application
    % P8 ]  k" P' N, z; _; ]* q% j
  2. /*; H' Z  D. B. ]
  3. * edma_test.c/ [+ `$ Z  C% l6 Q- i  u
  4. *
    # G% w5 d5 V( J( e
  5. * brief  EDMA3 Test Application
    3 d1 O& a% A* |6 _" U7 w( D
  6. *, |; t( H  G* |
  7. *   This file contains EDMA3 Test code.. i* s" U1 N  V7 x, u4 \( p
  8. *7 B7 S8 k( s) M+ t0 f6 Y! V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) J/ d  |  t: ~1 |* s4 m& D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : T/ n# N9 V; \
  11. *         TO CHANGE.  }% n3 C8 D: n% ]
  12. *$ L. {; g5 N  K2 q/ a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( _! ]; O/ e7 X& ]% a
  14. *; v  _) ]8 J. m; Y: L- _
  15. * This program is free software; you can redistribute it and/or5 ^7 h- n' @  d! ?
  16. * modify it under the terms of the GNU General Public License as( L  V& b' d! k) F/ E' P7 b
  17. * published by the Free Software Foundation version 2.6 L& m' E/ w" H* ~3 s0 d
  18. *
    6 Y# @8 D# f! ?% q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ P! @& e1 L7 [& [
  20. * kind, whether express or implied; without even the implied warranty& r2 N: W! s/ |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      \" q5 B- J1 Y4 d; G6 y$ Z5 n
  22. * GNU General Public License for more details.
    4 H0 v1 c# j. I* t  U! m: Z
  23. */5 G8 {' E8 e! [( {

  24. ( y! q8 y8 I2 b
  25. #include <linux/module.h>
    " v" c$ a6 G3 l( @- u% @8 q1 R& ?+ r
  26. #include <linux/init.h>' x4 A5 I* @. H1 c6 ^* f/ |
  27. #include <linux/errno.h>" a) K2 @/ Q0 Z) S4 W: D
  28. #include <linux/types.h>
    3 k% c+ S6 y* |7 T! m
  29. #include <linux/interrupt.h>  K5 U( s9 ^# N1 W% q1 M8 ?
  30. #include <asm/io.h>
    6 F$ I0 a& {+ r9 W/ i8 W
  31. #include <linux/moduleparam.h>
    6 D: p" b5 `& f* O" q) S
  32. #include <linux/sysctl.h>
    * q( V) G) x) q6 R! l# S. D
  33. #include <linux/mm.h>- p+ |  k% F( p* H, e8 J3 u
  34. #include <linux/dma-mapping.h>
    $ Y2 N, d4 \) S8 E/ [' i% C# s( t
  35. ' k  ^0 f, n" N. D
  36. #include <mach/memory.h>
    # n4 H! r8 H6 J5 C
  37. #include <mach/hardware.h>
    ) p2 A$ j" K( u
  38. #include <mach/irqs.h>
    5 m3 ?0 s% D6 n: q7 U" ^
  39. #include <asm/hardware/edma.h>  S/ y: y+ _* x) R, r* i( b+ G  r, r. i
  40. ( h3 I7 k' u6 \
  41. #undef EDMA3_DEBUG8 S3 Y5 q/ g1 W9 X& q4 }) K- A
  42. /*#define EDMA3_DEBUG*/& t; h: M' N* x* B' T8 Y' q4 z& `

  43. ) B& Y- t4 {3 e' ^& N) q4 U- p
  44. #ifdef EDMA3_DEBUG8 F% X7 S3 @, ?) q5 W  j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 x* _4 w2 P* W6 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 R8 E5 y  _/ w  L  m7 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 g* ^/ l% J8 m& U, w* [
  48. #else; ~8 X7 P3 Y  L0 R6 g9 d. c
  49. #define DMA_PRINTK( x... )
    * A: R! z/ C" S
  50. #define DMA_FN_IN
    7 A: B" }6 u+ D) B% [9 ?! t0 A9 `
  51. #define DMA_FN_OUT& Y: N# _0 y7 p/ R
  52. #endif  @- p: N# [8 Q! Q/ r! U
  53. 9 _) a* s# H1 b9 C2 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' |1 E& y% \, g) Z
  55. #define STATIC_SHIFT                3
    - m% E: I% S3 F' e9 a7 X8 _
  56. #define TCINTEN_SHIFT               207 m4 A0 C  Z" [" ?+ l5 a5 H! k
  57. #define ITCINTEN_SHIFT              21
    9 q* F, i) I& V! u! o
  58. #define TCCHEN_SHIFT                22
    4 S- `8 c) \8 Q0 W( A5 Y$ J' \2 q
  59. #define ITCCHEN_SHIFT               23/ B3 a0 Q# R; ^7 R# x5 ?
  60. . ^; w0 {8 w& @( K  j
  61. static volatile int irqraised1 = 0;
    6 J9 y: [5 x6 m. F1 Q6 J1 x
  62. static volatile int irqraised2 = 0;: m) l: r5 {& ~8 }% G4 x
  63. 6 V# Z% I: `  u  b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ^1 W8 o0 ^3 V% c- K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) W2 I- i/ R' O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Q. _' ^( G- l+ ~7 D: a

  67. $ N9 m( O1 _( U5 n: N7 ^* O' o
  68. dma_addr_t dmaphyssrc1 = 0;, U8 n) t1 O5 w% R2 }6 }8 U
  69. dma_addr_t dmaphyssrc2 = 0;
    1 D7 g: [7 q1 G: q
  70. dma_addr_t dmaphysdest1 = 0;
    2 s9 m# A. G1 ?5 G
  71. dma_addr_t dmaphysdest2 = 0;
    & T8 F4 r  j/ h  H9 v8 q3 ]
  72. 6 G" F' b4 o; Y1 H2 E
  73. char *dmabufsrc1 = NULL;) f/ \9 l/ \& Q, \. }) o
  74. char *dmabufsrc2 = NULL;# }1 `' c7 i6 L
  75. char *dmabufdest1 = NULL;
    ; [4 @4 D& z3 Q4 J5 ~
  76. char *dmabufdest2 = NULL;
    . E. c; K7 h0 j4 G
  77. / b  `2 q3 b  [% [1 H  v
  78. static int acnt = 512;
    9 b% U! @" f1 N8 b
  79. static int bcnt = 8;
    8 o; A' ?- u3 j7 N- U
  80. static int ccnt = 8;* f7 _6 E. i) F- J1 f* S: ]

  81. % t  n* B1 l7 c/ y
  82. module_param(acnt, int, S_IRUGO);* ^+ i: c  H  X# n
  83. module_param(bcnt, int, S_IRUGO);3 e# E2 o1 }0 f; ^- O8 o; w! b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; X+ Q$ _: P; q$ [: _$ T7 K6 [- N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 @. e1 f# e9 T" N; f# e4 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 d$ a! m# g$ |# v" q1 C3 p& k8 i: \/ [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) k4 X2 W$ `8 u2 G
  ]; _1 ?, K0 V6 C
5 b5 E; C, W/ D+ t3 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-28 17:35 , Processed in 0.038146 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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