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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  i5 S  U- H# ]) R1 L
  1. [code]EDMA sample test application
    4 p  a1 M; L4 g3 N  r2 Y
  2. /*; g% N8 b+ N0 _. l
  3. * edma_test.c
    3 P  ]3 Q5 h8 c! }6 j6 d1 b- m
  4. *8 ~1 t: l+ j. y: b
  5. * brief  EDMA3 Test Application
    - e; C3 F7 c3 V) Y* h) _4 n# f8 J
  6. *  t4 D- \6 s" z2 m( [- d
  7. *   This file contains EDMA3 Test code.
    + J4 ~! C- R; s5 l
  8. *
    " v' P- }5 P6 m$ n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! G! L3 X! U, Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) z# i! w& O, j; M7 F
  11. *         TO CHANGE.! z5 [4 @) z: k  ^5 g/ V
  12. *
    4 M0 J: Y8 H" P7 g0 q3 T9 j# n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! `0 N9 v7 [% _. ^& ?( c
  14. *  {  b3 Q. \: {# @; l3 a
  15. * This program is free software; you can redistribute it and/or
    " f1 z7 G8 B: b* v# S9 v9 p
  16. * modify it under the terms of the GNU General Public License as
    # V+ E: F: z6 V* @/ y
  17. * published by the Free Software Foundation version 2.9 B. S4 ?4 |) p% \  V
  18. *
    + l* ^" P9 z# |! q6 Q( c6 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ M4 T9 ]; M# O  w  L3 P
  20. * kind, whether express or implied; without even the implied warranty9 F0 }- S) R  G, o/ M) R( C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + `+ H( [3 Y% V
  22. * GNU General Public License for more details.1 r, K( u% ?: p
  23. */) N% p  `- x7 w- _6 b5 \+ D$ f4 I
  24. ( {$ `  ]5 ^; c, ^% }
  25. #include <linux/module.h>5 }% |3 U% C# o* }) v2 ~9 l
  26. #include <linux/init.h>
    3 C; O- Z; O' Q/ }3 v* U$ d
  27. #include <linux/errno.h>
    0 l1 B' h/ J7 w% o8 x, V
  28. #include <linux/types.h>  f$ m7 U, m4 @3 Z9 X
  29. #include <linux/interrupt.h>) Y) `7 d/ ^  `# m! i
  30. #include <asm/io.h>& g8 P9 N  [. t8 D3 M
  31. #include <linux/moduleparam.h>
    ( K7 d( w% d+ J4 H; V( a! T
  32. #include <linux/sysctl.h>
    ! p, f4 l- {# A
  33. #include <linux/mm.h>6 E/ g' P7 |" `0 V5 n1 t" H
  34. #include <linux/dma-mapping.h>
    : X( S6 r1 p& v; T$ \' W
  35. ' `. {8 _# v. k, J, X) O
  36. #include <mach/memory.h>3 T( y, E2 k- O' @: v/ S  q
  37. #include <mach/hardware.h>- N2 Y' y. A1 @% [
  38. #include <mach/irqs.h>8 G9 H/ E; _  A
  39. #include <asm/hardware/edma.h>
    ) c( r7 m0 N% V' p, `$ l& a

  40. # R2 v* p2 _: U1 K: V6 d) a/ x
  41. #undef EDMA3_DEBUG. c$ U8 s, o9 F: P3 m
  42. /*#define EDMA3_DEBUG*/
    0 K0 X$ V* L5 }* b& Q
  43. & ?! Q) s- c: J& ^7 ~+ X; [) q1 b1 N
  44. #ifdef EDMA3_DEBUG" e- \4 f. O: n% j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" h1 J$ R' [  q7 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! A/ Q; H+ ~; g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). s  n3 S9 K  F: s% p
  48. #else
    3 `$ F4 W1 I# N% i$ r' l
  49. #define DMA_PRINTK( x... )
    ) ~' |2 q# {2 y/ n! ~$ k
  50. #define DMA_FN_IN" p0 d# ^( ^+ g8 Q3 B2 L
  51. #define DMA_FN_OUT
    , m% \, S( O7 K- x) \
  52. #endif
    & r9 e$ ^4 k- x( V, r. o# D7 h
  53. 7 s) N+ |  v1 w2 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  @0 V5 g; X0 Z* j6 Q" k5 L  p0 h4 ?
  55. #define STATIC_SHIFT                3
    8 `) k7 j% D9 T5 D
  56. #define TCINTEN_SHIFT               20
    0 c8 G" [+ N' g$ o; y+ q. s
  57. #define ITCINTEN_SHIFT              21' s5 A' x- g5 L. }* l
  58. #define TCCHEN_SHIFT                22
    / V7 B  l( {" s; n5 N; d
  59. #define ITCCHEN_SHIFT               23
    ; X) j0 X4 n  w- l2 A6 K8 i
  60. 4 {: {- z( ]$ H: K% W+ U4 w# m  _
  61. static volatile int irqraised1 = 0;
    2 |" k) u, ~( V# b2 u. S8 H
  62. static volatile int irqraised2 = 0;6 z4 q* |, ]5 a% p4 S
  63. ; F9 ^. [8 D9 j- G9 ~" a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , S$ j- i/ _% h* D: K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ^9 a  t7 W$ {8 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! O7 \  {* e6 L: j; ~' ~4 Q/ F
  67. ) h9 r% z7 |% D9 K' q' S
  68. dma_addr_t dmaphyssrc1 = 0;
    / ]( E9 N3 k( D/ G4 c6 I$ `4 W
  69. dma_addr_t dmaphyssrc2 = 0;
    " Y% D( w) M  E5 V; I
  70. dma_addr_t dmaphysdest1 = 0;
    * I! q8 S8 b- N
  71. dma_addr_t dmaphysdest2 = 0;  \" e1 |7 j; \% [- F' S2 n

  72. # U1 O" R7 Z+ j: _3 [+ @7 H, V
  73. char *dmabufsrc1 = NULL;6 x# ]- R5 I; I. w: y$ e
  74. char *dmabufsrc2 = NULL;+ P4 G5 o7 f! U7 Z
  75. char *dmabufdest1 = NULL;
    2 a" r) a/ l! j1 _5 }# W0 R: O
  76. char *dmabufdest2 = NULL;0 m, A. }/ X- ^: [' t3 k+ C
  77. ' g+ p! b/ q) J) F& }
  78. static int acnt = 512;
    7 Z) ]" R7 Y/ a* W
  79. static int bcnt = 8;
    ) u$ n7 q# K4 j* y/ ?1 i
  80. static int ccnt = 8;
    2 Z& w' m" S  k/ t2 e
  81. 3 v/ A1 h( j+ P1 n4 n8 ^% H
  82. module_param(acnt, int, S_IRUGO);
    6 b& y( K6 {3 @% o+ R
  83. module_param(bcnt, int, S_IRUGO);
    1 K( u. |' M* i+ _: x- U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- }3 k' a3 t6 x! V# }: w9 Q/ i# b
% \8 f8 p0 s$ I: Y  {$ W/ w% \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ?* X# |! l6 S' garm-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) h& t6 w5 G  _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" s: f/ B) N' B. {- O! p+ y1 U( y
; b0 A) f% x( I$ k, u# }. S& \/ n' b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 09:00 , Processed in 0.037807 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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