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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 u) v) Q* M" s" ~; q: @
  1. [code]EDMA sample test application# X) N0 b, a& F: j$ Y) \
  2. /*
    2 J" k9 g. P$ S  `
  3. * edma_test.c8 a) c. N/ k" s8 Q  u7 _& ]
  4. *  ~* U/ \+ L  t1 j6 H; G
  5. * brief  EDMA3 Test Application9 O7 Z1 K9 \( X& `- i+ M
  6. *
    ) u- Q. Q( t8 X9 P0 u) |
  7. *   This file contains EDMA3 Test code.6 S; q5 [8 W3 W3 s  F( @
  8. *) }) o( P1 @. t7 F$ U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, Y- G: @0 U8 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; f& ]; j# g6 z  ?% o+ l) N7 b
  11. *         TO CHANGE./ ]: y  c$ X# n
  12. *; `* a9 S0 h7 j- n7 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * h. n3 ?! w3 r' ?8 L" S. t. m* q
  14. ** q% J6 r  ?1 f: }! v, i% ~1 S
  15. * This program is free software; you can redistribute it and/or  A% }1 }4 b. h. k( d
  16. * modify it under the terms of the GNU General Public License as) W9 K9 u1 Q0 M* n2 ?4 N$ `9 M
  17. * published by the Free Software Foundation version 2.
    " ~0 H( c: x) u4 c9 r  j! \
  18. *
    , h1 |+ F0 h2 Z+ I4 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / h& d8 z- v2 U
  20. * kind, whether express or implied; without even the implied warranty1 _8 G, G$ e; s& _  y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / z& _3 G; r- S1 q* R3 ^
  22. * GNU General Public License for more details.
    1 `* t, K5 B/ w0 m( E
  23. */
    / W9 \( p, Z- v# C
  24.   j$ x+ e, x( B7 D
  25. #include <linux/module.h>
    ; W, F. {' {: h, `
  26. #include <linux/init.h>! y' K, l# K$ m: v' o0 t  X
  27. #include <linux/errno.h>
    & y1 P2 j7 I* S! ~) t9 h, }
  28. #include <linux/types.h>
    5 _: [" x3 `5 P$ v, L* x
  29. #include <linux/interrupt.h>
    . P6 R  t5 C6 U. V
  30. #include <asm/io.h>% h7 C7 `0 G2 r6 u. P* ~; R  s
  31. #include <linux/moduleparam.h>
    0 j! w7 L/ M5 n) p
  32. #include <linux/sysctl.h>: L- F8 ~, y6 v# x/ {% ^4 ~% ^
  33. #include <linux/mm.h>
    8 ?! G  C. y  |+ ]# Z6 y
  34. #include <linux/dma-mapping.h>
    1 B6 S3 a% T* m% a5 \, @2 [

  35. - k& k, c4 ?/ ~3 p
  36. #include <mach/memory.h>
    8 D+ C! w5 O; H, Q* Z
  37. #include <mach/hardware.h>* a+ q. c7 q. r4 O! H
  38. #include <mach/irqs.h>
    6 q  L& j* ?! y4 [% p/ U. _
  39. #include <asm/hardware/edma.h>
    2 J) Y& {! x1 c6 B3 v

  40. 0 o1 v9 n2 e! S+ T' L! u
  41. #undef EDMA3_DEBUG/ o% i1 D; t' M4 N% p  u  q2 D# j, ?
  42. /*#define EDMA3_DEBUG*/
    + s* Z! ^4 {* d$ A6 T

  43.   f9 n$ r* v+ G( l
  44. #ifdef EDMA3_DEBUG0 Q! B5 G1 G5 e0 C6 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ O! q, C" L  h7 ]" J* D$ [# b$ b) \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 \) g- p7 V8 v* Q& P( V: o' H: j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  ?6 \- Y! k; N9 }- p3 a( K
  48. #else2 S& `4 D: z' l8 o# ?; O4 b
  49. #define DMA_PRINTK( x... )
    ) M2 k6 W  E4 @6 g2 J& i% J; O8 Y
  50. #define DMA_FN_IN
    & _8 A- e, L4 D' e! ^
  51. #define DMA_FN_OUT5 v; O' T  g$ M+ M, \8 e
  52. #endif
    . S* p7 {: r7 _$ o) v* z  [( s

  53. + L  U, }! y' K# H/ K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 Y3 U+ ~1 w1 r7 A3 x7 G; I! Z
  55. #define STATIC_SHIFT                35 c/ W) F$ ?* A- Q+ N
  56. #define TCINTEN_SHIFT               208 y6 k! s9 G: p+ F) R0 R
  57. #define ITCINTEN_SHIFT              21# P( L4 @& S6 S" g3 A/ @$ V
  58. #define TCCHEN_SHIFT                22  c( ~' u1 G3 o6 ]! w
  59. #define ITCCHEN_SHIFT               23" J" Y& x" R$ H0 ]* |/ F

  60. 2 g& P* Z. j* R  _$ S* [3 a* v! b
  61. static volatile int irqraised1 = 0;9 z$ \9 {& e, ?- i7 n% ~
  62. static volatile int irqraised2 = 0;6 Y1 C: n8 }8 i0 C0 |  @9 P
  63. 2 ~$ J) S; g+ c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& }, Y8 y8 R% C! C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]; N! v5 D0 g# Q* A9 Y( [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 R0 ?/ z6 J( w0 K, w  Y
  67. . L% V! n9 X" b: A; c. C
  68. dma_addr_t dmaphyssrc1 = 0;# N/ K' o4 y6 I
  69. dma_addr_t dmaphyssrc2 = 0;
    : W: N' W$ E- [, Y& S- C6 t; }
  70. dma_addr_t dmaphysdest1 = 0;
    : c6 ^$ {8 H( P1 G! K" C4 J, f- S
  71. dma_addr_t dmaphysdest2 = 0;2 ~1 K2 i+ ^. }

  72. / L' q; C, a7 S0 R2 S6 r- H
  73. char *dmabufsrc1 = NULL;& w0 c) Z  b2 J* P: u
  74. char *dmabufsrc2 = NULL;
    ' W# R- C! t6 z9 c; G2 |/ g
  75. char *dmabufdest1 = NULL;! B) ]# y* @) G- |' n
  76. char *dmabufdest2 = NULL;1 R/ w) w6 Y- t/ j
  77. / k* m' ~: D+ e* o: s: M
  78. static int acnt = 512;4 z7 ?6 |$ _" T9 u
  79. static int bcnt = 8;' }0 I2 `  m! X, i
  80. static int ccnt = 8;' `: Y. J% y! {$ M: Q& I& W4 m: s3 D
  81. ) R6 c8 t, F: ^1 x0 ?$ x
  82. module_param(acnt, int, S_IRUGO);: R+ m0 Z* K8 Y8 u/ b4 d% C; q
  83. module_param(bcnt, int, S_IRUGO);
    3 {8 H5 s! B* n  A/ |+ b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, H+ @5 C4 r" S( K1 s3 B7 b+ \; C3 o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  G% _9 y% l' O; P$ f: B2 X, H( t) @1 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ]8 p$ j# {' u+ h  n- M& {7 T3 a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, @3 F9 J2 M, ^3 E6 ~
, R7 t! J1 k2 X; k  U! H

& Q  ?7 H+ Z2 b9 k" H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 23:28 , Processed in 0.040707 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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