OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 \$ _. c: k' k7 ?! \
  1. [code]EDMA sample test application1 o; `6 J7 `5 z0 q/ S- D* h
  2. /*
    - }# z6 J$ ^2 P0 [7 F$ i; E* t! |
  3. * edma_test.c! c  o" _5 {/ N& I  G0 G
  4. *
    / V2 m; E3 X, u
  5. * brief  EDMA3 Test Application$ n3 r3 r2 W; U1 R: r, G3 H! m
  6. *
    8 n) n1 i. ?+ x' R0 |" Z& z/ j
  7. *   This file contains EDMA3 Test code.
    $ }& x6 m' I, }% U
  8. *
    3 k. Q/ X5 f& K- Q& X1 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& u8 R: H, h0 p: o$ L1 K8 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 z/ c5 K, @$ j& H" J; k
  11. *         TO CHANGE.
    ; X* C6 L' r+ ^
  12. *) e  F. p& A3 |3 L8 l) T9 T, w& o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' K% a4 G+ m) R
  14. *' }6 I" Q) y( {$ ^2 W4 S$ u$ j+ P
  15. * This program is free software; you can redistribute it and/or
    ) N. W' D3 n; {* R2 [
  16. * modify it under the terms of the GNU General Public License as
    ! b4 J( K6 T2 d: U& ?& E, o1 `
  17. * published by the Free Software Foundation version 2.* L% T/ l" n5 \& a: [1 |0 [; Q
  18. *
    * ^0 j) u: ]% N5 c9 n1 B! `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 @. H; z) G" w0 N& \7 O3 y* Q
  20. * kind, whether express or implied; without even the implied warranty
    ! s- c% U- q7 H1 j9 ~1 B2 g# }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; a0 g" F8 T+ ]0 h* j! e- Z/ ]
  22. * GNU General Public License for more details.
    8 K3 ]1 T" E3 Q, ?  S- h& ~
  23. */3 M  f2 i1 p  R
  24. ) D1 B* H; |* x5 p* A5 r8 E
  25. #include <linux/module.h>
    8 U0 ~. H7 r' T3 C
  26. #include <linux/init.h>( u5 Y' j2 N5 x" U8 {
  27. #include <linux/errno.h>2 J" C- Z& C' Y6 l9 R
  28. #include <linux/types.h>
    : C0 m8 A& M4 _5 w
  29. #include <linux/interrupt.h>! R% p% z. h8 I: t! }2 W+ m
  30. #include <asm/io.h>
    # {* O. J2 H$ \9 ?7 B0 \
  31. #include <linux/moduleparam.h>
    / A) z% c7 w( E0 |8 E# m; i1 o% ^
  32. #include <linux/sysctl.h>
    " f! v$ c) g  b% q& Z* \$ h# ~
  33. #include <linux/mm.h>
      k) G- }: x1 u% |5 M2 W* ~, f
  34. #include <linux/dma-mapping.h>
    1 {5 f2 |  z+ L
  35. ( H5 N, j9 O" h1 }: f- w! _: y
  36. #include <mach/memory.h>. H2 s1 ^0 r* S/ j+ m
  37. #include <mach/hardware.h>
    ) h: b! A! _$ i1 r
  38. #include <mach/irqs.h>2 M9 _, @& K& \- G: ~* o, O
  39. #include <asm/hardware/edma.h>7 W+ A( X& F! @8 y/ E& ]7 p7 J
  40. 9 a% Y6 O8 G7 y- K2 R
  41. #undef EDMA3_DEBUG$ ^% @# v8 ]/ u. E5 x
  42. /*#define EDMA3_DEBUG*/! x: g8 w4 r# x' G4 n. v
  43. 8 d4 o3 |7 Z; `) q( L1 r
  44. #ifdef EDMA3_DEBUG
    + }, j3 [  u) ^( M. }- Q0 @, F/ N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) [+ U! ?3 u$ Z( i1 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- O- f0 `: a+ \) ]: M* m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 u$ g! w) Z6 k5 L
  48. #else; Y: c# ~* ?# E: |  R
  49. #define DMA_PRINTK( x... )$ [7 o6 H2 G- V3 P% D1 D0 g+ _$ \
  50. #define DMA_FN_IN7 k0 Y& \6 L: Q7 h+ Z
  51. #define DMA_FN_OUT
    + d" x6 y. v: A
  52. #endif
    6 C' T3 v9 O; }4 T4 r3 N2 O
  53.   ?, g2 u$ t% m( B2 h  \, r4 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! _6 k; N% F) Z+ ?3 `6 Q& \
  55. #define STATIC_SHIFT                35 b7 R, I$ `9 ?* \
  56. #define TCINTEN_SHIFT               20
    % v2 Z7 d( N# W/ H; J
  57. #define ITCINTEN_SHIFT              213 |9 A# }0 x3 T" ~& ?
  58. #define TCCHEN_SHIFT                22
    9 g$ X  B) s$ ~. D0 ]
  59. #define ITCCHEN_SHIFT               23
    7 w* i7 d$ U7 d: c1 u2 g9 |
  60. , G  l/ ]) p5 K& F) a! c
  61. static volatile int irqraised1 = 0;2 c& i% U% _2 D) h7 k; k( m
  62. static volatile int irqraised2 = 0;
    ! j1 g: N1 ^! N- n) r

  63. / Y' [$ H4 f9 Z8 E1 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 B( D) Q3 {, j& V, R) o5 U- y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 W8 V' G) x  V$ P9 k1 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % \) B1 B! b7 Q" I3 |

  67. 1 j0 |( s9 U2 }& E8 n
  68. dma_addr_t dmaphyssrc1 = 0;, {9 ]6 P3 ~+ t8 r4 R
  69. dma_addr_t dmaphyssrc2 = 0;
    % M/ [* U1 |% r8 y  K: U7 k$ @5 e
  70. dma_addr_t dmaphysdest1 = 0;
    - r4 {' R- M5 s) }
  71. dma_addr_t dmaphysdest2 = 0;
    8 V& c3 ]. n) y5 }: s6 G6 J

  72. + ]0 x- _1 T% e' T8 }7 S
  73. char *dmabufsrc1 = NULL;
    5 ?) Y$ K  _  p0 g* J+ E4 Y
  74. char *dmabufsrc2 = NULL;
    3 b3 H1 |+ T- T  S
  75. char *dmabufdest1 = NULL;
    * ?- G2 S2 U# [8 \1 M0 |/ B
  76. char *dmabufdest2 = NULL;
    7 k+ U1 F9 s. n& j* K3 `% |2 z
  77. / R  x; m  N: y, A! U, ^( u8 V. G
  78. static int acnt = 512;
    " }6 \8 l0 w. E7 @
  79. static int bcnt = 8;9 S0 F) d; i# x" E4 b
  80. static int ccnt = 8;
    7 A. [" I; J- y% B1 j- B" s5 S) {

  81. " N' F/ Z3 D! A* K  m4 P% q
  82. module_param(acnt, int, S_IRUGO);
    ) D8 f" I2 k3 n$ ~; p. K
  83. module_param(bcnt, int, S_IRUGO);* a" G% Z; W( I! u6 c* |) b! I* ~0 c7 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; g7 g; Y; \- f9 }. q( S6 b+ x

% z* b1 {3 D9 U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# X8 g5 v/ `( j, Iarm-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 ]' p( ^1 u+ |  u: u) m) h5 ?. ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 ~. k2 ?1 ]) G( L. b0 ~
; o8 B3 J/ O# v( C: q0 \, ?8 _- [0 c2 J/ d8 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 22:52 , Processed in 0.039242 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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