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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & z, N. N0 y; E# Q( i9 ]0 J. l$ }
  1. [code]EDMA sample test application6 D7 g4 c2 O3 |0 _8 R. t+ L0 `
  2. /*5 o9 {+ c- S7 Q) E6 l
  3. * edma_test.c; e# R; B! p' K9 h+ Y0 p$ `
  4. *
    4 _% `: R# D4 M0 b
  5. * brief  EDMA3 Test Application
    & p* \( u+ z0 N& b" \6 w1 u
  6. *
    + F5 c4 T5 V2 m3 p" V/ ]! d* x2 g
  7. *   This file contains EDMA3 Test code.
    / z$ u$ B2 C  c4 p4 P: v
  8. *+ M  ?5 K0 x4 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . D& n' D& W# I) u5 m: t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 m( r& y0 E5 J1 V" u/ X  s8 m
  11. *         TO CHANGE.- i" M6 j: m& w$ ?
  12. *
    ) Z, I  f8 n* L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% Z( ~9 t4 q; h
  14. *
    / |8 g7 R! o- ^
  15. * This program is free software; you can redistribute it and/or
    , H8 J% {2 s+ w! c8 [9 n, D
  16. * modify it under the terms of the GNU General Public License as
    7 F1 X5 \9 H% l4 E* n' O
  17. * published by the Free Software Foundation version 2.; D: t* y3 W4 G8 R3 m: T( w) S
  18. *
    $ a8 x) f$ ~( I+ Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; I9 R) \4 a- g- h, N/ l& d3 v
  20. * kind, whether express or implied; without even the implied warranty5 @3 K9 T2 W* Z9 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 P/ `4 K7 I6 r& Y  u# {
  22. * GNU General Public License for more details.
    - W) @2 g' ^5 ^  ]! C( |
  23. */# I! H3 s* L% [8 k& H
  24. % b5 `) m; _! Q
  25. #include <linux/module.h>3 |3 x$ f# v- b5 z+ m- f. |
  26. #include <linux/init.h># A- u" i) {/ e7 d$ j  m' t  ~. E8 {- T
  27. #include <linux/errno.h>
    + h" [6 Y) Y8 M+ }1 N; N" r5 F
  28. #include <linux/types.h>
    % Q; G  {* Y% S/ a4 S) W
  29. #include <linux/interrupt.h>4 F; ?. }; Y4 y3 M
  30. #include <asm/io.h>
    / Q1 ]) J+ j" \# z. ?* s
  31. #include <linux/moduleparam.h>
    6 g5 Y( G/ s% G! J4 ]! T$ o
  32. #include <linux/sysctl.h>" r" c7 D* i$ H. P) ^! u
  33. #include <linux/mm.h>
    : t) f  F: K/ k+ _6 |0 `
  34. #include <linux/dma-mapping.h>
    . |/ w( Y" ^% S& \- U3 y

  35. & T2 S4 ~3 q, |
  36. #include <mach/memory.h>
    0 L' h8 D3 O, L/ q+ d2 f
  37. #include <mach/hardware.h># W# U8 K0 k# V( y2 B! w3 Z- r& R3 {
  38. #include <mach/irqs.h>: E2 U# B# e. I" u* q8 P
  39. #include <asm/hardware/edma.h>
    . K8 V1 z4 c& c$ G( d+ S) r

  40. ( V8 V2 m- p- {3 N; ?
  41. #undef EDMA3_DEBUG
    5 U! F$ j9 j9 I# r1 f2 e4 R
  42. /*#define EDMA3_DEBUG*/
    ! _7 n3 T  F- T, U, D

  43. 5 ?/ R: \1 A$ n9 i! N2 o$ e
  44. #ifdef EDMA3_DEBUG# g2 l- W- E! d; E. J- x- s( _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : c, p0 A) H5 H$ b1 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & {( D  G) e2 r/ U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 v: @0 C0 w. @% K
  48. #else# W0 J' U1 \2 `* @6 H
  49. #define DMA_PRINTK( x... )
    . N1 ?# Q  ^. R) ?$ V% j0 Q9 Q
  50. #define DMA_FN_IN7 A4 p5 i# ~7 h
  51. #define DMA_FN_OUT
    - h! D% y( E* M/ \$ o; \, ?; r9 j
  52. #endif
    0 g; k& w" j8 o& o" ~9 a
  53. ( S# _& C. E8 I3 b0 \+ w/ P! m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 P4 Y) |& u! H: [  ?: P- I( W6 K
  55. #define STATIC_SHIFT                31 d. K' ?0 F; j! N9 i3 s
  56. #define TCINTEN_SHIFT               20
    , y6 t: X# m& u& ?0 n( L
  57. #define ITCINTEN_SHIFT              21+ l' w- v- T9 c0 m8 b# _, e2 u) l$ @" S
  58. #define TCCHEN_SHIFT                22: ?8 u2 Q' h. U) D1 ?- x
  59. #define ITCCHEN_SHIFT               23* [9 Y: |8 c, ?0 U/ j. @
  60. 1 d7 W1 F; Q0 C1 ^! n
  61. static volatile int irqraised1 = 0;
    5 x" h  w5 x7 D0 d5 q8 b& P9 Y' x: d1 b
  62. static volatile int irqraised2 = 0;$ R8 \3 @2 Y( \& T/ z: |8 ^/ C

  63. + c& E/ C' @- G1 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % b- S; Y" p+ K+ m+ q& M( J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 j) @1 x8 A% r: P4 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + o# t4 }& Y3 P% `2 C* b6 G0 d, y

  67. 6 B2 t. i+ }  _% J* A
  68. dma_addr_t dmaphyssrc1 = 0;
    & q* B5 }& h% s
  69. dma_addr_t dmaphyssrc2 = 0;" J1 B4 A5 T5 t
  70. dma_addr_t dmaphysdest1 = 0;
    ! L9 t4 Q* K4 x+ C: g/ h) r
  71. dma_addr_t dmaphysdest2 = 0;
    3 ~% A( |% {) Z2 W1 I3 L

  72. 6 d3 [- o% B: U" l
  73. char *dmabufsrc1 = NULL;
    1 j# y( a) A1 }9 _
  74. char *dmabufsrc2 = NULL;
    4 m/ o* H& g, ^2 Y3 |4 U4 j  X
  75. char *dmabufdest1 = NULL;
    . ?+ @/ s. v  M& w+ [
  76. char *dmabufdest2 = NULL;
    " C+ ~; \' d0 {6 s
  77. ! }0 q" C" ]+ N0 P* y
  78. static int acnt = 512;
    3 d" H7 Y  m* C/ S6 L( _& B
  79. static int bcnt = 8;
    0 e7 _: t8 {" m7 V' A1 G
  80. static int ccnt = 8;
    / H4 I7 o" T" {% F/ Y2 Z2 e

  81. $ t5 ^9 D. P3 t8 v* L) j  R- i
  82. module_param(acnt, int, S_IRUGO);
    ( l6 L5 M0 {+ _" a$ b: R& M( b
  83. module_param(bcnt, int, S_IRUGO);. z" b9 G) N7 K) q, q" J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' i/ v" d+ v0 S- V+ A  q, _
4 L8 E$ ^$ M2 a1 G8 M2 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ E" o" \! \5 G& j% x5 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 J) F  Q; G4 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 S1 y" |3 P9 Y4 F; Y- z
0 I$ ?5 q2 y+ @. j
7 L2 J0 T0 Z0 J3 Q% l5 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 12:50 , Processed in 0.050456 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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