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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! ~: Q0 ~9 P8 h( A; `% l
  1. [code]EDMA sample test application
    $ x9 u3 P+ p( q) x
  2. /*1 @/ P: ?8 j, K9 p8 K# C
  3. * edma_test.c2 \( h6 V  o7 d9 X
  4. */ o  w5 n+ q2 A# Y& `5 }8 z
  5. * brief  EDMA3 Test Application8 f, z$ E8 a1 Z. }& t
  6. *
    + i$ ?0 V! O" A! X
  7. *   This file contains EDMA3 Test code.5 x" U6 O7 X# O  v- {: V
  8. *
    * p7 p( C  X' l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * W3 R9 r' t2 o& }- k. h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 h% ?0 F, h" O) S) e
  11. *         TO CHANGE.* ?# x5 t! \4 ^4 i& [/ m
  12. *
    + A7 m. h0 h/ e9 O' O& z- Q# g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      i8 r8 W  E& V
  14. *1 t! p; P0 v/ k# u
  15. * This program is free software; you can redistribute it and/or. T) f- o- n4 Y: B; e# M4 r
  16. * modify it under the terms of the GNU General Public License as
    4 D1 w' ~  v, W6 V9 Q
  17. * published by the Free Software Foundation version 2.
    * A2 m/ g' {, j1 D5 {& I  R
  18. *
    " q) g& L2 U& y! J8 \& }" Z3 o. T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , s1 V3 g$ E- `9 j. v7 f' i
  20. * kind, whether express or implied; without even the implied warranty9 O+ p* f. d$ w2 `: T4 P/ M$ w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 q+ F% j8 F9 a3 A% M
  22. * GNU General Public License for more details.
    ' `2 b# H* s# ^9 p
  23. */
      u7 H9 s0 g8 n( [+ ]

  24. % W& q" _5 @. ?' p0 k- w
  25. #include <linux/module.h>1 L1 ~8 e4 V! f6 q* \) t
  26. #include <linux/init.h>2 B5 V$ H2 {! P( ^3 K8 w( [  J
  27. #include <linux/errno.h>
    + K) `+ m* z1 j7 s% y
  28. #include <linux/types.h>4 I. q) F4 D7 `7 n
  29. #include <linux/interrupt.h>
    . d( s6 k! V- J9 d9 L+ N+ _3 Y
  30. #include <asm/io.h>
    0 ?# j, ~0 J' e! r+ {
  31. #include <linux/moduleparam.h>: |- s6 H& n, v( P- t* G
  32. #include <linux/sysctl.h>/ \, e( d2 o* o& Q  P
  33. #include <linux/mm.h>
    - W' G3 l( j2 I$ X! q' e
  34. #include <linux/dma-mapping.h>
    % W  @0 k6 ]; o. x  [

  35. " {& p$ G% o: U2 [$ H8 }) x
  36. #include <mach/memory.h>
    ! a" j- p% \! X0 {. I9 k# }
  37. #include <mach/hardware.h>
    5 _/ E6 |0 N6 S7 G( ]0 D# o
  38. #include <mach/irqs.h>
    # Z% |& u0 [  u: T' g
  39. #include <asm/hardware/edma.h>
    6 t0 ]$ P  z' D+ k
  40. 5 y" v! p  U8 U; b& Q
  41. #undef EDMA3_DEBUG
    3 H, @8 ^7 t: S
  42. /*#define EDMA3_DEBUG*/
    ) R- Y7 d: g# F$ E; P, v  t4 L& U

  43. ; r9 L7 j, M. H. |0 A! U
  44. #ifdef EDMA3_DEBUG
    ' v% ?, e, _. C4 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( t7 t' o& Y% b: f+ F( O, O. N/ e+ S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( t0 c7 R5 [' \( t% b- K: C4 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! Q. I0 x! F* `- Q6 c. X! b/ }& A
  48. #else9 {( j8 d* A5 E! K5 o( @
  49. #define DMA_PRINTK( x... )
    % C) T. B1 w8 `* C4 L5 q# A
  50. #define DMA_FN_IN
    1 Z, S# ~- c5 B) \
  51. #define DMA_FN_OUT7 d7 \* k4 m  ?
  52. #endif7 V, @9 j3 ?$ E1 g9 ~# P% {4 q
  53. 4 E) K- b, r- ~% p" A( J4 k- |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / T  C8 Y. E, p* Q7 P  S
  55. #define STATIC_SHIFT                37 H  x5 Q# \7 N0 C6 j/ L) ~
  56. #define TCINTEN_SHIFT               20
    . m1 p- `6 R# [" O1 r
  57. #define ITCINTEN_SHIFT              21
    5 y* q! V! w+ \! f
  58. #define TCCHEN_SHIFT                223 [! C: E' P- \5 |( T7 b" H
  59. #define ITCCHEN_SHIFT               23% u( X4 R8 {0 E+ _0 l

  60. $ L9 Z0 `7 }' r3 n: I$ h
  61. static volatile int irqraised1 = 0;
    7 c. H- h6 _9 |9 g& o7 X
  62. static volatile int irqraised2 = 0;4 R( l' L* X& Q; C$ j7 W! D

  63. 0 G8 X) M) I/ T& g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ]% e: M4 d7 [- l0 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % r. ~" P+ h% W. ^3 M) K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  j7 ^$ g8 [6 y1 Z! e3 P/ E

  67. 2 a/ n& d7 t2 J' Q
  68. dma_addr_t dmaphyssrc1 = 0;
    * q) ]( I+ B0 q- J2 B
  69. dma_addr_t dmaphyssrc2 = 0;3 H9 \3 X+ _. b
  70. dma_addr_t dmaphysdest1 = 0;
    # X$ X% K4 q5 ~8 ~) ~; ]
  71. dma_addr_t dmaphysdest2 = 0;$ v8 l9 y" }0 Q2 Y7 v- G  f

  72. 8 F8 v6 U. _* P5 H/ D- g7 c
  73. char *dmabufsrc1 = NULL;
    7 F4 T# [* _% A7 K/ M( A. o. {
  74. char *dmabufsrc2 = NULL;# M! D; Q9 w# J: I* @
  75. char *dmabufdest1 = NULL;
    , T0 N+ h& H& d2 N. S
  76. char *dmabufdest2 = NULL;
    + T2 _: p" k: C* Q  G

  77. 7 l$ E: ^: {  B
  78. static int acnt = 512;
    3 L, K  x' q0 g# h. o& j9 y
  79. static int bcnt = 8;( W1 l/ r, x- I7 d& K0 A/ o3 X( B3 i
  80. static int ccnt = 8;7 e. \& s# s" O5 q4 H
  81. % C9 Y( t5 j! V' l# q. F
  82. module_param(acnt, int, S_IRUGO);. M6 k( t- Q, v" {
  83. module_param(bcnt, int, S_IRUGO);/ b' @. I" n/ M& t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 s+ B/ `7 I/ o- P

: V2 L% I+ o- {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# J% n6 z: d9 B7 J/ P1 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: [% k0 y  ^0 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. [) \+ [3 _, V5 E- a  G& M6 ^
2 g' p& X( ~# E0 \
( q% U7 I: z% l7 A' K# M7 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 12:49 , Processed in 0.039694 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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