OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : a+ Z+ |) o1 S) F: Q
  1. [code]EDMA sample test application
    ; u3 A* `, {! j
  2. /*8 [  T6 W, \# Q% h: f4 u7 k9 N) U  H
  3. * edma_test.c
    7 n& k3 Z6 o% s8 Z6 q! m
  4. *
    . j" m  H, T& O& q. d6 M& @+ N6 g* e! [
  5. * brief  EDMA3 Test Application5 Z( X" E  h. }. I7 _. U) L5 {
  6. *
    & L" F6 n7 w* \% I
  7. *   This file contains EDMA3 Test code.) v! v+ U# q5 M# L
  8. *3 e1 P8 h% ?, F. J, P  v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) v) D; Y0 n# g  M& K: F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) E( o" _4 r  Z$ I3 b( P5 ^# P
  11. *         TO CHANGE.
    ; {- \7 T  i. o( x4 w, m
  12. *# H+ s" g( h6 h% q% g, L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// I& e6 X: h8 O! i: G
  14. *
    $ Q/ ^) [6 a) ?8 P7 U$ g% L
  15. * This program is free software; you can redistribute it and/or6 [+ M3 v! Q1 S3 G5 e6 Y, r
  16. * modify it under the terms of the GNU General Public License as
    5 x$ E6 c- ]7 {" X
  17. * published by the Free Software Foundation version 2." e: M: G7 y% t8 \% K, W# y
  18. *
    ! F1 q- m8 f8 d+ N/ z7 N5 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , [* O* x$ e7 _9 f3 I% N1 m0 ?
  20. * kind, whether express or implied; without even the implied warranty
    " r0 z5 q8 M( X& v) d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 N5 s5 }$ o' ?3 x% }
  22. * GNU General Public License for more details.  H8 ^9 C( t* f3 c7 y! l/ e, S' v
  23. */
    5 q% s+ C% v' R2 M: n; b
  24. ) c' n8 L8 Q- F6 N% e% h
  25. #include <linux/module.h>
    ' J6 l# x9 y/ |- B9 k
  26. #include <linux/init.h>5 @5 Y* l4 L* f. ?, e
  27. #include <linux/errno.h>
    " C9 U9 E! D7 H9 K! q( C
  28. #include <linux/types.h>
    / F+ c* E5 x9 E& K5 n0 F" J( @
  29. #include <linux/interrupt.h>
    2 U( S  [0 ^! A2 o, K4 F( o; m
  30. #include <asm/io.h>. v1 C+ _. M5 M1 M* i% t7 k' m- A
  31. #include <linux/moduleparam.h>3 C1 r: i# F5 n5 S  P' x2 M
  32. #include <linux/sysctl.h>
    2 _7 c* c0 C7 z' c5 Z2 d
  33. #include <linux/mm.h>
    9 [, M' u2 {9 I4 \( Y1 _
  34. #include <linux/dma-mapping.h>; a- Q. y9 J" K, B/ j( ]  Y; z

  35.   x3 V) r" |- E" d# }
  36. #include <mach/memory.h>0 T/ S8 D9 u4 x6 f" e- ]. K
  37. #include <mach/hardware.h>
    ) S) U0 }1 g& q4 `! c0 B
  38. #include <mach/irqs.h>  r! r3 R1 O/ m$ N* o! R+ j
  39. #include <asm/hardware/edma.h>( u7 ~. N8 Q% h$ x2 ?) E
  40. ; L4 o& n8 q1 N9 i3 r
  41. #undef EDMA3_DEBUG- x& T5 R/ I& ]: K$ `. t% U
  42. /*#define EDMA3_DEBUG*/  ~- F) Y4 }) ^8 k6 @; ?) X% T
  43. 3 _: {/ w4 j) m0 `: @, e4 x
  44. #ifdef EDMA3_DEBUG* v! w7 J6 v& U# A+ T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' v1 F( \( L4 Z6 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . g4 g9 f" c# q+ R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* Z- y4 ^3 d3 y1 {) m$ u
  48. #else5 ], P/ V7 X1 P! M( w" ]9 w
  49. #define DMA_PRINTK( x... )
    ( F4 {5 S' }# u7 r* F, L6 b! o
  50. #define DMA_FN_IN
      Q) }+ L  R3 Y  P$ J
  51. #define DMA_FN_OUT+ I7 q& A3 @" F9 q0 y9 Y
  52. #endif
      C& R: Z7 }; A# }: e
  53. ) D& f+ a" X2 [( }7 D3 ~9 P9 H3 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 R/ n* M( {( L
  55. #define STATIC_SHIFT                3/ Y* [2 o( Y& w7 P) Q, [' G, _
  56. #define TCINTEN_SHIFT               20
    5 G$ h" j/ r  ?& ]
  57. #define ITCINTEN_SHIFT              21' B' @1 G. [" C/ x! ^: m
  58. #define TCCHEN_SHIFT                22* t$ l# R/ C' N; H/ D# L1 ^7 v8 A
  59. #define ITCCHEN_SHIFT               23
    9 W4 u! p. \: c$ J8 A/ ?

  60. 6 y0 c0 N3 ^! u! y
  61. static volatile int irqraised1 = 0;# t' E( R6 C  [/ L2 r: M2 F" R, B3 f
  62. static volatile int irqraised2 = 0;
    - P! M/ h. N2 S0 }5 p6 a

  63. * g% y: O" z  Y  L0 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& s7 k+ O3 A% |& t9 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 e% _, v& j1 k# k  _$ b3 J4 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % J" x9 ]) D- ]/ n4 ~: b

  67. " `+ y, ]- D& i& A1 o% d. f
  68. dma_addr_t dmaphyssrc1 = 0;+ Z9 o9 r4 [# _5 f! {) ^$ C
  69. dma_addr_t dmaphyssrc2 = 0;
    ' M+ o8 Q+ Y7 n: v& v! Y
  70. dma_addr_t dmaphysdest1 = 0;0 k% n! Z9 Y) L
  71. dma_addr_t dmaphysdest2 = 0;8 T0 S3 a1 K6 Z# F
  72. 0 p. L$ h! m7 ^) F7 |8 B3 d
  73. char *dmabufsrc1 = NULL;
    ' w% d0 I9 z8 e0 Y! \
  74. char *dmabufsrc2 = NULL;3 R2 ~% u# A& F$ v& f! S
  75. char *dmabufdest1 = NULL;5 x( Z1 N) t: w; ?" E, ]6 W
  76. char *dmabufdest2 = NULL;" U# c' G# I' A0 x, |% i  X5 E7 U

  77. , h8 L  H' l4 j5 r6 M' x
  78. static int acnt = 512;9 _* Z9 S: @8 E
  79. static int bcnt = 8;% K2 |1 E8 Q2 v+ o% q' v, D7 F0 Z
  80. static int ccnt = 8;$ v& m2 g4 _! v

  81. * d/ Z* W! d% k& e# S& o8 B
  82. module_param(acnt, int, S_IRUGO);
    ) c7 y, W3 u  t# S
  83. module_param(bcnt, int, S_IRUGO);
    8 U! j. K1 |* O+ B2 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' U5 n6 L" c) W" Y) N& {. s6 o  Y" O1 F( w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 `- S4 t) d/ n$ Barm-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 i) x7 ~! e5 U' g; C7 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# Q1 V1 r9 R; I$ t
; ~0 n4 ^6 l1 k; ~

( b- c* e' W; D$ j9 |$ F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 21:52 , Processed in 0.038132 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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