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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ z$ ~: @; j" W8 b( N; @
  1. [code]EDMA sample test application5 I) Y8 u( W9 U/ Y/ @+ W
  2. /*
    3 e* y/ Z+ l& `# v8 C! L
  3. * edma_test.c
    . _& m6 h/ ]3 W6 k
  4. *# s. I- ^  ~0 L7 g0 `' K  J
  5. * brief  EDMA3 Test Application
    ; s' ~+ d# \* C! o2 Q# }
  6. *+ z3 k4 ^* v7 z# N+ s, |, b; H
  7. *   This file contains EDMA3 Test code.  e  L5 ]" y* @. |- A4 H7 e/ ~
  8. *
    4 x5 D) X0 m3 A9 C& G$ p' Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; D8 P  ]$ W2 Q) x( Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 h0 A- z# z3 W0 \8 H3 K
  11. *         TO CHANGE.
    5 @$ ?- v+ r5 d5 n4 D5 p1 E
  12. *; Q" Y5 n7 ^- _: g% [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* C' z/ i( J0 j: @0 T% l6 K* f
  14. *2 `5 \3 G! Q% `  }$ J- Z
  15. * This program is free software; you can redistribute it and/or1 @; _- v3 H& {: @( W+ A' q1 w1 w
  16. * modify it under the terms of the GNU General Public License as; X# H" j9 B  Y4 b
  17. * published by the Free Software Foundation version 2.% z3 \; b/ w) ~" Q. H' _
  18. *1 Z4 Z) W0 B8 }: f$ F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 g; y$ P% [% z+ x8 q' I# f
  20. * kind, whether express or implied; without even the implied warranty
    0 Y$ x. B6 V/ I# e% h0 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 m- V( F$ L& }3 c
  22. * GNU General Public License for more details.6 n/ ~, W4 _) i& V2 j
  23. */: P4 L+ q; ?7 g, }. d4 C. y) k3 i) }
  24. 5 G' u+ q1 d+ ~" }9 v8 A
  25. #include <linux/module.h>
    + a$ S9 l, y+ w8 r0 C4 z2 u! \
  26. #include <linux/init.h>
    4 V5 h+ N6 l+ Y3 g: g7 g! J
  27. #include <linux/errno.h>
    , N3 g$ y4 j. k; P
  28. #include <linux/types.h>
    0 E* M7 K0 p2 H2 F/ d% v8 |. x8 a
  29. #include <linux/interrupt.h>
    ! e2 R) }4 N3 \3 q* i
  30. #include <asm/io.h>
    4 @0 x2 }5 E; o
  31. #include <linux/moduleparam.h>
    & _5 }% W+ F, G% H- s! H
  32. #include <linux/sysctl.h>
      ~& t: B* p, h$ h$ |( N, Z
  33. #include <linux/mm.h>
    " h1 ]4 x" c  J& c
  34. #include <linux/dma-mapping.h>
    + P$ m$ [, t- |* b# i

  35. / p+ k, e* e; K5 a
  36. #include <mach/memory.h>3 x3 n/ m8 P/ ~; O1 o. I
  37. #include <mach/hardware.h>, V" Q- s$ m; ], [1 U" ~
  38. #include <mach/irqs.h>; e" y- [& b% f( T% F( v6 i% z. N
  39. #include <asm/hardware/edma.h>9 M$ Y& k5 x/ \: z4 r( [

  40. 7 \4 P+ ~* F8 q- z7 O5 j
  41. #undef EDMA3_DEBUG
    . ~0 K% k# {& F+ \/ }* L
  42. /*#define EDMA3_DEBUG*/5 H' v, f9 E- `% j1 G; U  ~

  43. 8 ~4 `& }9 U7 J( q+ `. d- q
  44. #ifdef EDMA3_DEBUG
    ; z( C8 _- c. U+ G: i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 L2 H. w3 x- \5 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 P+ c7 d% g: z3 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      F2 R/ B! N4 o, w
  48. #else2 A- T, q0 F0 ~# w9 n
  49. #define DMA_PRINTK( x... )
    + h: e; Q. ~% }2 w; A, h
  50. #define DMA_FN_IN
    ! I4 d% C/ T2 W. s: ]8 G
  51. #define DMA_FN_OUT
    ' v2 T( M0 q! {$ `+ ^- B
  52. #endif
    " T7 @8 b/ N7 C9 A
  53. ! b$ q) ^4 e) a+ X8 ^1 N6 @2 Z& I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), ~/ V+ P( z# |
  55. #define STATIC_SHIFT                3
    ) N3 u3 n$ U" c2 H% y$ s& r- {& q
  56. #define TCINTEN_SHIFT               20, d" F5 G! j/ ~' B
  57. #define ITCINTEN_SHIFT              21- ~9 C/ H' w1 V4 y/ T: O( f
  58. #define TCCHEN_SHIFT                22/ J* |6 c3 G2 o' J  }  \5 x
  59. #define ITCCHEN_SHIFT               23
    ) l2 P! V8 [& q% \) J$ C3 L
  60. - \4 `) i& [) ~
  61. static volatile int irqraised1 = 0;
    - k) J: m( {( [4 F
  62. static volatile int irqraised2 = 0;
    * c  g, o% m% V( x( W! ?
  63. . T/ M' f, j4 c. C) _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " G1 t. M; P$ G  L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 m  m  y6 z& v) T% R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 \) T1 j8 s) V) `& V
  67. 2 e. ~- Q% E9 P0 J4 c$ E
  68. dma_addr_t dmaphyssrc1 = 0;; D  Y: S4 L+ ~1 Z, M( D
  69. dma_addr_t dmaphyssrc2 = 0;! a+ ~+ f7 x# M! Q3 J. h/ q
  70. dma_addr_t dmaphysdest1 = 0;" M- I4 `% \* K0 f8 ]2 r
  71. dma_addr_t dmaphysdest2 = 0;
    ; p% N% f& E' d( h1 R2 @0 \
  72. 5 g* \4 X4 x. \" E. i8 _
  73. char *dmabufsrc1 = NULL;
    0 V) ^9 F( ]" E1 U2 V5 G
  74. char *dmabufsrc2 = NULL;; O4 j+ ~: Q; U- Q4 D. Q, H, w
  75. char *dmabufdest1 = NULL;
    7 q6 i+ ~, w: Y0 E1 g
  76. char *dmabufdest2 = NULL;4 q. D1 G+ D1 ^+ s/ v) {

  77. - D3 Z- O' `) d6 _" t
  78. static int acnt = 512;
    + ~! ]+ p7 _* ?# k" v( E
  79. static int bcnt = 8;
    6 L. k/ X  `2 x) c0 M7 p; E8 k5 c* r
  80. static int ccnt = 8;* ~/ k, _. A; @: _

  81. & i$ H; d5 K7 @+ `" p, `# N
  82. module_param(acnt, int, S_IRUGO);% {1 k! o! E7 o# {
  83. module_param(bcnt, int, S_IRUGO);6 Q/ C" Q3 d6 ?5 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% I' p; w( U! U; g& [
- @6 F, L, A, f- Z; c% ]% H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 [9 u2 o, Z. ?$ X" i8 iarm-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 R  c) ^! g7 e( ^; o* @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- X7 R0 U% w1 ?( W* ]( |

/ I# j! S8 ?$ C& T5 M3 A( _7 I5 n# G3 Z- v3 ~* F3 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 02:46 , Processed in 0.050761 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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