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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 w6 p: l1 ?. _2 G
  1. [code]EDMA sample test application* {2 H( e3 a5 U3 I+ e- R% o0 M$ l; t
  2. /*% _: ?& `) G: u+ A/ n$ `
  3. * edma_test.c
    / [" V# k  p: E; ]5 A
  4. *
      F  L- r/ O  W/ L
  5. * brief  EDMA3 Test Application/ T+ s6 w$ p) C* W. G) [
  6. *& j0 O7 G0 x7 h& F
  7. *   This file contains EDMA3 Test code.
    # Y. Z- X3 m9 s8 n. D/ ?- `+ s2 {+ H
  8. *) g  X7 m2 v/ c: `/ o1 W! O. y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! P3 q0 c, k1 j: o( W6 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ s( F- l6 Q2 W; c% U+ u. w
  11. *         TO CHANGE.
    + d* g7 _- `* L
  12. *1 h+ q% w' k, L0 L/ C/ p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 Y5 f: \9 z; T/ w( j. a
  14. *' z" J! s- u9 F! q, a2 e
  15. * This program is free software; you can redistribute it and/or2 T, K7 p- W4 t% M
  16. * modify it under the terms of the GNU General Public License as+ r, J1 |4 C& C7 \/ Y
  17. * published by the Free Software Foundation version 2.- \3 a. S9 T  k8 L/ n
  18. *
    4 H: u, P) G# |- z: S/ p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + a0 L0 n5 w/ s" A/ `
  20. * kind, whether express or implied; without even the implied warranty/ H" J* \* \3 Z) @7 o) m( D$ i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 U( q, U* T2 C4 Y! N4 D& z
  22. * GNU General Public License for more details.
    , `% w5 f9 ~$ X  K- ^# s# W: j
  23. */; I5 F9 V0 ]+ Z1 M

  24. ) v9 o* M- O# u) f
  25. #include <linux/module.h>2 r; G  E5 O' Y- Q
  26. #include <linux/init.h>
    - z% a4 P8 M9 t4 N5 Q2 g' Y1 p* H
  27. #include <linux/errno.h>
    8 n2 U! b2 g' [1 i6 m3 _8 p
  28. #include <linux/types.h>2 s" o) R2 t- N" n: @. g$ M
  29. #include <linux/interrupt.h>6 x# @  W8 i9 b! H1 f
  30. #include <asm/io.h>$ T+ }2 [% w; p& D; c5 u
  31. #include <linux/moduleparam.h>
    7 A  r! S1 R5 t) x5 x# j/ I2 I
  32. #include <linux/sysctl.h>( k7 R) W% t  z3 {5 y
  33. #include <linux/mm.h>
    % J$ P5 P$ n6 R
  34. #include <linux/dma-mapping.h>$ `0 A, j" G2 x
  35. 6 g/ b6 j3 I; S7 U0 E9 Q
  36. #include <mach/memory.h>
    ' W: w) @( c# _6 i; a# p7 n1 n1 g4 o
  37. #include <mach/hardware.h>, i( J) r; k* }$ }: r% u
  38. #include <mach/irqs.h>' I3 F% E% @) J! y& ^- A  R4 Q
  39. #include <asm/hardware/edma.h>
      f* O! `- \1 l8 k

  40. # N- R$ R) A" h& m9 H7 u  n9 R
  41. #undef EDMA3_DEBUG
    0 n5 ^- ~1 t" @4 u3 `4 j0 S
  42. /*#define EDMA3_DEBUG*/$ Q* ]! q: v3 i! U2 o; |+ P: ?

  43. 8 ^& n4 S" Q4 l! l: m9 H
  44. #ifdef EDMA3_DEBUG: x3 I. w6 ]5 ]# _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      k7 h$ ~# _- I1 ]0 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / K9 ]  s5 {% X! F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ n- P8 ]3 y/ P/ A
  48. #else  g3 b7 U2 S. T2 G
  49. #define DMA_PRINTK( x... )
    7 {1 @, S' s" u! O
  50. #define DMA_FN_IN/ a" Y+ w/ f( B/ z, a6 o! M
  51. #define DMA_FN_OUT5 b3 Y5 `! v- |) z4 x  q0 U' I4 r
  52. #endif' _+ K5 X, M; ?, N

  53. 7 Z# c2 b+ n( F+ |+ m  e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 a" w$ H( t/ Z
  55. #define STATIC_SHIFT                3+ s* U% D3 E( m+ P3 l$ }
  56. #define TCINTEN_SHIFT               206 n1 a2 G8 d$ f, F: t
  57. #define ITCINTEN_SHIFT              21
    6 y8 f/ v$ E8 R/ F4 F# |7 B# l
  58. #define TCCHEN_SHIFT                229 {: f$ b( E* b) s7 N
  59. #define ITCCHEN_SHIFT               23" N! r. u6 `* F! `2 U; ?

  60. 6 b) E9 D3 X) _( T+ W5 P7 G1 E0 t8 K
  61. static volatile int irqraised1 = 0;
    8 M1 z8 E3 r1 V2 V6 h& t
  62. static volatile int irqraised2 = 0;
    $ T" H$ C. ~- ^0 {; M! ^2 L

  63. 3 K' {2 {, t( d3 m/ Z6 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Q/ E7 o% ^$ {! Q4 t2 z7 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 f6 k9 l7 Q! f9 Y6 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & u1 l* U& S1 y% X; c. V/ B8 C
  67. 9 v1 L+ |" H8 ~4 k, N9 \, C
  68. dma_addr_t dmaphyssrc1 = 0;2 n4 }7 n* J, {3 n
  69. dma_addr_t dmaphyssrc2 = 0;
    & R/ a9 Y* @: c1 a( H$ z& \6 l
  70. dma_addr_t dmaphysdest1 = 0;8 e6 @1 V, j1 V
  71. dma_addr_t dmaphysdest2 = 0;
    1 p0 s* r# H! T! A9 a. p" q

  72. ( r+ J$ P; D  U7 I& [2 w
  73. char *dmabufsrc1 = NULL;$ N, k( V3 B. s
  74. char *dmabufsrc2 = NULL;
    ' [& U9 {5 _! A& u
  75. char *dmabufdest1 = NULL;1 k  S9 y) i! \9 ]
  76. char *dmabufdest2 = NULL;, Z$ \5 O2 i, E1 ~) ]
  77. 1 Q* s9 D4 x( l
  78. static int acnt = 512;
    ) q& b0 W+ Y! S
  79. static int bcnt = 8;- ]- Z3 g& r' X" X1 ]
  80. static int ccnt = 8;
    & ?3 S, Z* U7 w6 \9 G
  81. ( ~) v0 Y+ G# [& n% [) l
  82. module_param(acnt, int, S_IRUGO);+ a8 X; R8 o, q6 R3 i
  83. module_param(bcnt, int, S_IRUGO);
    + k- l9 `4 F9 ], |" E, K, ^! M. [; w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: K9 u" H% ^0 `( |/ n- ]7 f. s

) C7 u( E; n- ]/ ~, \* W1 ]; _7 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( N! m2 f0 S' t* d6 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ }! M% Y7 n# w( d3 z8 L! m2 }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 q! N/ C8 t. J6 F
; y/ Z* _: X( O& Q9 \+ c8 V( K
  A7 G7 R- H# ~3 M4 A2 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 06:47 , Processed in 0.038852 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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