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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - n/ `& \+ f3 W5 ^
  1. [code]EDMA sample test application
    8 }6 D; H: |. P
  2. /*
    ! _+ K2 W+ Q9 W6 ]
  3. * edma_test.c
    # d1 b* [4 @$ [/ b- p) N1 ^
  4. *
    6 `5 O) [/ Q5 c: ?
  5. * brief  EDMA3 Test Application
      V& w" o2 ~# I# r
  6. *
    / I& O9 F. g: Z0 a6 M3 \- i
  7. *   This file contains EDMA3 Test code.
    # k4 I. K& s. Z/ m5 q& v
  8. *
    & r% e! w* ^3 O7 Q- w/ _. g3 B' C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# g7 s: P3 X. ^: O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , W8 \0 T- O/ l+ {+ n
  11. *         TO CHANGE.+ L! N7 m6 L1 Q) @) j
  12. ** m* h) o& a# B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" J" x* i1 W8 f4 F( c5 P
  14. *
    : H. B" k* y3 `; w2 G
  15. * This program is free software; you can redistribute it and/or* D. N; a. l2 k& m( ?
  16. * modify it under the terms of the GNU General Public License as
    * P: B, d0 D: H- P
  17. * published by the Free Software Foundation version 2.
    ( d4 l$ o' T) v: U: J% H6 a" h
  18. *
    + L: H5 s% E7 [  e; N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 S; Z2 a6 p8 L- m
  20. * kind, whether express or implied; without even the implied warranty+ a+ i! \  q; P, g3 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) K, l: F& l) K9 I. w
  22. * GNU General Public License for more details.0 |8 M. q0 X+ c/ X6 a# F4 ~  t
  23. */
    ; I8 y3 K- ?8 ~& w. r( l0 M
  24. - S* _* p2 J3 k7 `* d
  25. #include <linux/module.h>. B7 S. [5 f; D/ C% i
  26. #include <linux/init.h>4 K2 q8 g$ P/ F+ r# h
  27. #include <linux/errno.h>
    $ i! u* e$ l. B% v* B/ B
  28. #include <linux/types.h>% a$ s: o* Q% o* w
  29. #include <linux/interrupt.h>. |2 _" C9 Z" T0 R4 A. Z
  30. #include <asm/io.h>
    ! E% q0 H8 `% ^, n3 R" ?1 }
  31. #include <linux/moduleparam.h>
    $ j3 L# m% V& J8 U6 Z7 q
  32. #include <linux/sysctl.h>' q: F+ k( B6 ?
  33. #include <linux/mm.h>
    " i$ u- Y9 b- M- s
  34. #include <linux/dma-mapping.h>3 L, E0 L1 x2 U! L. o# A

  35. 0 e- P" T3 {& c; {0 s7 x
  36. #include <mach/memory.h>2 e" P6 v  r, q
  37. #include <mach/hardware.h>
    6 D$ o- o% D& G# z: \0 u# W
  38. #include <mach/irqs.h>/ B: r8 c$ l# _7 j$ T3 }5 @$ S3 t
  39. #include <asm/hardware/edma.h>& M( U- M( [8 ]7 N; K$ B

  40. * G9 ^4 g' ]8 _2 c
  41. #undef EDMA3_DEBUG
    8 Q; p' t5 x0 _& P7 y7 O/ n
  42. /*#define EDMA3_DEBUG*/
    8 A+ h  J3 H4 j% }' Q1 j; G
  43. % \4 @. n5 G; P$ |" x% f5 `) j& [
  44. #ifdef EDMA3_DEBUG
    , M! n- A$ t. E1 A$ Y% s: C; q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ j: Q# z+ Z; V7 l  \2 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 C, z' [" |$ R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 K0 C" X0 S# N& N6 Q
  48. #else
    ; {. j) P6 M! Z
  49. #define DMA_PRINTK( x... ); A# y8 f' a: h0 O$ b
  50. #define DMA_FN_IN1 L6 N: V  q5 U9 ?
  51. #define DMA_FN_OUT
    ; X8 _1 y7 K" T' g) Y, [: f/ a
  52. #endif, A8 y( ?! k& ^1 D% Z' |' n3 b  n

  53. ' u6 H: @2 {8 Q$ Y8 M( S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) V, D) G4 N7 u% o" O
  55. #define STATIC_SHIFT                3- R, B, x8 M4 h! h" O0 |
  56. #define TCINTEN_SHIFT               20
    ; {7 Q7 f# V# }* Z" Q# F0 u
  57. #define ITCINTEN_SHIFT              21; Q! P* @8 d; C& E. ?4 v
  58. #define TCCHEN_SHIFT                22
    ) @+ }- n  c' S
  59. #define ITCCHEN_SHIFT               233 t9 j* ]2 ]( I& ~: ]& J* f2 o

  60. 6 v/ c- u' g4 u+ ^/ e7 o
  61. static volatile int irqraised1 = 0;
    ' S5 @% g% j5 C
  62. static volatile int irqraised2 = 0;
    ( ]7 O( K3 Z% D7 L( Q% T

  63. 0 e4 L0 p0 k2 }" q$ w+ x8 ?  f2 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " L/ R; A1 X/ g2 a8 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * J& B7 D# s# B5 K% j# p* F' z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 w4 y9 ^$ J1 x! j

  67. 0 O1 D" b% q- y' p& |
  68. dma_addr_t dmaphyssrc1 = 0;
    % w% u0 a# j% D; c. N' F) U+ J
  69. dma_addr_t dmaphyssrc2 = 0;! F5 S3 Y/ ^( B; y; z4 _
  70. dma_addr_t dmaphysdest1 = 0;( t- O, h* U4 T- Y0 Z7 Q# x4 r- J
  71. dma_addr_t dmaphysdest2 = 0;& O* \6 v8 B/ |% S! O+ e7 t; ~# Q1 \
  72. * S5 M6 _: Q9 ]) K3 T0 d( }' M
  73. char *dmabufsrc1 = NULL;5 Q, b: m7 @7 Z" p
  74. char *dmabufsrc2 = NULL;5 Z9 R7 I; B( m5 z5 n( E& I
  75. char *dmabufdest1 = NULL;3 g, Z" b3 [* e$ y
  76. char *dmabufdest2 = NULL;
    ! Z$ T. i9 p' r" K1 H$ Q7 \# N# m# f

  77. 0 s# F5 q0 a' ~2 Z6 d6 Q9 b/ k4 _! M8 ~
  78. static int acnt = 512;
    ; T7 c! H, Y8 z) \0 \
  79. static int bcnt = 8;5 L' N& `# {2 D; l, o5 P, M: N/ O
  80. static int ccnt = 8;7 C4 b- Q$ W* S0 R/ m( T

  81. 5 ~7 U1 C1 l  H1 ]- p, e; a
  82. module_param(acnt, int, S_IRUGO);% B; p/ V9 u$ k+ I! k3 E
  83. module_param(bcnt, int, S_IRUGO);
    ! j* W7 ?6 A4 h& w  n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% |6 D4 Y9 X6 }# H* y1 a; N2 j
: q! P6 n% o, W7 ?6 @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' }8 L2 x: R  Z  \, m7 _# [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 U* _5 \# V- k2 ^6 d! e" @: X$ T; c) C6 n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: a2 X0 p  M5 k, v
" l. N' a& w5 D1 h
  G  d' |0 f" N* A& p  H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-26 20:09 , Processed in 0.043862 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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