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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( v' C1 _  R( s; _6 n5 Q; p4 n
  1. [code]EDMA sample test application
    ' T2 R5 k9 r% n8 ]6 W
  2. /*
    / y; W+ q; y% R" e' d* V
  3. * edma_test.c+ B7 G! B: F+ B3 }+ b
  4. *4 V3 C9 F+ G$ v& D& U$ i) \, I
  5. * brief  EDMA3 Test Application
    " C' V+ W( |4 l- g! z
  6. *
    / V* C. k! k* I% L
  7. *   This file contains EDMA3 Test code.6 D1 G2 f7 n3 a1 r; j
  8. */ N" P, S! O9 I# X) x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' n+ q8 [3 U' q: c. v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* K( ]3 `& e. ]6 H
  11. *         TO CHANGE.7 B6 a1 o" [/ W/ X0 `
  12. *8 u4 `. t, T* _" o1 z& d4 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 p' d& b4 l2 C0 l" t: d) ]
  14. *. l( Q4 a* }, c. v- w7 t
  15. * This program is free software; you can redistribute it and/or
    % p2 C. d$ k7 a! C: ~! O# F
  16. * modify it under the terms of the GNU General Public License as6 U1 G) n3 [9 I) b
  17. * published by the Free Software Foundation version 2.; p. U/ ^7 L. e
  18. *1 L; l% ~( w; [* i* d" k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. l  v- Z9 P2 B+ a
  20. * kind, whether express or implied; without even the implied warranty. K; V2 y! l/ }+ Q& V+ Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 p! U: S% C# n" M' D
  22. * GNU General Public License for more details.( R. P5 m1 D/ p
  23. */
    / A/ Y- s2 T, x
  24. / y3 _9 Y( J& `2 U; [
  25. #include <linux/module.h>  t4 i7 B, W4 D7 B5 N, l, I- p
  26. #include <linux/init.h>
    / K- j) n% t( E! J8 m0 i2 x' W  Y
  27. #include <linux/errno.h>6 j9 c, _- J/ l, G/ b; y! ~+ X
  28. #include <linux/types.h>! p' j. j0 w; }8 ^2 s2 p
  29. #include <linux/interrupt.h>, e& W' B: ?. E% B5 J
  30. #include <asm/io.h>
    2 y' @. \4 Y6 d  o
  31. #include <linux/moduleparam.h>
    6 @$ L8 L7 A) q+ |" \7 L3 s
  32. #include <linux/sysctl.h>& Q# ^+ B4 l) [2 f5 Z, c
  33. #include <linux/mm.h>
    ! C$ B2 u3 H4 }% E9 P8 f- Q
  34. #include <linux/dma-mapping.h>
    ) ?: A# \8 o. g/ T! u; c0 J4 k

  35. & S1 s7 ^* g  {& k
  36. #include <mach/memory.h>
    0 r" o1 q, B/ U- k
  37. #include <mach/hardware.h>
    5 g5 s* M7 ~: ^9 S$ a- k! F+ W
  38. #include <mach/irqs.h>
    ' ]6 s# e6 O- A7 r8 }$ X
  39. #include <asm/hardware/edma.h>6 F: q/ \5 K* @' b5 ]4 {% Q6 g9 r

  40. 5 M8 u- [6 m7 ^: u9 X3 t  u
  41. #undef EDMA3_DEBUG
    5 E- p0 g1 e6 x' W6 \) p" j9 w
  42. /*#define EDMA3_DEBUG*/
    ; D1 G: x* e, E2 c% K; R0 P
  43. / T  \" ?& l+ K/ g6 p
  44. #ifdef EDMA3_DEBUG- D) D! A9 K; P8 S+ S) @% V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& S1 b  T$ f2 u1 g& u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      P0 ?+ o" m! `4 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 u! Y" I) Z) w# s
  48. #else) R4 e' i9 T5 m0 E; c) o
  49. #define DMA_PRINTK( x... )1 [, n* Y( e- X! _" V: ?
  50. #define DMA_FN_IN
    ' I. \) \0 v- w9 s& N/ s
  51. #define DMA_FN_OUT' o$ |) m9 A' o! i# _$ D
  52. #endif, i- a) w# D* `  A2 H
  53. % F, R' z4 k% W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( B& a& m+ X3 S5 T/ t
  55. #define STATIC_SHIFT                3  c0 [% P# H2 C7 l8 P! l
  56. #define TCINTEN_SHIFT               20( I$ P. f- c9 e$ p" P5 Z
  57. #define ITCINTEN_SHIFT              21
    ! f, z, C; B/ i/ l$ x, I
  58. #define TCCHEN_SHIFT                22
    + g5 Z0 H- Y% ^0 U
  59. #define ITCCHEN_SHIFT               23' `- Y) `) u% u- a

  60. + \" T  x2 X! D# q% R
  61. static volatile int irqraised1 = 0;
    5 t: }2 T4 J; |1 }0 U
  62. static volatile int irqraised2 = 0;
      u8 n" n. y& M( u& s0 a0 h
  63. 2 V0 e9 D: I  s3 d7 y2 C; V3 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' |: q- r, e. L$ D; e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Q8 J+ e) `; [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - [8 W2 B! Y! b( U! i# S0 q

  67. 5 c4 V* Y! K2 N$ N. R4 n+ Q
  68. dma_addr_t dmaphyssrc1 = 0;
    , W$ F+ b! c/ I3 i5 I+ ?
  69. dma_addr_t dmaphyssrc2 = 0;
    $ l6 ~, n% D* Y6 q- ^
  70. dma_addr_t dmaphysdest1 = 0;% i4 C% E: M0 l* [4 K
  71. dma_addr_t dmaphysdest2 = 0;7 G9 y/ ^1 z1 W! H% ^9 V+ x, G

  72. - i3 R' N$ {5 W! O' Q, C( ]
  73. char *dmabufsrc1 = NULL;
    # V2 B- p) s) l1 D: H" o& Z3 Z
  74. char *dmabufsrc2 = NULL;
    4 S9 Z  \+ j$ H& u) D% ^: a" A. \
  75. char *dmabufdest1 = NULL;
    ' E5 \! r  B" A
  76. char *dmabufdest2 = NULL;: B- X5 i+ R0 [0 x
  77. : [/ i0 T) D1 `/ i2 S) u( S
  78. static int acnt = 512;) `8 b. H8 O8 h! m
  79. static int bcnt = 8;
    ( b2 ?- }0 ^/ z' B/ y
  80. static int ccnt = 8;
    % }' ?8 x8 B/ G) Q' u7 x3 `/ Q
  81. , @/ d( v; K! |, x6 A
  82. module_param(acnt, int, S_IRUGO);
    5 `( ]; e! x, N" e
  83. module_param(bcnt, int, S_IRUGO);4 b1 d  n5 n& m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' N+ `/ I& K! v. Y! @- }) V7 i6 Q

( ^3 V% z7 n( E+ U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% t& j# m# n. Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. b( G1 z0 E. `8 x/ p' u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 N& m7 K5 q( C3 y
" _- V$ [1 b5 h! i$ E# a' f: f, Y
6 _; S' a, R/ {: Z# A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 01:48 , Processed in 0.049919 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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