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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ^0 T5 x2 s- |9 Z
  1. [code]EDMA sample test application
    0 r: i1 ]2 k2 U4 ?
  2. /*
    1 ]+ {+ h% Z7 X' @  Y' s. c
  3. * edma_test.c
    ! s, H9 J6 }0 _! x
  4. *
    - P# G# }7 y# K3 E
  5. * brief  EDMA3 Test Application" c$ c/ }- K4 G. g/ F+ W1 ^8 L
  6. *8 Z  m  `/ n/ C4 U" n* l  c
  7. *   This file contains EDMA3 Test code.
    % s6 H% H! Y& _! Y; Q& I
  8. ** r: c3 k2 @& U$ T2 t, b$ f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ P7 W" G1 b3 n/ K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 k7 o( C& _' {+ @8 ]3 |; L
  11. *         TO CHANGE.0 s0 x2 f8 H1 g) ~2 x# e* V
  12. *
    & ]$ m( H4 G4 m& @. L+ b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! p0 E+ u( ^7 u
  14. *
    2 m0 ], V0 L  ^& U$ p6 S
  15. * This program is free software; you can redistribute it and/or
    . ~) s( }" _8 p
  16. * modify it under the terms of the GNU General Public License as) p3 V9 Q! y" l& m1 B3 w
  17. * published by the Free Software Foundation version 2.
    4 G/ N6 a( `: V  a/ _5 k
  18. *4 p% A3 U3 z* f1 D9 S8 q; M9 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 ~0 T, D+ V) n: r! [
  20. * kind, whether express or implied; without even the implied warranty
    1 T7 n+ ~) k+ I; L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; M4 E4 ~' p- p7 N. I
  22. * GNU General Public License for more details.1 k3 a9 Y- e: @! c7 K( F
  23. */
    1 J* X# y  v) v

  24. & g3 p7 O5 D' k. Y: U
  25. #include <linux/module.h>7 Z' _9 ^3 J4 x+ F3 Z% _# o; m
  26. #include <linux/init.h>
    + y- t/ m& b, O/ n7 a! k4 q; }
  27. #include <linux/errno.h>' l5 ]# s5 m$ e9 E; z9 y8 G2 T  R/ p* h- I
  28. #include <linux/types.h>
    * V2 \% b1 o4 h4 p% L
  29. #include <linux/interrupt.h>
    9 k: W! p0 x0 P3 R( M& ?" g
  30. #include <asm/io.h>' E/ W" `- R: @6 F
  31. #include <linux/moduleparam.h>: A" @  r& g. o& u4 Z3 d8 G
  32. #include <linux/sysctl.h>
    % C# b& T7 P- s% N' B; Z
  33. #include <linux/mm.h>; |1 c& z* H2 ^3 D" M
  34. #include <linux/dma-mapping.h>- I! l$ k/ Z, c: a  H# w
  35. ( @' a/ ?2 ~  I- C  b
  36. #include <mach/memory.h>
    ! s1 u1 }( r+ u1 z' O8 S2 U3 B
  37. #include <mach/hardware.h>
    : R& _- W, }9 ~6 d0 f9 j
  38. #include <mach/irqs.h>/ g7 L# J. }% e, `
  39. #include <asm/hardware/edma.h>
    # o) `0 r: Z0 e4 |9 P
  40. 7 X- V+ P1 Y& Z( ]
  41. #undef EDMA3_DEBUG
    6 v& \' h7 }( k, C( R
  42. /*#define EDMA3_DEBUG*/
    ; ^9 }. W# {" {4 Y0 @" L
  43. 1 E2 O; k1 ]8 ]. L
  44. #ifdef EDMA3_DEBUG
    1 R% W# l* r1 b7 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 H3 ]2 N) {  u7 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 x8 E& r# _( p) g- F$ @8 {% M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ r/ Y/ t0 f* P
  48. #else
    & G5 I0 @8 D4 r% u; J
  49. #define DMA_PRINTK( x... )
    : I5 y0 }7 z* t* f4 u
  50. #define DMA_FN_IN
    . x' L) I% d! \, r" _& Q
  51. #define DMA_FN_OUT/ f# c  _8 g" L! R6 F; t; q. M
  52. #endif* A5 u0 e: z: c9 j' f, m

  53. , ^" n- P2 I2 e" i) c% ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 C' S1 c" ?: K- F, L3 A& f, W( Y
  55. #define STATIC_SHIFT                3
    % ]1 M" [; z  K
  56. #define TCINTEN_SHIFT               204 Y) r# u1 @' U5 y
  57. #define ITCINTEN_SHIFT              21, B5 n  s, z- `# ]! m3 o- v0 Z
  58. #define TCCHEN_SHIFT                22
    $ |5 u! }1 Q4 L. e+ H' u
  59. #define ITCCHEN_SHIFT               23  S( ?' b9 g$ I9 p

  60. * \2 z( V( u: H
  61. static volatile int irqraised1 = 0;  f7 \& ?, t  s6 N
  62. static volatile int irqraised2 = 0;
    ; P* t7 e8 q# Y  _

  63. ( T1 d+ n& A# `. `" E1 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 C. w4 r0 n1 \; O( P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- n  {4 B0 ?; U) l8 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& y& D4 O) U! Z8 E0 {" H& o

  67. : L* i, s+ r8 s9 z8 j1 h$ _* {) V
  68. dma_addr_t dmaphyssrc1 = 0;
    ) d& p% D0 ?9 V/ T$ @
  69. dma_addr_t dmaphyssrc2 = 0;7 [; g" s, d0 d, m$ v  R. b. }
  70. dma_addr_t dmaphysdest1 = 0;- q2 a( C+ }/ h5 U* u. g
  71. dma_addr_t dmaphysdest2 = 0;
    7 [( ]0 o1 k7 \) f6 ?. m
  72. 9 M' S  a, ^# y; }( t: _) o
  73. char *dmabufsrc1 = NULL;
    0 r8 Y- W; D! s
  74. char *dmabufsrc2 = NULL;
    8 _- G" i5 S9 q5 Z
  75. char *dmabufdest1 = NULL;
    2 b+ Y; P1 E" G# |8 I  c% a
  76. char *dmabufdest2 = NULL;6 `( c; \  O. ]; W: q7 T

  77. / y/ @6 z' |% e1 m
  78. static int acnt = 512;
    0 g% e: v1 `' v
  79. static int bcnt = 8;3 q: T8 Q" e" ^! M* O
  80. static int ccnt = 8;
    8 y0 c# q" T" a/ s

  81. 3 M, g2 P1 R. b7 u+ y; c
  82. module_param(acnt, int, S_IRUGO);- Y( h- ]" V$ q% W0 x) D$ R6 P
  83. module_param(bcnt, int, S_IRUGO);
    $ Z4 }! e! O2 q& G! u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ h  O: B; M. M, I. H" [
4 `# G9 c' i0 w0 |0 }; q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ r- h$ n2 p+ j: {! U" y# b% x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 {8 O( y* D2 H. b; H1 k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. R+ M; P" ?0 a3 j6 {& v' t8 x1 y2 p2 G( s& m
8 c' ]$ O2 O0 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 20:44 , Processed in 0.045612 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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