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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- d" n5 S; r9 N7 k* J3 I
  1. [code]EDMA sample test application
    ( k  ?* I/ J! N, ~3 A: u% _
  2. /*
      n: h; e/ J3 z0 v/ A) e
  3. * edma_test.c
    8 `- m6 j3 R: z9 i1 g/ d# B
  4. *( c! E- }7 r* V5 {' M6 a
  5. * brief  EDMA3 Test Application
    + q# g% ~: S. s+ T: K9 h
  6. *( y# D' t" h/ N3 A9 u$ {: ^
  7. *   This file contains EDMA3 Test code./ T4 G9 v$ H9 D4 C4 b$ n& u
  8. *
    3 j/ Y& l. P1 h) R% y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 [+ \5 N7 m0 T3 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- V$ n. H; O: l! K2 D  w, ~3 \% Y4 Y
  11. *         TO CHANGE.9 K+ l/ z2 G# v  D: T5 L
  12. *
    ) u; J; p- g' H. H% m9 c! a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 A: j* t, x. W( I$ Z
  14. *; J% v9 B5 S& H$ M
  15. * This program is free software; you can redistribute it and/or8 Z/ R9 L5 _9 g
  16. * modify it under the terms of the GNU General Public License as/ U0 O5 E* x% L1 v& P) d
  17. * published by the Free Software Foundation version 2.3 k* C! k6 m+ I+ n; Z8 `
  18. *
    * u" n9 i0 ]- K5 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  @" X% D; K  W! m2 X
  20. * kind, whether express or implied; without even the implied warranty; ?0 Q2 Y/ ^8 E/ h0 }( U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & P( A+ A! u' v1 P( O
  22. * GNU General Public License for more details." l1 }9 C2 S6 K/ I% _8 Y) G
  23. */
    # q/ c& y$ Y- ^+ G/ l/ x

  24. ( Q# }+ [9 e' \9 a5 M0 M
  25. #include <linux/module.h>8 R) C1 |, m3 M5 D# i5 h
  26. #include <linux/init.h>" `- V# i# Y2 V6 q* C# O3 s
  27. #include <linux/errno.h>- k- v% l3 }% g6 R$ z" J# E
  28. #include <linux/types.h>, w0 T' N% G" \5 V7 \
  29. #include <linux/interrupt.h>
    ( E7 T' L8 ^. m6 S* h' s! F8 Q
  30. #include <asm/io.h>
    & j' K  e5 R) Y* H! J
  31. #include <linux/moduleparam.h>
    ! e% K9 k% _# m7 z7 _9 ?0 P/ d' V
  32. #include <linux/sysctl.h>6 a. F' K! ^5 C' }
  33. #include <linux/mm.h>
    , m9 q" J  g3 z! ^& k3 D
  34. #include <linux/dma-mapping.h>
    ) w# _: i" b% _1 X

  35. ! G1 S6 w4 T- x* G' J; Q/ O: [
  36. #include <mach/memory.h>
    ; O6 X( u0 y8 h' D  z
  37. #include <mach/hardware.h>' T  @! `& b& Y7 y$ R6 J9 |
  38. #include <mach/irqs.h>
      e' t. q2 m* w; [& W' {4 c
  39. #include <asm/hardware/edma.h>$ \( a6 m+ s  g+ j, X: ]4 d
  40. ' O: B, p/ ]. s4 I3 ?
  41. #undef EDMA3_DEBUG
    ! B% w9 ~# `' F( d
  42. /*#define EDMA3_DEBUG*/
    - U3 o6 D: x( j% ^& o8 u9 J& s
  43. 4 i5 z3 K  b( f9 {$ L5 g
  44. #ifdef EDMA3_DEBUG
    , y0 G: Q! M7 ~  g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# `; V$ x, g6 ^9 g" C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , f8 }2 W2 p2 C! G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ~2 z2 s  \9 T0 K. d' Z* [& p8 B
  48. #else( Q6 h6 e4 n( ?7 a1 |7 J& e
  49. #define DMA_PRINTK( x... )/ |' y% m' X0 Z! N! l
  50. #define DMA_FN_IN
    . d6 [1 E$ b0 v# `7 D
  51. #define DMA_FN_OUT! s7 U% V# h6 ~
  52. #endif
    2 `$ h. a. D" m) S3 R
  53. & s! E4 g7 W# I! _! L- ~, p/ a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). s% {% Q4 I( G6 i9 Q' U! A: _
  55. #define STATIC_SHIFT                3
    6 L2 t& ^" Y1 _, w' q% ~
  56. #define TCINTEN_SHIFT               20( I: E! q. Q  d! f+ G
  57. #define ITCINTEN_SHIFT              21% n* q3 p: P: n3 ~# F
  58. #define TCCHEN_SHIFT                22* B+ R' I3 B; `) W" t  ]
  59. #define ITCCHEN_SHIFT               23
    ' m6 j4 V2 {+ K; P3 v, j9 i

  60. 8 f* n( h5 @. ~$ |
  61. static volatile int irqraised1 = 0;
    $ F* ~7 J- O- p+ q, Q% R; t
  62. static volatile int irqraised2 = 0;% d  g  }0 u+ Z% w6 {, P
  63. $ r0 J+ v4 I! E" K8 e0 z% O! h$ T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 X* o+ i+ q: |8 J& J" D( `5 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; m( Z$ _0 {# _0 ?6 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o4 ~( j+ \2 L7 g9 h; ?( J: t1 m

  67. + m7 ~6 W8 G$ [* K' W1 g+ y/ g
  68. dma_addr_t dmaphyssrc1 = 0;
    1 C/ ~' ^5 `( e, ]. {( r
  69. dma_addr_t dmaphyssrc2 = 0;, I4 e% t8 a6 U& `; H( W
  70. dma_addr_t dmaphysdest1 = 0;
    : I6 Q4 j% }3 K" m1 \9 k$ ^* e
  71. dma_addr_t dmaphysdest2 = 0;
    2 D( I- M7 B3 x

  72. ! F. y& V! W; h! `2 i4 S: a
  73. char *dmabufsrc1 = NULL;
    3 O+ Y% L8 E$ D' m- q
  74. char *dmabufsrc2 = NULL;
    ( M% Y: \( y) Y9 p4 Z& N3 \6 w/ k
  75. char *dmabufdest1 = NULL;" z6 ?0 \" X& t- |2 Y
  76. char *dmabufdest2 = NULL;
    ) y% M" ]# w4 g2 W7 t, K  R. L
  77. 0 a3 z- S8 d, H8 T
  78. static int acnt = 512;. g8 S# f0 ?* Z- j, Z; S8 a8 O
  79. static int bcnt = 8;
    6 L: N. @" o) h' R
  80. static int ccnt = 8;* v8 K! P; h9 X8 l  i
  81. , t1 c6 g. H, C
  82. module_param(acnt, int, S_IRUGO);
    * M3 u  c" @& a& p/ a0 |( x- m0 w
  83. module_param(bcnt, int, S_IRUGO);$ Q: i! @5 L) G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, W4 D* l' Y6 Y" _1 {

+ [% l4 o/ Y  I7 F2 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  I6 W6 A* }" E$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  h( z  m; i& _3 x6 g/ a- s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 d9 `# j, g/ a5 [) r1 e
9 F/ K3 a) y0 |3 q
8 I. \; u% W! P+ x4 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 02:46 , Processed in 0.039255 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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