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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 X4 o0 A& _# u
  1. [code]EDMA sample test application6 e5 @+ R7 B! ^* h$ T
  2. /*
    1 D4 M9 S! X& |
  3. * edma_test.c) g2 \7 t% o3 Q5 g( c, M! s0 _
  4. *) ~& R% _3 p0 C: A
  5. * brief  EDMA3 Test Application
    / Z/ C/ |8 U8 ]7 m
  6. *: [* ^, @, N' a8 j7 h0 F
  7. *   This file contains EDMA3 Test code.8 y. Q& V7 G4 Q  k% [& N
  8. *
    # e. b1 z7 B# v- k0 Z) s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # e3 _$ g4 `/ S2 R5 U9 E! S9 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      H' f( s# {$ n0 w$ h- J- Z* K' {
  11. *         TO CHANGE./ W# c, t' L' R( X- r5 c9 |
  12. *
    1 _1 g; w7 G' B8 v4 `, V, `' N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' ?( G  b) D3 ~# g
  14. *
    # P# t: A1 {4 a: |' C' m
  15. * This program is free software; you can redistribute it and/or; t% I4 Q3 }) U: L9 B$ H: o
  16. * modify it under the terms of the GNU General Public License as
    3 C( \* {0 E: Q0 k( Z; \9 V
  17. * published by the Free Software Foundation version 2.
    0 F  k" _" z4 |& b7 y4 @+ f
  18. *
    5 q4 |2 B' j+ e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: K/ y8 _3 Z: v" B4 N, \
  20. * kind, whether express or implied; without even the implied warranty7 q' g" Z- m. B4 I) p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & O7 A6 x6 U9 C$ Z
  22. * GNU General Public License for more details.
    ) T. ]* P: t- F
  23. */# G  [6 w1 o- o) \

  24. : K0 ]3 Y9 e0 @/ h0 m
  25. #include <linux/module.h>7 R' v- U& x: x# `: c9 E5 T; y
  26. #include <linux/init.h>) D1 Q$ ~; q6 {$ n3 L  X
  27. #include <linux/errno.h>& L7 v7 @* r  j; R# e3 i# U
  28. #include <linux/types.h>
    - o& r  f9 H8 v& a
  29. #include <linux/interrupt.h>
    4 [6 t" Q+ t- \% |) B' ^3 Q4 a; u" X4 }
  30. #include <asm/io.h>% D: Z& M( I9 m* U
  31. #include <linux/moduleparam.h>7 o5 Z1 o& I$ v/ j  S+ I
  32. #include <linux/sysctl.h>' V3 ]. E9 P! @8 {
  33. #include <linux/mm.h>) d  W* O2 \+ ~- t, E, K  ~
  34. #include <linux/dma-mapping.h>
    * v: ^( r& |6 R. H

  35. 2 i; f5 W+ b3 h! Y, c/ B2 Y" w& f
  36. #include <mach/memory.h>
    4 z1 U: T3 S+ E& t: `9 x+ U
  37. #include <mach/hardware.h>: r$ B0 `& U5 f; x
  38. #include <mach/irqs.h>
    : z7 T; i# |5 W! W$ \
  39. #include <asm/hardware/edma.h>% [" k4 \- ?0 ?* R

  40. 6 v3 F- X2 D5 X0 ~4 _( x) L5 E* t
  41. #undef EDMA3_DEBUG
    9 Z. e% J, G; [: f; h5 d7 F
  42. /*#define EDMA3_DEBUG*/" f6 H: ?9 B- Z! R1 y6 k$ t
  43. , p% q- o* W8 {
  44. #ifdef EDMA3_DEBUG, a/ Q6 z1 W: e% U3 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 u/ f4 c/ W( {- Y# F  H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 q, }7 A7 Z1 O. e, K3 e! A9 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 |. u3 B% {" [0 W' ~+ f' e. v
  48. #else
    1 P: e! t* z# K/ E7 Y0 t8 ~
  49. #define DMA_PRINTK( x... )% l, a" ^: P; ~" ^1 n0 a
  50. #define DMA_FN_IN
    ! S! w  f  I0 I% _
  51. #define DMA_FN_OUT
    - I5 f$ W5 L1 ]& G+ ~$ H" C
  52. #endif7 T% L& s1 ~3 Z' M. z4 a6 h
  53. ! w9 O& V( b  o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  a- K& Z% m" E7 H2 R1 |' n
  55. #define STATIC_SHIFT                3
    4 ^) r: w: ^/ Y' s) o
  56. #define TCINTEN_SHIFT               20' W. {& C( e: U. x. w# t
  57. #define ITCINTEN_SHIFT              21' E* c; `2 ?# d) [
  58. #define TCCHEN_SHIFT                224 e( w, M* y2 S+ d% X3 v
  59. #define ITCCHEN_SHIFT               23: _- Y+ A+ v4 `" e5 m) E4 u9 Z7 z
  60. # V- N0 T! T% o3 t. i/ y
  61. static volatile int irqraised1 = 0;
    3 G1 c% r) g0 s0 b+ s# H6 c
  62. static volatile int irqraised2 = 0;
    ! I( j8 i3 A/ R3 w, L& T5 s

  63. " M: s3 K/ z* A7 G! m1 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R, l( H# j3 S; j4 t# j) H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- M( P2 F5 @9 q1 S, s! }$ z6 R* Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G+ O4 n1 D9 S3 x0 y! l7 w

  67. $ |: x  a5 V$ [* g  y1 g
  68. dma_addr_t dmaphyssrc1 = 0;  i& J+ ?) p" W. y) l7 Z: t
  69. dma_addr_t dmaphyssrc2 = 0;
    0 j8 D- ~% r- S4 [$ @* J
  70. dma_addr_t dmaphysdest1 = 0;
    ( t; `7 e; w) q- j4 {
  71. dma_addr_t dmaphysdest2 = 0;, L! z- ~. P! K$ O, \0 I
  72. % {  @3 ~- H1 q& O/ |7 ]" x/ A  H  S+ u; W
  73. char *dmabufsrc1 = NULL;
    ! C: t7 s0 R/ q6 Y: Z) _3 Q
  74. char *dmabufsrc2 = NULL;( U( J6 C/ K* H/ i& p' a
  75. char *dmabufdest1 = NULL;: j6 t) @4 A% J3 Q
  76. char *dmabufdest2 = NULL;. K" d9 {* j- W, k& W4 v
  77. 9 e0 Y% ]& X' C) v& L# Q& ?) I
  78. static int acnt = 512;$ w1 h5 Y/ B6 Q- T$ h* U0 p4 N1 b
  79. static int bcnt = 8;3 Y* I; O  b$ Y3 N6 E; d. g
  80. static int ccnt = 8;5 }5 V( `1 ?' p5 H8 I# n' J1 |5 w
  81. ' ^+ N$ L$ k) E5 g% I+ e/ k+ G, D. V
  82. module_param(acnt, int, S_IRUGO);
    - W9 S6 t. C* c3 O3 j7 }% o  u  e4 O1 B
  83. module_param(bcnt, int, S_IRUGO);5 ], z! P2 h* c% P; T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ M6 X. v" ]7 {' b
5 [7 `/ C8 [, G) ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 I$ c1 T8 @5 v- a' u- u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! T& K2 S$ \: I" u: ^2 W# j3 L) h& }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* z. S+ X$ C$ P/ y" x  h
6 T# W2 c! d* O. a: d* ~$ k. E, p
4 f, W4 s0 P1 y1 }1 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 22:15 , Processed in 0.053349 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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