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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' K7 S  P& b" w6 h4 V4 r+ X
  1. [code]EDMA sample test application
    8 U' R# P4 N; I: l& D& b, P
  2. /** r$ X1 `" I% p$ b7 Q1 |
  3. * edma_test.c
    0 _3 G3 J  Y2 }3 {6 d
  4. *# T1 _+ R% F8 F" b1 e  \
  5. * brief  EDMA3 Test Application
    . K* U1 Y0 y2 j( M+ B
  6. *. ^! H0 a) b7 _6 i$ K1 z
  7. *   This file contains EDMA3 Test code.! |/ j  ^" H1 T
  8. *7 w% r: r9 L; l) Z7 K" }! Z) L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& m$ e. |! a  c) @# u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( p, l# b; c2 d' U# q3 m) k: C, M0 p" C  {
  11. *         TO CHANGE.0 g; j+ j0 z: x  x9 f
  12. *
    # f0 _+ ~. I- F* U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 A$ R. p  ?' y/ J" }
  14. *; t6 M# Y6 g: L+ |: z( q' d8 T
  15. * This program is free software; you can redistribute it and/or' {" S, {/ t/ i$ G6 `
  16. * modify it under the terms of the GNU General Public License as
    0 x# t- ]0 A( Z1 q& `
  17. * published by the Free Software Foundation version 2., w9 y4 n$ u  F  c& r
  18. *
    1 c9 H. {6 N8 J1 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" |( L% h4 m7 x: d3 W' u7 d8 ?$ F
  20. * kind, whether express or implied; without even the implied warranty
    / [/ w6 Z. t" R. y. l. z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : J7 a3 O, b; \! e0 h4 g! s
  22. * GNU General Public License for more details.3 B( v' @0 m, k9 R+ H
  23. */
      G6 p  w# {# W8 O0 L

  24. 6 a* a& L* }- Z
  25. #include <linux/module.h>
    * u) l* L" s4 a* v" @* B- Y
  26. #include <linux/init.h>( l  ~6 I# A# f) b; U( N
  27. #include <linux/errno.h>' v! q- G) y* b5 O7 ]
  28. #include <linux/types.h>
    7 K, |7 M- E( b/ Y; Z0 _
  29. #include <linux/interrupt.h>
    ( S% B& e3 u0 x. v8 e
  30. #include <asm/io.h>
    2 G( ^5 P, I3 `; ?" y0 L4 s  Y
  31. #include <linux/moduleparam.h>
    1 q* m# {6 i) X4 u8 H
  32. #include <linux/sysctl.h>
    * D- r7 L: |8 Y/ ~6 w( \9 G
  33. #include <linux/mm.h>
    ! t* w. Q2 `+ {: [4 [) X
  34. #include <linux/dma-mapping.h>! k" Z& t$ a) I

  35. 0 _: G$ i! l3 u! U# }6 {
  36. #include <mach/memory.h>
    3 l6 C, z6 Q: k" i9 A( E
  37. #include <mach/hardware.h>2 A6 ]9 V' _0 B/ M: X- @8 |
  38. #include <mach/irqs.h>& @: d1 S! ]" p) J, @2 y
  39. #include <asm/hardware/edma.h>
    # U5 q: A6 W% @! P$ A3 z4 F
  40. 4 I6 @4 s, S- f7 P' G
  41. #undef EDMA3_DEBUG
    0 E- ~7 `* a4 l. @
  42. /*#define EDMA3_DEBUG*/- K  B* S$ v% b% m4 T

  43. . K& W# |# ^( C$ u
  44. #ifdef EDMA3_DEBUG4 E: Q0 g$ L% t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      [  z: f6 w4 y4 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . L) ~' o' [. d# x% N% p/ H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; H, C5 y  N) |6 f8 Z+ q9 p7 b, L: Q4 y/ o
  48. #else- L7 t( E1 W1 y. V
  49. #define DMA_PRINTK( x... )
    2 T; ?$ \* H1 ?2 M# a1 i
  50. #define DMA_FN_IN
    ; M; _0 P" X; Z+ n
  51. #define DMA_FN_OUT
    8 v! C; U1 H9 T, M! ]/ w5 Z
  52. #endif
    ( j7 |1 C3 s1 e% \; L4 w, `3 ^- y
  53. 8 c7 l( L% j3 f- h+ W/ Q: F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 |0 n7 g6 b8 b% B" s
  55. #define STATIC_SHIFT                34 X  G) X$ X( g8 W
  56. #define TCINTEN_SHIFT               20
    , N* B  k1 Q$ q4 p8 w; Q; G& M
  57. #define ITCINTEN_SHIFT              21) s. z7 ~" i, K7 {2 G* m. r
  58. #define TCCHEN_SHIFT                22
    1 @/ U7 R  F) H  o- A% p/ P
  59. #define ITCCHEN_SHIFT               23" q! g& O) Y2 R: s4 Y' F, g

  60. 3 ~* y4 u! B( i# ?7 T3 O
  61. static volatile int irqraised1 = 0;
    0 y" u1 c% h+ ?  u
  62. static volatile int irqraised2 = 0;2 m6 N# d8 t. ]6 c) G3 w

  63. ( ^, ~0 T/ Y! _) |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & }9 P. D- P& T% i) L8 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ^; _" O& g3 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- V1 s: c8 v; I: |4 h
  67.   G7 z4 {( P5 a9 w: J3 _
  68. dma_addr_t dmaphyssrc1 = 0;6 Z$ r4 l3 [- c' Z+ P3 U
  69. dma_addr_t dmaphyssrc2 = 0;
    , |7 \8 A/ T: P; M  @( V
  70. dma_addr_t dmaphysdest1 = 0;/ o! @. V& B  g: T/ N+ D- M
  71. dma_addr_t dmaphysdest2 = 0;% l! e. H+ c( C% D
  72.   o% q1 j* [6 {: _. a; x4 g% c, b, ~* U
  73. char *dmabufsrc1 = NULL;
    8 g( O& N: w+ `# Y4 U8 _
  74. char *dmabufsrc2 = NULL;
    * ~' w" h2 x- O. H) `! X- {
  75. char *dmabufdest1 = NULL;; b+ \2 s$ s9 e  s& N) |, [% u
  76. char *dmabufdest2 = NULL;
    , n  N  @2 l/ {$ v  s& k

  77. 2 j$ \* }3 `& k, h9 H% f: r' R
  78. static int acnt = 512;
    1 E* Y8 W  a/ K9 m
  79. static int bcnt = 8;& L. Q" X/ S5 D" J4 |/ X
  80. static int ccnt = 8;
    $ F; ~# ^6 ^2 N6 `

  81. & @  ~$ c7 L9 e, D5 U9 }
  82. module_param(acnt, int, S_IRUGO);, ?0 h0 C! a+ Q& D" ^, c
  83. module_param(bcnt, int, S_IRUGO);
    ) q  A) J  E! B9 x6 l  D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" K8 n' {% E4 ]7 o' _
3 W, n, B$ A2 |2 t9 ^5 L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! n3 z' v- g9 W1 b* s2 a8 Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 O0 t& q  o/ F+ r8 N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" s2 `- z: Q0 y7 N9 F: R
, Q6 B! z1 O6 o/ t# L  P6 P5 L  R; Q7 b6 a( I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 19:19 , Processed in 0.036653 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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