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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 I) c- g% J" V, z: z; z
  1. [code]EDMA sample test application! r% T/ D" k. V6 a1 L( r/ N
  2. /*0 W8 D* L, A& Z, K
  3. * edma_test.c2 w0 E% t* S; r1 T7 v# ~
  4. *
    ) y; A0 G& A* u
  5. * brief  EDMA3 Test Application- h" A( L* e3 S. Y' }+ o4 M
  6. *7 G% s  ]0 n3 ?) _. h9 \
  7. *   This file contains EDMA3 Test code.
    9 z+ [* M1 R; O& U" o8 [
  8. *$ ^9 ?& M- U) m' x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! s& q( R) E) n' {1 l6 _) r4 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; C2 [$ f& W  F  q
  11. *         TO CHANGE.
    $ Y- b, _& L5 r1 M
  12. *
      F% C+ A3 C9 m* S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# B$ o1 {# p# i
  14. */ [7 h" X. {7 e( ?  i& a7 A
  15. * This program is free software; you can redistribute it and/or
    , Z- T+ z2 u* |$ u
  16. * modify it under the terms of the GNU General Public License as6 \/ |1 f. J" v# f2 U$ h
  17. * published by the Free Software Foundation version 2.
    ' y1 k. O& x  Y. U1 L  p1 e7 {0 j1 w8 g
  18. *8 U1 K& [+ T# i$ m) t; y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 u( w7 P0 g4 e4 Y) [' h/ m. l
  20. * kind, whether express or implied; without even the implied warranty
    & r! l: P- `" D$ W/ K+ G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " Q; X6 S. Y- v, {6 T
  22. * GNU General Public License for more details.) X* {2 @% k3 a9 v1 }" j* d
  23. */
    , r6 ^' [3 k# _. {$ I6 i, ]

  24. 4 U. e1 Y% V2 A2 V4 S- n/ E
  25. #include <linux/module.h>
      ]& }4 ^" E4 c8 L  ^* v4 i
  26. #include <linux/init.h>
    7 J* ~4 j$ A2 D: i/ D& Q
  27. #include <linux/errno.h>2 J8 D* ^7 ~7 G  h1 b
  28. #include <linux/types.h>: _# ~8 B! ]! i$ H2 n
  29. #include <linux/interrupt.h>
    # z8 j5 ^5 l6 F  z: h
  30. #include <asm/io.h>. c, v5 R! W+ q1 E- b# o
  31. #include <linux/moduleparam.h>  C& Z8 q) a7 t( ~" U
  32. #include <linux/sysctl.h>! x- c" c- Z3 z- ]. N# e7 |( t/ A. a$ c
  33. #include <linux/mm.h>/ ], ]% i" p) \
  34. #include <linux/dma-mapping.h>6 c$ P& r" M$ P& B8 C( M( f

  35. + r7 N5 [' F3 o- t
  36. #include <mach/memory.h>
    / R- f' {! o7 @) I, J
  37. #include <mach/hardware.h>+ ?! v$ Q. Q& }' }) x
  38. #include <mach/irqs.h>
    % W8 Q' ?$ Q- x$ w/ f. B
  39. #include <asm/hardware/edma.h>
    / E% u1 C  l4 s- e' J, H
  40. 1 B  G% ]& Q( w3 Y  x. w
  41. #undef EDMA3_DEBUG+ R) t7 M0 A0 d7 V9 K" M/ d
  42. /*#define EDMA3_DEBUG*/$ U" O4 y$ _: u' y8 K. T; w
  43. ; X9 Q0 B( W5 @: \. R5 G' g
  44. #ifdef EDMA3_DEBUG
    " W0 j4 {" V, E: x' p6 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 d4 p$ B* `6 J6 v+ c; l7 `( q4 K- R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' B2 q: |- c# P$ x" n* _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 g4 _  c7 C. c5 a
  48. #else7 m  s. p, V5 y6 u& F6 U
  49. #define DMA_PRINTK( x... )
    % j% Z0 Q+ \- w# g$ B
  50. #define DMA_FN_IN
    : X& @$ D+ t. J
  51. #define DMA_FN_OUT6 s2 s8 n8 r  z& N) Y
  52. #endif, V- J- j- @  v1 m( D: l+ m
  53. # D2 t) n  G8 |' K/ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 Z6 A5 ^0 Z" \1 Y- ~  w
  55. #define STATIC_SHIFT                3
    " P7 |: P/ d( Y* A
  56. #define TCINTEN_SHIFT               20
    $ f9 D' z7 ^4 V
  57. #define ITCINTEN_SHIFT              21. R' i4 q: K6 K1 |# y
  58. #define TCCHEN_SHIFT                224 ]/ K9 m; K* {: V9 O
  59. #define ITCCHEN_SHIFT               23
    1 \$ F" t# z& h6 T

  60. * u& z3 e' k' {& {
  61. static volatile int irqraised1 = 0;4 g: w7 G2 S+ x2 J$ r
  62. static volatile int irqraised2 = 0;
    9 {8 b  o( r, {/ t- n

  63. , h+ e$ [2 j9 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - e1 U0 B- n" F2 S! w% i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 u- Y% [  m+ N3 t3 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! d7 d' u, o- H
  67. " S+ I0 J- y* C2 q/ s& U# ?0 W& Y
  68. dma_addr_t dmaphyssrc1 = 0;1 |* I- b8 ^. m1 o, ^9 d8 o
  69. dma_addr_t dmaphyssrc2 = 0;/ N$ x1 }( q$ @: R
  70. dma_addr_t dmaphysdest1 = 0;( ^" u& C$ \( w) r! H1 |8 \1 @, T
  71. dma_addr_t dmaphysdest2 = 0;
    + v& M* o# j3 i% r+ ~

  72. + k7 A* }  i; G
  73. char *dmabufsrc1 = NULL;" @+ v# c; f- _7 O( i( Q3 `5 R
  74. char *dmabufsrc2 = NULL;
    $ T# N/ R/ h( \1 l
  75. char *dmabufdest1 = NULL;
    " t7 @, t( e3 |6 r, l3 u2 e. l: _
  76. char *dmabufdest2 = NULL;
    , f. @7 S1 U  M

  77. . Z$ g9 o; l, i- A$ a
  78. static int acnt = 512;& p5 I% y1 c& v$ y3 v
  79. static int bcnt = 8;
    - T5 y- m# d/ o
  80. static int ccnt = 8;- V8 D4 I# ?0 r$ r- u$ i4 `

  81. 6 v; |$ D6 e9 K2 p/ {) g: d! v
  82. module_param(acnt, int, S_IRUGO);
    9 Q/ f; I  P6 d1 g' r4 }* ~: y1 }
  83. module_param(bcnt, int, S_IRUGO);
    7 `( A3 J' T! k% P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( U6 o" m1 ]3 w# ~4 z4 Q

* _2 ^* c+ g& q) j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, ]1 f; a6 o0 N# X' W3 Q+ |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: b1 d2 r. E  w0 G7 {9 _) b( g. R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 H5 w( O* }8 Z! f/ h9 ?5 [8 M
0 G6 _+ C2 ]4 g% I% }
$ f3 X( f$ M2 {# w7 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 21:37 , Processed in 0.043651 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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