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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : _8 s( w% |! a2 f* A  J
  1. [code]EDMA sample test application( O' Q* [; o, H! A7 n6 I
  2. /*: p( M9 d  [* ?: o
  3. * edma_test.c
    & z6 V+ ]  b. H6 p4 J
  4. *
    % s  M% e6 C7 j) V5 h- @2 J
  5. * brief  EDMA3 Test Application1 L' }) ^+ R. h6 M* V& e- S8 y5 z8 z
  6. *1 [3 U5 d. M) E' e5 Y+ ~
  7. *   This file contains EDMA3 Test code.
    / P/ _4 r2 B: n( c
  8. *
    * J3 ~- K, [! O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - q% A( G/ V" j9 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 \, |) H, |8 U
  11. *         TO CHANGE.
    " x& z# u. E( q7 }6 Q
  12. *2 u) E4 Z2 r: d. A& }  I' m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: Z, x6 g, @1 e' |. y* {5 d
  14. *
    1 d+ b: p4 g6 d' q, _' O
  15. * This program is free software; you can redistribute it and/or
    4 C+ g) t2 M5 ~$ u5 ?
  16. * modify it under the terms of the GNU General Public License as
    : T$ w, G: x( Y9 ~4 b7 M* h
  17. * published by the Free Software Foundation version 2.
    $ K/ d- g$ _0 k( e: J( a. L
  18. *  j4 Z3 K1 _! {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) V' ]  k, c; _
  20. * kind, whether express or implied; without even the implied warranty: k  i( A, @" d0 S; f5 Y& H% V. ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 P' ~1 k7 s6 X/ I" u; Q1 f9 W% Q3 B
  22. * GNU General Public License for more details.! N5 e; n; x/ K3 c$ ^1 x' [
  23. */! @) H, c- c8 ^
  24. $ K6 k9 `% ?8 I2 H. G0 f5 D
  25. #include <linux/module.h>
    ! f! h7 p* u# F+ B, p2 T' k
  26. #include <linux/init.h>1 g2 F7 O/ t9 n8 D# O% L! }' H
  27. #include <linux/errno.h>+ w( m0 y6 C/ ^$ U8 Z% F9 R
  28. #include <linux/types.h>
    1 O+ A& z6 |; m
  29. #include <linux/interrupt.h>
    7 W( p  [9 }  w0 }5 ?
  30. #include <asm/io.h>
    ( L# K& G; L! |) r4 B
  31. #include <linux/moduleparam.h>
    $ R$ D& l# B1 q8 |' _0 j- b2 X
  32. #include <linux/sysctl.h>
    % x6 W# g+ ^0 N3 ]
  33. #include <linux/mm.h>$ c6 j4 u( x: R! v
  34. #include <linux/dma-mapping.h>" p- M+ q, K# I

  35. " O* D: b( I8 d: U" m& u
  36. #include <mach/memory.h>2 S( Q- k5 M" ~2 ?' U, n
  37. #include <mach/hardware.h>
    2 ?; X; b6 X! [  z+ e* Q& F5 a
  38. #include <mach/irqs.h>
    6 d  U  r' [# J; E8 _+ a
  39. #include <asm/hardware/edma.h>: D3 G# N  y, n: l$ |8 Y
  40. ( Q& H- X# h3 W7 I# r8 i- n+ O8 A: e
  41. #undef EDMA3_DEBUG
    $ o7 J" |' C! A, U9 L
  42. /*#define EDMA3_DEBUG*/
    2 N" L. o3 t2 b  W9 x# `6 ^

  43. ! G2 u# ]* [" d  C, X5 Y8 l
  44. #ifdef EDMA3_DEBUG
    5 k- t4 K' k" J+ I/ o, }: S& b& |$ H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 _7 Y& p4 }  I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 M  p9 _/ [0 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- a  C% g( |% R: E! l* D
  48. #else! [+ L8 W' o6 N; Y3 a, S
  49. #define DMA_PRINTK( x... )" o" M2 ?6 ~( D- {# w& n
  50. #define DMA_FN_IN
    " Q0 O7 L4 @+ d: h* r3 N8 e
  51. #define DMA_FN_OUT
    5 q% |, J5 a. s9 ^* Y. G' t9 I
  52. #endif
    6 Q) B) B3 m- @3 `) h. m0 U6 M/ s
  53. 0 S2 ?7 ]5 R& u7 B! b; U9 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ w$ F! }* k7 @2 Y: U
  55. #define STATIC_SHIFT                3: Z7 |8 E; |5 C% Z# v5 B
  56. #define TCINTEN_SHIFT               20' n& Z5 C0 J3 I/ a
  57. #define ITCINTEN_SHIFT              21
    9 P( `. |% s. o1 J2 Z
  58. #define TCCHEN_SHIFT                22
    0 B* M$ T, w7 m9 x0 n
  59. #define ITCCHEN_SHIFT               23
    % n7 @; F& ?: d6 V( q

  60. % C  l, ~# |; u2 i* g
  61. static volatile int irqraised1 = 0;! I& O! K% u9 P) `
  62. static volatile int irqraised2 = 0;+ c( b  q( f$ i5 L- M# X

  63. . K/ [; z5 C3 X% F! @0 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) S' H5 C7 q- s' E7 V& r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 @: U- W" O- U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 J/ P' H! X# l7 Z; n

  67. " K1 {. B, q8 Y0 P$ }3 w0 X
  68. dma_addr_t dmaphyssrc1 = 0;3 h- N, }: V* ]) F
  69. dma_addr_t dmaphyssrc2 = 0;
    * C3 U( {/ R+ P. H
  70. dma_addr_t dmaphysdest1 = 0;& i4 F3 U8 {- L2 q$ D. Z1 c/ D$ X$ q
  71. dma_addr_t dmaphysdest2 = 0;+ q! O' x. i; F' ]

  72. ; R0 \( t/ L2 d" W
  73. char *dmabufsrc1 = NULL;
    8 I7 x4 @& @8 V1 w
  74. char *dmabufsrc2 = NULL;
    * `0 y3 G; u, J* r
  75. char *dmabufdest1 = NULL;' Y' N0 ^3 r+ N! F
  76. char *dmabufdest2 = NULL;
    + }. k( a. H) ~; K  Z) O! n

  77. & h1 l1 ^  ]6 c% _+ m  `! Q5 Q
  78. static int acnt = 512;- a' l# m5 O( x
  79. static int bcnt = 8;
    ( T% v6 k/ Z' N7 ^+ c
  80. static int ccnt = 8;
    8 O+ i0 d$ R- A8 o0 @' P# J

  81. $ {7 N& M+ ~! Q
  82. module_param(acnt, int, S_IRUGO);" d, T  k9 m/ D2 w
  83. module_param(bcnt, int, S_IRUGO);/ R, ]3 B+ _" g% j8 o% g/ p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* ^( X# Y/ J) x( X& g8 Q& E9 M- }, N* h9 y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' |# z6 h/ M1 ^; C1 E  A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 g0 ~( s4 u/ c+ }9 _4 |" Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ @0 m  e& P3 [. L. a/ {/ O
- G( t" x# s8 i1 v" f
, l2 H, P+ T% C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 18:01 , Processed in 0.041152 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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