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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 c* \/ G4 @, j9 n) }
  1. [code]EDMA sample test application
    , {' S6 G# W# G
  2. /*4 M9 ^7 l  e  `
  3. * edma_test.c, E1 b& S7 c) o; H% r% H6 v: I7 ^- h
  4. *
    7 b/ e& Q' q. Y  f$ M8 ^- u
  5. * brief  EDMA3 Test Application
    + B* K6 w+ B, \/ ?
  6. *
    5 Q2 Z) N4 O+ I
  7. *   This file contains EDMA3 Test code.
    " @* _. d$ b& ?" N
  8. *
    # ]' }; _+ p( B4 }7 b8 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 ~4 I. X3 z5 S5 @8 \6 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 `  L5 l+ H( ~7 {5 I8 Q
  11. *         TO CHANGE.6 ~2 r* J7 c7 J& |/ U6 J
  12. ** ?; D- j1 W! x) B7 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + d0 K2 x/ N. @8 T9 w
  14. *  U- o6 I" |9 m8 Y6 w) N2 h1 w) Q: A+ Y7 p
  15. * This program is free software; you can redistribute it and/or
    : U+ y  U  G% x1 J6 L
  16. * modify it under the terms of the GNU General Public License as2 c5 b" [$ V* V$ V% N) I4 X* D
  17. * published by the Free Software Foundation version 2.  x4 k9 g9 q4 |! z1 r6 b
  18. *  X: D  N$ y3 p2 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 d8 B% n7 f6 j( ]3 A" M9 {
  20. * kind, whether express or implied; without even the implied warranty: K; }2 n* p2 u1 @5 q: x6 R# Q6 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& m* \8 _0 Y/ C( p: X& l8 c9 ?
  22. * GNU General Public License for more details.0 h! {: M; J7 r6 k! h
  23. */+ |2 t( r' K6 l
  24. . S* p( L# P9 H" m9 m7 s% L( ?
  25. #include <linux/module.h>: }, B& t! y& m& |# _
  26. #include <linux/init.h>4 A3 R# i5 b! p+ z: @1 r) M# |
  27. #include <linux/errno.h>1 Y: q2 ~' X: a1 Y. o; }
  28. #include <linux/types.h>
      n. o8 V# @% D9 n; l
  29. #include <linux/interrupt.h>3 A  ]% r- L! d3 ?
  30. #include <asm/io.h>
    ' X0 \$ T- o9 }6 H1 k- x
  31. #include <linux/moduleparam.h>
    ' ]; O2 ~+ o$ z
  32. #include <linux/sysctl.h>
    6 E( v, u0 U; A4 G- O
  33. #include <linux/mm.h>
    / Q$ _) h  x) I: Z
  34. #include <linux/dma-mapping.h>
    6 a; F: J; t* Z6 V0 R
  35.   Z) s3 `1 ^8 z% T
  36. #include <mach/memory.h>9 A0 |" t8 F# h3 k* ^5 v& I
  37. #include <mach/hardware.h>1 X, P  L) r& M7 [
  38. #include <mach/irqs.h>5 }# O- X7 e+ o) l6 i# J. D
  39. #include <asm/hardware/edma.h>
    $ j/ t. q9 y7 u. H8 ]8 p

  40. , P3 j$ \! I2 Q8 }4 }+ h# v
  41. #undef EDMA3_DEBUG: `  O- F$ z1 I+ y
  42. /*#define EDMA3_DEBUG*/3 [5 J; C9 n  o* _( u6 J
  43. . k8 O' N" L: g0 j4 a
  44. #ifdef EDMA3_DEBUG# {. e" H9 M* c9 S  T. H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 v& u* E8 L) f: K6 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), W" f+ e# u5 r& T6 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 ~( C% d( X/ d0 e( w+ e
  48. #else$ a  W; i- `) @0 v
  49. #define DMA_PRINTK( x... )
      R% Z1 ]5 x% `. P/ X4 q
  50. #define DMA_FN_IN7 L2 _) O+ ]! P; V0 ~
  51. #define DMA_FN_OUT
    0 a# S& i/ h9 Q  C
  52. #endif3 \, d( M  O$ Q: T% E3 r3 W3 o

  53. & o$ y$ Q; t, h2 e+ q- V- N! f! Z$ l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), K  {* e- m& f! Z# M, E
  55. #define STATIC_SHIFT                3
    7 {- x% p- H0 S2 f* J
  56. #define TCINTEN_SHIFT               20
    0 i# m4 t6 T, D4 I: @9 c5 ]
  57. #define ITCINTEN_SHIFT              216 {( g3 u! c% P
  58. #define TCCHEN_SHIFT                22+ c, p" x7 Q: Q  f: [( ?
  59. #define ITCCHEN_SHIFT               23
    ) l6 q6 F, r4 G! a; e! J+ @
  60. 4 G. Z5 d* c3 v9 C- b# b
  61. static volatile int irqraised1 = 0;
    + J# l- V6 G+ `# y
  62. static volatile int irqraised2 = 0;' y6 W8 K0 n$ k3 Q) ^, p9 a. e5 ^

  63. # S5 x1 |' Z3 v0 r, i4 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 R. l# E! G* F! O% n5 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 j: t5 n; |7 g7 E) i) N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a- ~1 _" S2 N9 ?+ Q5 X

  67. ) ~) ?  D9 H& ]
  68. dma_addr_t dmaphyssrc1 = 0;- i* X0 L3 z* l, B' p' ^9 Q9 v& t& t
  69. dma_addr_t dmaphyssrc2 = 0;) N# H0 @* S4 U( g0 L
  70. dma_addr_t dmaphysdest1 = 0;
    3 _  c" X  u/ e+ t( T: Y7 ^4 s- u
  71. dma_addr_t dmaphysdest2 = 0;
    3 C: |  l1 _  N  `$ d
  72. . I! w, I; r! ]) t9 a) ^8 k
  73. char *dmabufsrc1 = NULL;
    ' [$ z2 ^" _  C# T. ~
  74. char *dmabufsrc2 = NULL;4 n# R- k8 U3 |, Q: s
  75. char *dmabufdest1 = NULL;
    3 J+ J. c6 J. h8 c- b3 p
  76. char *dmabufdest2 = NULL;
    , B, ^! E$ @1 O& W, @9 N0 Z

  77. : t- ]% K, t* ]  _+ [& w
  78. static int acnt = 512;
    " M2 W4 L& x* P) Z
  79. static int bcnt = 8;' @5 p  |* i. c& u
  80. static int ccnt = 8;
    . }: v& N$ T( C" A% ~0 o

  81. 7 A/ c9 }- `+ M6 W, l
  82. module_param(acnt, int, S_IRUGO);1 q+ V, ?8 f  |# F0 D2 i( X
  83. module_param(bcnt, int, S_IRUGO);
    # L- k, q8 f; ?; [: w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 s% B9 n- ~, a% ^2 g/ C/ |4 F' \/ `0 b( ^# h0 e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 N  j; K9 ^$ s$ ^$ ]+ farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. v# ?; H) a5 r/ Y7 o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 r/ N1 K; U$ c: Y7 ^& d
) F! z- a8 q2 Q& S; a) r9 R8 |5 H  H% G! A+ @& {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 21:05 , Processed in 0.039496 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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