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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 y/ J) u# @$ O: b" {
  1. [code]EDMA sample test application, B5 R7 N- J0 Z/ R3 f# U1 k1 c2 T
  2. /*. r9 K: C& d# |$ v6 L
  3. * edma_test.c
    + h0 n: U2 Y* O" I
  4. *
    9 E2 J) g2 R3 [4 Q$ X* W/ Z, V
  5. * brief  EDMA3 Test Application4 {: B3 Y) T2 J4 K0 v! p
  6. *
    0 y/ ?+ v" z, Y7 G
  7. *   This file contains EDMA3 Test code.0 i. g3 x- q) R% |7 n0 n
  8. *' q3 q  k/ Z/ A; D! B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) q% H% Q" D, w+ H. D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( r9 ?  b: r+ R% V7 Y
  11. *         TO CHANGE.
      `6 K% c* V) @) L; Q
  12. *' u! q6 h( r9 A+ b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . I. k5 L" l, Z: b
  14. *- {3 m; V+ _1 {0 C
  15. * This program is free software; you can redistribute it and/or0 ]5 H; h6 b: `* O
  16. * modify it under the terms of the GNU General Public License as1 F! p3 b  S" E2 _; b
  17. * published by the Free Software Foundation version 2.( x2 Q3 ~8 I. F$ Z! r0 b7 I9 W
  18. *
    & A/ e! g4 H) f+ j) ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' s0 J$ e; z9 w& n( v; i, ]
  20. * kind, whether express or implied; without even the implied warranty
    6 h$ K0 N! ?( L! I: F! m* G- \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & b- M! y" L; j& {4 t0 B
  22. * GNU General Public License for more details.; I6 t% |8 d. ]% C2 p
  23. */
    1 @" K# A( y7 i/ e

  24. 8 [) ?9 s4 E: C0 y
  25. #include <linux/module.h>
    ( n4 `1 `: \0 v* |+ _6 F9 ]
  26. #include <linux/init.h>5 E4 a9 I/ {8 v0 `) N
  27. #include <linux/errno.h>
    5 M# @" `+ [# I4 h9 `0 }
  28. #include <linux/types.h>0 k6 f; X+ |$ C# M9 X0 P* O
  29. #include <linux/interrupt.h>( J& z; t5 c7 D6 U3 Z
  30. #include <asm/io.h>
    + M2 l  l7 I0 g, I
  31. #include <linux/moduleparam.h>9 _! h7 N% I! \5 c8 `
  32. #include <linux/sysctl.h>0 ?& n6 k) j5 k8 ~# w& J; M# o
  33. #include <linux/mm.h>! g' j- N( i: J# K; a
  34. #include <linux/dma-mapping.h>
    $ U: b5 x/ W6 c8 p4 i; l

  35. * e0 ~) A" v+ e8 I
  36. #include <mach/memory.h>2 _) j( w/ _1 T3 F8 _0 K$ Q: m
  37. #include <mach/hardware.h>& Q$ U& ?0 ~/ u
  38. #include <mach/irqs.h>* z; Q  m& p+ W2 _2 g3 v% ]; r
  39. #include <asm/hardware/edma.h>
    " [% U( s/ j, D0 z8 P: u3 F

  40. ; B8 J. P' u' W8 ]1 z
  41. #undef EDMA3_DEBUG0 n+ l0 \3 t8 {) y3 _+ {/ o+ ?0 W2 N
  42. /*#define EDMA3_DEBUG*/1 a# h( _2 U4 W1 t3 _9 ?) A  ]

  43. ( p6 n  _+ q) g! ?9 }
  44. #ifdef EDMA3_DEBUG
    7 V4 d8 W4 ^. n) q6 d8 ]. C* y$ M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). p0 Z4 s- @/ I, u4 z. |  I, L3 J5 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / ?8 ^& Q+ [) B" U0 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) v: z  d' t# P
  48. #else
    ( N" ?* `, x: K4 \# l  t7 i
  49. #define DMA_PRINTK( x... ): w+ D# f# ]4 w9 X4 c2 E5 v
  50. #define DMA_FN_IN) R2 J( k; ^! U. k
  51. #define DMA_FN_OUT$ c7 z' H/ B- q* L& s0 X
  52. #endif% B+ V' h, h* N' _, X1 v1 E
  53. - ?; p% t6 `* j" W; G; _% f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % y5 [7 z+ j5 t5 @
  55. #define STATIC_SHIFT                3
      N* y) X" C. s0 L9 C
  56. #define TCINTEN_SHIFT               20( S7 e5 d, s2 f: u; w9 @- ~4 \
  57. #define ITCINTEN_SHIFT              213 ~$ `; ^: w! }( \
  58. #define TCCHEN_SHIFT                22$ ^* u/ B3 A& v: `
  59. #define ITCCHEN_SHIFT               238 @( B% _+ G: A; L1 C
  60. 2 L: e# `' \8 ]) f* P4 z  G
  61. static volatile int irqraised1 = 0;# ~2 u+ P1 n4 i  n
  62. static volatile int irqraised2 = 0;
      i. j2 T3 m  i. r" G

  63. # q, T* i0 w- N0 ?  g2 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 v# \: W  E5 G) ]4 f4 d- Q! D2 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 J# n4 \1 _% u3 j3 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 _* o7 A  g" ~# X. J- {5 i' E
  67. 5 x3 o$ U1 q& Q3 K* ?
  68. dma_addr_t dmaphyssrc1 = 0;5 k0 G+ X6 E: |7 k6 ?
  69. dma_addr_t dmaphyssrc2 = 0;5 f& D, N, p: p# M
  70. dma_addr_t dmaphysdest1 = 0;
    2 U% C  N( \" f! @+ N8 ?3 i
  71. dma_addr_t dmaphysdest2 = 0;/ E0 l2 N; x; @, X- L: a) z

  72. 8 w5 `% U$ \. x0 e& U2 k  y5 ^2 S
  73. char *dmabufsrc1 = NULL;1 q# a  r1 M# Y; x
  74. char *dmabufsrc2 = NULL;
    ( Y7 g0 H, }% g7 k: i; @
  75. char *dmabufdest1 = NULL;
    # ~7 ~7 C2 T+ }) S
  76. char *dmabufdest2 = NULL;
    ; l: J# f; k6 m; D& o2 s
  77. ! K9 r6 d& \$ \: ]
  78. static int acnt = 512;3 P8 z! P1 c# u8 }% f% u2 Z/ J
  79. static int bcnt = 8;
    5 N" X: |6 f+ K) L+ a
  80. static int ccnt = 8;
    ( o& A8 P: M1 D/ e

  81. 5 z" F) D: l  A+ L
  82. module_param(acnt, int, S_IRUGO);& B: h" ~# A( n) O
  83. module_param(bcnt, int, S_IRUGO);
    ; [1 ]: n/ W( |7 s# f0 b8 t) D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. c4 j4 |2 w! q; [0 B( h$ X8 C2 O- w2 T; g4 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! [( ]* h, V- Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' y9 t" ]- C! Z. j  I% s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 p5 g2 r. h, Z$ V$ x
/ z; c( j! H& m( r0 M
& y* D+ y  S4 B$ T+ ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 00:02 , Processed in 0.043662 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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