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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' X) z& Y" I* M+ [
  1. [code]EDMA sample test application2 H: ^# t' e& ?* ^
  2. /*
    + F# b- [% [/ b6 ~6 x5 j9 U6 g
  3. * edma_test.c  L3 Y/ s* K- M, F# T: S% V1 |3 O
  4. *' s: B. M! s5 d+ [4 F  e
  5. * brief  EDMA3 Test Application
    " [$ g# ?1 O8 |6 _- e; D
  6. *
    " D) I! Q% z) [
  7. *   This file contains EDMA3 Test code.7 O. U- |  C9 O& e6 n
  8. *
    - K# g, h# |3 O; d# E9 l) y& H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 {) i% t, a0 d3 R; u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 E# W4 k* t. \8 r
  11. *         TO CHANGE.
    ( D. Z' X5 H9 c, m* Q% D+ u
  12. *. ^( g! L% G8 I; @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' i" S, ?3 e) Y4 ^) y7 z
  14. *1 X1 M" W! b  S8 u0 y5 B
  15. * This program is free software; you can redistribute it and/or
    + T( t, ~2 |. D& d
  16. * modify it under the terms of the GNU General Public License as
    " N9 g; E1 x. [# X
  17. * published by the Free Software Foundation version 2.
    5 M. P$ @4 u5 ^8 e7 }
  18. *
    0 f8 D1 l" l) c, A! e) w& L2 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ]6 [) [  a$ \
  20. * kind, whether express or implied; without even the implied warranty
    , [- |) ?! y& d  E1 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* x' B$ X% i+ `+ x
  22. * GNU General Public License for more details.
    + N" Y: x% U( e' @( [3 |; @: G0 S
  23. */, u7 F4 B3 ~0 x3 [5 J( \3 N
  24.   K, @3 M) Z& c. \3 s7 p+ X
  25. #include <linux/module.h>: ?+ a* i, y- ?( z$ W3 D8 k
  26. #include <linux/init.h>
    $ g$ C! G* ?. c1 M
  27. #include <linux/errno.h>
    ( {5 r. x2 }3 N7 s6 R' E' J) q
  28. #include <linux/types.h>3 g" u1 y6 ^7 i+ ]- Z8 v6 N
  29. #include <linux/interrupt.h>
    5 Y0 P! ~1 X/ `- {  O
  30. #include <asm/io.h>5 c4 l* X) E; ~
  31. #include <linux/moduleparam.h>3 w5 |% x5 a7 H" C. E* H
  32. #include <linux/sysctl.h>2 q1 i* K# H! a4 @- ^
  33. #include <linux/mm.h>
    " q8 y8 g6 _- A. N2 W& F/ m
  34. #include <linux/dma-mapping.h>; d& b5 [; o1 r# b, J

  35. & p2 `0 C6 Z( `1 |' n4 a
  36. #include <mach/memory.h>
    3 R% z/ Z: ~6 ?+ I, n
  37. #include <mach/hardware.h>
    7 V5 l; F( Y4 V
  38. #include <mach/irqs.h>
    0 E1 C4 W: r& C7 W' `
  39. #include <asm/hardware/edma.h>
    . p' Q; a0 Y  W
  40. " V, R3 V1 l: r# \  c% U* Z$ t, h& r
  41. #undef EDMA3_DEBUG
    5 x0 ^5 _! h7 ~8 l
  42. /*#define EDMA3_DEBUG*/: ~+ H/ S# Q2 x# s) s$ F: M1 K8 k

  43. : d' T9 p8 |  j$ |
  44. #ifdef EDMA3_DEBUG
    % }1 X8 s& a0 H# w7 n% z% _! a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  w* k. u8 n, ?* [4 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * X8 x! E! i; B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 D/ x3 `; u2 n6 R" c) {" l
  48. #else; q' S9 e8 U2 O
  49. #define DMA_PRINTK( x... )
    / N& p; Y8 E; [: ~2 X
  50. #define DMA_FN_IN
    + @/ r" q; Q! ^7 ?
  51. #define DMA_FN_OUT
    . }, E( g% q2 a! h3 D
  52. #endif
    " U7 `- n; q7 a$ [  v9 m$ |" m
  53. 1 ^( I7 g0 S0 h: {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 D( h7 K* s! P+ \9 j" d
  55. #define STATIC_SHIFT                3) f8 ?3 A% H# E6 F! U
  56. #define TCINTEN_SHIFT               20# Z7 w& d* W" t9 i% A. T( i0 t: W
  57. #define ITCINTEN_SHIFT              214 g2 ?. ?1 s6 d, {. V* l  b/ f( ?8 D; w
  58. #define TCCHEN_SHIFT                22: k; V) W, [9 C, F" m% n
  59. #define ITCCHEN_SHIFT               23& \# h+ ^, w' F4 r
  60. 3 ]. v8 C5 q4 n# x% [/ t
  61. static volatile int irqraised1 = 0;
    ; G& n* H: ^1 t% R  i2 X3 z
  62. static volatile int irqraised2 = 0;8 c8 `1 D# q. G; V. Z. s
  63. * n) T( [; C# U' d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & l0 J, `% q* [1 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % F7 Z& a+ K7 n2 p- r# {  w4 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; f) a+ s  n4 d2 x
  67. 4 w7 o  h3 q- j; u7 i, A
  68. dma_addr_t dmaphyssrc1 = 0;
    3 t4 g3 l3 ?2 c& ?
  69. dma_addr_t dmaphyssrc2 = 0;+ Y& k: k0 s$ o* R$ t
  70. dma_addr_t dmaphysdest1 = 0;+ y. B, r, @& H! e, G/ b
  71. dma_addr_t dmaphysdest2 = 0;
    . L0 y7 M3 U. c, b  k) k) `0 q
  72. 1 M7 X: Z+ W& t5 `: I
  73. char *dmabufsrc1 = NULL;
    2 v$ u; u. A% }' T
  74. char *dmabufsrc2 = NULL;
    ) n6 G$ \) ?0 ?1 h: b& n+ }
  75. char *dmabufdest1 = NULL;  J- X- m- D3 j) W# m; c
  76. char *dmabufdest2 = NULL;$ E2 ]# @" x9 [
  77. 8 L  r8 s6 j! U& J5 z; z0 A: O5 v# ^
  78. static int acnt = 512;& w3 s! l) x& m/ U  W
  79. static int bcnt = 8;
    4 Z* s' ?7 t& S
  80. static int ccnt = 8;
    ( `# f  H9 L5 y' g
  81. + t" [  J& N3 A1 Q2 T- u6 U
  82. module_param(acnt, int, S_IRUGO);
    ( ]6 f5 {1 {5 H# U
  83. module_param(bcnt, int, S_IRUGO);
    3 E1 ]% l8 K& X3 a' R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  N# W  l: i/ _! O1 p: [: g* A0 F# G' _+ a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! ~6 Y8 _# _: L1 \" z' U5 r* X8 q; p. darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) c8 T  Q  P7 e8 F) n4 t7 d7 c. f% U& G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ m) \7 g' B+ j' m; u7 P+ r! a
& h1 x5 ~4 a% U' N, S" a2 }5 v: k7 M

# b' h, I; T* h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 22:10 , Processed in 0.041683 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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