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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ e7 c: F3 X  p5 s0 B& y
  1. [code]EDMA sample test application/ Z, E! \* I& v4 S
  2. /*+ H2 `/ H' Z& N3 A) ^
  3. * edma_test.c% c# \* p% `! T! o) a& R& |
  4. *; R- _0 x& a* m) H' C
  5. * brief  EDMA3 Test Application4 o8 O" _3 i! @3 T
  6. *! A7 g1 z" ^  L4 J
  7. *   This file contains EDMA3 Test code.8 G+ }1 e! _: H0 X7 {
  8. *
    % `4 ]2 i$ v+ O. U* Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* Q& D  W1 |" U- S( B  j/ I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - i6 `1 d% e4 r& u; y
  11. *         TO CHANGE.
    % J+ U4 _2 |9 u6 [/ B
  12. *) M6 E4 x2 _5 Z; \3 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 |& z& S& R( m% F- q
  14. *0 m* F4 [9 _5 R) i5 P5 T: P
  15. * This program is free software; you can redistribute it and/or* |8 o  L, S) p' @* _$ {
  16. * modify it under the terms of the GNU General Public License as
    : _; L; b2 J# ^8 o" a* h
  17. * published by the Free Software Foundation version 2.
    , s2 a/ P4 f) A: }, r& [
  18. *
    7 Z6 u4 N6 @  ?1 i$ y: U( C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; s2 Y& o+ J" ?3 T# ]4 U
  20. * kind, whether express or implied; without even the implied warranty6 [& ?' d* p% p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 s# y+ U( ^8 v
  22. * GNU General Public License for more details.
    3 U, ?! p& X0 `5 t. f+ q! ~
  23. */
    & i- z/ ^0 f3 `* p  t# R

  24. * y+ G7 D1 x) m  m8 }  a% r
  25. #include <linux/module.h>' ~3 ~" E; [' {% j. e8 |% c
  26. #include <linux/init.h>: ]2 t" H5 |: e) F
  27. #include <linux/errno.h>+ K; _" @+ P& G( s
  28. #include <linux/types.h>
    : u: H7 k) V% t* j
  29. #include <linux/interrupt.h>
    / ~3 T" |6 P+ k; }
  30. #include <asm/io.h>
    $ D. p0 f( ]2 x) X7 y2 ~, T3 B- o
  31. #include <linux/moduleparam.h>: _0 ]& u$ N; c0 C
  32. #include <linux/sysctl.h>2 W7 u6 H" n, \
  33. #include <linux/mm.h>
    " B8 B4 P3 W  ~" c
  34. #include <linux/dma-mapping.h>
    4 A7 \- o0 _5 a7 s; s

  35. % g8 ^7 g5 k+ g$ c6 G0 d
  36. #include <mach/memory.h>5 n! z/ a. U# e3 B2 F! C6 d
  37. #include <mach/hardware.h>
    " M- d" u  G1 M) m& E, W
  38. #include <mach/irqs.h>
    # ]" ]& {9 a+ _- X* u% M) D8 }
  39. #include <asm/hardware/edma.h>$ t% L! p9 r2 ^2 J4 f

  40. 3 j. d% o/ J8 `5 V+ Y3 _
  41. #undef EDMA3_DEBUG
    ) p$ P8 }; E# |, Z$ }* A
  42. /*#define EDMA3_DEBUG*/: \' ]& A  `" g# d

  43. 2 `7 ~6 I3 B& D& ~" h, E  j1 o
  44. #ifdef EDMA3_DEBUG4 m' R2 `( }# y2 s1 M, R9 J- s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 c. x: S; g% ]9 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! a: X& ^/ n# V& g3 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + D- s, r. _( S
  48. #else
    0 `5 C9 m0 O. c/ N, |& U
  49. #define DMA_PRINTK( x... )' E7 j2 m2 B5 S& m
  50. #define DMA_FN_IN. K# `6 j$ z# h1 b
  51. #define DMA_FN_OUT& c) W) ~: ^9 n2 P7 |
  52. #endif* x3 N: ]% Z( [/ I5 z
  53. 6 t- C8 S3 x7 a# N, V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      {4 P( Q/ g, C) U2 @
  55. #define STATIC_SHIFT                30 t9 f% f5 O4 T# [
  56. #define TCINTEN_SHIFT               20
    ' ~  F, A! k- k: ?0 \6 L
  57. #define ITCINTEN_SHIFT              21
    1 a9 C# ]0 r5 R, U" Q# ~; s
  58. #define TCCHEN_SHIFT                22
    $ o: e" `) _0 m/ x
  59. #define ITCCHEN_SHIFT               23; A  S3 @, o; Z
  60. 0 p8 a. t; d  c! {- K
  61. static volatile int irqraised1 = 0;: t0 h/ ^. X. t0 D/ K  z
  62. static volatile int irqraised2 = 0;1 b! L) ?: L) ~1 d( D

  63. 3 v9 o0 f% k: B& b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 d! @; m% {/ V8 O* U  f- u& o* A0 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! d; A6 E" r! ~; j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 n5 I7 X3 H2 Q- b; Q! R
  67. * n3 W  z6 ?( G  d2 N7 Q) F  A
  68. dma_addr_t dmaphyssrc1 = 0;
      X( J$ D; u% i+ T1 ^  o$ [
  69. dma_addr_t dmaphyssrc2 = 0;* M8 Y& I% J% A- n
  70. dma_addr_t dmaphysdest1 = 0;
    6 A4 n$ d1 L/ u1 W3 E
  71. dma_addr_t dmaphysdest2 = 0;
    5 k0 B1 w' `9 k% N7 B9 N

  72. 2 [& [! p$ z# n8 O# R
  73. char *dmabufsrc1 = NULL;* |* F' a- e" t' {& A7 A
  74. char *dmabufsrc2 = NULL;. j! c- a) W" g
  75. char *dmabufdest1 = NULL;* }9 u/ y% D) L( G; y; b& N
  76. char *dmabufdest2 = NULL;
    ; t2 F6 n( S1 l! y2 u% R
  77. 9 z1 N" Q- V2 B2 c* x9 n
  78. static int acnt = 512;
    , P8 S0 O8 }; p" z
  79. static int bcnt = 8;* C- b8 p  k, z/ z1 a1 o
  80. static int ccnt = 8;
    1 ]. y; S* `6 L8 b: |
  81. ; t) g4 [, x7 U" ]6 O
  82. module_param(acnt, int, S_IRUGO);
    6 T+ P; R+ I4 b0 J; V
  83. module_param(bcnt, int, S_IRUGO);0 H- o. m; x/ f  t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. T. I: M" y% t( s6 s4 f+ v! L5 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 x1 b4 ^8 d+ f# A  Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" y, b  _9 r* s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 p: g. c7 r7 i" v
  ~2 |+ s$ M+ M: c# R. L; J% T
+ W( T% M: j0 X8 n, y6 T  r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 00:32 , Processed in 0.040744 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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