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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% Z8 S9 Q6 r5 d7 n, Y6 Z# N
  1. [code]EDMA sample test application
    : z5 s  Y; h# h. ^& K
  2. /*
    , A4 q. g% s# a5 e
  3. * edma_test.c
    + i  i4 s, D* o3 u1 G. ]
  4. *4 P1 b$ v9 N4 Y  x7 K+ {8 c* V
  5. * brief  EDMA3 Test Application
    : n, O. M& F. u. f5 t3 _# q  E; H
  6. *
    3 U, e8 H+ f! \; {6 \$ z" f
  7. *   This file contains EDMA3 Test code.8 t, m* i- X& n# G6 }8 w
  8. *  ~6 [( f( q  t* j8 X% n8 V2 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 P. B0 E2 B4 _# n6 U# D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' @' [7 m) v! T- J8 \, Y
  11. *         TO CHANGE.
    4 q8 G- r4 B1 w. G2 K* e  A
  12. *
    / I2 n5 Z# l, u' U, u2 `0 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 w1 M: p2 C4 }2 Z
  14. *0 e1 v. l1 f( {1 P! u7 ~
  15. * This program is free software; you can redistribute it and/or
    2 a4 K* C4 U, Z4 H0 H# I
  16. * modify it under the terms of the GNU General Public License as
    5 c5 X# |6 }+ @, D* p; a
  17. * published by the Free Software Foundation version 2.- r; h% t4 c3 I: R  S, R
  18. ** m( c) u8 l' @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! U( R3 C+ h8 Z4 |; |& ?0 J
  20. * kind, whether express or implied; without even the implied warranty& j! U" d8 I0 Y" U: @% A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; m% x, z3 \- X+ D8 |/ ?
  22. * GNU General Public License for more details.
    " }( N4 Z! U8 K, ~, s8 X
  23. */
      _5 q4 a$ P- ~3 \1 A% {
  24. $ h4 X! g8 \  p  w# @4 K. F9 r+ o
  25. #include <linux/module.h>* w5 ^% o# L1 k8 _: U
  26. #include <linux/init.h>
    * G; S  R# [$ M4 b* R
  27. #include <linux/errno.h>. G5 Y: r( F& a3 y
  28. #include <linux/types.h>! j) Y: Q& j4 n9 A5 {8 S" M( d
  29. #include <linux/interrupt.h>! q/ ]/ J) v% m
  30. #include <asm/io.h>
    $ U/ I* I3 _2 U" K: C: T
  31. #include <linux/moduleparam.h>
    1 ^/ @& f. q6 o9 ^) O: F9 p5 K, C
  32. #include <linux/sysctl.h>
    0 B$ G& Z+ R; ~
  33. #include <linux/mm.h>
    1 Z* Z2 }8 y, T/ h" N  {
  34. #include <linux/dma-mapping.h>; s0 }# L3 }' d" T2 q3 |2 ^

  35. - i) |( Q4 o& A5 f3 l2 M
  36. #include <mach/memory.h>
    / F- I6 [, S& T6 I: R- J8 w8 l  D
  37. #include <mach/hardware.h>2 Y- |3 |0 d5 Z/ ?4 n" P# W) u
  38. #include <mach/irqs.h>9 N/ @: `3 x* \( G
  39. #include <asm/hardware/edma.h>
    3 n2 c% y8 I: p: z# @" S/ d: r) c$ g

  40. 3 s/ o" h8 s' [( S# _
  41. #undef EDMA3_DEBUG5 N! ]! ~8 y' N+ U4 r
  42. /*#define EDMA3_DEBUG*/
    ) ]8 Z3 I7 k* Q9 d8 _5 c  Z: f
  43. 0 H) Z" U4 S9 V0 e7 n
  44. #ifdef EDMA3_DEBUG
    + J9 R" }) Y2 X/ t/ g% u0 z, S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 E$ F4 a! x: M2 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 ]( d6 C* J$ R6 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 T9 d6 q. p% x2 Z
  48. #else4 _* \4 ?4 q1 w  X5 Q
  49. #define DMA_PRINTK( x... )
    % e- w' f9 W, A7 v
  50. #define DMA_FN_IN
    8 @0 s. ~2 Q; ^0 r9 S% g: N/ o
  51. #define DMA_FN_OUT
    / y, ?% x, v  v1 v" y& y) H
  52. #endif
    0 }* E% @0 I3 f
  53. ! S9 c* d+ b9 E6 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), x2 k2 v7 }* i, \9 x: V
  55. #define STATIC_SHIFT                3
    / v* B2 O; t4 E" {% L2 x
  56. #define TCINTEN_SHIFT               200 z" T" Y( z  Q
  57. #define ITCINTEN_SHIFT              21
    0 {. j( T7 D* g1 W( N
  58. #define TCCHEN_SHIFT                22
    - X* M. I% r2 S; j5 p; h, V3 U+ v
  59. #define ITCCHEN_SHIFT               23
    & T) h' @  A% c& D4 Y8 o5 k

  60. 6 E, h$ {( x) T; p* v3 S
  61. static volatile int irqraised1 = 0;2 @, P4 {5 u% [, Y: T8 C
  62. static volatile int irqraised2 = 0;$ m; C1 D( O6 R
  63. $ {7 S& k. C) T4 ^! [. Z8 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 a' [( z+ P. A( h9 R3 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % X+ |! ?* U5 R+ v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 b3 c, f3 `1 W

  67. - O- {9 M) L' T. b
  68. dma_addr_t dmaphyssrc1 = 0;; W. G! Q: J3 A9 f, u
  69. dma_addr_t dmaphyssrc2 = 0;5 U/ `- Z8 a; S, G
  70. dma_addr_t dmaphysdest1 = 0;( i" ~# f  X' B2 m  ]  t( l& b
  71. dma_addr_t dmaphysdest2 = 0;2 K8 {' E1 B. p

  72. + _/ Q( ~. E' _
  73. char *dmabufsrc1 = NULL;7 S' ?- _4 w6 n" X, e! \
  74. char *dmabufsrc2 = NULL;/ l1 {1 s! j4 D0 A% ?4 M! L" [1 H
  75. char *dmabufdest1 = NULL;: ~% }+ e! e' Q! F. K+ |6 l
  76. char *dmabufdest2 = NULL;
    8 y# \! J5 W) g7 M% R9 [7 ^; t0 ]

  77. 8 y; F$ Z0 o) j  d( m* F0 ~' K
  78. static int acnt = 512;0 ?0 o4 K4 m* W3 L; i* `9 ]
  79. static int bcnt = 8;
    9 p- S4 A1 u( R7 E& p
  80. static int ccnt = 8;8 t. d2 H# C; X+ p$ s1 u# ]

  81. ! a2 e6 I  p" z4 V
  82. module_param(acnt, int, S_IRUGO);
    " A) h1 o$ ]# s/ T& q
  83. module_param(bcnt, int, S_IRUGO);# K* G+ E' E9 O3 N0 }5 u) a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 w% `1 i- Y; \* ^+ v

( D. E0 R8 M6 Y+ o' y8 m3 ^. m& O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: g* W+ h+ M) ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' o% L5 l0 ]. }+ T) K  u6 o" V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: C# t" s. D+ T
6 }" o/ r5 q/ V; T  S

6 @9 i5 q% l1 _3 j$ `& L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 15:54 , Processed in 0.040061 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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