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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 ]5 h# Q& v+ L. f- m1 P
  1. [code]EDMA sample test application% ?' H: R  j6 k$ ]  q3 F
  2. /*
    7 [1 B2 u2 Z$ d  I) j9 a
  3. * edma_test.c6 w0 J8 c* b3 e. R. m* p$ I$ H
  4. *3 C  ^0 a' X6 D1 w2 P/ a( z
  5. * brief  EDMA3 Test Application" u! w1 N  O" @# F, r8 j3 b
  6. *
    0 s4 A: t: F9 d3 f
  7. *   This file contains EDMA3 Test code.' @5 U( w' `4 Q. ~
  8. *0 M0 {% x' ^! k. d, x( G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ H) B' W6 @  |1 P$ e% _$ H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + d4 {; n3 t% c" }. G* N
  11. *         TO CHANGE.* j; w6 U; Q! X2 C/ W
  12. *
    # C7 `6 I* S9 `& n& t& r% D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 b2 D/ W3 x% `' n- X/ A) A, j) y8 M
  14. *5 V1 ?1 r' m% j' J9 f
  15. * This program is free software; you can redistribute it and/or' ^& }* w  E  z: e* m& R
  16. * modify it under the terms of the GNU General Public License as. z. J8 Y/ |& l3 b
  17. * published by the Free Software Foundation version 2.7 [1 w$ a% f- u
  18. *
    . y6 H2 }9 O0 \6 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: p( h- {9 \  u1 P' i
  20. * kind, whether express or implied; without even the implied warranty4 N5 N! D! o8 _( g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. n9 K& F9 `! n2 c# x+ U
  22. * GNU General Public License for more details.
    % J% i. Q8 B) Y0 k- ?" J
  23. */
    ) V  [# ]$ r, x9 l# S1 T
  24. ! [9 B5 e2 Z) A- Q5 ?- R
  25. #include <linux/module.h>
    $ @' c4 J0 Q% g" `
  26. #include <linux/init.h>
    7 g6 p5 W& Y6 d
  27. #include <linux/errno.h>9 ^: I. z% k" F# q& x
  28. #include <linux/types.h>
    1 K" s$ i8 e! q
  29. #include <linux/interrupt.h># N3 o: M, }- z% Y( r& ?8 Y% x. w
  30. #include <asm/io.h>
    - v" _: i% b; x( t  g
  31. #include <linux/moduleparam.h>$ Q7 N6 f  U) N' ^: I
  32. #include <linux/sysctl.h>: \7 w/ o3 L, A& D" z: B/ i. H9 D
  33. #include <linux/mm.h>
    # R* l, J" z' P7 G* _( Q, l* t
  34. #include <linux/dma-mapping.h>
    ( n  [0 P) P. ~+ i0 w

  35. / k  A( w& {( R5 X
  36. #include <mach/memory.h>
    8 }% Q- B: f9 D8 i  y- ~
  37. #include <mach/hardware.h>
    ' k8 g9 O5 _- i: [' U6 b  C+ u$ S. ^
  38. #include <mach/irqs.h>
    - ?. X3 _+ Q: C# l# g, a* r: I
  39. #include <asm/hardware/edma.h>
    ; y8 E4 h$ i3 ^6 X9 ~

  40. : n: p& O3 d; A
  41. #undef EDMA3_DEBUG
    ( T; a/ j  D$ H
  42. /*#define EDMA3_DEBUG*/
    $ R4 W9 B# g: ]- e! F& [7 g
  43. / E& t( E" p3 N- l& f4 l
  44. #ifdef EDMA3_DEBUG5 x) n9 K6 v+ g% o. J+ k, {8 f3 O/ r7 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . f: F' U! m' i- f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : C! ~0 O1 S) c) v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + g" E( {5 x$ \' f' [  u/ F
  48. #else
    4 y) m) o3 ]7 }, ]& n# E
  49. #define DMA_PRINTK( x... )
    4 j& J& p+ J- s8 ^0 C
  50. #define DMA_FN_IN' d5 ]+ A) A/ N$ h' e
  51. #define DMA_FN_OUT
    $ H  g2 r( F1 x' B8 X, f& }6 W1 B6 C$ ^9 e
  52. #endif
    ! b8 Y1 B! J+ p# J9 o

  53. + G5 Y9 h+ p; I+ F7 s& [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' w- T9 J5 ^5 q  F) @
  55. #define STATIC_SHIFT                3* ?& V. z& `& f, Q
  56. #define TCINTEN_SHIFT               20  P; d8 q" {% W# X' M
  57. #define ITCINTEN_SHIFT              21" @0 @. c' Z6 i' [! S8 M
  58. #define TCCHEN_SHIFT                22
    ; [0 q  H8 A( D/ i) x
  59. #define ITCCHEN_SHIFT               23  {# J& _4 ~& b: h- I* D8 K; S" w

  60. & z8 f# f' k2 Q7 d$ y$ o1 F1 i
  61. static volatile int irqraised1 = 0;
    0 E6 Y& q- C& |/ n- x
  62. static volatile int irqraised2 = 0;2 y4 U. H; S/ n( q( C  G# t
  63. ( H6 F5 A0 D9 \- t2 y! e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . n3 [, m0 b* U5 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s4 I9 P- [5 b6 A' T9 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 B; R$ ?2 }; B7 ^8 R

  67. 0 q' f2 D" T, L# W5 `% w
  68. dma_addr_t dmaphyssrc1 = 0;
    ! N2 A) c# W4 ^7 I2 ^, J( a4 r5 K
  69. dma_addr_t dmaphyssrc2 = 0;0 M& w% b: |. v. Y5 u
  70. dma_addr_t dmaphysdest1 = 0;3 l5 p8 t) u) Q# }: ]4 A* t4 X
  71. dma_addr_t dmaphysdest2 = 0;
    3 s6 }; X! [# @. h- |1 n7 s
  72. 6 r8 n  N9 J$ h5 D" v6 F
  73. char *dmabufsrc1 = NULL;4 w$ o* D2 }! F7 |
  74. char *dmabufsrc2 = NULL;
    ! `2 N7 I0 D( W' P
  75. char *dmabufdest1 = NULL;# g1 U, X+ X( B& m
  76. char *dmabufdest2 = NULL;* i6 R, L: m8 q5 j
  77. 9 A$ h; G, L/ F& J7 \
  78. static int acnt = 512;
    9 d( S& }3 D. ?) V: B
  79. static int bcnt = 8;! O3 F4 U4 M2 ]0 M
  80. static int ccnt = 8;! e, U% K2 e5 E5 x  G3 @
  81. $ e8 m+ e+ `3 U; c$ i0 V
  82. module_param(acnt, int, S_IRUGO);
    ' K, Y0 k8 M8 M6 I- r2 z8 E! m0 q
  83. module_param(bcnt, int, S_IRUGO);, @: B- e5 e1 g$ u9 V# m# Z) r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. S& J% H3 e5 y8 a% d8 h8 |" f- @2 y

' O- _& y5 N) ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 I8 b% A  z2 c5 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ _& F: ]+ R8 e  T# R7 a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 u5 F4 \, E. {" t9 Z6 V3 r
: N8 c* `0 e/ U7 U# H0 v/ w

* G' C: t2 Q0 a/ d' t3 J6 x# b1 d/ D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-30 03:24 , Processed in 0.042740 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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