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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / D, T, G" [  k- T3 d. o- B9 H
  1. [code]EDMA sample test application
    4 f5 W; Z% R6 g! v1 l6 V
  2. /*
    4 l& p3 I4 @" ?/ }3 _
  3. * edma_test.c) }- m8 @1 s8 P) W4 R( k8 k' j
  4. *
    % \# \# ?: x' a, d
  5. * brief  EDMA3 Test Application
    * {* }" O) `2 ?% r
  6. *  V5 R" S, Z$ E! k/ L& S! \0 N
  7. *   This file contains EDMA3 Test code.3 n# W( H" j4 f1 i- t
  8. *, p9 Q; d; t$ N+ I& a' Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 G3 f: @' T9 i" Y" T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / a9 j$ ^* ?& C, O6 M* h0 m+ V" }
  11. *         TO CHANGE.
    9 h* r* W8 l% e! Z2 ?5 {
  12. *
    * S* v/ s) `) T2 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ o' \  r& p$ v
  14. *" v* ^) k! i: U7 q0 v" E8 B
  15. * This program is free software; you can redistribute it and/or
    & e3 F7 _; A4 n+ Q6 e
  16. * modify it under the terms of the GNU General Public License as
    1 o5 L; C- m. o/ o
  17. * published by the Free Software Foundation version 2.
    : n6 e+ B/ U/ g* e$ {5 s- \5 B  R' l
  18. *$ q/ J  g4 _7 F- S, \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 m: T2 t# b- h2 t2 h
  20. * kind, whether express or implied; without even the implied warranty2 }2 K  y; ?% i3 s, r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 v4 Y; @& N; S7 b) C+ ^
  22. * GNU General Public License for more details.% O% H# v. |3 J" Q
  23. *// }! E1 P( N( t
  24. 2 Z. w9 B2 ]* n; ]& y) J
  25. #include <linux/module.h>
    / C5 Q7 r5 s4 r2 V: h
  26. #include <linux/init.h>
    , i( X# V3 O. Q8 f! h0 K' b3 f9 f
  27. #include <linux/errno.h>: S1 Q6 c6 i- z
  28. #include <linux/types.h>
      A: D* L4 w" c" v3 D) [! y, Z) Y9 e
  29. #include <linux/interrupt.h>
    ( E- c7 p. ?/ A
  30. #include <asm/io.h>( D5 s/ M" H+ J3 e( Z
  31. #include <linux/moduleparam.h>
    4 n/ b! r' f, D7 Z  ?) y
  32. #include <linux/sysctl.h>0 q- f" c2 k9 `
  33. #include <linux/mm.h>5 Z# I) I" p2 g! n9 n9 W
  34. #include <linux/dma-mapping.h>
    - L0 B* B8 P8 v: E9 S

  35. ( k$ |+ \% t# C. @
  36. #include <mach/memory.h>: N# F4 h* T% r% A1 g: `
  37. #include <mach/hardware.h>9 U/ B+ V" U: b. K* v" q. F$ A
  38. #include <mach/irqs.h>
    2 E/ ^( M& V/ n
  39. #include <asm/hardware/edma.h>
      j6 L  f7 N6 ^6 b$ \
  40. , ^4 {9 y* F) {6 g2 @5 q
  41. #undef EDMA3_DEBUG; W4 N3 ]4 B; \4 k0 P4 ^/ ~
  42. /*#define EDMA3_DEBUG*/4 o6 d! A. S7 ^5 @9 _" d! n
  43. ) C' D6 |+ t$ ?% w+ \
  44. #ifdef EDMA3_DEBUG
    9 d; [" [1 B2 o8 ]0 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 @0 a% H9 `2 v7 @. s% S' d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 v/ y) e' C: V6 [* ~, n8 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & v: G( f: e- T; B9 H
  48. #else
      O3 |3 Q5 U, T, M* N$ T6 {. l: c/ g
  49. #define DMA_PRINTK( x... )8 s6 J, Z4 o) j0 g/ T; O1 z# N! V8 ~
  50. #define DMA_FN_IN' S6 U) |  R* G" M! U* U' i
  51. #define DMA_FN_OUT! M; y# W: T$ b3 ~* F+ g0 r
  52. #endif4 @9 t: C& U5 A9 x) |4 _

  53. $ u( B( V8 v) a% v0 h( I: B8 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " {3 F' u* e4 i; y# S! O
  55. #define STATIC_SHIFT                3
    " j  x" c" l; _- k1 h
  56. #define TCINTEN_SHIFT               20& G7 R$ f3 O  L7 i( k- G
  57. #define ITCINTEN_SHIFT              21% ?# Y' }: w( o4 z# X. H
  58. #define TCCHEN_SHIFT                22
    5 b* r: B* y& Z! u& f
  59. #define ITCCHEN_SHIFT               236 P5 S( P8 p/ B7 d7 I1 H8 C. ?, f
  60. & h/ d# b* }' _" C/ ^& I
  61. static volatile int irqraised1 = 0;
    , f; \8 A9 C" \  }% Z
  62. static volatile int irqraised2 = 0;
    8 X8 \7 P: K7 H7 g3 |7 g
  63. 6 z4 z* W: U6 i& F8 l2 h2 Q. I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Z/ n7 q  ?2 W4 A  z: t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      E, q  d' m) F4 \* S& s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i) n2 u, n/ v" u3 \

  67. % K) }6 i3 G) Z
  68. dma_addr_t dmaphyssrc1 = 0;8 Y" a! E/ ?1 F& G5 J) z/ P
  69. dma_addr_t dmaphyssrc2 = 0;
      F) Y* T' z: x" l! L
  70. dma_addr_t dmaphysdest1 = 0;- S! B/ ~7 g% M4 b) ?! B
  71. dma_addr_t dmaphysdest2 = 0;9 E! C' H/ l3 n2 V1 M

  72. 5 K; |5 n2 X* g: A) w
  73. char *dmabufsrc1 = NULL;$ ^7 U# n3 b9 y# n" Q  M
  74. char *dmabufsrc2 = NULL;2 q- D4 ?/ j1 [
  75. char *dmabufdest1 = NULL;
    " L' p: @8 D+ s/ Y  x* ]
  76. char *dmabufdest2 = NULL;
    + c5 r4 r5 j1 p+ B) u
  77. 0 n7 @( S: ]0 [; X; S' a2 u9 D8 U* s
  78. static int acnt = 512;* [2 k& q, R9 G; A7 Y
  79. static int bcnt = 8;$ |; s& I3 U2 D6 O8 @1 X  l
  80. static int ccnt = 8;6 c" A: }' a: S8 W/ |" c6 j$ S

  81. 3 G# G" k9 d1 ~* W, z/ z( j
  82. module_param(acnt, int, S_IRUGO);
    3 T; ^* ~7 ^; x  @
  83. module_param(bcnt, int, S_IRUGO);
    # `0 `( i2 b( ^2 y% U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ z  t( I1 j' ]: w
6 J  `4 s9 k$ ^) c$ R/ }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! s4 Z) i& P5 o- D" U: n' Y+ z) _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: X3 C! l6 L  w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  v" e0 `  g. J& d* A9 `- r4 x1 h: b" X4 C

$ K8 {' ?# F8 i# L6 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 16:33 , Processed in 0.036130 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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