OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( r2 y" Z! R- E8 Q/ a
  1. [code]EDMA sample test application. r5 f* f8 g# f) d  v& a( b6 R: x
  2. /*
    6 w1 [4 R0 g1 c! c: W
  3. * edma_test.c
    2 D! w- {0 [+ }7 B+ u
  4. *. N, }0 c2 z3 W. @6 T' Q
  5. * brief  EDMA3 Test Application$ d4 t. Q: ?& Q+ r5 ?6 V( e5 x4 L
  6. *3 ^% m3 {, D& \2 Q7 p3 O8 y* {9 M
  7. *   This file contains EDMA3 Test code.
    " _/ `4 G9 b/ w5 W
  8. *
    8 L9 D8 v8 m' _$ d2 g, @5 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 l! M. c' m1 t$ v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 U8 t  Y9 f- c( c0 h/ G
  11. *         TO CHANGE.
    ! u2 j( U- J& r8 b9 W; q8 a* `
  12. *
    : k9 [. l1 Q# @; j5 P! c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 q1 {( Q& m. G, j8 R' V
  14. *
    + b0 \" `- x( E
  15. * This program is free software; you can redistribute it and/or
    + B  C, y) K! F  N+ e" m  X3 L' `" l5 D& D
  16. * modify it under the terms of the GNU General Public License as
    ; F2 b+ G: V7 c
  17. * published by the Free Software Foundation version 2.3 v' L$ v: G/ H2 d
  18. *9 U, j+ q9 u  I, S/ |8 R8 }' _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 e% p6 d9 c  y
  20. * kind, whether express or implied; without even the implied warranty
    & ]; T# X4 y; {- {. a1 M2 y: ~) Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 J: V; b" w$ k: j
  22. * GNU General Public License for more details.
    % k+ F) y1 e! M/ p
  23. */
    - \( g2 q! d+ K1 X4 v

  24. + u! U8 E! f! h8 ^- m/ f: m
  25. #include <linux/module.h>. C/ ~: M8 A5 @$ z
  26. #include <linux/init.h>
      C$ V& y" |; R" k  o: ?" ~; W
  27. #include <linux/errno.h>7 `: o: ~$ H* _1 M" c/ R- n
  28. #include <linux/types.h>/ V( S8 k) G) F9 C+ z. U
  29. #include <linux/interrupt.h>
    8 Y6 d, Q- B( a: f5 N7 w3 l
  30. #include <asm/io.h>2 G+ m: r- y+ a4 i( K' S
  31. #include <linux/moduleparam.h>
    5 m, p# y2 \- Z, F; `$ K
  32. #include <linux/sysctl.h>
    6 h- X* d0 r2 T# `
  33. #include <linux/mm.h>" K# ~0 l* G2 h$ D: o3 a
  34. #include <linux/dma-mapping.h>
      Q$ T2 F  x% C

  35. - m# n1 V, @; }
  36. #include <mach/memory.h>: V0 P7 w' V+ ^. P/ }
  37. #include <mach/hardware.h>
    . m6 F! b" `: a( B5 Z9 x
  38. #include <mach/irqs.h>
    1 ~" o1 y, X" S- H& d4 D
  39. #include <asm/hardware/edma.h>
    * E9 N- A& D% N6 x6 }

  40. . L$ y8 p+ R% L* q! a* a" U
  41. #undef EDMA3_DEBUG" z4 }5 N; o" T9 H" c# _9 {
  42. /*#define EDMA3_DEBUG*/
    1 h2 m) f, V7 ]: H

  43. 1 n: F6 ^6 {8 ^/ m4 f/ G( e
  44. #ifdef EDMA3_DEBUG
    . J/ ?3 g+ k% ?# Y! `5 q# M# Q& e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 z. P- [, W) c  t' b2 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 C0 \5 a0 G0 K& @- R4 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): T, N: \- m# a* p7 S) X
  48. #else
    ( m, S* r8 Y2 N6 j  ~
  49. #define DMA_PRINTK( x... )
    * B1 I% A9 e, z
  50. #define DMA_FN_IN
    % |- a) C; H. J" z" E' y
  51. #define DMA_FN_OUT
    5 @8 [* z$ E5 t! v; D/ e. U
  52. #endif
    , {2 R& [* c) |1 R% e6 f
  53. 6 @' a& d4 [, J& N1 @  V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : {' q6 o8 t% p2 z; p
  55. #define STATIC_SHIFT                3' `+ Q7 b/ z6 C& |4 W1 Z
  56. #define TCINTEN_SHIFT               20
    ; L/ [9 P" c* m1 c/ _
  57. #define ITCINTEN_SHIFT              21
    # o: ~4 o7 w& g" e" r1 I; _
  58. #define TCCHEN_SHIFT                22& o6 ?! |! [/ W5 l5 K* n
  59. #define ITCCHEN_SHIFT               232 b* m1 X% c/ n, x! _( X
  60. $ a. [! ^* T) u& }1 h7 s, }! c; F
  61. static volatile int irqraised1 = 0;$ w1 @# A$ I9 l; |: K5 R' G7 t
  62. static volatile int irqraised2 = 0;
    ' ]6 M7 ^+ D5 [2 T/ _
  63. ! H1 r* [* N' I5 |4 Y7 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 m1 r* O! F: n: O5 B: H- Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, m4 P! U- x7 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , N9 g: \1 ?' W  j/ V/ L

  67. 8 D! k2 _1 L, l
  68. dma_addr_t dmaphyssrc1 = 0;
    3 I5 y8 L6 z# S6 X6 z8 O
  69. dma_addr_t dmaphyssrc2 = 0;# e3 k0 r7 Q2 G$ z
  70. dma_addr_t dmaphysdest1 = 0;# Z$ a; J# ^5 M8 ]
  71. dma_addr_t dmaphysdest2 = 0;! l. C8 b  p. j  w# E
  72. / k/ Z6 m  Y8 |5 Q9 D% d; {
  73. char *dmabufsrc1 = NULL;" U% l9 t, n. s9 M- d$ V. p$ }: u  s
  74. char *dmabufsrc2 = NULL;9 a3 |4 }9 \) m8 ]- d  J. g
  75. char *dmabufdest1 = NULL;3 f3 ?7 M4 ]& w
  76. char *dmabufdest2 = NULL;
    ( g# K. D$ S$ a/ [8 f

  77. $ |( d  J; w- \! x8 G/ `2 U) j
  78. static int acnt = 512;4 S. ~" |+ X3 a, @5 }0 ~
  79. static int bcnt = 8;
    0 I1 I" W6 r& Z/ F' w+ h% U+ E
  80. static int ccnt = 8;3 U. f6 N; M/ O9 E) _
  81. , W9 E; H* P) W& U/ j" ^3 a3 K
  82. module_param(acnt, int, S_IRUGO);
    # h: Q4 `3 K" J3 \6 n6 m# [
  83. module_param(bcnt, int, S_IRUGO);
    6 _# _& {( k( y3 S" {# @7 l0 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ B" D$ v, q/ w3 s; [

3 O1 z& v1 j. m9 _1 u% U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" w& v( F& X- w9 V7 v, W, P' |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 e7 V* d- O. e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: H! V0 X' E2 W' c! B! o9 e4 T8 A

9 h6 B0 }5 {* {, r2 i5 z, b8 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 12:17 , Processed in 0.043357 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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