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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 E0 `, x; d: a0 x6 ~: ?. i
  1. [code]EDMA sample test application
    % r7 d( Z; V$ O) [) @, }. ]2 T0 u/ u
  2. /*
    ! c6 n$ l# k5 h# K9 m- g
  3. * edma_test.c
    * a) f2 @, B( `0 k1 H1 d
  4. *
    % z4 Y( f$ B- B, V9 H
  5. * brief  EDMA3 Test Application
    & a! c# a5 h* B& t. H' _# ?! W3 |
  6. *$ S/ ?0 \5 O1 B  C0 j5 c/ G
  7. *   This file contains EDMA3 Test code./ T; k3 e0 ~# g
  8. *
    7 |5 F* y" g+ W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 W# p4 b/ r  A. _- D: S6 v) M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 r4 q$ N2 s, B
  11. *         TO CHANGE.
    % e# ^, X; a: ?2 a( t$ ~" s
  12. *
      o" m2 T$ L4 H9 A. l5 |& n7 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// M4 K: H5 Y! f# O' f. a
  14. *
    # d- m- T' `9 U7 F8 T; D0 ^& V! i6 }
  15. * This program is free software; you can redistribute it and/or
    3 `9 m4 |3 a5 |. g7 K9 \
  16. * modify it under the terms of the GNU General Public License as  q/ R& G% ]$ o
  17. * published by the Free Software Foundation version 2.% R) C( _9 o* _9 [1 a6 C
  18. *
    " V$ K' x: H6 c  D/ c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 `# _; n  V1 W) q1 M" }7 z8 T
  20. * kind, whether express or implied; without even the implied warranty; q- ?1 c3 d- c) y- b, v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % o5 R5 k9 X3 i" }/ b$ Z* i
  22. * GNU General Public License for more details.+ y% v1 E! G6 f- ?1 ^/ x
  23. */
    + p6 r% ^* I7 x

  24. ( X/ Y% ]  L) Z
  25. #include <linux/module.h>! N3 e# L" E$ ~# o5 g, O
  26. #include <linux/init.h>
    - U9 x  S  t- w5 p/ x4 k: ]
  27. #include <linux/errno.h>
    & o0 M: s5 C. }# P
  28. #include <linux/types.h>9 ~( `/ P' `) k% l
  29. #include <linux/interrupt.h>
    / @! h) G) U* }% W
  30. #include <asm/io.h>1 p5 o/ s7 ]( M. \) W6 h6 I
  31. #include <linux/moduleparam.h>' K$ ?( O8 z4 L. ^5 U4 l
  32. #include <linux/sysctl.h>0 ~; O8 W& \& B+ t; {) r
  33. #include <linux/mm.h>/ r4 ~, t& ?  c, O7 Q
  34. #include <linux/dma-mapping.h>
    - }- U/ p1 L' G9 O- O) M2 G1 |6 W

  35. 3 |& r7 j* b5 `
  36. #include <mach/memory.h>. p. I2 E  ~* D: M8 k
  37. #include <mach/hardware.h>2 c6 i& J1 ~/ S# s7 \
  38. #include <mach/irqs.h>) }' `5 ?% B$ \$ h& f
  39. #include <asm/hardware/edma.h>; ]9 q! N# e* s% r, v$ D

  40. * Q/ ?" y- S, N
  41. #undef EDMA3_DEBUG1 r/ g# l0 R- h7 D4 B4 `
  42. /*#define EDMA3_DEBUG*/
      ?) V8 E9 ^5 C4 E1 Q2 O
  43. & B# Q& e2 w5 |5 }
  44. #ifdef EDMA3_DEBUG
      O, k% x6 G2 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 @7 `5 W) c6 a1 L/ o$ R/ Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      t# F6 A5 [% U: u: g- t4 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% b/ X6 ?! C. Q- o0 a
  48. #else; N4 ^$ }# \4 z, V2 q
  49. #define DMA_PRINTK( x... )
    ! z9 T# E. D- P" ?
  50. #define DMA_FN_IN
    / y% d( g* n4 U) \* [
  51. #define DMA_FN_OUT
    ! Z. t/ A* ]2 I0 c  a+ j6 J: H3 p
  52. #endif
    5 P# h/ C% I( m1 ~: ~$ t

  53. . r$ C7 T  f8 N% @7 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' j5 P5 w* @; H1 {( L% \0 `
  55. #define STATIC_SHIFT                3
    + m/ L/ ?% f* @) L! N& _. P
  56. #define TCINTEN_SHIFT               20
    : ~% J$ I' m7 R2 }/ t7 o
  57. #define ITCINTEN_SHIFT              21
    8 a' T8 w2 ^8 Y* C6 b9 `: f
  58. #define TCCHEN_SHIFT                22# ]4 O3 f& D8 N0 s, ]' w
  59. #define ITCCHEN_SHIFT               23
    ! ?9 S' s" b9 p

  60. 9 @1 d6 _! Y/ L+ m1 N1 E) p3 P
  61. static volatile int irqraised1 = 0;
    & j7 o/ u) t# S5 q( i* T
  62. static volatile int irqraised2 = 0;
    # p3 E" A1 q6 E2 [9 m/ w7 R- H

  63. , w6 u% N( z. B' j) ~0 J. n: U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 R* M/ T$ h9 e. [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! @6 v& g( @* L2 }0 f, {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! V: N6 x4 S- E; v) R8 V4 g
  67. , n& Y9 G4 h& D9 K# r4 x
  68. dma_addr_t dmaphyssrc1 = 0;8 ]% P" P3 P7 R  ?" M% f
  69. dma_addr_t dmaphyssrc2 = 0;0 Y+ \9 [7 a1 d; D7 D. m0 h: U
  70. dma_addr_t dmaphysdest1 = 0;
    ( M( y; y  M: z1 b9 J) v
  71. dma_addr_t dmaphysdest2 = 0;1 ?/ |& \1 X# n, K

  72. * `$ Q/ s" V2 ~
  73. char *dmabufsrc1 = NULL;
    & B1 G% ^2 k# W5 e2 h
  74. char *dmabufsrc2 = NULL;
    * z0 z6 e1 w$ e9 p$ L8 _; B
  75. char *dmabufdest1 = NULL;$ o- U8 R, c6 _4 H( a) a
  76. char *dmabufdest2 = NULL;
    # z- _9 A9 @. @
  77. 3 W3 C2 u2 f9 `+ b2 ^. y+ o
  78. static int acnt = 512;" b% G. x5 j( X* L+ B" \! a
  79. static int bcnt = 8;
    3 B  q+ p6 T* ?5 i& m/ z+ P
  80. static int ccnt = 8;/ x8 d8 K* U( U/ V' r
  81. * a, ^1 u  u) O  M* b% Y/ Q  v
  82. module_param(acnt, int, S_IRUGO);5 Y; {9 F  ?. E# f9 U; ~
  83. module_param(bcnt, int, S_IRUGO);" x' I! B8 A( r4 N+ S$ C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! e: n! g: W% o2 D: |8 c# C, T" |  w& q' u' g) Q9 p% O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- u- L. x3 y; Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; G8 q  d& g6 l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% s" w! Y- U+ n6 W/ {
! E1 c& f8 I6 \8 ]/ S$ K8 B# o# T6 q: @: o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-23 05:34 , Processed in 0.040386 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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