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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( o: F6 N2 q8 W( B
  1. [code]EDMA sample test application) ?8 Z8 W8 Y' {3 ]8 F6 l
  2. /*
    * s* ^, Q! }+ ]& N; \% U
  3. * edma_test.c
    4 z: i) ^% a; K% J# \3 R
  4. *
    1 n/ G% N) z8 _' n, G
  5. * brief  EDMA3 Test Application# B% q* j8 f9 Y
  6. *
    5 L+ N2 Y7 {' g( F# `7 T
  7. *   This file contains EDMA3 Test code.4 y$ u& f2 s% s1 }( H4 l( y
  8. *
    1 Y0 E3 ^4 K# r+ o5 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 \, d! N7 h; u' ^1 X+ p; h4 {" |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( e" o9 A- n, R! x" I$ B
  11. *         TO CHANGE.) t0 E2 E" Z8 @! ]
  12. *  K  Z% h+ X5 V0 n$ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 x+ v- b& ^- n
  14. *
    5 W. ^8 u, W* N. ^5 `4 E
  15. * This program is free software; you can redistribute it and/or; [; X0 o1 t. e8 o/ R) ^7 d
  16. * modify it under the terms of the GNU General Public License as2 f7 W0 s/ m% \7 I5 }# ^
  17. * published by the Free Software Foundation version 2.
    0 T3 D9 p5 {, c. G
  18. *, `" Q( `  T) G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 L1 W6 i' |% d
  20. * kind, whether express or implied; without even the implied warranty# C+ d! o& R0 P8 Q$ S' _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; D) q$ P( w# ~7 e! g, X
  22. * GNU General Public License for more details.
    4 Z+ Q( F- M# a/ \
  23. */
    , A: l9 d3 l4 \' g/ K0 N2 b- f+ B" |
  24. / R4 C1 t5 X, |1 u$ o
  25. #include <linux/module.h>
    0 s8 M: l! \  r
  26. #include <linux/init.h>
      n8 ?4 |4 n) {- R, b0 l
  27. #include <linux/errno.h>
    ' s8 ?# J, @# a* _4 h1 V9 p$ W
  28. #include <linux/types.h>
    " r+ ^4 n! n: C7 i. j. \
  29. #include <linux/interrupt.h>/ e9 ]. n# E+ ~
  30. #include <asm/io.h>
    % Y6 C# `5 p1 _. T
  31. #include <linux/moduleparam.h>& H) d( ~. ?1 v$ H
  32. #include <linux/sysctl.h>
    * E# A6 `+ I: u1 n0 t! D
  33. #include <linux/mm.h>6 T0 t- @0 i% _* x( R( V* R
  34. #include <linux/dma-mapping.h>
    $ b, s9 \* g7 q) X$ H, l9 `2 B( |4 L; n
  35. # b& m: g) }  ]4 W; L2 o) K
  36. #include <mach/memory.h>
    . `8 T1 Z8 t; X8 b  ^" U& }
  37. #include <mach/hardware.h>! g/ }8 T0 v& P; Q
  38. #include <mach/irqs.h>  t9 Q) B: W! L
  39. #include <asm/hardware/edma.h>5 C, a* j: N& `/ ]) }

  40. ! b; e0 y% X" U5 v/ ^
  41. #undef EDMA3_DEBUG% P& f" o" ^, H+ D8 A
  42. /*#define EDMA3_DEBUG*/
    6 ]+ U5 n; U9 Z" `& @

  43. ! |* T( B  \. P) O" O2 I; u
  44. #ifdef EDMA3_DEBUG9 i. C: z  _/ n: w+ G' o9 n% Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& N( T9 N. c- I$ `2 ?* ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ @# M6 h: W) ?! }& K# I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - M6 H& J7 d5 q& }) G( W
  48. #else
    ( g3 @6 W, g% \& k0 g5 Z8 s
  49. #define DMA_PRINTK( x... )
    ( Y/ ~) y: q/ M& e
  50. #define DMA_FN_IN
    0 X- s: p  u/ s4 z3 D
  51. #define DMA_FN_OUT. P8 e% c$ t( Z; s- k
  52. #endif
    7 l6 R( `( R8 F- D" U5 d
  53. * t. h  x/ \8 b# R! b' g+ s: y1 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) j1 f' _4 k) C' Q3 X. T8 ?
  55. #define STATIC_SHIFT                3
    - h+ _/ u: }/ n3 w1 A
  56. #define TCINTEN_SHIFT               202 t3 c# n! H$ _" ~! j
  57. #define ITCINTEN_SHIFT              213 x( \0 ~2 v' [% |$ x, W! ^
  58. #define TCCHEN_SHIFT                22
    % i( B- M$ o9 F: \) @
  59. #define ITCCHEN_SHIFT               23/ x3 A( s' {+ \% p
  60. 6 O! z/ j, l1 ~0 m
  61. static volatile int irqraised1 = 0;5 b" F# t+ H% y. G5 I
  62. static volatile int irqraised2 = 0;
    % y4 p# P% }: H9 M3 b& g" Q

  63. . b/ O7 L+ X" x8 v& V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 g5 w" b# G# ^; y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 b) P& W9 T- l: s! s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . k# q/ R/ `$ O1 Q  B, t! q

  67. ) y! p$ ?* @% c3 v' T- f# n
  68. dma_addr_t dmaphyssrc1 = 0;
    7 H" w$ G7 \( \% @  Q% g
  69. dma_addr_t dmaphyssrc2 = 0;
    ' I* e9 T4 O# J  ^5 Q
  70. dma_addr_t dmaphysdest1 = 0;
    % T# e+ A+ h1 Z/ A4 K
  71. dma_addr_t dmaphysdest2 = 0;
    5 p/ K6 p4 n2 h0 k

  72. ( L$ V$ N  s+ n6 P1 W* E
  73. char *dmabufsrc1 = NULL;
    1 L! Z' [1 N3 C- y+ g: T. S
  74. char *dmabufsrc2 = NULL;" |) P* H# a9 }8 S# q
  75. char *dmabufdest1 = NULL;: {& r5 s& O% P0 J, m
  76. char *dmabufdest2 = NULL;- l0 ^$ {) K" O6 D2 K

  77. * y; L- r  k& I' N7 I$ u
  78. static int acnt = 512;
    . P: _& w6 n4 Q% C' K; @) v
  79. static int bcnt = 8;; Y' T  d! ~3 h9 W1 E" s
  80. static int ccnt = 8;0 s7 p. q( F; t8 r) l) w. Z6 e
  81. $ x8 I& I. d3 |) F* y
  82. module_param(acnt, int, S_IRUGO);
    1 k$ M9 \6 ?$ J6 o' W8 Z
  83. module_param(bcnt, int, S_IRUGO);
    ( ]6 T, D; B# ^. u" g& _5 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 B% |6 b8 e9 Y

; @8 u, b  _3 h3 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  J7 x7 n  N4 J
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 {$ S: c) v* x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ?2 x9 k) `) A9 j' ]. k+ H' l9 i( b- K8 t2 I
& O% M) \3 A9 J1 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 15:42 , Processed in 0.036814 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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