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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 n+ B* c' Q# A8 _
  1. [code]EDMA sample test application6 Z0 J0 ~( i/ z" @& ]
  2. /*
    # l* H2 M# Y) R) r6 ?) Q
  3. * edma_test.c
    4 C8 f" e$ ?% u" a. x
  4. *2 c5 Q5 j9 m2 e6 F8 ?2 l* [7 }
  5. * brief  EDMA3 Test Application
    0 V# Z# z- l  D9 W6 D
  6. */ Y' m* j- ]0 R! E/ i
  7. *   This file contains EDMA3 Test code.2 y+ R& Q  [2 g; L" w/ i7 r2 [
  8. *  k3 N2 }/ L+ n9 R+ R' `' |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . b( X, {( K( |3 h; z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  {, W( {1 \# n  c6 |0 |% B* G
  11. *         TO CHANGE.
    . p) J' l: k- s1 Y) k3 F/ z
  12. *
    4 y9 E, X; N4 d  O* J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  s2 _" N$ A% y- H  V! @
  14. *
    ) C# C2 Q( H2 F% Y
  15. * This program is free software; you can redistribute it and/or: \7 j- V( s6 f/ a- q% |& B' n
  16. * modify it under the terms of the GNU General Public License as' u$ U1 w6 U. ]/ ^8 P2 P! a
  17. * published by the Free Software Foundation version 2.) ~# w* S8 e- ?
  18. *
    2 x9 P, O7 C/ V) E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- b- K6 i/ d! `* }7 r
  20. * kind, whether express or implied; without even the implied warranty
    $ a+ H- W& E. Q2 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * L- q( q& T5 O" {3 _
  22. * GNU General Public License for more details.- v8 r7 U% M5 X/ v. H2 b9 T# f  V( y
  23. */
    4 }8 s) s5 x4 }& p* J+ P/ y# U% F
  24. - @& p! C( r3 I+ d
  25. #include <linux/module.h>
    4 C( H3 g. u, F9 r, n1 r7 i( r
  26. #include <linux/init.h>
    # o& D6 ?4 R( J  h- t8 j/ @
  27. #include <linux/errno.h>0 D- _% g0 \5 S- {/ d1 a. C
  28. #include <linux/types.h>- H3 Y0 w$ @- `" _7 ~6 @2 I& H
  29. #include <linux/interrupt.h>
    7 P; d$ [( p5 c. n0 }: ^
  30. #include <asm/io.h>  u* l9 U6 g1 z8 t% F$ X' q
  31. #include <linux/moduleparam.h>: }3 ^! G$ |8 \( ^
  32. #include <linux/sysctl.h>
    ) u5 V) U  ]2 U9 A" O
  33. #include <linux/mm.h>$ r; u6 C, q0 j5 S5 |
  34. #include <linux/dma-mapping.h>  ~! E8 g! p. E
  35. 6 b9 i8 ]: C* y' X
  36. #include <mach/memory.h>/ D7 F" [8 L' K
  37. #include <mach/hardware.h>
    + k) f! }: v* _
  38. #include <mach/irqs.h>
    & Z' j5 M: A% ~8 i* S' j0 x: ^4 L
  39. #include <asm/hardware/edma.h>
    % D, `" ?6 d6 x' y1 _& q
  40. 8 K! E9 W% n5 m3 Q& m. {
  41. #undef EDMA3_DEBUG
    , A/ M8 _2 h& l4 I' w9 M2 V' O3 R
  42. /*#define EDMA3_DEBUG*/
    6 Y  r: z0 G  d& |  _% v( C5 ]
  43. * ]& b) H, F9 f5 ]. x- V
  44. #ifdef EDMA3_DEBUG
    8 P- X2 M2 P/ }3 I% F4 n5 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # F& I" c* U' W, N) j; b' \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 y6 _) t% l* o; L3 U' E% E4 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 J7 |# i5 Q5 L8 {% u6 U. |
  48. #else7 e6 v5 ?0 `" h9 |1 v6 r3 D9 k8 u
  49. #define DMA_PRINTK( x... )+ _! C! B7 i8 r8 |$ v4 [
  50. #define DMA_FN_IN$ S: E' v# A# G; s" K
  51. #define DMA_FN_OUT+ \/ ~/ ?! ]: O( S7 y
  52. #endif
    ' q/ ^0 G6 \0 E9 f4 V# C, }
  53. $ t8 z4 S) ^0 n4 p& u* P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * Y- E- \+ q. q+ C, K/ \$ A0 V
  55. #define STATIC_SHIFT                31 _( C2 V* k# b4 i
  56. #define TCINTEN_SHIFT               20+ t0 a( o! E% w* M/ [/ M
  57. #define ITCINTEN_SHIFT              21: ?5 w9 K% w$ P
  58. #define TCCHEN_SHIFT                22( m; z* ^- s' E) m. e3 r+ z0 C+ a4 z! f
  59. #define ITCCHEN_SHIFT               23
    5 A$ z& w3 H- R) R+ Y
  60. 2 `9 |4 j8 d% h$ n; Y# q8 G8 @+ [9 w
  61. static volatile int irqraised1 = 0;5 E& b2 |! T" ~' N
  62. static volatile int irqraised2 = 0;
    % w/ G# C" w) \
  63. . M4 g* Q5 l5 K8 ?0 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! T2 w/ e. w6 j' @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 r# B. {. S( i  ?! k0 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # b; y8 G2 z% Y, {
  67. # }! O+ n7 {- {% Z
  68. dma_addr_t dmaphyssrc1 = 0;& |1 R6 ]/ H9 }4 |! u
  69. dma_addr_t dmaphyssrc2 = 0;8 x9 V4 D4 P# H& \& h9 o
  70. dma_addr_t dmaphysdest1 = 0;
    , g4 H8 m9 t; ?
  71. dma_addr_t dmaphysdest2 = 0;( B6 S. o  f! D$ {$ U9 D/ T5 k
  72. " y/ d& U* d7 X7 C- {
  73. char *dmabufsrc1 = NULL;
    - r. Z3 G9 a* h% @3 Q; t) |
  74. char *dmabufsrc2 = NULL;
    . j# q( _) G% w
  75. char *dmabufdest1 = NULL;. Z+ r+ E: [: W
  76. char *dmabufdest2 = NULL;7 x8 @; B# D- g, L4 v

  77. 8 a9 e, ?/ c* ~
  78. static int acnt = 512;! y! h; S8 F, i( g" ]) g/ ^
  79. static int bcnt = 8;
    7 F+ y0 H1 s7 X5 l5 ?
  80. static int ccnt = 8;
    ! A2 f# u% [% B- `8 m& e+ J

  81. # }! N. x2 C, t4 K
  82. module_param(acnt, int, S_IRUGO);
    $ |" m* [  e( z7 ]0 d$ C: b
  83. module_param(bcnt, int, S_IRUGO);+ D3 Q& C6 h4 a" v4 w" v5 n' B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 p. X& s7 _, w: q7 y. _, |4 u

1 G6 d* A. Y0 e0 R2 e9 p: ^/ e4 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 q* s. L+ r, Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 I6 V( d0 E+ L+ a- S+ e2 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: M8 `5 c2 ]: H+ s2 ]4 A* o' N0 d2 X! J
% f% p" S! `; k3 l# k

8 v0 u' }: _# [( V/ f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 11:29 , Processed in 0.038879 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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