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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ d; v- s0 z* d6 H5 t0 P: E
  1. [code]EDMA sample test application
    9 w# r" ~+ {2 n. K: c
  2. /*7 }! q- @* _1 l, U- P- t5 x4 p
  3. * edma_test.c/ k, m% K6 o' g" h. O( P% m! n4 z
  4. *' i" D! ~3 G9 ?0 s
  5. * brief  EDMA3 Test Application
    4 E: Y- \% T, C
  6. *) V9 D6 T; N* p
  7. *   This file contains EDMA3 Test code.
    . z5 l% Y& f8 Y1 N3 x( ^+ }
  8. *
    ! t! e% F: D. L  @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / h- U3 i* z% a" d9 M* s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ I3 j  l+ ?2 Y8 _, C. I9 z$ j$ }
  11. *         TO CHANGE.
    . R1 [+ l, a2 V6 x  n. r
  12. *
    8 l- e7 _, l0 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 j8 W& I6 p% r+ ?; O( n/ V* w1 F& L
  14. *( C! l7 _) l) X9 |) I
  15. * This program is free software; you can redistribute it and/or
    0 R8 d2 A+ S8 Z+ V" i- C4 j/ c
  16. * modify it under the terms of the GNU General Public License as" h2 n0 N- w. c, h
  17. * published by the Free Software Foundation version 2.
    % Z1 t% z3 j" ]; s! ?5 B
  18. *
      l( @, ]9 Y8 T; ?9 F5 K" B; F) K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 R: P4 B4 @" [6 W) i8 J% ^
  20. * kind, whether express or implied; without even the implied warranty
    , g1 w, O! `0 H$ p" ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& a+ [. }0 D4 ~& v3 C* ?
  22. * GNU General Public License for more details.# p; Z! ^6 V+ P. v# n6 }
  23. */
    & b; t4 u* M! h, Q& e- L- t: M

  24. + ]2 l$ _  @: ]
  25. #include <linux/module.h>
    ; P! z/ P$ S/ N5 a( ^
  26. #include <linux/init.h>: t, ^$ S& E6 |
  27. #include <linux/errno.h>
    ! w# b4 T' M8 v. S  Q+ I& G
  28. #include <linux/types.h>  y5 ~; W+ s  L* M1 o' [
  29. #include <linux/interrupt.h>+ e5 [) b1 M: k4 z- g3 h
  30. #include <asm/io.h>
    % ~/ ^4 u6 J/ B- R% c
  31. #include <linux/moduleparam.h>; G3 O2 C2 ^5 b. ?" h1 ^5 p2 {
  32. #include <linux/sysctl.h>
    & r5 J  H6 @* p0 Y! J( n8 K
  33. #include <linux/mm.h>8 H0 O2 C* b+ S+ n/ S2 f; u
  34. #include <linux/dma-mapping.h>" `8 f/ c7 g! Z; V& e$ G) L
  35. / ~$ g3 S0 Q% C% M5 f
  36. #include <mach/memory.h>7 c; a, g* v  @3 f
  37. #include <mach/hardware.h>% H1 G5 G/ ?0 {2 x
  38. #include <mach/irqs.h>
    8 ~8 K; [2 b7 [/ v" P, R
  39. #include <asm/hardware/edma.h>
    ! x0 O. u* G9 I; o- ~3 l
  40. 4 D9 a9 @2 y( M0 r( ~
  41. #undef EDMA3_DEBUG0 D2 q6 k- \" c1 a4 q! F2 s6 {
  42. /*#define EDMA3_DEBUG*/9 w7 q6 L3 I- F

  43. " \, i( ?) Z% j' F; Q. Q# Z
  44. #ifdef EDMA3_DEBUG
    6 ^! F+ k1 x  X3 M9 o) Y& w2 O( c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 f  a; L( _& g1 D' b/ r! U" w, p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & ^0 X: @. @- F) Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . t: M* X/ F2 H# ^1 w: f# e
  48. #else" a1 N& K' j: r/ C
  49. #define DMA_PRINTK( x... )# R; p$ T2 Q9 P, B  v
  50. #define DMA_FN_IN
    / L: l$ a0 E# o  }" ]$ F/ e2 |2 _
  51. #define DMA_FN_OUT
    / G! y) T# U4 V3 W7 V
  52. #endif
    9 m, m) T6 }& d# R! t

  53. ; l$ J5 L3 G6 G+ ^1 {5 T. e; v* c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* Z/ L* P# ]: i8 w7 H
  55. #define STATIC_SHIFT                3
    8 T# D$ O9 R: n2 y$ M8 k
  56. #define TCINTEN_SHIFT               205 d! H/ F$ v$ i
  57. #define ITCINTEN_SHIFT              21
    9 K; j4 q3 c9 r0 ]3 x
  58. #define TCCHEN_SHIFT                22
      v% c/ n6 S0 P- J, _
  59. #define ITCCHEN_SHIFT               23" `' x. Y5 S2 y: j5 G1 C3 D/ X

  60. + n* y3 ^! x0 j( H% \0 G. D! H) ]. z
  61. static volatile int irqraised1 = 0;/ O5 _. W0 N5 b" J8 C  h
  62. static volatile int irqraised2 = 0;* \. w* w! P6 C  ]
  63. / W2 B; t3 \8 T- h+ v! k! F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. W% m/ Q! m- |) j& _0 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# }8 }4 @9 v" g- b# e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % l+ F/ r" Y. s6 l% T

  67. , }4 U! a9 P2 Q2 _
  68. dma_addr_t dmaphyssrc1 = 0;# \% }2 j$ R" f4 J8 t5 b
  69. dma_addr_t dmaphyssrc2 = 0;
    1 O% n2 i0 I: ]& Z8 K5 d% A  l
  70. dma_addr_t dmaphysdest1 = 0;
    " \7 C" X# i! S9 r- n, C- [
  71. dma_addr_t dmaphysdest2 = 0;0 X# f! J8 w' b1 z* C! B

  72. 4 O, o* ^# j0 _. ^! h  n
  73. char *dmabufsrc1 = NULL;. S4 W- J6 v3 p- @# B- z6 W
  74. char *dmabufsrc2 = NULL;; r6 E; C# {# x# P4 r9 l2 o
  75. char *dmabufdest1 = NULL;
    : |& _, k+ O9 Q1 ?7 c* @
  76. char *dmabufdest2 = NULL;
    % f+ q  ~4 |1 [' O5 t9 Y
  77. + g7 Y" _, u, p
  78. static int acnt = 512;  ?3 }; {# `% n/ `3 k( V
  79. static int bcnt = 8;
    4 g5 L& j9 N( Y# s7 K6 P
  80. static int ccnt = 8;
    ' x9 ~' @; R2 v7 L4 D

  81. 7 f. k7 \& f7 n3 x/ }8 w
  82. module_param(acnt, int, S_IRUGO);' r& L$ [- P' \1 c$ W
  83. module_param(bcnt, int, S_IRUGO);
    / s9 f, h3 p7 Y( m( @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. l* @3 h" s2 T: \+ M; n7 r$ D! @' m7 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" E; _2 n1 H/ H1 S+ N- e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# D* @7 @- }+ J6 c/ ?; m, m! R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 g5 H( `* N  Z$ p  {' G2 E7 P7 w3 [9 k7 g
- `" d8 L- N; I/ f! F/ b& h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-21 06:27 , Processed in 0.041114 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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