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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ T% n- p3 N; p7 V# K% z
  1. [code]EDMA sample test application5 A6 q2 ]# Z9 g/ x
  2. /*6 t& _; V' W: _- D
  3. * edma_test.c
    9 t1 L; U# y. x7 B8 p$ T* e, E
  4. *# {9 A% C4 J8 R1 j6 N& q. z3 q( s
  5. * brief  EDMA3 Test Application8 ?$ a; J' P$ @& }
  6. *, Z8 o! a" _& ?
  7. *   This file contains EDMA3 Test code.$ K2 X3 w% f' a7 e7 E
  8. *5 c& F: |0 K9 E' q6 b; M; w& M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . v2 p' @* [7 d5 Q3 l9 o4 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# x) G% p* C" u: ~2 b
  11. *         TO CHANGE.
    ; A  k4 X' U2 v' N! }- G
  12. *
    ! l, \$ H* Q5 |: z( p* O+ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 [+ n- A" R% j. W' A% t% B
  14. *
    + f/ N) P) {6 D  O  i
  15. * This program is free software; you can redistribute it and/or6 R# i. J: M& n/ H  J; _/ r- {) r
  16. * modify it under the terms of the GNU General Public License as
    * z0 _; X$ |. T4 m: v
  17. * published by the Free Software Foundation version 2.
    2 R$ L4 w) D8 m
  18. *( q+ k+ O  ?, T, M9 f* R# R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) K0 C- i+ K( a' x* X
  20. * kind, whether express or implied; without even the implied warranty
    & G8 L; z$ O  j# |/ K. A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) u' \& U- n7 v
  22. * GNU General Public License for more details.
    0 ~( I; N. a* z: i
  23. */, w2 O, C6 V$ G4 s! X) j

  24. 4 J& p8 W2 K  m
  25. #include <linux/module.h>
    6 h: R) Y  {! v
  26. #include <linux/init.h>
    , K2 j! L; K' y6 J
  27. #include <linux/errno.h>
    9 `# Z" z+ e0 }
  28. #include <linux/types.h>
    0 i- A. ~1 W/ A$ ~* q& K
  29. #include <linux/interrupt.h>
    0 t; f2 ]: {/ B: ~* \+ H% g
  30. #include <asm/io.h>2 I1 ^0 I% H" a1 U
  31. #include <linux/moduleparam.h>
    5 y! k2 N5 a! `( i
  32. #include <linux/sysctl.h>" E+ D- ]) F% Z  R: ]
  33. #include <linux/mm.h>
    $ k9 w/ }: r. R
  34. #include <linux/dma-mapping.h>
    1 p9 R& p' Q" V1 G2 s4 E# M

  35. ) a( `) [& u6 ~2 j' A2 v+ \: Z6 ^
  36. #include <mach/memory.h>- H; ?* M" J" L$ [% `, ?; U9 N
  37. #include <mach/hardware.h>. F) l% E3 b# U, n
  38. #include <mach/irqs.h>
    * |; G; I% b/ u3 p
  39. #include <asm/hardware/edma.h>
    + f* M0 ]7 R1 [& ]* y  N! ~
  40. # `5 Q- \7 A" F: [. `
  41. #undef EDMA3_DEBUG
    5 x! u9 x2 {( F1 K, r$ M
  42. /*#define EDMA3_DEBUG*/; {4 y+ H$ Z  K! X9 V
  43. / r2 z) ?( j  O1 R) W- K3 B
  44. #ifdef EDMA3_DEBUG
    : P# j- @; E6 L+ O- p) u% Y1 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 P! U9 @% [6 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 s# `) f& a8 T# I" I, K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 H2 k* G/ u$ M' t4 B# p' w
  48. #else
    / E2 }& |" P& A
  49. #define DMA_PRINTK( x... )) z& j) r. J% H9 o6 W
  50. #define DMA_FN_IN
    & O# |; }; J4 I/ ?  y, L$ h: o
  51. #define DMA_FN_OUT) i0 s! d- S0 Z* w) [; h! s
  52. #endif
    4 W3 {* d( f2 P8 g1 R1 ^
  53. 0 K. z- z. S$ [3 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 l3 M+ O) S/ v- m
  55. #define STATIC_SHIFT                3" y/ R# X6 D: h" N  j4 L# y
  56. #define TCINTEN_SHIFT               20( l3 X9 E" A! o1 O
  57. #define ITCINTEN_SHIFT              216 m$ O1 G% q/ J) S$ l$ q4 \" [+ @' r
  58. #define TCCHEN_SHIFT                22: V1 H. h6 o1 X) c
  59. #define ITCCHEN_SHIFT               23
    # T" n; P: J( I9 y, c0 O" ^7 F
  60. 1 P) J+ {3 F4 R! S5 Q; f
  61. static volatile int irqraised1 = 0;  t5 l8 n0 h" ]  d
  62. static volatile int irqraised2 = 0;
    4 K4 Z2 ?2 T- a( C6 B4 K
  63. # W$ d7 z$ a# H" x& C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % S% T$ }! t* a1 X1 y5 u( c1 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / i" V7 I3 ]+ k0 S/ z# a0 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! D5 j! f! \! @0 _9 i4 ?

  67. " Q4 g1 j3 H- C$ C3 r
  68. dma_addr_t dmaphyssrc1 = 0;& p3 ^1 }. J; I% Z
  69. dma_addr_t dmaphyssrc2 = 0;' [. s* G- ^8 t( @
  70. dma_addr_t dmaphysdest1 = 0;; w9 [3 M$ x% _# e
  71. dma_addr_t dmaphysdest2 = 0;
    3 @4 v7 m0 K1 f

  72. - ?; \- K/ l; j
  73. char *dmabufsrc1 = NULL;8 o8 l1 E$ S5 `, |2 Y
  74. char *dmabufsrc2 = NULL;
    # d+ ~% [# P: w; a9 B8 V, p
  75. char *dmabufdest1 = NULL;
    * h# A) B9 D% R' N4 H
  76. char *dmabufdest2 = NULL;  s6 T* }# q( p7 G9 F7 N& a
  77. : r. N1 b% W8 n2 E- R* R$ J
  78. static int acnt = 512;) v$ {. }+ T4 \0 c. W; ~* Y
  79. static int bcnt = 8;
    $ t; ]& E$ L- }% r, j
  80. static int ccnt = 8;& s1 e* v+ K& S% ]& f, C

  81. 4 S5 @# h8 T  y  _% N. v9 p. t5 b
  82. module_param(acnt, int, S_IRUGO);
    + M6 Z2 F: q1 t5 q( ~2 s
  83. module_param(bcnt, int, S_IRUGO);
    7 B4 [9 y+ s! g$ x" u: R2 S6 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 N; r" e7 h5 Y. W; I+ Y  V9 v. u  {9 h8 o/ G8 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  B$ z' f: k0 }' I8 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. ^: N, l5 U2 G, `( b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. h& X0 B% _3 m- e+ Q& `, M  ]$ b1 G

6 C9 @  L+ t5 K# g6 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 13:06 , Processed in 0.038708 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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