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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 Y$ i# p3 I4 ?' E5 m; W" H7 m+ m
  1. [code]EDMA sample test application
    % v6 @' \5 w: G$ T7 B3 O- j5 y/ ]
  2. /*
    & U8 E8 |5 b7 b$ u; \, L3 h! \( S
  3. * edma_test.c
    % W( e7 Y( K5 Z/ \1 ~' h
  4. *2 x, M% h* [9 i8 s8 h
  5. * brief  EDMA3 Test Application
    , Y0 h3 S: B8 `( |3 }: |( i9 ?3 L/ ?6 P
  6. *: \0 P" b$ i* M5 d: S. i1 l8 V
  7. *   This file contains EDMA3 Test code.
    * L. W& P/ ^' w
  8. *9 f3 D. [9 c& O  X" j1 G! ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      E, V8 I  y' Y3 B# \3 Y- B: ?4 E2 X4 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # h; m( {5 E6 g% _+ R5 |7 {
  11. *         TO CHANGE.% q! o' Q5 m* q
  12. *8 @6 R; q7 S! j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + m$ d3 l4 ?9 A& _( W+ m# s5 _
  14. *. Y; N. A/ ^( j, q: K' \
  15. * This program is free software; you can redistribute it and/or/ S# T8 j! U4 h9 [
  16. * modify it under the terms of the GNU General Public License as2 A: @* {; x" W; a8 f
  17. * published by the Free Software Foundation version 2.
    ( J% n+ z& M" Z" V; N; z2 @8 h
  18. *
    9 g2 B4 s; K: d' a1 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ l2 c  m: W7 B* y
  20. * kind, whether express or implied; without even the implied warranty
    ; o0 u- W+ M$ T; l! {, M1 C/ a& x, C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 p% j# i( `) R' A% {/ M
  22. * GNU General Public License for more details.) S. h3 h6 u  Z/ Q1 k$ J
  23. */
    , D% H. f* e+ i8 O2 _) `% g
  24. $ _) W' J) k. H( E/ k9 R" _+ C
  25. #include <linux/module.h>0 _+ G  Y3 l# I9 x# ?
  26. #include <linux/init.h>
      N: ~" J, M; R1 n2 s& |
  27. #include <linux/errno.h>  o3 ~6 s; t& {( e: j5 L
  28. #include <linux/types.h>
    9 R9 t  ~) k% o; q/ u
  29. #include <linux/interrupt.h>
    + l: L. F) c# k: E) v6 A- G
  30. #include <asm/io.h>4 P. z  e1 y$ N, b: k4 n! R
  31. #include <linux/moduleparam.h>
    + c( F8 S# B; b" n% r$ m
  32. #include <linux/sysctl.h>" x  C7 h; u7 `- z
  33. #include <linux/mm.h>
    9 Q- X  T1 F% S) E" ?+ N
  34. #include <linux/dma-mapping.h>  X5 [# `+ q" a; @
  35. * ]" Y4 |8 J5 j, }( r) P
  36. #include <mach/memory.h>; d9 h- ~( J$ i" n% @; {. l
  37. #include <mach/hardware.h>& @' n# c1 J; m7 o1 w. k' Y- L
  38. #include <mach/irqs.h>
    , ?) D5 n9 P% b9 E' @* _
  39. #include <asm/hardware/edma.h>% l/ A* j9 e  ~5 d8 S! w5 ]$ a* P
  40. ; p; ]/ G- Q/ k9 `, C( g' ~
  41. #undef EDMA3_DEBUG
    , u) u; H. o# }) Y
  42. /*#define EDMA3_DEBUG*/
    1 R2 W$ ?# X9 i

  43. / P4 M: L! E* M+ y
  44. #ifdef EDMA3_DEBUG' z+ B- I- y/ W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " Y* y0 _1 E% M. Z! w$ n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 C/ j( g& M& u& Z  V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , e! f6 n% n2 ?
  48. #else
    2 ]/ L1 o( E# K
  49. #define DMA_PRINTK( x... )
    8 H: C6 P8 q/ d6 n3 S; z- `
  50. #define DMA_FN_IN
      a- {# V; e/ ]6 D' A2 V
  51. #define DMA_FN_OUT: `4 v# A  S6 |0 z6 f: f8 M* W
  52. #endif& S! E' i6 k- p/ Q/ N
  53. " W0 r) @; X- b1 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! I! T3 a. a6 c
  55. #define STATIC_SHIFT                30 x9 F/ s* u  I" \
  56. #define TCINTEN_SHIFT               20' d. b5 q, K& T9 q
  57. #define ITCINTEN_SHIFT              210 T8 t+ ~8 Y6 H" S1 u; a% B
  58. #define TCCHEN_SHIFT                22' T. L* d/ l% f
  59. #define ITCCHEN_SHIFT               23+ p3 N: H  O/ t. C$ p

  60. ' D* K, q' w& i" s2 ?6 C, f/ y
  61. static volatile int irqraised1 = 0;9 a( `8 ^0 n; r2 G
  62. static volatile int irqraised2 = 0;
    * [: `" \( h# j6 t7 {0 s

  63. % I# P: k& h2 v; S2 P" M# Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W1 F; x7 U4 t. a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - G( t& ~; }, X+ k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r5 M8 w% c- j# i' K" P+ H
  67. ; J% ~& r$ t* R
  68. dma_addr_t dmaphyssrc1 = 0;
    4 U' q2 g8 j- V# w  ~# W) C
  69. dma_addr_t dmaphyssrc2 = 0;: W+ O4 r5 g5 B  O+ Y! S
  70. dma_addr_t dmaphysdest1 = 0;
    9 s: N9 N, U! F) [
  71. dma_addr_t dmaphysdest2 = 0;4 J3 Q' {2 ~5 |  m

  72. 9 J0 z! u: M; J, ]- h8 O
  73. char *dmabufsrc1 = NULL;, a3 _+ c% D8 Y+ B! ^
  74. char *dmabufsrc2 = NULL;- \- t) |' A' I. t* F9 I8 |/ L
  75. char *dmabufdest1 = NULL;4 Z$ ^; ~- ^6 |( L
  76. char *dmabufdest2 = NULL;% L4 v- `3 [; L' ^4 Q  j
  77. $ t+ c0 V- f, w, K* G5 C6 K0 D
  78. static int acnt = 512;
    * A+ i; j& u$ ^0 U$ K, V% x1 R
  79. static int bcnt = 8;
    8 X3 ]* l0 I* [- \, Y* w3 |
  80. static int ccnt = 8;
    7 D3 T8 l$ w9 K% A2 m8 f

  81. 4 i) z4 U4 g2 C% K
  82. module_param(acnt, int, S_IRUGO);: i+ l! D9 p1 S# z8 o" P8 B
  83. module_param(bcnt, int, S_IRUGO);# ]8 y9 u: z9 V, Y* ?4 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 |# F; c7 t+ S* A' D
$ R, n- G9 E1 _5 S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ m9 M* y" v3 n2 o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* g# Z( |: K: G9 k7 t8 b0 Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' }# _' z! J$ [: P# E+ z) w
: K( Q9 ~/ c4 Q; _

; Q# x- F+ n& k) N; r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 02:56 , Processed in 0.042387 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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