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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% A3 S* e1 A% {* D, K( Q
  1. [code]EDMA sample test application$ r' s& \4 }5 ~# `" a1 }0 G
  2. /*1 Z1 X5 H/ u- ?$ q1 U8 ^
  3. * edma_test.c% {+ ]' V% Q0 M( a) h
  4. *
    ( d  f  k3 W- W: l
  5. * brief  EDMA3 Test Application% p" f4 O% ?" z5 b5 H# ?
  6. ** H5 H+ w' c' N( |8 N7 U9 [
  7. *   This file contains EDMA3 Test code.
    : U* D& z5 `, Q$ ]) P
  8. *  k  J$ C& i$ b$ g* h$ m$ f7 B2 C8 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) \/ {; U: S) q; n8 k. J3 `' O+ z. g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  h9 D' e, P9 P5 c7 O
  11. *         TO CHANGE.% M$ M4 _2 |! n
  12. *# ?3 _2 Z5 \2 J* ^* j: n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: K2 q! I/ s) N6 _) _4 w" s" y
  14. *. C; I& H8 M4 |
  15. * This program is free software; you can redistribute it and/or( `% f* }/ f! l, p8 M: v0 x
  16. * modify it under the terms of the GNU General Public License as8 ]/ c' X# O: B! A
  17. * published by the Free Software Foundation version 2." P1 H# }7 g$ g) j
  18. *% }, K4 @0 K6 E7 b' {$ ~! B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * j) V+ }  N9 z" U3 s4 f% @
  20. * kind, whether express or implied; without even the implied warranty
    " ^. W1 h; X* Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ i( ?' D8 G. n
  22. * GNU General Public License for more details.
    7 }4 r' y! t* F1 w3 }$ h) A
  23. */
    9 h9 p( H, ]) G9 e+ J- \$ p. Y; H7 J

  24. / t, i0 c% w2 v4 u' m/ C& r( t
  25. #include <linux/module.h>
    7 j- O  t5 u/ o, Y- {
  26. #include <linux/init.h>  X' C4 p: b. V) d3 k) d
  27. #include <linux/errno.h>5 [  D. e6 W% `6 @% i' Z
  28. #include <linux/types.h>
    2 I$ ^) ~+ h. K- E0 g
  29. #include <linux/interrupt.h>* s! c& C/ C6 h# u# _( i
  30. #include <asm/io.h>3 T0 y; X' K! F% ~  {! g
  31. #include <linux/moduleparam.h>
    5 r* _7 l- r) o# r0 x" p
  32. #include <linux/sysctl.h>- Z8 P7 V/ A1 j1 W& Q" F
  33. #include <linux/mm.h>' J3 D! u, Q  K; T* e, m( Y- ^
  34. #include <linux/dma-mapping.h>! U7 Z$ x; R' P" K& e3 F. ~( a
  35. 3 e& [2 f1 @' S+ M( ]/ A* @
  36. #include <mach/memory.h>
    ) R. m7 F3 _3 F9 U6 S
  37. #include <mach/hardware.h>
    9 Q( j6 G! P* k- p
  38. #include <mach/irqs.h>& {% a. }) W7 f
  39. #include <asm/hardware/edma.h>$ u& x# n, p5 H/ z9 z
  40. 2 a5 ~2 }" g% {1 u6 [
  41. #undef EDMA3_DEBUG
    0 }8 q7 P5 A$ i/ j9 J
  42. /*#define EDMA3_DEBUG*/
    ( B6 x0 k6 U' V" [" P
  43. 1 m9 g$ K  R$ I2 i6 t% M" a
  44. #ifdef EDMA3_DEBUG
    4 q/ Q% Z0 }% Q' j# G% L2 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : [0 W5 G* H( m5 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      b# @% ^4 n+ e5 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ \/ l. [1 l6 {; x* w5 }% P+ X3 q
  48. #else6 `0 J' o. G  H
  49. #define DMA_PRINTK( x... )+ l) f+ Z5 c1 x  v. B% j7 j/ A
  50. #define DMA_FN_IN
    * R% U! E& L& p* s' m4 Z
  51. #define DMA_FN_OUT
    - D( G% f& q  f! |, H9 E
  52. #endif
    7 L" D" Y/ U7 Z& o7 y9 |

  53. " V' I% h9 ^) }9 t4 ^4 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , [  r2 k9 J0 _/ [, d- ]7 e
  55. #define STATIC_SHIFT                3
    9 F. Y6 U$ Z1 A' T6 {
  56. #define TCINTEN_SHIFT               20) i! f4 O) k9 z
  57. #define ITCINTEN_SHIFT              214 e, }7 u" L% b) c
  58. #define TCCHEN_SHIFT                22
    6 O4 r& z) Y! G2 G: \
  59. #define ITCCHEN_SHIFT               23
    ) H5 f( v$ U6 B: g5 |
  60. 1 ^+ ^; Q3 \+ A
  61. static volatile int irqraised1 = 0;
    7 O3 k9 J! v/ [4 e9 j# Z
  62. static volatile int irqraised2 = 0;$ l- o$ _4 R) B+ l( Z- S

  63. 4 A: M' U: H& H& D5 y  p* ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ P6 M5 S3 A- D6 p" g. {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, W! k0 a3 F- y% C- ]) `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Y( D: S. W) F. E" V. f' {

  67. 8 O3 h1 A- E0 l$ o1 `! g; n
  68. dma_addr_t dmaphyssrc1 = 0;2 g1 |5 h7 i6 N; R
  69. dma_addr_t dmaphyssrc2 = 0;  h0 h2 ?/ G# @, @
  70. dma_addr_t dmaphysdest1 = 0;9 _, p1 E- X1 ~+ J, |
  71. dma_addr_t dmaphysdest2 = 0;" n# Y' S' J0 z) L* A
  72. + ?4 X, O$ y7 J/ i, H; }# h
  73. char *dmabufsrc1 = NULL;
    : s! u% z  w; G
  74. char *dmabufsrc2 = NULL;
    6 I2 _4 Y9 \: |, s1 N7 y
  75. char *dmabufdest1 = NULL;
    " ^9 M" P' h2 ~$ [
  76. char *dmabufdest2 = NULL;6 a1 s( x: _$ d4 S
  77. 4 C! }. e2 L4 I8 a
  78. static int acnt = 512;
    & W5 a- _( j4 I1 j$ L
  79. static int bcnt = 8;
    # u5 j0 ?( Q# N# P  q- G4 q9 y, w
  80. static int ccnt = 8;, s9 X1 ]; [# I) ~) m& p0 b
  81. 5 c3 H$ X! r. L
  82. module_param(acnt, int, S_IRUGO);& Q8 ^: p# Q9 H
  83. module_param(bcnt, int, S_IRUGO);
    # x" A9 ^7 y' E0 U: T! \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 ]1 P8 `" c4 A/ b7 `- w, V. M
. t' h! Z  [0 K$ ?$ s# e' U  Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% ]4 z$ S6 l7 P5 d. R& a9 Rarm-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 f  y* d7 N" Z  p5 n8 W& z, w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, E3 v- [2 d2 s0 x$ x5 h

, x3 H/ Y4 D8 C' j! A) q
1 s+ H4 h2 z9 H) z/ h+ Z& ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 19:06 , Processed in 0.038470 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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