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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) p0 _0 C3 d; n" K5 v1 Q. i" c
  1. [code]EDMA sample test application( |. Z6 }, E. _. _8 |9 s
  2. /*
    : r2 }# p6 S. s5 t
  3. * edma_test.c
    6 I7 C, l4 {2 b+ a
  4. *
    # ~" i2 t1 f- t( G" m3 M; s
  5. * brief  EDMA3 Test Application. I' M6 p8 N3 z7 m- Q$ A2 c
  6. *
    3 V; j3 M& @) ]. @& v) X  F
  7. *   This file contains EDMA3 Test code.$ y& C4 e2 U4 X# w) g8 \
  8. *9 M( {' u/ A& Q% `  H/ h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ e$ H6 ?, e$ y# W) q* x9 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 R( ~1 e6 ~6 }
  11. *         TO CHANGE.
    1 {: c0 P2 F( J
  12. *7 y4 X2 P9 b1 @, Z! L, [* n* |5 k! u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) D, `4 Y& {: h& C& }/ r* L$ G
  14. *
    " t- Y' u! y- Y* P6 l1 S1 ]
  15. * This program is free software; you can redistribute it and/or
    : q/ x5 h4 J1 ~5 a
  16. * modify it under the terms of the GNU General Public License as
    3 Z; B( W1 k  \8 l
  17. * published by the Free Software Foundation version 2.
    9 }. N* C' _; \7 A
  18. *3 a  @( k, T2 w' d6 o1 c: C' }) h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 `" }" y( D3 ^# S
  20. * kind, whether express or implied; without even the implied warranty
    1 ?9 y5 K* A' l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 v/ z9 s9 j1 r6 c1 J' R
  22. * GNU General Public License for more details.
    # s0 t1 g: z! K, @
  23. */
    ( W/ [0 a6 x! l" L
  24. 4 p$ e* |4 ~8 k8 n+ o) w, t
  25. #include <linux/module.h>1 V. K* Y( T  c. Q7 j5 ~7 l2 \/ H+ V& u
  26. #include <linux/init.h>! J' _  [4 k+ B" M: b* K; y
  27. #include <linux/errno.h>& ]' d7 p7 U4 d3 h
  28. #include <linux/types.h>
    7 K; t" {/ z6 ]& R0 ?! v) ~4 ]
  29. #include <linux/interrupt.h>, a/ z( w6 ?5 y7 I% T
  30. #include <asm/io.h>: f" I, O7 S+ q$ E
  31. #include <linux/moduleparam.h>
    : Q2 y9 R7 M+ _
  32. #include <linux/sysctl.h>
    ' x" L. |8 e3 C9 p
  33. #include <linux/mm.h>
    + k- E7 e7 Q* R' d
  34. #include <linux/dma-mapping.h>
    . I6 `4 O0 k; ?$ F9 }  f: O6 F

  35. ; V/ C! i" o) U/ v: `
  36. #include <mach/memory.h>! Y- f9 s1 s- U7 {" }- X5 B$ x8 X' h
  37. #include <mach/hardware.h>
    6 I& f2 p' m& w) C% A9 j3 M8 B) n
  38. #include <mach/irqs.h>
    7 q7 ~. \: p/ q# v/ F! K
  39. #include <asm/hardware/edma.h>; @0 c( E7 d' g7 h1 P% P
  40. 4 p* w- j, `) @* c6 c
  41. #undef EDMA3_DEBUG: t! w  N4 \6 Y7 ]. @8 n+ T
  42. /*#define EDMA3_DEBUG*/3 v) ?+ I( g7 q

  43.   @0 S) [+ @% `# ~* I
  44. #ifdef EDMA3_DEBUG* \9 H- g  ^# u5 L1 N: T0 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 x$ T) _) W( L* G4 @, R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      W, \6 c# D# U* L) n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ s; A6 k# H, N8 W2 m& Y* t
  48. #else
      S$ f1 B8 `/ _/ _1 K( b
  49. #define DMA_PRINTK( x... )7 D" n) ^' d2 e( r; ?2 v; J, V
  50. #define DMA_FN_IN( x0 c; \1 i* f- C
  51. #define DMA_FN_OUT
    ! \7 S1 z3 X9 A) T% i
  52. #endif
    5 l0 h/ T! C6 X  }

  53. ! E% D, p- H& j8 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 K6 Y4 M  a; P$ t$ n- p" b
  55. #define STATIC_SHIFT                33 k7 ^: z8 I$ V; g
  56. #define TCINTEN_SHIFT               20  T2 v$ p  {/ N
  57. #define ITCINTEN_SHIFT              21+ H4 _) M, s9 G& O8 j# V
  58. #define TCCHEN_SHIFT                229 @7 Y7 L* Z+ _; k4 ?
  59. #define ITCCHEN_SHIFT               23
    2 z% z' {( X0 S0 d& k1 |  m

  60. ! A" M* P$ o5 L7 X
  61. static volatile int irqraised1 = 0;
    1 {" n- w/ R5 ?& y0 d
  62. static volatile int irqraised2 = 0;
    4 o7 G6 N  Z5 l7 t! l# U' H5 O

  63. 3 Z% c( t3 Y9 u8 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F4 u$ B+ `( v  Y1 L1 `9 r' r; Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o% _3 Q0 O5 h8 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G1 {$ c, E7 [
  67. 6 d. M) ~; s) H
  68. dma_addr_t dmaphyssrc1 = 0;
    ! e2 b; a+ b( x0 q  H# j7 e
  69. dma_addr_t dmaphyssrc2 = 0;
    $ J+ ]: V# M- g" s! z: M
  70. dma_addr_t dmaphysdest1 = 0;
    ; o3 i3 c2 e' i  w  y7 T( z
  71. dma_addr_t dmaphysdest2 = 0;$ r0 @3 B( W: i; `
  72. * H2 b% H1 X9 z* |
  73. char *dmabufsrc1 = NULL;
    * ?, f& Q' I5 r* ?- D5 v
  74. char *dmabufsrc2 = NULL;% @( @8 c# x* B% ~# H4 f9 G$ M
  75. char *dmabufdest1 = NULL;
    " D  ^3 k( f4 a# H) \* L
  76. char *dmabufdest2 = NULL;; k/ \! g+ m4 c0 ^- ]- e

  77. 0 n; z& Y1 c( _, v
  78. static int acnt = 512;
    ) L; n: ~% `9 n$ E- \3 p
  79. static int bcnt = 8;
    " y" z# _2 z0 b8 K- K2 O
  80. static int ccnt = 8;4 V# H" \$ g" L' v9 D& s) R& F& ^  L7 x* {

  81. $ ~4 S. U9 O# Y: u1 ]1 ?
  82. module_param(acnt, int, S_IRUGO);
    . }) [& N, B! @
  83. module_param(bcnt, int, S_IRUGO);/ N# @/ j& w0 w) E3 o' ?9 d: G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. n+ J& G5 J/ G0 M: h

' |" n; Y/ F6 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 j  w3 H$ a! T" v6 _: ?2 h* Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* Q: ^+ x& ]) O9 ~2 p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 @# ~0 m& ~2 c" t- G1 R
% m$ G$ Q0 \: K
0 ]" j% k3 c) T8 Y5 h. V3 A! S) b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-4 03:23 , Processed in 0.041449 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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