OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ \& v( U9 k- J  C# y' I
  1. [code]EDMA sample test application
    * B8 @5 |* C8 v. ]
  2. /*. B9 r; q( T  d
  3. * edma_test.c
    ) J  {# ]! }* ~* f% V" [
  4. *
    / c. a, l8 {. V+ ?* _
  5. * brief  EDMA3 Test Application: o) _: d/ M% B' G
  6. *6 n# v' [# S4 g. {/ n
  7. *   This file contains EDMA3 Test code.$ z5 q' s& f# t( |  k
  8. *8 Y$ }) J5 a% ?6 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: W. r. k: ~& j2 |7 U3 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( O% Z0 q, U+ L+ f
  11. *         TO CHANGE.
    # _; ]: R/ \' u& E
  12. *
    9 G  k0 L2 ^: C* o/ J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 V1 x" G0 G8 t$ _- Q
  14. *8 b# ^: r3 o# u
  15. * This program is free software; you can redistribute it and/or, w8 Y3 \% e! W6 L5 q: y; S) _
  16. * modify it under the terms of the GNU General Public License as
    1 T. i9 ]0 n$ h9 y( o& C
  17. * published by the Free Software Foundation version 2.
    7 t# f" L: \. |; C
  18. *
    8 [( }" R# p6 @5 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 M5 Z+ P2 }5 l/ U7 \; l' ^% x4 Q
  20. * kind, whether express or implied; without even the implied warranty% z8 V7 D' x) B6 z. J8 V7 l; @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 {  m- `3 ~3 H' L
  22. * GNU General Public License for more details.
    6 h1 ?5 W  l" c1 S' j7 ^, }$ H
  23. */
    ( \  q: P1 W" R

  24. + P/ @9 h% ~. h
  25. #include <linux/module.h># C/ Y0 K* a. ~4 a
  26. #include <linux/init.h>
    7 h) f- I% v% q4 B- o" W
  27. #include <linux/errno.h>
    5 `4 `* c8 l/ s8 N
  28. #include <linux/types.h>7 a/ r6 L3 [. W0 f) s
  29. #include <linux/interrupt.h>- L" S/ j0 I5 Z7 v& h0 ?' e6 O
  30. #include <asm/io.h>6 m0 V# ?" U& v5 Q! O0 a$ V
  31. #include <linux/moduleparam.h>% R- \+ ]. a  |0 k6 H) z$ ?
  32. #include <linux/sysctl.h>9 X5 c# D- S" U  w. K. L
  33. #include <linux/mm.h>
    ; K' Z, L! Q6 E! l6 ^# e3 l
  34. #include <linux/dma-mapping.h>
    2 O5 C7 X3 @" c4 _6 K" f

  35. 4 V! G+ P* |( w
  36. #include <mach/memory.h>8 f6 s2 r# s  {' \& `' K
  37. #include <mach/hardware.h>/ W3 Z- G7 {. A; A
  38. #include <mach/irqs.h>7 @, B( Q# y$ O3 j4 n
  39. #include <asm/hardware/edma.h>+ w( @, f. |/ r4 `+ K' V
  40. 1 _  a! Z' w6 A7 S6 g2 w
  41. #undef EDMA3_DEBUG' U" J- a, X6 w7 T: E  {
  42. /*#define EDMA3_DEBUG*/: V+ g) L9 }4 g, E. e

  43. , T, G3 [% e! x7 S+ y  q2 o2 b" A
  44. #ifdef EDMA3_DEBUG
    - M* `. I+ Y  B' A& `$ Q3 {' R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( e/ M( \5 H) m* Y. p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! C9 n# o* U9 K! Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 {6 g; O: U  G+ `- ]$ _
  48. #else
    % s9 o+ |) y) s" P/ D9 K1 i
  49. #define DMA_PRINTK( x... )
    9 W) M% G( q# e' m# l7 F& w
  50. #define DMA_FN_IN
    0 x. _3 [. _4 F, ]0 ?5 M
  51. #define DMA_FN_OUT
    ; f8 i* q- k& h
  52. #endif
      s' D8 f4 f; E' {5 g' F
  53. - [# u; C$ s: S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 o( ]' r$ S  R" c
  55. #define STATIC_SHIFT                3
    % n2 L* @' `/ Q0 I# E
  56. #define TCINTEN_SHIFT               20
    : r: W9 n& I: [% \2 W
  57. #define ITCINTEN_SHIFT              21
    8 [9 P$ X2 e$ I/ C( s2 i- c4 u, h
  58. #define TCCHEN_SHIFT                22: n  t) x9 u! H& f
  59. #define ITCCHEN_SHIFT               231 {( P1 o$ ~# p' J/ x4 D3 ^! E
  60. 9 _( G$ ?( x3 K( J3 Z2 g( v
  61. static volatile int irqraised1 = 0;
    9 B" `% m% V3 m" w" @
  62. static volatile int irqraised2 = 0;
    ( A* T! o9 z; S
  63. # \4 p9 g$ y# n9 @$ _1 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 e, Y1 N8 j1 n8 z" L) n: d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : x4 @! W0 O; S# t( ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " W; _( d1 R' v* A5 v, J
  67. & l) R: i$ E& P4 |) f, l# ^/ t
  68. dma_addr_t dmaphyssrc1 = 0;
    . p* m% _# F$ n2 W
  69. dma_addr_t dmaphyssrc2 = 0;
    : c4 k/ h5 ~# U/ X
  70. dma_addr_t dmaphysdest1 = 0;
    4 a- U0 Y8 E7 [/ k* [5 {3 T0 X
  71. dma_addr_t dmaphysdest2 = 0;* G2 E- i2 a3 n2 g: A, i) }/ g$ r% ~7 ~

  72. 8 H( {  {3 h4 H. d
  73. char *dmabufsrc1 = NULL;
    5 i* M. b! t2 Z; e* R: ~' y
  74. char *dmabufsrc2 = NULL;: g( y) \8 V: {; y4 y+ D* j/ n  c
  75. char *dmabufdest1 = NULL;% C0 [: X' t# S2 ], a( m4 W/ U: s
  76. char *dmabufdest2 = NULL;
    & ^1 j) C4 U9 q6 ?, v4 P
  77. * C+ f' }( ?. j
  78. static int acnt = 512;6 t' m! i8 }$ k; r7 o  ~
  79. static int bcnt = 8;
    / E4 P" `8 b3 q* x, {/ \( r. j
  80. static int ccnt = 8;  n& b7 U% D2 ]3 j& @
  81. 2 w" T) @0 `+ L; e* `# Q) v
  82. module_param(acnt, int, S_IRUGO);: J2 n/ [3 p$ R; s' _+ i) W
  83. module_param(bcnt, int, S_IRUGO);( B/ W. I, Z4 i0 D- ~4 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# f2 v2 F% C9 _$ T& {& n8 x! S) Z( H5 @' H' W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. L' O; @& M8 E3 H1 P; _4 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ J- `: y* x) F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 M8 T# L5 r( e

* \/ Y$ x/ F3 A9 |- s$ h
; C( M/ q8 x) T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-1 01:35 , Processed in 0.041024 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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