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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 @5 _) m! e3 G
  1. [code]EDMA sample test application
    # s6 w4 S" |6 c- J
  2. /*
    9 g/ D- x( \# x7 d# Y3 {# V$ ?! D; S
  3. * edma_test.c
    6 u+ M% @& V8 ]- y
  4. *7 c( P8 I( U+ F4 H# ]
  5. * brief  EDMA3 Test Application
    0 ~3 A7 j7 U. f1 E
  6. *
    : I9 C* R5 D' i! J  }6 c* _! o" B
  7. *   This file contains EDMA3 Test code.' |/ q% I9 p' {( n! K! y
  8. *
    - K/ k; `, h9 K  \3 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! e+ h4 e. t# T, O. P. _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 b- [7 V' ]# F6 y; P$ H" t
  11. *         TO CHANGE.; p8 X- E: P! t: r- P3 o) R
  12. *' p! I0 v2 {2 T, Z$ Z! p# N) d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% r* o! [) |4 U, `( W' a
  14. *
    7 n1 a* k4 ^; h+ s
  15. * This program is free software; you can redistribute it and/or
      C7 ~2 b- @& v: Z
  16. * modify it under the terms of the GNU General Public License as$ e  u) ^5 b4 {
  17. * published by the Free Software Foundation version 2.
    ( |6 r1 r; @% l8 o! E5 ]- j
  18. *. }* N% B# J. j" i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 S; b  D$ s- p& F" i# X$ a
  20. * kind, whether express or implied; without even the implied warranty7 o+ {1 P* K0 B, I2 E% u/ E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * K+ o4 x- S8 T$ x
  22. * GNU General Public License for more details.5 D/ ?, _- i/ U! u# P9 U7 P
  23. */
    9 Y- T0 ^2 T6 E

  24. % Y0 D. ^0 j- R2 z9 w6 L
  25. #include <linux/module.h>0 k* E  Q) v# j1 P0 J) [* l, w
  26. #include <linux/init.h>
    4 S! |* @, v2 S. a: K
  27. #include <linux/errno.h>' Q! K+ ]$ s6 Z1 S; b
  28. #include <linux/types.h>
    % A# g8 c' ^2 [5 z6 ~
  29. #include <linux/interrupt.h>$ h! R3 W. \# H, g- c! n5 D. A& }3 z
  30. #include <asm/io.h>+ Z# X: Y/ b' o: u7 t/ P) X
  31. #include <linux/moduleparam.h>
    ( M& Y$ _" ~! s- H7 [- i
  32. #include <linux/sysctl.h>9 a4 p7 T$ s( D& @7 P( J
  33. #include <linux/mm.h>/ V0 V3 g% O- l# @7 v9 m1 K4 Q2 ?
  34. #include <linux/dma-mapping.h>( X3 ^6 n( e3 t8 x) v0 b9 @! C

  35. ) q1 Q5 |% K# y) g9 w! K
  36. #include <mach/memory.h>
      o8 O/ A. c4 a
  37. #include <mach/hardware.h>
    6 }3 H' C# @& d2 r
  38. #include <mach/irqs.h>
    0 e+ c+ T1 v0 F9 ^
  39. #include <asm/hardware/edma.h>9 `' M! Y& i; `+ A0 X
  40. : {* z0 O/ N; N
  41. #undef EDMA3_DEBUG; ~  d5 \7 W0 E+ E" J. ]
  42. /*#define EDMA3_DEBUG*/
    1 S7 k5 }: ]5 W. ]2 X8 |. f3 r

  43. / C) W) A% X+ P0 z
  44. #ifdef EDMA3_DEBUG
    $ l  q3 o7 D9 R( h6 C7 b7 P" q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 Y6 X  L0 f9 E- T% ]/ F% j7 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 T6 m( ]* C$ H4 K. Q# O3 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); u1 O' L. _# e' n/ E* w+ @
  48. #else
    3 ~* |1 J+ o0 J% R2 f: _# ?6 p
  49. #define DMA_PRINTK( x... )! x- s7 Z6 y8 h) w8 ?$ j
  50. #define DMA_FN_IN% ^' K, @; t; F2 u3 `# W5 x
  51. #define DMA_FN_OUT
    * [& W8 {( z0 p+ v& S6 X
  52. #endif1 Y# C3 `& R9 Y: o, W4 g
  53. % l( R1 N3 I% d) x" D* }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 J3 [  A: z5 t. ~1 U
  55. #define STATIC_SHIFT                3$ b. W0 _2 z+ }' z3 [2 o# f
  56. #define TCINTEN_SHIFT               20
    / K9 X% }: f6 c1 ~; h
  57. #define ITCINTEN_SHIFT              211 ?5 s& I$ K- e# Q. u0 a
  58. #define TCCHEN_SHIFT                22
    8 c3 Y( l+ I4 |5 r3 X7 h, M; d# k3 @
  59. #define ITCCHEN_SHIFT               23# {+ h8 \7 n, \4 s5 a
  60. ) r" ~6 X/ Z9 |1 Z" Y/ i/ N
  61. static volatile int irqraised1 = 0;( T; g. z& i3 K, d. {, b) M. [+ X; x
  62. static volatile int irqraised2 = 0;
    , V1 x" A: y1 [+ A

  63. 8 ~' W8 c( l7 _% f0 @& R2 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! n2 s* u6 I2 {, ]  h% A# {$ C* J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( R7 o, e3 C) r' J5 k. F- |4 W: \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % B# f+ Y0 Z  S5 ~# J6 D% q9 @
  67. ( {% J6 e9 u  }
  68. dma_addr_t dmaphyssrc1 = 0;: P7 i% F5 |2 J) W
  69. dma_addr_t dmaphyssrc2 = 0;
    + @- B3 M9 e2 t8 w; u% S( U# b
  70. dma_addr_t dmaphysdest1 = 0;
    0 t' X' Q( q0 V( l# ^! y  }
  71. dma_addr_t dmaphysdest2 = 0;- z1 Q% g5 E" F+ v$ D1 ]+ X
  72. # H' G1 e  B) O4 A+ h
  73. char *dmabufsrc1 = NULL;
    & }: h# h# e' T6 T, f
  74. char *dmabufsrc2 = NULL;  \* ^% l; _& J9 ~7 m: m  j
  75. char *dmabufdest1 = NULL;
    1 n3 B& j* P8 ?4 z6 I: B4 V( u
  76. char *dmabufdest2 = NULL;# @$ u0 {1 B( J* g" p

  77. . y( Q" T4 N6 D
  78. static int acnt = 512;" f$ w& P# Q( w/ @1 @, o8 R
  79. static int bcnt = 8;% [$ }7 e) \/ _, R( x* m& M
  80. static int ccnt = 8;# [  p# f# z- T5 T, S4 R
  81. . _$ q& p' _8 c
  82. module_param(acnt, int, S_IRUGO);1 F" U! @5 R. a5 Z
  83. module_param(bcnt, int, S_IRUGO);. K9 ?- Q( N* l) ?$ Q  l1 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( ~7 W6 j6 I! h- o: l; I- [$ M$ L7 ?; I. d3 ?2 g5 b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: @  ]1 T  u3 X% v0 Y8 G' Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& [; `4 i% j9 S1 Q! z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: e: I5 r- ~9 ?: |. B. G" J5 L& F/ t& V& Y

6 ]- s- s0 J2 D- o3 U: F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 06:36 , Processed in 0.041914 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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