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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 o3 A0 n& b6 |/ w& n( |8 m' p
  1. [code]EDMA sample test application& V% o6 K1 G+ t* r
  2. /*
    : F0 ?" p( k) v7 m' ~
  3. * edma_test.c
    6 ?' ?. n, X+ T8 H# F5 e) s
  4. *
    . f* g' A( r! K/ @# Z3 _/ z
  5. * brief  EDMA3 Test Application
    4 P$ L* X5 T1 F( w  \" I
  6. *  `1 L. m. `' ~" `8 u( }
  7. *   This file contains EDMA3 Test code.9 Q% }8 {% T" F7 e' V
  8. *
    ; z& Z1 m, F) O" |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  b4 h# K; Z& D$ C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! {+ t1 o( c" F3 A+ d8 t* l( w2 T6 u
  11. *         TO CHANGE./ f2 P+ \. I% R. [- a
  12. *0 K* Y( D3 i" N8 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & U& w  P! U4 `% m' b4 G, r( r7 }, Y
  14. *
    : r. K( s( Q7 ^: Z0 }) P5 ~7 Z6 L3 ?
  15. * This program is free software; you can redistribute it and/or1 q! D+ E' t+ n3 H
  16. * modify it under the terms of the GNU General Public License as
    % I7 i0 G( {, G% u. l$ _  g
  17. * published by the Free Software Foundation version 2.$ `2 a4 l( l, }) `5 Y
  18. *  d1 U, a* b$ f8 c* I# c5 q" @- B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. V9 r# }* ~) p
  20. * kind, whether express or implied; without even the implied warranty
    " Y$ C7 `" J) a" n1 |# _; [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' m; @. D& z0 i4 o1 r! m
  22. * GNU General Public License for more details.
    ! V3 v2 [) C0 d: @/ u
  23. */
    9 R8 W% B( r0 }* \6 A# U. Q9 J

  24. . v, u! |+ B9 V" o% ~2 }( f
  25. #include <linux/module.h>
    . }: z2 I' i2 r2 q+ d4 Q0 i; _
  26. #include <linux/init.h>& o- N4 T* @/ T0 x* i
  27. #include <linux/errno.h>
    # }' f$ H! P$ e( C& r7 Y0 v/ f
  28. #include <linux/types.h>, s8 X' `6 z9 X/ N& j5 n/ S# r5 b
  29. #include <linux/interrupt.h>
    5 J* k- O  A3 t+ D/ C: n
  30. #include <asm/io.h>
    $ J! a- Z% l0 I# b1 B
  31. #include <linux/moduleparam.h>
    + ]8 k3 O1 [1 x
  32. #include <linux/sysctl.h>
    # D$ }; ^5 {9 R1 x# @' Y
  33. #include <linux/mm.h>% ^) h& o: V/ d* R2 e! D! O
  34. #include <linux/dma-mapping.h>
    7 X* T% m% ^8 c2 C3 n+ e3 S4 H
  35. % x' ^: R% f8 K3 N7 b
  36. #include <mach/memory.h>
    " p* P* j+ x# x3 v, e
  37. #include <mach/hardware.h>0 M# _3 R9 E* F  p* q
  38. #include <mach/irqs.h>
    % }/ X3 R( k& b4 `  a* x( K6 R" @' i' ~
  39. #include <asm/hardware/edma.h>* U' G) l! ]. N+ ~$ q/ z
  40. - a9 x$ `- u6 S# R
  41. #undef EDMA3_DEBUG
    3 i5 D$ T$ N* B' L7 b  J
  42. /*#define EDMA3_DEBUG*/
    ( D* _  e5 q! h' {
  43. / ?+ |6 M! n4 V! I
  44. #ifdef EDMA3_DEBUG
    $ J3 |! c7 n& |2 \4 P7 n, _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 S- m& x4 s# I1 v/ t. e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 D0 a" g. B5 ~! K# C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' L6 H2 o! E6 J+ \4 t# M, N
  48. #else
    ( T& C7 V1 ~4 ~5 O( d
  49. #define DMA_PRINTK( x... )" t- u  Q# t9 Z$ q7 a" T- e
  50. #define DMA_FN_IN
    5 Y0 k3 o3 o& }! S5 F) X
  51. #define DMA_FN_OUT
    + c% @5 j+ L! Z  {. m  q$ h
  52. #endif; g7 C  B6 n( z! F. N1 [, H

  53. 5 b7 `1 w' _1 j" c; W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & s% @$ B, s) t! D' W( n
  55. #define STATIC_SHIFT                3
    2 A: P: t+ q; o" ]8 _7 }* @8 p  Z
  56. #define TCINTEN_SHIFT               20
    ! [- X1 a; |  v( h1 J9 }4 O4 n
  57. #define ITCINTEN_SHIFT              212 o% s9 i4 i1 t. b2 F
  58. #define TCCHEN_SHIFT                22, K) k1 s+ T2 X' y6 F, H" p
  59. #define ITCCHEN_SHIFT               23. k) u2 l+ H2 s) g

  60. ! t# S" F9 ]# K8 j
  61. static volatile int irqraised1 = 0;
    ! |( N1 f* }  z1 c% V* {, e
  62. static volatile int irqraised2 = 0;  c7 N# N* `# i/ v8 @* j. W6 o5 @

  63. 0 c3 n+ q7 w6 T. `: G6 d: y* ], D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / O) i% M8 P8 L" P& t9 F$ Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : W7 @2 u3 o1 M# Q5 ^( \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + o4 a; Y) ?7 X) N, _! }& `$ R

  67. 8 s9 m2 E7 R; r2 ^2 u: ?& v( _
  68. dma_addr_t dmaphyssrc1 = 0;8 Q9 `3 `$ y% V$ S1 z3 c
  69. dma_addr_t dmaphyssrc2 = 0;# ~8 \; d; z) L, U6 g: Q( t
  70. dma_addr_t dmaphysdest1 = 0;* j$ |/ v( h0 d. e3 L
  71. dma_addr_t dmaphysdest2 = 0;
    2 i4 l5 T) t6 r! W2 o2 N
  72. 8 Z( I4 e6 w0 c5 W( n
  73. char *dmabufsrc1 = NULL;# d0 }" O! \+ e0 ^3 x0 K
  74. char *dmabufsrc2 = NULL;9 `& A2 D% U" P  F& [; k8 W
  75. char *dmabufdest1 = NULL;
    1 u3 Y) n8 S6 ~2 H; `$ j
  76. char *dmabufdest2 = NULL;2 c% p* f) v! y( n6 U/ p0 W

  77. 5 t6 a, @) z. F9 W7 w! b
  78. static int acnt = 512;! r/ y- z; Z  s
  79. static int bcnt = 8;" L5 u+ G" I1 L% A/ t' C9 i6 ]
  80. static int ccnt = 8;
    / }" E. A( d+ o6 H/ Y. V& b

  81. 5 Y9 O: \  E9 h0 G6 ^! w
  82. module_param(acnt, int, S_IRUGO);, b# g! `: Q& l5 L+ r$ y# x
  83. module_param(bcnt, int, S_IRUGO);
    $ W/ |& f8 X1 f/ z# ]; J$ a5 q( p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' e1 l/ H) E5 ]8 H, I
. }4 u( O" p. F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! ^; _3 }3 Y8 X9 c/ warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 Z* r  n8 P, w3 s  }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 ~- z3 [+ c' H8 a% f- a9 V

, \, O( H: e2 X* c
" R6 ?$ J; c5 F0 [1 N4 U% h4 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 16:44 , Processed in 0.039895 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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