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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - q+ N# n. R7 Y* A3 S
  1. [code]EDMA sample test application/ S8 b7 p; M' X# J0 s
  2. /*1 ?* Q1 v! o9 W- K4 u3 h
  3. * edma_test.c
    $ Y; s$ I9 H  Y" t( X" A
  4. *4 P; O+ X7 r- ~2 b& l
  5. * brief  EDMA3 Test Application, y0 ?, [" q+ @" e1 y. Z
  6. */ L* e8 D1 \( _
  7. *   This file contains EDMA3 Test code.
    # a- b+ c- J( R) M& K
  8. *0 t; a9 y3 R6 }& x5 J* K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / Z9 W, q5 F( Q& y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 H1 m* l% v. w+ n& G
  11. *         TO CHANGE.
    ; d# ]( {- X& J7 [1 d6 J& C
  12. *+ X2 R! |3 i& D3 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 b6 _6 }. p* S0 q. U& R
  14. *
    + j7 `/ `5 b+ B1 V) [! U
  15. * This program is free software; you can redistribute it and/or* ?' P3 K* N3 W$ i0 h% z
  16. * modify it under the terms of the GNU General Public License as2 J& n. b, n1 S$ |% G
  17. * published by the Free Software Foundation version 2.+ {* V) q1 L7 O
  18. *, J5 ~, Q8 G1 m! @6 p4 Q! {. p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ b9 }- s' u& G( Z
  20. * kind, whether express or implied; without even the implied warranty
    2 z& E/ ^. p' c5 V+ @$ a1 W; Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * t1 X* o3 Z1 Y) u
  22. * GNU General Public License for more details.* o# y; U0 j/ i& P- D
  23. */5 |9 d+ @! G& [5 G* [
  24. 0 f7 N4 M0 u8 |' ~1 S! o
  25. #include <linux/module.h>
    ! Z# z: y, W+ i9 P
  26. #include <linux/init.h>/ p2 h6 G) T. W0 Z1 A* O
  27. #include <linux/errno.h>
    " o' r9 T/ ?. p  J6 X
  28. #include <linux/types.h>
    5 Z; f( B' y  o9 [5 [7 [6 ~
  29. #include <linux/interrupt.h>
    1 r3 \* Y* K  B0 N" v3 k
  30. #include <asm/io.h>! Q2 U9 N6 \- [* H; @
  31. #include <linux/moduleparam.h>0 b0 I$ S* h7 N6 _& |$ z# z
  32. #include <linux/sysctl.h>/ k8 D3 h" Q- h% f" Z2 d
  33. #include <linux/mm.h>
    , W% }/ H5 C& E% z
  34. #include <linux/dma-mapping.h>7 p0 ]3 d' v/ h8 o

  35. 7 i% c8 B! j8 Y
  36. #include <mach/memory.h>  F! r4 P$ M9 ]1 U
  37. #include <mach/hardware.h>
    " K' i1 q% {6 ^; X
  38. #include <mach/irqs.h>* V- s1 H! ~, L* M
  39. #include <asm/hardware/edma.h>
    1 M  _' f9 b4 C; ~1 b
  40. : o1 X( x) i9 D% v; X/ b
  41. #undef EDMA3_DEBUG
    1 h. l' F$ k3 B2 h7 x
  42. /*#define EDMA3_DEBUG*/  \+ L- M7 q' u' C
  43. $ [, g. N: c9 i8 V7 r
  44. #ifdef EDMA3_DEBUG
    % O  G1 V* _9 X- B; y+ C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - [5 ]8 y4 H( r) S8 n9 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      E9 T; Q/ X. @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! l8 J1 }0 R  `
  48. #else" ~! ^! |, T$ U( S# n
  49. #define DMA_PRINTK( x... )
    ) b& Y- @1 D- g8 k& R3 v( ?7 c* v
  50. #define DMA_FN_IN! s6 Z& s: l) N* `3 q( M
  51. #define DMA_FN_OUT
      c! X: Z: X# l5 u3 S
  52. #endif8 y1 t1 I* e" b/ v& ~# ?5 E9 Q
  53. " U' B6 h' ^5 j) `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& C# l! E' `3 r  _3 T, m1 A/ |9 h
  55. #define STATIC_SHIFT                3
    9 ]6 @& `1 K' B9 V% @1 Q8 m
  56. #define TCINTEN_SHIFT               20
    : c* r9 h! A6 v+ M. n
  57. #define ITCINTEN_SHIFT              21
    2 l3 O6 G3 _6 }; `! U
  58. #define TCCHEN_SHIFT                221 d0 x& i) ~6 j- G9 v
  59. #define ITCCHEN_SHIFT               23+ O& F# V; @  h
  60. ' P7 S& n  w5 ^, Y1 X
  61. static volatile int irqraised1 = 0;
    9 _0 v  {. Q/ M8 m- c5 T& b- z
  62. static volatile int irqraised2 = 0;" d) ^. u! H% K6 ?4 n  U

  63.   R2 q/ X# B5 `0 q+ K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- |* U1 g& e' F8 @, P: b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. {* m0 G1 H, c8 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# E" C; d# [; c1 ~+ u, O

  67. ; i; C$ U9 C3 ?
  68. dma_addr_t dmaphyssrc1 = 0;
      \3 h; S1 h* {: B9 Q  P
  69. dma_addr_t dmaphyssrc2 = 0;7 |0 d% E/ _: e; C
  70. dma_addr_t dmaphysdest1 = 0;
    4 h$ l+ R' C3 f/ A# F
  71. dma_addr_t dmaphysdest2 = 0;( B2 v( q8 m* q; L: C9 Z8 ^% }5 v
  72. 9 \$ M8 G% J6 |  Z! c2 Z9 h
  73. char *dmabufsrc1 = NULL;
    " P3 j1 _" v: h  I: x
  74. char *dmabufsrc2 = NULL;
    * P  V+ Y" I+ k: ]" V  p
  75. char *dmabufdest1 = NULL;- _7 }- e8 B, @" G( v' j
  76. char *dmabufdest2 = NULL;
    ! ?8 E4 O4 e: i) f4 C. M3 w$ |+ w) t2 R

  77. 8 S" [( b) Q8 E
  78. static int acnt = 512;
    # S) B; @  a+ g/ r1 c" z: ~! P! g
  79. static int bcnt = 8;# S) z3 @, [0 @4 @
  80. static int ccnt = 8;
    + H3 z" d& ~0 `. J" F
  81. $ R, ^3 U; n! I7 F$ J
  82. module_param(acnt, int, S_IRUGO);' L2 z. l$ B( L8 I$ @
  83. module_param(bcnt, int, S_IRUGO);9 A+ B6 h! T9 S9 f) d" I' D* T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) _; q2 f: F& A8 H5 e
3 S. n# T! m  J8 \' ^9 x& a: s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 q, s3 h. w; {0 P) o% S) p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: v& `! h' }4 S7 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 z3 p9 S$ v9 ^; n) M3 `8 }
/ @0 W8 m% g1 A: I
* ?1 }8 b7 _+ q+ g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-24 14:25 , Processed in 0.046550 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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