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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, P4 I6 M& A3 \+ g3 q
  1. [code]EDMA sample test application
    # U* ~4 ~& g4 ^* i
  2. /*0 l9 @* D2 [7 m" ]- W4 e( C  Y. g
  3. * edma_test.c
    # }6 \! t2 k% C: J& [( u# M2 B+ r
  4. *6 n5 d+ W; d8 b0 c7 b0 s: N
  5. * brief  EDMA3 Test Application
    # |% ~% a- I7 b0 s* s! s+ V
  6. *! v/ M% A5 Z- e/ o3 I9 `8 g
  7. *   This file contains EDMA3 Test code.0 e! Z& S0 Q; C2 H( `
  8. *  ?: X9 m& Z( S, [7 E# M, f. b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 d6 D& }  z) O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 b( y% f5 M" h5 E# B3 f, P
  11. *         TO CHANGE./ i9 I5 g& P  D8 D) d( I
  12. *+ Y1 ?* T5 q7 |; D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ R$ P: g  \3 l! {6 s  Y
  14. *
    " G# {; d; g. d7 E
  15. * This program is free software; you can redistribute it and/or
    & ?; C) n" U# w. b
  16. * modify it under the terms of the GNU General Public License as
    , Z8 C* n& O* G# t8 [2 R8 z7 L, @' S
  17. * published by the Free Software Foundation version 2.
    5 [0 n4 q: o; v+ f0 j9 G4 T
  18. *
    . ]& `% v2 c% H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 p0 q+ f8 K3 z& ]* C# t1 ~* N
  20. * kind, whether express or implied; without even the implied warranty4 y0 @9 T6 i; p0 r+ n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* l' o  X! h  {0 Q* n
  22. * GNU General Public License for more details.2 x1 \1 f/ o+ A" b
  23. */
    6 Q4 p% j. I3 |" U9 P( c' d3 \

  24. ) P7 y) O  y! F, E( @3 f
  25. #include <linux/module.h>1 m- K4 ~& G+ R% C: n
  26. #include <linux/init.h>7 F" E5 B/ y7 e( X7 K7 c: R
  27. #include <linux/errno.h>
    % I. n9 Q% n# t/ F4 ^: H
  28. #include <linux/types.h>
    9 f$ M8 M* Z7 Z
  29. #include <linux/interrupt.h>
    ; a" Q9 \  I/ K6 i
  30. #include <asm/io.h>
    7 }- F, L. R" R4 \& P
  31. #include <linux/moduleparam.h>
    ) e  F: F& _; c/ F  U
  32. #include <linux/sysctl.h>
    * ]+ _  R3 Z  r4 F8 b1 }2 F" a; [
  33. #include <linux/mm.h>
    + A2 L6 R2 M, N- s5 a6 b
  34. #include <linux/dma-mapping.h>
    : V  D& E- o1 U! ?$ S
  35. * t3 a% }$ F) Y5 w$ O
  36. #include <mach/memory.h>$ K( @! |! E4 u+ d6 b0 [! z
  37. #include <mach/hardware.h>
    3 e; Z3 |6 ~2 S' ?3 T) j& B
  38. #include <mach/irqs.h>
    ; W9 x% s" r0 L  N8 j) k
  39. #include <asm/hardware/edma.h>
    0 V5 w% e" F# F

  40. 7 P" V; T" C3 d
  41. #undef EDMA3_DEBUG7 X8 v/ ]* t0 A8 b+ A1 q
  42. /*#define EDMA3_DEBUG*/
    + b# x: ], z2 m* d

  43. % t$ K! S  Y+ Z. z& L. Y9 Y
  44. #ifdef EDMA3_DEBUG
    : t8 H& t) o" y% Q  g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & Y' _- k' E0 k2 X" A' x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  B: R' G0 O" j. B# \* A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 H- J7 K7 @) A
  48. #else2 E7 F& s; i, t6 d
  49. #define DMA_PRINTK( x... )1 N, t7 d4 k0 N( K5 n4 ]0 @: n
  50. #define DMA_FN_IN
    # g. T9 Q" u2 V
  51. #define DMA_FN_OUT
    1 t) w+ _0 X0 J6 J2 a9 a
  52. #endif- V& q" R1 i' V" y
  53. % X4 P) ?0 \; r, T/ P: U4 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' j5 Q# f4 [) t
  55. #define STATIC_SHIFT                3
    1 b& q8 G" D8 H/ N0 ^$ c6 ^
  56. #define TCINTEN_SHIFT               20" y2 ]9 P+ X6 X( R0 j9 X( o
  57. #define ITCINTEN_SHIFT              21
    + Q% S0 Y% ^! K
  58. #define TCCHEN_SHIFT                22
    , n* y+ N4 K3 B4 t6 O5 i0 N
  59. #define ITCCHEN_SHIFT               23
    ( u* \! i. {; H! g# H
  60. 2 B" Y; B: s6 N
  61. static volatile int irqraised1 = 0;! i& q& j3 k7 P2 O# `& ]' ~
  62. static volatile int irqraised2 = 0;
    % ?; ~8 y7 I+ T& y3 n6 q# I

  63. , q/ r3 P; S, L7 \: O2 |8 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! `% k& R) X7 x# `  \' O1 D; N5 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [5 n" a4 f- `6 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * B5 H8 o( y3 u' T

  67. * {5 t3 L! p1 |/ S% ^
  68. dma_addr_t dmaphyssrc1 = 0;+ B$ O& D: U! g& g: r/ r( M$ k% m
  69. dma_addr_t dmaphyssrc2 = 0;. {# @* ~5 ?% ?1 m, `1 x
  70. dma_addr_t dmaphysdest1 = 0;
    * k, F7 o/ ~/ u- @" h7 L/ @0 D
  71. dma_addr_t dmaphysdest2 = 0;  K& A  A: S8 R, u- g

  72. 6 l  E: W  f; i- S( o4 F
  73. char *dmabufsrc1 = NULL;
    % A- P4 v/ p) N+ N
  74. char *dmabufsrc2 = NULL;
    * q% N7 \% K. W) n* ]
  75. char *dmabufdest1 = NULL;( }3 J- I8 x8 ~
  76. char *dmabufdest2 = NULL;
      f; u7 q& u1 F. ?  d
  77. 9 f5 C' b! [' r$ |. v0 |
  78. static int acnt = 512;
    ; s* G$ w! E! F) l& r* m1 |/ Q
  79. static int bcnt = 8;6 y" X& {' Z& V( N; `5 J# y$ f
  80. static int ccnt = 8;
    # Q  o$ b# K' D' j7 J' [

  81. 3 W2 S; N+ T' x  x: ^. W
  82. module_param(acnt, int, S_IRUGO);
    + k7 i/ q9 O  f- k0 A2 S$ B
  83. module_param(bcnt, int, S_IRUGO);
    3 ?" Y; E$ A7 g. s  o" e0 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 l6 @6 r9 s; D1 p8 B! y2 Q
$ S. h# b/ j1 f+ z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 A, C- s7 R8 k/ T+ \; Q* G6 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; V9 N8 r9 V' s  m8 B# ]: ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( u9 Q! Y7 }7 l. f
! @2 C2 W+ j. o3 b4 ~

2 g' E. j. R( y7 B; E* ^4 }1 O& j0 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 01:26 , Processed in 0.037948 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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