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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 S/ L. `) q. H7 a1 e# J
  1. [code]EDMA sample test application
    9 ]! ^# i1 S9 D# V' @
  2. /*( F9 l/ x# V% E: T& ?) b( D
  3. * edma_test.c1 E+ f) ]; s- D' d/ ?: B
  4. *
    ; E9 m' P# e. n' N2 Z" w+ P
  5. * brief  EDMA3 Test Application
    1 A: E5 \0 K3 X5 @3 _; O7 H
  6. *
    & a) c+ H; R( E9 X# B; X& n+ a) s# D
  7. *   This file contains EDMA3 Test code.1 ^2 |  M0 k* ~9 j' R
  8. *
    ) D' J, ?' a! a( L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 N0 V: b, {' K0 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, T& `5 g! s5 K. K4 j1 j* p7 Q
  11. *         TO CHANGE.3 }$ n/ E; L+ ?1 B
  12. *; t4 F- {  O3 a4 n1 A- e( P2 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 i6 J' I5 [& Y# v' Z
  14. *
    , H% l5 A. w/ m' A1 d
  15. * This program is free software; you can redistribute it and/or/ F6 ?1 |% ?: H* i: P
  16. * modify it under the terms of the GNU General Public License as
    & x6 _: Z" `! a  i' O
  17. * published by the Free Software Foundation version 2.
    - A2 O$ o4 Z8 b# B
  18. *6 Y- C/ W2 ]: Z3 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : L" q4 }+ q' Q+ |% Z0 u. F& U* Z  _
  20. * kind, whether express or implied; without even the implied warranty/ C' e) W$ |3 h9 {$ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% j9 c3 n8 e8 f& Y0 \
  22. * GNU General Public License for more details.; Q, o9 C6 l) I
  23. */
    9 \9 G# [0 A  q2 f& o, B$ C

  24. 5 B  Q# ^2 B8 V* K; v- O' X
  25. #include <linux/module.h>
      {; \4 j! T4 Z0 D* O) \
  26. #include <linux/init.h>
    + H1 x% `% ^  ^& P6 {% l$ A
  27. #include <linux/errno.h>
    $ k# g: O0 Z& S& w  U+ v
  28. #include <linux/types.h>
      O2 Z  B( v0 d
  29. #include <linux/interrupt.h>
    % r5 ~( p9 _& M5 p
  30. #include <asm/io.h>
    & A+ p( o# R( E6 a5 i: m+ S
  31. #include <linux/moduleparam.h>
    2 g; _! f& A9 z, t
  32. #include <linux/sysctl.h>
    ; f$ n& ]0 {5 o% \3 L1 q
  33. #include <linux/mm.h>1 Z0 Y+ |6 ?* ^' ?- a1 k- r1 j' r
  34. #include <linux/dma-mapping.h>
    3 G7 l/ A( N; k' K$ x7 M

  35. : l4 S/ p. K% `0 @5 R7 n- X
  36. #include <mach/memory.h>/ ^8 g( o' K! X2 y0 U9 e
  37. #include <mach/hardware.h>6 S; ^% c2 f0 D! K7 W. j  |
  38. #include <mach/irqs.h>0 ^* q4 c: s  x& ^1 f% X- {
  39. #include <asm/hardware/edma.h>
    + _' t! X' N( s, b2 X
  40. 9 I9 b1 r, ~6 ~; z  w' g% }. v
  41. #undef EDMA3_DEBUG
    9 L+ t& v. I6 s  D  q
  42. /*#define EDMA3_DEBUG*/9 s) `3 m1 M7 e9 E9 a0 n' S

  43. 0 ?4 O7 T1 }9 Y* _- o: i' P
  44. #ifdef EDMA3_DEBUG2 k7 ]- w7 o7 R5 Z/ U3 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : S# M; U" X& Z0 x4 |3 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( _: g0 b' Y  Y# u$ c8 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( i: y$ C6 l9 X% ^
  48. #else
    - [) K& u! S" B: S) }
  49. #define DMA_PRINTK( x... )
    * u1 H) a+ v# V) n
  50. #define DMA_FN_IN# \! D9 o1 ?( E, p, h9 p- H: _
  51. #define DMA_FN_OUT# j% o/ k! i8 d* q! y
  52. #endif
    1 `. ]$ D9 {! ~6 H; A& y7 T
  53. " z5 ^0 A0 v. J* _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ k2 [9 h' p- @
  55. #define STATIC_SHIFT                3
    8 V: F- f% q: e! P
  56. #define TCINTEN_SHIFT               200 n/ c/ r2 f+ B. U* k
  57. #define ITCINTEN_SHIFT              21
    , s4 V# `7 c$ Q# t9 J. [
  58. #define TCCHEN_SHIFT                22
    ( V) b) v0 F9 {7 ~
  59. #define ITCCHEN_SHIFT               23
    . ~$ L: o9 `- H# U) t3 w. i5 A

  60. ' }+ l& U# H2 N0 }4 }
  61. static volatile int irqraised1 = 0;
    3 E4 @8 x! W) U% h  ~- J
  62. static volatile int irqraised2 = 0;
    1 c/ ]+ \2 C8 I5 p# e* E

  63. + k+ ]' f* ~3 H3 ~" w; l) z, K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % [7 @% O9 H# F4 u) @0 F& e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' e) R, t" ]3 R# S2 n* ^8 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * M6 y& G5 r# _  G/ ?* ^
  67. 5 \# i  z/ ]! v( e
  68. dma_addr_t dmaphyssrc1 = 0;
    : {6 d- k* g: D( F7 g* ?
  69. dma_addr_t dmaphyssrc2 = 0;) `: ~2 g) f- Z
  70. dma_addr_t dmaphysdest1 = 0;. a$ o- m4 b# N
  71. dma_addr_t dmaphysdest2 = 0;
    7 r9 W- e! e% M

  72. ! H8 i6 e+ \+ B, C8 V
  73. char *dmabufsrc1 = NULL;
    % |: H# Y# ^- i! ?, U; S
  74. char *dmabufsrc2 = NULL;
      w2 z; e/ Y  W9 B0 W
  75. char *dmabufdest1 = NULL;- G# i- X+ e8 P
  76. char *dmabufdest2 = NULL;
    ! X6 O" y# Y7 F/ X' j
  77. " ]5 v) V, [* S7 J
  78. static int acnt = 512;0 g9 J" n/ C6 S6 w0 X
  79. static int bcnt = 8;
    # H- R/ [. b0 k2 C" U
  80. static int ccnt = 8;! r* k; |% t- Y' a! s
  81. : S* z  n6 ?$ B* i; k
  82. module_param(acnt, int, S_IRUGO);
    * W; w* m' Y! A+ S3 [
  83. module_param(bcnt, int, S_IRUGO);# {. \6 h- F- A9 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, P' \. O, ^: D/ A% f8 Y+ W
# ~  G! y- F* Q4 G% V3 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 B0 Y& T  x; }  w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 _2 V8 t' a" D4 |6 j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- z+ ?8 O; A4 z
  p( B9 h. a2 `  C% {+ e
2 b' J. X! X! J  `7 D( M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-17 19:17 , Processed in 0.042174 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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