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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* u3 ~5 ]0 y8 N
  1. [code]EDMA sample test application
    * S- \/ c- L4 n/ o* c' C' {/ E, s
  2. /*" g4 M6 x2 W& s2 }* q5 t
  3. * edma_test.c
    ! }. V: T; ]( P1 x5 M
  4. *- d; I" o4 {8 b
  5. * brief  EDMA3 Test Application
    * X# M. m* `0 [4 _
  6. *
    # x2 q8 o* b  A9 e3 c
  7. *   This file contains EDMA3 Test code.
    $ }/ z# |& Y1 u# M3 o: ^2 _- k
  8. *; {1 ~+ q7 t( N6 L3 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * c- e; @6 S; a2 O# _! x# `8 a+ q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" k( R3 X8 H1 _4 `6 T, y
  11. *         TO CHANGE.
    0 m3 {( g6 c' I
  12. *
    5 l3 o8 K2 ]& I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* ^7 \( ?# N4 j" H8 }2 u" D1 Q
  14. *5 l) v% d. J+ Q3 j+ U0 D0 ~
  15. * This program is free software; you can redistribute it and/or2 ^& i( S- R  V2 o* _
  16. * modify it under the terms of the GNU General Public License as
      l" P+ m4 U# F; x/ p3 T3 q7 T) y
  17. * published by the Free Software Foundation version 2.5 ~& C2 P6 j% _/ S% R( C
  18. *1 ^: y7 }1 `# ~# x. f  L9 z3 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ A; B4 y0 R; R) {1 |  ]" t
  20. * kind, whether express or implied; without even the implied warranty
    % {2 I1 J3 b3 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( z) J" M" ~) i, f0 h
  22. * GNU General Public License for more details.
    6 ]3 R8 o  v1 {% y
  23. */
    4 E: M) h2 w( s- L0 L
  24. # ^# {# L! a( I* D, U" q5 K7 q
  25. #include <linux/module.h>. ?( m) g6 _5 O% V7 L7 g* {
  26. #include <linux/init.h>
    # C0 L, S) }+ r. \* Y7 W0 [0 G
  27. #include <linux/errno.h>
    ! Z% V" W% L& V0 X" b
  28. #include <linux/types.h>
    : X2 z, e5 }1 s6 }0 x* B1 ?) d
  29. #include <linux/interrupt.h>3 J- ]9 R4 d. T7 S, g
  30. #include <asm/io.h>) K4 q' c; C+ J1 P3 h! S, ~
  31. #include <linux/moduleparam.h>
    # y/ y" g1 B! v
  32. #include <linux/sysctl.h>
    2 N/ k1 k5 b  W, u/ u
  33. #include <linux/mm.h>  j7 J5 w$ m0 S; ]& E( q' l. h
  34. #include <linux/dma-mapping.h>
    5 ^7 W: [2 n, ?3 C5 r; i7 Q

  35. ( n0 ^4 i  g' `3 d" @
  36. #include <mach/memory.h>
    ; N  S4 H6 q- @, s
  37. #include <mach/hardware.h>3 |/ `% ?! U" P: y: v  h
  38. #include <mach/irqs.h>6 G3 h( s7 h/ \7 X* T$ z
  39. #include <asm/hardware/edma.h>" {$ V  {" p9 d7 E

  40. 1 j/ R- v" ^4 P6 z, i
  41. #undef EDMA3_DEBUG$ a1 D) L0 C1 u# r$ t7 ?
  42. /*#define EDMA3_DEBUG*/+ ?/ F, Z( d2 ^5 J# M  o: k
  43. % ]' U, X0 b0 l
  44. #ifdef EDMA3_DEBUG
    , v9 K1 L; y1 M; h% v) P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% ~& G6 O+ `# ?  S. u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 m0 d# S5 @6 k# F) L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 H- X# M4 c: Q  N
  48. #else( I6 O1 `" W3 R- f
  49. #define DMA_PRINTK( x... )
    5 T9 l/ N' @6 C6 c
  50. #define DMA_FN_IN2 H; P3 N$ r$ i- X: j+ q
  51. #define DMA_FN_OUT
    $ Q+ `. ^: f2 G
  52. #endif4 G8 s! V- ~! o; `1 x4 G

  53. % ]6 e3 a+ u7 `. S( K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " Z: s5 Z5 e5 k) C) e
  55. #define STATIC_SHIFT                36 w( N9 r4 b2 O$ A) O& q) @/ m3 @
  56. #define TCINTEN_SHIFT               20
    $ A8 p) \' E+ {% y
  57. #define ITCINTEN_SHIFT              21
    " o6 C! U3 |7 U& `! U% i
  58. #define TCCHEN_SHIFT                22: W2 `. h4 S' F6 n
  59. #define ITCCHEN_SHIFT               23' Z4 _3 @: c, N5 I5 U2 C

  60. 8 c1 x7 F! G; p4 `7 o1 ?' S3 V3 `
  61. static volatile int irqraised1 = 0;
    # x% l8 P2 F1 }1 B
  62. static volatile int irqraised2 = 0;
    " q0 W, w0 B. t6 [

  63. ' r6 D# @; h5 _" t5 I9 }. l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % C! E1 I# ]/ A( {, l4 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Q- x6 W, W' Z' M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 L9 a7 C  ~& j" h( C
  67. : L; Y. s& x7 b: u. [, a
  68. dma_addr_t dmaphyssrc1 = 0;
    4 U- L3 v1 @+ B" Y+ [
  69. dma_addr_t dmaphyssrc2 = 0;
    - q2 X" R4 e$ m  F7 ~
  70. dma_addr_t dmaphysdest1 = 0;
    ) E" o" V: O, L& p/ @+ Y" D
  71. dma_addr_t dmaphysdest2 = 0;
    6 V; t% K" \* G5 V, Z: y
  72. + r$ h  g- l5 P7 e
  73. char *dmabufsrc1 = NULL;0 Z  B  f) [& L: P9 f$ M
  74. char *dmabufsrc2 = NULL;# Y3 ^8 g7 n% }8 S% N2 v; ]+ f
  75. char *dmabufdest1 = NULL;& X# \% A" y6 D! a. a" n
  76. char *dmabufdest2 = NULL;
    6 z, R7 T7 ~/ n8 }7 k; N" j
  77. 7 E* ]& z" S8 @7 c, H- A& L2 e1 I3 i- C
  78. static int acnt = 512;
    6 o2 B+ m5 `: @  m% F
  79. static int bcnt = 8;+ v+ H  u8 \& k' B/ ]9 C
  80. static int ccnt = 8;* K" d2 z8 c# j9 G; _6 f

  81.   d7 u& K; `& G. \! f7 I
  82. module_param(acnt, int, S_IRUGO);
    " }0 T8 y+ [' M2 I- w
  83. module_param(bcnt, int, S_IRUGO);& a5 w) A1 ^) G5 o. K( S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% @8 f" R* R& `; t/ k

7 V' V0 @0 S3 M0 {; w, H" }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- Z5 b% j1 w# z- uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 x: A5 h, C7 C1 t* h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ n- D9 @/ c/ U* z0 M( q

6 ^, c7 B  t- ]; w3 p6 H$ R) K3 @9 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 21:09 , Processed in 0.037720 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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