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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . Y; j8 y3 V/ E6 y5 B
  1. [code]EDMA sample test application
    8 D$ Y; L  {6 X/ h0 V+ p' |
  2. /*
    % N' Q( z$ z  q# C1 \( k, l
  3. * edma_test.c
    6 _1 H6 u/ L' L/ i1 ?
  4. *, T, D9 A! R4 m+ l0 }; X# U
  5. * brief  EDMA3 Test Application+ f8 y1 k" U0 K: Q. `2 r% e: X2 o
  6. *- _+ U! R) b" D2 n
  7. *   This file contains EDMA3 Test code.
    ! d& d& ?5 K/ {# t: v. k& [0 q# G0 Q
  8. *& ?7 a: H; c3 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 e) s; w. E& Z7 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 x$ X* W  l' d* X/ d# t$ b
  11. *         TO CHANGE.6 n; B% Z- c* r3 U
  12. *( F# ~4 H8 F# E9 d2 h; [. k7 w' p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" }5 A' t7 N% P) K  _9 U9 s. P6 R
  14. *
    " S6 a1 [; L# t/ r2 j
  15. * This program is free software; you can redistribute it and/or
    / _1 d, W' S! U1 S3 L( u
  16. * modify it under the terms of the GNU General Public License as
    4 {8 Z1 k8 M% b! ?8 G
  17. * published by the Free Software Foundation version 2.
    - Y& v- x8 t. `" F
  18. *: S8 U2 R2 U# o) O& c( ]/ U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - @1 u7 e% Q' ^% Y2 R" a2 u- H
  20. * kind, whether express or implied; without even the implied warranty
    9 z8 d5 Y& R5 q$ ?6 r* g6 n' k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' S- ?+ k9 A! |7 F
  22. * GNU General Public License for more details.. [0 l; x& Y% @
  23. */
    - D8 Z2 K' B) b6 P& Q

  24. + Z" z3 z# I7 |' l! E. J$ ^+ W& T8 g; s
  25. #include <linux/module.h>
    3 b/ z& i1 W( b  L' F8 |
  26. #include <linux/init.h>
    5 x1 W( {+ [) u: x
  27. #include <linux/errno.h>, t: X* f# u) a: @0 G
  28. #include <linux/types.h>; d/ f! k, m( S8 x
  29. #include <linux/interrupt.h>, J3 P9 v. f' Z
  30. #include <asm/io.h>6 a/ `0 T; e& R% \$ Z3 K, ]
  31. #include <linux/moduleparam.h>2 F0 k6 |( o- U5 V# |0 W
  32. #include <linux/sysctl.h>
    $ z' U( a  n/ x1 P" C
  33. #include <linux/mm.h>
      Q% O+ ^* g7 a! Q! S- N; e0 b
  34. #include <linux/dma-mapping.h>
    ; Y$ I% c" M/ r0 Q" ?2 ?# Q

  35. + O% w* y3 u9 b6 c2 u# @1 |. R
  36. #include <mach/memory.h>
    * x& q8 ~+ Y7 N
  37. #include <mach/hardware.h>
    & I7 y# o& g7 O9 H2 A
  38. #include <mach/irqs.h>
    ( V6 L9 G6 S7 R/ L
  39. #include <asm/hardware/edma.h>
    * s$ s3 n6 R+ [$ |9 \/ n

  40. 4 V5 h3 d: t$ T2 D) B' v  v5 @
  41. #undef EDMA3_DEBUG  S, g( o- _  {
  42. /*#define EDMA3_DEBUG*/
    / u( Q. O" h6 o, o+ @- r2 `  _

  43. : c' |! E  W0 B! @1 w0 G5 Y8 F, e# N
  44. #ifdef EDMA3_DEBUG
    2 F4 [$ D# n7 A/ n/ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ \# F7 j0 m9 H1 Y$ l/ |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 n, g9 |4 n& f( f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ s1 A. t9 H1 Q. D# J
  48. #else
    $ R  o% u  p/ ~9 E$ x5 `
  49. #define DMA_PRINTK( x... )
    0 l8 q  Y' ]/ H0 V5 m  |
  50. #define DMA_FN_IN. R) V3 O3 j! U! j) M. P% [
  51. #define DMA_FN_OUT
    4 ?- D: q" N6 D  A
  52. #endif. F& B1 \/ ^  i0 z$ M0 R/ ^$ v$ a
  53. ( i: K; }* V" K# A7 N6 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! J+ v3 H/ j7 |  S6 B. S0 w5 ~
  55. #define STATIC_SHIFT                3
    : o$ [' s. [) t0 L# }7 i. C' \
  56. #define TCINTEN_SHIFT               20
    + n% \* f7 D+ K# {( L" r) K
  57. #define ITCINTEN_SHIFT              218 S' a  L" D; g: u- {- F
  58. #define TCCHEN_SHIFT                22
    / l: s( M3 k$ \7 o9 c" ^
  59. #define ITCCHEN_SHIFT               23
    2 U* X8 m) c5 m( j0 o+ |6 a7 w/ ^. X9 M

  60. " c5 c1 H3 R9 M) N
  61. static volatile int irqraised1 = 0;( N! p) i9 Q4 p5 [4 \% X5 l
  62. static volatile int irqraised2 = 0;( W1 ?' i0 V7 c8 P

  63. 1 c' R: S, a% k  J8 e/ P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( \3 e7 I9 Z1 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. q2 @" v2 u: z: z+ U" p' Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 \* k' @) p( S( D

  67. % m4 k$ [' y/ d$ J3 X
  68. dma_addr_t dmaphyssrc1 = 0;7 K7 r6 s' j  b& f# I5 N0 i
  69. dma_addr_t dmaphyssrc2 = 0;( e0 {7 Q" I+ @/ h9 K9 J- [
  70. dma_addr_t dmaphysdest1 = 0;, s- e& _* C$ J, M
  71. dma_addr_t dmaphysdest2 = 0;* J) V8 l2 B# \8 h

  72. + @. \( Z% m( ~) p9 c: J3 ]
  73. char *dmabufsrc1 = NULL;+ V$ e% m0 K: r  Y9 p
  74. char *dmabufsrc2 = NULL;
    / z6 M3 a  R6 m, n
  75. char *dmabufdest1 = NULL;  C8 j3 d+ s6 J" c6 I3 |5 k
  76. char *dmabufdest2 = NULL;
    9 _* f0 Q* d) Z) O
  77. 5 A9 w# w/ Z% q4 x4 m8 s* e+ J
  78. static int acnt = 512;
    " m5 N* }, p5 ]8 |# M( _/ L$ a
  79. static int bcnt = 8;
    0 B5 O+ y' {7 c2 T" E. k9 a9 g+ I
  80. static int ccnt = 8;
    % _! \8 B9 X9 n. K4 g$ n+ I
  81. . b! i+ `+ ]" j  _5 H
  82. module_param(acnt, int, S_IRUGO);; Q; X# s" D3 H$ c" M. Y8 k
  83. module_param(bcnt, int, S_IRUGO);
    9 z7 m6 }; G% P% }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) z9 v) l% u% `7 q' g. q

. m; H4 X. e& \' |/ F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, P) p* }4 O( M% h7 H% o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 L  d9 p+ r9 d- P) x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 \+ p* Z, ?4 A8 X( a& X
" H2 ], X) B; [" U2 D# K: D( k, Y
$ G" T. c: |+ A" i* j+ N) r( O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-9 05:25 , Processed in 0.040215 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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