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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* n/ [1 ?, w* z& _. h
  1. [code]EDMA sample test application& ~9 Z- g' f% W) i" k- n
  2. /*
    , D: @) l# [2 Y6 o6 O4 g
  3. * edma_test.c# N9 a9 A, A1 t
  4. *
      C5 W" F+ \6 H( p) g- y3 s& W
  5. * brief  EDMA3 Test Application
    1 L6 m% I- Q4 ^$ q. b% a
  6. *
    9 h; h: e9 @2 _! ~1 |# w
  7. *   This file contains EDMA3 Test code.& z2 d& m- x6 Z
  8. *3 C, J  _6 d! k& X8 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* ?  p- e: O, F- G8 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) U5 B$ N1 P& z$ I
  11. *         TO CHANGE.
    8 E3 @9 V) z# H) u3 o8 r
  12. *
    + D. k# ]% L$ n4 g4 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  d- o8 s5 {; ^- P" q
  14. *# u# R. N8 m0 K  e
  15. * This program is free software; you can redistribute it and/or
    ; O6 f& L7 j$ ~' {
  16. * modify it under the terms of the GNU General Public License as  s7 e4 K4 U0 }# l6 T
  17. * published by the Free Software Foundation version 2.
    % n3 x/ Q7 c1 @1 k, s- }9 V
  18. *. Z4 x5 G# e: J$ o" x& S& ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) I8 y  Q& N0 G7 U
  20. * kind, whether express or implied; without even the implied warranty- R8 d; S+ d( a. s! M* P/ R8 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 @+ \+ v1 q) p* x
  22. * GNU General Public License for more details.
    0 E7 S- A1 s% b' }) s3 K9 u$ p+ Y8 P
  23. *// y( x$ j4 \1 C
  24. 8 b6 O; d; H2 Y& h. u
  25. #include <linux/module.h>
    8 w8 B- K3 k6 a, e: c* D
  26. #include <linux/init.h>) }& b, Y' t+ c. M
  27. #include <linux/errno.h>( e- a' M/ Z8 g! v' r3 N4 E, r
  28. #include <linux/types.h>
    " s5 M, ]: R8 l# X8 u
  29. #include <linux/interrupt.h>
    6 p0 w/ ]0 t  {# l. t+ G. q
  30. #include <asm/io.h>6 O9 }9 i3 |& {, b' [, ?
  31. #include <linux/moduleparam.h>
    % O% E  a! `6 }# ~2 F4 B
  32. #include <linux/sysctl.h>1 w& |' ~0 Q% z5 E1 Z
  33. #include <linux/mm.h>) `& o, @0 o# m
  34. #include <linux/dma-mapping.h>+ y# O3 F6 i- `5 c5 p4 S( j

  35. * e2 K& T5 J# J3 d% Y
  36. #include <mach/memory.h>; [  \1 E1 V+ {1 O9 W* L- Q
  37. #include <mach/hardware.h>
    * N& f( Q& h( h- E4 ?
  38. #include <mach/irqs.h>
    8 U3 H4 N: f! r  S! I
  39. #include <asm/hardware/edma.h>( Y) v, {" G. k
  40. " d/ M! R; R& l* }$ k% i
  41. #undef EDMA3_DEBUG
    ! t" b5 Q! \( V- o) k8 H8 k2 @: B* }
  42. /*#define EDMA3_DEBUG*/
    ( p9 B6 h/ {$ @/ X

  43. ' v, m$ F7 p" Y( r6 c" D) o
  44. #ifdef EDMA3_DEBUG3 h5 K+ f( j) c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % d6 c. h2 z- s5 |* u- b  n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) P3 g( O& p+ C' U# O+ P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 b* g* k. X2 a& S8 m
  48. #else
    8 M2 V# n% g! m, [* d9 i/ P
  49. #define DMA_PRINTK( x... )
    # F  X, s* j: B) P8 o1 K
  50. #define DMA_FN_IN
    4 j, j" ~. v7 P$ b
  51. #define DMA_FN_OUT
    & q/ J: m( H2 Z7 m8 ?, I
  52. #endif8 U3 c6 \' l- u( T
  53. % Q6 M" G! }$ ], R9 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 F. g2 s# w5 {( O: j' ]6 }3 k5 u
  55. #define STATIC_SHIFT                3
    # z( w5 _" P6 V/ Q
  56. #define TCINTEN_SHIFT               20# j5 E, s/ V& m3 H) R, W! f
  57. #define ITCINTEN_SHIFT              21) A" ~' y2 X/ P/ S4 A, b  g
  58. #define TCCHEN_SHIFT                22
    % {% E9 H4 t* L4 ^9 z7 J8 [) h
  59. #define ITCCHEN_SHIFT               23/ P; ]* J/ @& y7 _0 G
  60. $ Y  W- r# X, D& N1 X0 Z  z
  61. static volatile int irqraised1 = 0;
    8 {' _9 \* z8 p0 d7 y6 U1 b
  62. static volatile int irqraised2 = 0;$ K4 y! u9 h5 O6 T% _2 V% u
  63. ! C4 H- M( n1 E2 [. X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " U: h* \2 @* G* Z' m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 n0 C, _1 L0 c% E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : b3 ^* m& v) ?. D
  67. 0 Z- M" N; I, i; n- |
  68. dma_addr_t dmaphyssrc1 = 0;
    0 Q& b5 ~4 g( O2 V
  69. dma_addr_t dmaphyssrc2 = 0;# c6 z# {9 }, Y8 @' L2 y
  70. dma_addr_t dmaphysdest1 = 0;
    / |: z0 i# v# V8 Y" U
  71. dma_addr_t dmaphysdest2 = 0;$ ]- ~# Z$ K' Z/ ]. L

  72. 6 J6 f1 T: P6 K; j$ K3 @) B5 r
  73. char *dmabufsrc1 = NULL;
    + B2 `" v/ A9 R( G0 \$ b
  74. char *dmabufsrc2 = NULL;! [6 C$ P: S( U* x9 T
  75. char *dmabufdest1 = NULL;( Y. J  O& O5 y+ B# g" H& F2 x1 p: Q7 f
  76. char *dmabufdest2 = NULL;
    6 H; y' Y2 y. ]
  77. ( p+ K) x2 \6 g6 A% C/ u( `
  78. static int acnt = 512;
    $ p# h: d5 o( [7 s* G
  79. static int bcnt = 8;* ~$ ^+ Z4 S; z
  80. static int ccnt = 8;
    : Q2 y5 D5 R  G' r' I

  81. : D& ^! ?- t7 S  o: ?+ w
  82. module_param(acnt, int, S_IRUGO);7 b7 P/ k* J+ H3 Q5 a
  83. module_param(bcnt, int, S_IRUGO);
    ; U, S( o! U% Q. b0 W: K$ s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 z. o2 y' s- e  W" j
2 T8 s6 h( s0 f0 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 w$ y- J' E3 ?
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 l: e: G0 U" r6 c) J1 P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* z, G2 C' X3 N0 }0 |' S% Z2 S- W) U% W6 D

( D. c8 j% x$ I. I* I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-13 05:54 , Processed in 0.037460 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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