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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% k7 a* }8 m- ~5 X0 V* D, ?  k( u
  1. [code]EDMA sample test application
      L+ u6 ?7 q5 r) Z" C
  2. /*0 C8 X6 j4 `( u1 W; t
  3. * edma_test.c
    8 w; X4 [' w! h
  4. *+ b" @3 f# z$ P
  5. * brief  EDMA3 Test Application# o5 d! b4 J, R9 k2 e
  6. *
    , q5 l/ B& [1 |% F8 j4 P# [
  7. *   This file contains EDMA3 Test code.. R, C1 G4 x- n0 Y* q( q. w% Q& v7 |
  8. *
    : c- z  Q$ R5 w* `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * l* Q4 Z) _7 I+ ^5 s. ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 |1 I+ ?7 x' ]) N. `. Q- P
  11. *         TO CHANGE.( o: H' U7 Q, `
  12. *
    . X0 u" E  I" R" j9 M8 r/ f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 J5 |/ W" ?% N$ {" ~( T
  14. *7 U4 i! _" D6 _' j; l5 y0 c
  15. * This program is free software; you can redistribute it and/or
    7 N& S9 ]" y$ {+ M, r
  16. * modify it under the terms of the GNU General Public License as
    # W  G0 R6 a; f  I
  17. * published by the Free Software Foundation version 2.
    0 t  o* R  o- S) {- U  C# _5 ^
  18. *
    ) N, i. t+ v7 w5 l2 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 {( E0 B) c6 s0 p/ k
  20. * kind, whether express or implied; without even the implied warranty$ I# W, H  t2 h, [8 |; U+ h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' b+ e- l" \0 X  L8 [$ e
  22. * GNU General Public License for more details.
    4 L/ }* ?0 K; W* k8 y
  23. */; U( g, M3 T9 C4 b
  24. 3 ^5 d9 n" o) a3 f2 J  |% Z! @2 m
  25. #include <linux/module.h>
    ; t) n* V: u  k8 H7 H6 B6 J
  26. #include <linux/init.h>
    9 x9 y7 {% ^' o
  27. #include <linux/errno.h>
    , a/ Q( h# U" \5 W' @/ X
  28. #include <linux/types.h>) ~3 o% ^3 Z6 N5 K( l' @# m) A; Q
  29. #include <linux/interrupt.h>' r: e! o& Q7 T. T
  30. #include <asm/io.h>* \, o3 ]% L- M2 H. S, h
  31. #include <linux/moduleparam.h>+ m. ~1 R5 z* _* L8 ~2 v/ N
  32. #include <linux/sysctl.h>) n; d# t& |. O) u
  33. #include <linux/mm.h>' I  ]0 c, X. D- C( i! b
  34. #include <linux/dma-mapping.h>$ t" t' o' P( i

  35. # k* q6 U! I4 ]- l% T6 M* H
  36. #include <mach/memory.h>
    ! F  j  `' ^3 O1 \. \1 \; x
  37. #include <mach/hardware.h>
    6 {' r( n7 a" i; c' I3 c
  38. #include <mach/irqs.h>
    , \2 X- R& Z0 T& m
  39. #include <asm/hardware/edma.h>
    + x, j# F( ~0 ~3 \5 Y" z

  40. / N; L3 {1 y5 H9 X, I
  41. #undef EDMA3_DEBUG$ K  \  ?3 m. y4 |
  42. /*#define EDMA3_DEBUG*/
    9 [3 g. t$ m9 C( D
  43. * Z) K/ ?+ |. x' L5 A) v
  44. #ifdef EDMA3_DEBUG& I  d1 `8 R% x0 N0 p7 K9 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 r2 i7 {  d0 F6 h# J* c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), U" r( X! z; C+ i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      P, q; j# h% E3 [
  48. #else
    " A( U! P1 J, Y, j
  49. #define DMA_PRINTK( x... )
    ' t3 d6 |) [  n  t
  50. #define DMA_FN_IN
    6 d; t, F: p; F1 W  T% A
  51. #define DMA_FN_OUT8 }& C' ?# j& ~! a
  52. #endif
    ' r' D5 A5 a; z9 ^3 `

  53. , e) A$ g/ T4 _9 O; O( N+ o; X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 P+ b" y* s( ]3 i
  55. #define STATIC_SHIFT                3
    $ M8 g# P- d9 S# k. O' Y
  56. #define TCINTEN_SHIFT               20
    ' w% z& O! G0 h/ N
  57. #define ITCINTEN_SHIFT              21
    $ u" S$ s+ Q( [
  58. #define TCCHEN_SHIFT                22
      k* G7 ^' O) K8 W
  59. #define ITCCHEN_SHIFT               23
    # ~0 ~% c6 P* L1 N. n

  60. 9 i" z5 J# a# |& {* P
  61. static volatile int irqraised1 = 0;  ?, f; v2 `5 U+ Q6 v( I
  62. static volatile int irqraised2 = 0;( |% o, D! \6 o- w: ?; }3 R8 p4 w
  63. " [  W3 ]" o; w7 ^* f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 u/ T0 U, S7 j' X6 R( ^* K! d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! u1 K% i$ r5 B, N% y" E) K8 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 j) X+ p; h3 c( _  f: S
  67. 9 q$ [8 z& W* Q" N0 n) Q4 U
  68. dma_addr_t dmaphyssrc1 = 0;: x. h+ k' y9 _: g6 U) f& r
  69. dma_addr_t dmaphyssrc2 = 0;+ q7 H# [0 k* D4 [7 ?( c
  70. dma_addr_t dmaphysdest1 = 0;4 w, e+ e$ ]. Y0 d* h  T  [
  71. dma_addr_t dmaphysdest2 = 0;
    " m7 A# G$ D) ^  j  F

  72. + {+ G4 ^% t$ `% {( d  s
  73. char *dmabufsrc1 = NULL;
      w7 @( b  L# i  f2 }
  74. char *dmabufsrc2 = NULL;
    / ?2 J0 }/ @7 ~: {5 R2 X
  75. char *dmabufdest1 = NULL;
    ) L+ w/ C  \( l. S+ N6 _0 V9 j$ r
  76. char *dmabufdest2 = NULL;8 X  B# v2 P3 J* }; Z0 O0 }1 L# \8 N

  77. 5 c* t& a) b) m
  78. static int acnt = 512;
    3 B$ q& c: ?8 y
  79. static int bcnt = 8;& A0 s! c3 b- \( @9 g
  80. static int ccnt = 8;
    - s5 C# T& k1 K, W
  81. $ ~2 t5 y0 n7 v5 K' G
  82. module_param(acnt, int, S_IRUGO);
    / M! ^) d6 _! g* Y! {, x* M. Y6 i
  83. module_param(bcnt, int, S_IRUGO);
    ; U; h' E6 B2 S3 K( J" s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 q+ g8 \0 L- L
( T2 @( a3 k( t$ R! z! [; V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; G) Y. l2 F; X. e( M/ e* m3 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: i7 E# q$ ^/ e" F* D) M$ _3 ?+ A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) }  v) i& D$ T7 R6 @4 g6 S* W9 |: e8 V& O( O5 [
* q7 \) V) `% K; M- F) o* o9 k0 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 13:04 , Processed in 0.051064 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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