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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * f! W: V" E2 d
  1. [code]EDMA sample test application( P3 Z& s+ V& w* t0 N1 s
  2. /*. V1 W+ h( X* d5 T: a) a; E
  3. * edma_test.c3 y3 d! o: f1 Z7 n, }0 N5 u( c
  4. *& c" R5 c" K- e
  5. * brief  EDMA3 Test Application
    ; h3 ^1 t0 \  d' r9 l; t5 s
  6. *
    0 T9 H8 P1 y3 t- f  g  _" m
  7. *   This file contains EDMA3 Test code.; D8 R4 j/ l( T, @1 x
  8. ** c/ e( _3 g5 @7 K  V" \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% Z' u0 `# l5 ]' ?: l2 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 Z. Y# z/ s8 C: Y$ I8 M7 Q
  11. *         TO CHANGE.- l$ ?9 ]. r2 g+ _
  12. *, ^: h, c. v) d* I; v) [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" A. P* ]! F" a2 N! }' b8 X
  14. *: F- Z) u! d( {: x* p/ D
  15. * This program is free software; you can redistribute it and/or
    - t& F  w7 F2 }3 N( ~1 \( g6 [- x' |9 G
  16. * modify it under the terms of the GNU General Public License as: W! }- q# A  l2 B$ n
  17. * published by the Free Software Foundation version 2.
    # W4 y& x' O- J
  18. *- b8 q- x6 l+ w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % N4 B8 q! V( K3 i( i* \
  20. * kind, whether express or implied; without even the implied warranty+ A1 B; p$ G- Q& Y) G/ X  @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, W. }1 s/ T  N2 C' S, P
  22. * GNU General Public License for more details.
    9 t/ p. A) ~/ g0 S" F+ ~
  23. */
    ( d' |% `$ v; \- j* l( z

  24. / t) R( v" v( H: i
  25. #include <linux/module.h>
    6 [/ p- e+ d# ?( m) }( F0 L+ U2 J
  26. #include <linux/init.h>
      S$ c* ^3 w2 t+ R4 I
  27. #include <linux/errno.h>
    - U. T; F! Z/ Q; C1 `5 L- j
  28. #include <linux/types.h>
    1 t) q6 K/ d5 M+ }" A# _
  29. #include <linux/interrupt.h>, |" ?8 G+ m6 U0 Y& z
  30. #include <asm/io.h>
    , c$ K  v/ y( h( q$ J9 q
  31. #include <linux/moduleparam.h>
    , u& S( B: T. x8 I( x2 u
  32. #include <linux/sysctl.h>3 M* p6 ]' f: n& \% Q3 i  Z0 J
  33. #include <linux/mm.h>5 \0 \9 `* @" L& Y: x* v
  34. #include <linux/dma-mapping.h>
    - H: |4 R: t! Q$ }6 Y1 }

  35. , Y* H4 J/ {* \' a4 Z! L# ?
  36. #include <mach/memory.h>
      I) W" u7 L7 f/ ?' p. K
  37. #include <mach/hardware.h>
    2 E  o# V; Q% C  y' Y
  38. #include <mach/irqs.h>5 d: p* k$ j( w: i
  39. #include <asm/hardware/edma.h>
    0 F  E; \0 F. O5 K  t+ N( S- A/ U5 O
  40. : h' b% X% M: c& s* s  E% K3 y
  41. #undef EDMA3_DEBUG
    6 i3 D+ ]+ s" }0 ]( D2 J
  42. /*#define EDMA3_DEBUG*/
    7 {7 M  a  A9 v7 ~: L0 N! @0 A- |

  43. 2 Y3 p, j0 W1 `4 x- ^1 U
  44. #ifdef EDMA3_DEBUG. a0 p4 @2 H2 n9 O$ [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ^3 q% w& W8 P4 t/ y7 {, @# \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 s" A  D) W, X& a' ^: O% @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ ~. i- p# J3 c7 Q% ]- m+ Y0 A3 C
  48. #else
    7 G4 Q7 I% J1 _3 j: b
  49. #define DMA_PRINTK( x... )8 u/ a9 s% A9 P! G  g
  50. #define DMA_FN_IN- c" |1 j3 P. `1 t1 c6 d# W7 C3 E$ R
  51. #define DMA_FN_OUT8 I; }1 G) {2 F" G9 F$ w. _2 c& \
  52. #endif0 Z" f$ T( F7 l# ^  L9 ?* p5 t. x$ p

  53. 8 h4 k' U4 l* J3 b- m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ q* w; I; H! L* v6 ?
  55. #define STATIC_SHIFT                3$ Z" w) R* K  g) ?3 p' {. h& }' j
  56. #define TCINTEN_SHIFT               20! j4 [, j% p0 |+ q" W! @
  57. #define ITCINTEN_SHIFT              21. m  x* c- r/ f0 B% [: Y
  58. #define TCCHEN_SHIFT                22
    ! X$ B' X+ V1 h
  59. #define ITCCHEN_SHIFT               23+ `. j+ u& }7 x8 C  v6 ~+ ]; y  g
  60.   \) _* U6 }, r( |3 N" c5 A
  61. static volatile int irqraised1 = 0;
    : z# W: _1 q# U4 P) T
  62. static volatile int irqraised2 = 0;% t& G) h# Z! U' u+ g; k) \3 }

  63. : n4 B& o! O9 b  U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 g  j3 h% w- |# J! ?0 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! L6 m7 l+ t9 w  R6 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e7 R+ G9 U( |# w3 b1 p6 Z

  67. ! g" ~2 ?8 A; q& e1 K' w& d: O
  68. dma_addr_t dmaphyssrc1 = 0;4 E6 X' F6 V3 ], W' _, {
  69. dma_addr_t dmaphyssrc2 = 0;7 k* Q6 b3 l, m- y, D' F  s1 n
  70. dma_addr_t dmaphysdest1 = 0;. h, H& s" K" U) E, Q
  71. dma_addr_t dmaphysdest2 = 0;
    3 c- w( D  Q' ^6 ~( u: `* l/ n
  72. 3 F* n. v1 t% O" P
  73. char *dmabufsrc1 = NULL;
    ' L- f8 C3 Q. T% |
  74. char *dmabufsrc2 = NULL;8 |4 S: }; o1 J3 A2 `8 ?/ O) }: y
  75. char *dmabufdest1 = NULL;9 @( Q  R5 @. B( v2 s, v6 ]
  76. char *dmabufdest2 = NULL;7 M' L+ h* D4 K3 N
  77. ' \% T$ d! h5 g! @! J6 J
  78. static int acnt = 512;
    ) |" y( l* B  Y8 E6 a+ l# P
  79. static int bcnt = 8;
    . j7 P4 i1 a/ ~$ D
  80. static int ccnt = 8;* J/ f9 B. d% v3 T% l8 |- t) ~) }
  81. * l3 t9 b2 Y4 ~# b
  82. module_param(acnt, int, S_IRUGO);
    0 k! i/ a+ d: K; K
  83. module_param(bcnt, int, S_IRUGO);, [# F, Q" B( h  W( z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 E8 ^$ u3 Y* w" t) }: P7 f" e* a* j
9 F, Z* g: \* a* S0 i$ D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, |) o0 w  @1 I6 E/ N0 Y6 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ K- O! c% {  u3 k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# }. u) u% D% v, i* S, x! r9 W" y

' }3 w7 F. }7 @( j7 O7 a# m4 `% i, ]3 K4 B3 E2 h  h9 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-11 18:20 , Processed in 0.041084 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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