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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, ?, u2 \4 [1 T& [# e3 P; [! g3 T
  1. [code]EDMA sample test application7 d4 F& O: A  V
  2. /*6 `8 z8 ~. w' J5 D# h, R# b% k+ c2 f
  3. * edma_test.c
    " c/ K" z; N# v6 Q/ A* Q
  4. *0 h0 r5 i! V0 Q
  5. * brief  EDMA3 Test Application6 a; g3 M0 k# Z$ l6 d8 E
  6. *
    7 H* Z3 K" E& @
  7. *   This file contains EDMA3 Test code.
    0 E0 a+ x# Q# v
  8. *) t* h% y: v2 A  o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* k9 U1 q/ G- M4 u, b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 r  n, f' Y7 i, e, u, D8 F
  11. *         TO CHANGE.
    7 L5 ?# o/ j9 i6 z& I9 @
  12. *' y, y1 o, \4 k0 p# X9 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# O! O$ G2 X  i$ g& ]
  14. *3 f+ d5 Q# l* ]1 s& ]; F, b3 Q
  15. * This program is free software; you can redistribute it and/or2 b2 s, C( O0 d
  16. * modify it under the terms of the GNU General Public License as
    5 V! Q6 A  V9 T! W; |2 x
  17. * published by the Free Software Foundation version 2.1 ?" q  U. z2 ^" s6 e4 H! E
  18. *& f& s) T, G: W+ K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. q8 y3 s# t) r! j) E6 D; [
  20. * kind, whether express or implied; without even the implied warranty, t& K3 a7 Q/ p& `' D4 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , R$ s. j  m) F2 y5 G
  22. * GNU General Public License for more details.
    9 t$ u( g5 F0 @6 x
  23. */
    : [9 V: M$ v% O5 L2 i4 Q6 m  V: x, c

  24. & O2 }9 h! f. C
  25. #include <linux/module.h>
    - M+ y2 M# y$ t1 D# w
  26. #include <linux/init.h>
    4 W& m( x8 F; o8 z9 R+ M
  27. #include <linux/errno.h>
    % l! h! p: Z% E
  28. #include <linux/types.h>. L2 ]) n; q- w
  29. #include <linux/interrupt.h>
    0 u7 Y! t( X+ j: e# K3 _) v5 y
  30. #include <asm/io.h>6 [- N3 c# H3 [& b7 ]+ f
  31. #include <linux/moduleparam.h>8 I: _2 u1 T6 t# K4 v
  32. #include <linux/sysctl.h>0 h6 g1 y- y, U# M
  33. #include <linux/mm.h>
    . y2 N$ S1 D7 Q2 L: I+ U
  34. #include <linux/dma-mapping.h>2 n# v: J! T5 Z9 U

  35. ! Q& c5 s% }% V- ?$ |
  36. #include <mach/memory.h>. z4 L. x4 a0 p$ j" ~2 }; _2 L
  37. #include <mach/hardware.h>
    , x: @/ W! N" ~8 J. K" X: E
  38. #include <mach/irqs.h>+ m# S9 T* k) F1 y7 v$ l& F
  39. #include <asm/hardware/edma.h>
    7 X" X) K5 t, _4 _6 `

  40. / M" H& E! A) Z9 Y: D
  41. #undef EDMA3_DEBUG' L2 o% J* N! O3 R! e. X7 z5 f5 |
  42. /*#define EDMA3_DEBUG*/( |  Q7 M! a- I6 ?9 j* E2 c
  43.   r& N, A( P- x% F8 F7 R& v- D
  44. #ifdef EDMA3_DEBUG
    , p9 ?& a- c* X' K2 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " t9 K" o$ H; k# }/ {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). j4 O* G( `5 Y" F% m1 ~& Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 n: s  ^6 ^( W; }" }* g- t. r
  48. #else$ e1 Z! z4 Q% R$ S
  49. #define DMA_PRINTK( x... )$ @8 d* P- n7 s8 k; O, P
  50. #define DMA_FN_IN" E# g) k- [. M' ?  S
  51. #define DMA_FN_OUT
    9 S) z# E* |5 l! a
  52. #endif* I: [4 Y( b) |  l/ ^5 x% |% G, W9 o
  53. 2 H" r* A3 l2 S; s+ o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' q) s' ^, U: B9 u; v
  55. #define STATIC_SHIFT                3% A% j5 V; z! N0 n+ n2 E
  56. #define TCINTEN_SHIFT               207 w0 I/ Z" A( U4 E% ?3 A. f" b+ E
  57. #define ITCINTEN_SHIFT              21  U* Z  T7 @5 ?2 F, P
  58. #define TCCHEN_SHIFT                22
    " S, T7 C# u& x. H, n8 l! Q, r
  59. #define ITCCHEN_SHIFT               23
    ) ~- w5 n  o% l2 `! P; d
  60. " V, Z# m3 w+ s
  61. static volatile int irqraised1 = 0;
    0 J1 \: j3 P0 o  W, l
  62. static volatile int irqraised2 = 0;+ W/ c1 L: F% a$ o# h! q
  63. 8 O$ x6 h% v* X3 U1 b$ c- l  C* O; ?$ x* D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Z& W9 z4 [  M7 m1 p; G% t/ Y1 @2 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 i7 P* e" g* W5 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V$ |5 O- h  o' T' r' r+ P% \; Q5 |

  67. % g& a6 j" U# H6 n
  68. dma_addr_t dmaphyssrc1 = 0;
    ! \- @! N) K" {, L2 m
  69. dma_addr_t dmaphyssrc2 = 0;) h+ P2 O4 N& T
  70. dma_addr_t dmaphysdest1 = 0;
    8 D* T1 b( A# B8 S& f
  71. dma_addr_t dmaphysdest2 = 0;
    8 O1 g# M! M* B& G8 y3 [6 i7 i! f
  72. 8 c" X# p9 G: I* K6 d0 m  r$ k0 c
  73. char *dmabufsrc1 = NULL;3 O# U, N* \' s
  74. char *dmabufsrc2 = NULL;
    3 F1 S1 S) Y& x' [. S& P( e  Q4 B
  75. char *dmabufdest1 = NULL;& }8 \8 y, i/ S, c" R) t
  76. char *dmabufdest2 = NULL;1 v) q! G3 a8 Q+ A
  77. : e+ @! c5 C1 o, b" p+ r$ z* d
  78. static int acnt = 512;
    & t& I) o: N* R6 e2 z* x) V" a3 r
  79. static int bcnt = 8;  K4 X7 L: ]1 `
  80. static int ccnt = 8;
    5 \1 a$ A/ {8 [1 T

  81. : z$ g! T- I1 C0 K
  82. module_param(acnt, int, S_IRUGO);9 X% t/ ]/ U9 K% d
  83. module_param(bcnt, int, S_IRUGO);
    , P: L# x/ c5 T0 G# u: z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 g2 u, Y+ U% ~% w- t

( Z- N( r7 X) [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' Y0 _2 x8 H+ }$ y" }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 E! V5 K3 m9 f+ z9 t* {" _, I. s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" }9 B" c; G( p# a; ?3 X- B! e
0 c6 g7 a# x' J- W& I& [
+ Z  X1 Z6 }/ c4 O& b9 c9 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 21:34 , Processed in 0.039564 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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