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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ Z! t# s9 b9 ]8 O6 T
  1. [code]EDMA sample test application; A) X! r' d8 ~! Y
  2. /*; Q0 C+ C: {, y) s
  3. * edma_test.c
    9 {' u3 b8 x  F7 Y) i- f7 K2 ~$ |
  4. *
    0 {* O8 |5 e4 K0 S, y9 l
  5. * brief  EDMA3 Test Application
    . i/ @# Q" v. _; s1 S1 }
  6. *
    7 E" Y! ^$ M; |. L& R" g
  7. *   This file contains EDMA3 Test code./ A# Z* F6 t# E" n( i+ f  m- J) u
  8. *2 }) X4 {; t9 J: H5 [+ R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - ]( h4 Q: [# R* T* ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * ~+ }7 r# V& B- t5 T: o$ d9 j  u0 c
  11. *         TO CHANGE.
    5 o$ S/ W, E) ~+ Z5 `5 @
  12. *; I# v4 c" \: \) |9 ~  o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , r+ ?4 S2 g5 v6 ~
  14. *
    ) @) N; i# W/ G" X4 K: P) G
  15. * This program is free software; you can redistribute it and/or4 a. {# _) \. D) U  |
  16. * modify it under the terms of the GNU General Public License as; V3 i2 a: F, U
  17. * published by the Free Software Foundation version 2.3 _+ {% w* T; L7 Y( ^' E( y
  18. *; c# e( I( d, T4 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  y! v4 K; @; M: M/ l! n  y% `
  20. * kind, whether express or implied; without even the implied warranty
    $ Q  r( A+ F# T9 v5 o4 R  M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * Q3 K% p! m/ ~$ h
  22. * GNU General Public License for more details.# d4 s2 i+ X( J, t  W+ W
  23. */
    6 m0 d+ r# J6 X* P3 {5 G/ N! n" F/ n

  24. ! R& t! p3 T# ~: `
  25. #include <linux/module.h>/ S. E3 x8 t' @, |) a! W: {0 n
  26. #include <linux/init.h>
    8 f/ m4 ]) C& _
  27. #include <linux/errno.h>6 k* p8 X  _/ d8 S  C8 ^3 Q  S
  28. #include <linux/types.h>5 i& A" q  t8 |: ?
  29. #include <linux/interrupt.h>
    ) l$ p& u! j' h' }5 a
  30. #include <asm/io.h>
    9 U6 r& T8 b( p! _2 u
  31. #include <linux/moduleparam.h>
    7 F7 K7 X; ]0 r6 W; l# B; E
  32. #include <linux/sysctl.h>
    - G8 F2 e5 K( v- U0 K" {+ n# y: M
  33. #include <linux/mm.h>
    ) @( ~  q1 v, c2 |
  34. #include <linux/dma-mapping.h>. c0 T- s+ v9 ~6 _

  35. 3 ~6 E2 x  |7 h; ]6 X- P0 P% d" @- z
  36. #include <mach/memory.h>( m" Z( e$ [! R
  37. #include <mach/hardware.h>& |1 {0 K. f+ g4 U* n4 b8 e8 i; Z/ i
  38. #include <mach/irqs.h>
    ) I6 ]/ M4 ~; x5 P
  39. #include <asm/hardware/edma.h>7 i* J$ [# w) m4 d
  40. # Q6 R( ]6 V; B5 N: N0 b% k
  41. #undef EDMA3_DEBUG# `7 d) A2 m7 d
  42. /*#define EDMA3_DEBUG*/
    3 T$ O. B4 X* G" W/ y8 E

  43. $ C% @, B9 E( z' c
  44. #ifdef EDMA3_DEBUG
    7 ^. [2 R6 ]1 F* `% B- L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- Y+ L! j5 A1 @+ M$ q" P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & L! ]8 d/ H0 y* F# l/ n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 r7 g6 x- w3 ]: P1 K5 z6 Y# v
  48. #else8 v" f% u8 \/ b5 Y. q, V
  49. #define DMA_PRINTK( x... )/ [2 m! U1 ]4 k* c
  50. #define DMA_FN_IN
    % h* X4 k0 s1 R
  51. #define DMA_FN_OUT
    & a  l. ?+ l! R0 X
  52. #endif9 `& s0 B5 ~$ `7 i; f

  53. 0 W7 \9 L. l5 l0 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . d& F0 Q# k2 @- V9 n
  55. #define STATIC_SHIFT                3, l: X  [# j2 M( r8 T! M
  56. #define TCINTEN_SHIFT               200 W( ?( u+ l4 [
  57. #define ITCINTEN_SHIFT              21
    , Z# h2 U  ^* _/ b3 m6 c5 B
  58. #define TCCHEN_SHIFT                229 }9 d: e% [2 C5 }1 j; O3 r
  59. #define ITCCHEN_SHIFT               23: `1 p: R! E9 ?) a* o
  60. 5 g; a% T1 o' L$ b
  61. static volatile int irqraised1 = 0;: j4 M6 U+ i! k8 X" q
  62. static volatile int irqraised2 = 0;2 D9 V- R/ K& M$ A2 U/ a
  63. " b& e5 ]0 P, x, y8 w6 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & p. D" l) E. U4 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Z& Q& }) k! G9 e* d3 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 R( ^9 [4 D' p( M- H8 t! S% g. f8 B
  67. : [" p! ]1 |5 E
  68. dma_addr_t dmaphyssrc1 = 0;4 |  q) p* [6 Z9 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ; X! l" U" a. P" X
  70. dma_addr_t dmaphysdest1 = 0;
    4 l- d: K( o) c4 Z6 A
  71. dma_addr_t dmaphysdest2 = 0;# l! G2 D1 s0 y; p; ^! f% U! K3 `
  72. 7 V' z6 Z( h% j) d& o9 u1 q/ x
  73. char *dmabufsrc1 = NULL;
    / o/ l: ]7 V7 d
  74. char *dmabufsrc2 = NULL;# O! R8 e( b. p1 {5 H
  75. char *dmabufdest1 = NULL;
    . o. M4 F! L  h% Y4 E
  76. char *dmabufdest2 = NULL;
    " W* h0 C# g# o- f% _$ f2 A

  77. + M& Z/ E3 V/ |3 p3 q
  78. static int acnt = 512;
    : H$ X* p/ ^% L2 k; J* Z
  79. static int bcnt = 8;  D5 K. U0 F. q- n; L/ ~( y& L
  80. static int ccnt = 8;& G+ B0 d; J# q9 i2 X

  81. 4 X7 u+ |+ J% G( ?4 ~9 @3 R: P
  82. module_param(acnt, int, S_IRUGO);- U9 ]5 ]5 T0 f; Y, J5 K
  83. module_param(bcnt, int, S_IRUGO);
    # w( S% V9 z9 H; {1 H9 N+ Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 L+ f+ V7 |) ~9 A: u- [; z8 k7 l( o) o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( D# N0 m0 W7 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 R% p" n/ e$ p# w( P" m; y% _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ~; d9 J0 f: m' u+ Q
! v$ H( R8 w- @/ @2 z
: b- w9 B, ]/ o3 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 20:27 , Processed in 0.038794 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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