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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ o$ u" K! [6 L' r* j
  1. [code]EDMA sample test application6 {: e/ @9 Q9 F" Q' ]9 u( [" M+ j
  2. /*' U0 ]* X  |# N. L" D
  3. * edma_test.c
    9 u5 u( V8 u% a0 q& D) S
  4. *
    " m: w$ k" a/ d7 G
  5. * brief  EDMA3 Test Application
    # @% v! T) z& p  z  I
  6. *
    ) [' _/ R2 Z4 O* p% Y5 m
  7. *   This file contains EDMA3 Test code.
    7 \& n- \3 V8 y! p2 o% b0 |' m
  8. *1 x+ m) i6 F& P( r/ I/ D2 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 u/ ?' _; v8 Q- L0 s* y9 ~1 ], n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ x# H5 P& L; e1 G& o
  11. *         TO CHANGE.) z( r' H+ E; {+ q2 h
  12. *
    ) _: V7 s" u. G$ E" N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// `9 T1 M/ y3 J) @0 Y
  14. *
    ( r* J- p5 B+ \7 h5 }
  15. * This program is free software; you can redistribute it and/or
    , D8 l8 n, H" n" a% i8 Y
  16. * modify it under the terms of the GNU General Public License as8 k# P  H; H. o0 g+ }
  17. * published by the Free Software Foundation version 2.
    - @/ M8 z* R# [* d% B
  18. *
    , R& ?) c9 |+ X4 ^/ Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' b% s$ Q+ j( ~: \
  20. * kind, whether express or implied; without even the implied warranty
    ' J# s# ]/ S0 T$ {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # o. T4 ^7 f7 S* u
  22. * GNU General Public License for more details.
    % R5 i. p1 D. G- u) C) H/ v: L2 E' w
  23. */1 N+ E) x5 H1 i

  24. 4 R. @  i8 d1 t& @
  25. #include <linux/module.h>, K5 [( I5 E3 D$ a3 [' y
  26. #include <linux/init.h>7 [9 Q+ X2 V" e1 E2 c
  27. #include <linux/errno.h>* `! X& D6 b# G4 E0 w/ M7 Q
  28. #include <linux/types.h>4 b8 d0 O+ w' T1 ]9 v% e  r
  29. #include <linux/interrupt.h>/ e6 `5 L. X( k" D/ f( T+ R6 u2 H
  30. #include <asm/io.h>
    ; t/ h, S$ s3 r/ x2 }1 e
  31. #include <linux/moduleparam.h>9 ~7 l* g4 U7 V  c3 W
  32. #include <linux/sysctl.h>, j; g% y2 J! F/ Y* l7 T' ]8 d
  33. #include <linux/mm.h>9 F$ l1 r8 W# N' n, n/ I" S0 g
  34. #include <linux/dma-mapping.h>
    - O* u# q  q+ s- c! l1 d

  35. " F8 K2 M" n# {# [# g
  36. #include <mach/memory.h>
    ( _7 p) }& H3 \( v2 w+ Z
  37. #include <mach/hardware.h>7 }# t  ]& z8 ?- I7 B) A
  38. #include <mach/irqs.h>3 e# |5 d8 W' ~+ @) y& I
  39. #include <asm/hardware/edma.h>
    ' U0 e* y! Y! R$ i- J! F
  40. . F3 A3 ], ]" |% ~" J, r
  41. #undef EDMA3_DEBUG
    2 V8 _+ D' q& _5 B1 [$ b$ S
  42. /*#define EDMA3_DEBUG*/
    6 Q* f7 N7 c) l' S' }
  43. 8 [* U; x5 C7 e" ]& a: f
  44. #ifdef EDMA3_DEBUG* T) v! Z( O; j2 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! A0 I+ y0 i8 Z* y6 I6 x# _/ F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' N, i- ?/ I* `; j! U2 ?  I2 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 W! ?, ^6 N( O% s2 v  h" k
  48. #else
    $ e+ X9 |5 E& g. x
  49. #define DMA_PRINTK( x... )
    : G/ e6 N0 Z, H
  50. #define DMA_FN_IN
    $ ^5 U) [7 o3 d; h" N2 a' K8 }/ l
  51. #define DMA_FN_OUT- d8 K8 Y9 W/ Q7 t/ ]( f& `! \
  52. #endif5 R6 c- r" L/ T- {: y5 N) y. b$ @8 P% s0 F
  53. 6 s# T; z$ |1 j) L" V! c3 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 F9 A1 U( ]3 ?
  55. #define STATIC_SHIFT                3' p: H* A! `9 T
  56. #define TCINTEN_SHIFT               20
    ! p. s: [$ Y$ Y
  57. #define ITCINTEN_SHIFT              21& U7 S# K- }- t5 `% z- s
  58. #define TCCHEN_SHIFT                229 D8 ~7 M8 k: B/ q
  59. #define ITCCHEN_SHIFT               23
    - f1 X! u' i' w9 t0 y

  60. 2 J2 C# z" T& _  R' R) G* w
  61. static volatile int irqraised1 = 0;$ S; j( d, x# d1 O7 V& W
  62. static volatile int irqraised2 = 0;7 B2 \. T1 ?5 L: y9 z
  63. " O% X' f) }( J+ c4 [( c" q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u  `1 C$ c: l- T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 {( \% D5 x3 r+ G+ v+ d3 J# e5 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: [% r* W& a8 H5 ?+ G4 K! b

  67. ( u9 m! d) r: s
  68. dma_addr_t dmaphyssrc1 = 0;
    7 \$ ~  Z! X! f) A% r+ f
  69. dma_addr_t dmaphyssrc2 = 0;2 c) Y3 Q, S) C, w! `& F
  70. dma_addr_t dmaphysdest1 = 0;) D4 f0 r; k8 d: m5 j
  71. dma_addr_t dmaphysdest2 = 0;
    8 E" a  s, D3 X  n4 N8 i& o
  72. 1 j  h. M9 m% G" i, w0 r& K
  73. char *dmabufsrc1 = NULL;
      v: `1 k% y; w, B* f
  74. char *dmabufsrc2 = NULL;
    * @9 N7 R/ Z, o; K+ z
  75. char *dmabufdest1 = NULL;  w" B# D$ x) K6 T& e6 O: O
  76. char *dmabufdest2 = NULL;
    * Y4 w' e8 `9 m, X/ t

  77. ( q/ i* |4 n- W& ]: Y! g
  78. static int acnt = 512;1 P6 ]( O' l3 X$ X. x  @, f2 Y
  79. static int bcnt = 8;
    9 g: S0 T6 O3 l1 ^* B2 j
  80. static int ccnt = 8;4 A% `0 P: [" Y% a4 k

  81. 9 r: p3 ?# G% X
  82. module_param(acnt, int, S_IRUGO);
    ! ~6 S8 o7 ^$ _/ x
  83. module_param(bcnt, int, S_IRUGO);
    + x8 C1 ]3 B* {' L; t0 Q' v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 M+ [! \. K7 I/ Y& [
9 t$ F3 ]3 s( d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# u  q7 H, ]% \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 A) v( Z; t4 @$ G. a+ _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 Z: z. e) p' U3 f# V
' q8 s, ?; f: Z( ]0 X

% J$ q- p( F+ W4 @2 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 12:06 , Processed in 0.041358 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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