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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) V, z, w4 @+ |1 [
  1. [code]EDMA sample test application. h* x: m8 L8 J9 v
  2. /*
    & N7 k6 P1 Y  w$ o$ @' u8 O
  3. * edma_test.c, T5 g% _, a+ j& ?( ]- A
  4. *0 a0 k! b! ]6 k  d# k) z$ T4 H
  5. * brief  EDMA3 Test Application2 E2 [" m) w! [6 L# W
  6. *
    - |. A; ?: m* h( }7 g1 {; ?
  7. *   This file contains EDMA3 Test code.* s5 A8 g% M; J* {; ~" [
  8. */ X7 J8 n6 z" w6 H& A' n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - f! g6 t, l) {. N6 I  ]0 f8 C& m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" K5 w/ W! n6 }3 _6 b9 ^1 }
  11. *         TO CHANGE.
    $ Q; f9 G2 v' @. U/ o6 `
  12. *9 X' M- R0 I, i$ U- V0 `" O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 @+ |8 o9 f7 B6 i  X$ \
  14. *
    ( C& a' N# b1 f- G
  15. * This program is free software; you can redistribute it and/or# V& X# z* A. N- [) e# d
  16. * modify it under the terms of the GNU General Public License as
    / \6 R/ @( r$ X; @
  17. * published by the Free Software Foundation version 2.
    ) b' n1 G! k- t. K1 k* y3 j
  18. *4 p6 F* x9 Q, T: q) p: Y' X" u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 b' _( T/ f: G  u6 W
  20. * kind, whether express or implied; without even the implied warranty
    0 ~$ H4 J. T! T% W- t0 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - I1 i3 d. p0 y! i4 V( g
  22. * GNU General Public License for more details.
    ) m, ~! B! d0 a1 V, u
  23. */5 H' Y. w5 {; Q
  24. 9 T' C; }  K% e
  25. #include <linux/module.h>
    4 [4 p: S- ~. c- b8 W: [
  26. #include <linux/init.h>1 w. r- C; o2 e6 J2 j: h
  27. #include <linux/errno.h>
    5 U# J# j  W1 w: w2 e& I) I
  28. #include <linux/types.h>3 U6 M6 d& e! y" B  S$ P' Q
  29. #include <linux/interrupt.h>
    " p- j: k/ s' x. v
  30. #include <asm/io.h>8 g, |' n/ x+ W7 A# y; {
  31. #include <linux/moduleparam.h>
    5 N( M+ d& `# x) I
  32. #include <linux/sysctl.h>
    9 ?1 x6 x7 M) ~2 N$ f, ?
  33. #include <linux/mm.h>$ u2 a% H2 E1 B( f1 c
  34. #include <linux/dma-mapping.h>
    % }3 D) v! J/ i  e
  35. . a, }( ~8 L. B$ D# p3 K5 P
  36. #include <mach/memory.h>6 u. h, Y* q; [: T( U( C
  37. #include <mach/hardware.h>
    ) r3 A. g7 O0 L" v9 l4 a' D# |
  38. #include <mach/irqs.h>1 k. ?3 e3 H1 T4 F( y
  39. #include <asm/hardware/edma.h>
    9 |" f  Z: P2 u: `, G6 C
  40. , I" G4 o. t5 x& K& c
  41. #undef EDMA3_DEBUG# p* D0 Q/ O+ V' I8 X$ r& p/ }4 d
  42. /*#define EDMA3_DEBUG*/
      x( y) t1 Y* t' M* ]( v

  43. . ~' S& n3 A, u% ?# y
  44. #ifdef EDMA3_DEBUG1 t. ]  q( Y  Z6 W0 p6 B0 ~& V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). ]# N0 e5 E5 ~/ ~/ k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ s0 Q, F4 `& [0 H. T1 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! k, ?2 \: Q0 \/ r5 y
  48. #else
    % C7 G; s- U, C6 |) @
  49. #define DMA_PRINTK( x... )! c) O5 a$ e- p; p
  50. #define DMA_FN_IN
    ( i: P$ x' A! ^. s$ Q, y$ \# w
  51. #define DMA_FN_OUT) E# B/ a4 t- W7 O$ V% e
  52. #endif* G( w6 s; s, Z, ]8 P& M; Y( |
  53. 9 s! v% ~$ X& E5 U! g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ z# ?. x& H1 l7 c7 s6 m: L
  55. #define STATIC_SHIFT                3
    ; ]# o$ P0 I' u$ S' |1 T5 K
  56. #define TCINTEN_SHIFT               203 D  P. Y/ P8 E+ e$ o# B# ^8 U* c
  57. #define ITCINTEN_SHIFT              21
    2 ~1 o  w0 t2 K0 I* s% @" E1 R
  58. #define TCCHEN_SHIFT                22
    - [# k' p- F( \: p+ P$ g- r
  59. #define ITCCHEN_SHIFT               23
    # Q& ]" P  Y- F8 Z! e+ U

  60. + v0 k* v# o! |
  61. static volatile int irqraised1 = 0;- }' }- C/ l, P2 l: m  p
  62. static volatile int irqraised2 = 0;
    & y* a5 j7 x; V0 x; y6 P; _, l

  63. 8 j8 h- k* n. \0 j8 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 c3 L+ {* \# H) Y$ ^# A, f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + m: z' w4 {( Y) {1 i7 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 \3 B& o1 g- n! b, I9 \

  67. : W- N: p5 u: a( e9 s! M
  68. dma_addr_t dmaphyssrc1 = 0;
    7 K( y3 z2 u* ^
  69. dma_addr_t dmaphyssrc2 = 0;
    ; i& S( Q$ z- z4 v
  70. dma_addr_t dmaphysdest1 = 0;
    1 `; r, |2 p2 z5 p
  71. dma_addr_t dmaphysdest2 = 0;: u( G+ U- M/ f: ?, s; P; g5 y9 I! w: p

  72. 6 I, v0 h! R3 x9 H; x
  73. char *dmabufsrc1 = NULL;
    9 V* q/ s: D: R3 x" Q4 S3 V
  74. char *dmabufsrc2 = NULL;- S2 j5 h( ^8 e9 z% [# [) S# o
  75. char *dmabufdest1 = NULL;. L" D0 N. N  m  \8 A, u: W4 n
  76. char *dmabufdest2 = NULL;* H. k0 N; V* ^( {7 _
  77. + ~" s. w$ ~: i
  78. static int acnt = 512;
    ; s, W8 x2 I' K# c7 B1 @$ G
  79. static int bcnt = 8;2 A. V6 H# u  l3 l9 Y1 G; A
  80. static int ccnt = 8;( n6 H* ~: y* M3 l

  81. $ P! V1 _! W, C
  82. module_param(acnt, int, S_IRUGO);3 {9 A* q8 m' H8 `
  83. module_param(bcnt, int, S_IRUGO);
    - G9 d1 m. g* {. x4 K2 q" g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  D' f: O) E8 ]* @4 Y) X4 L2 ]9 l7 M' W, c' m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 Q1 o* O6 G5 D5 G0 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  ?) e+ M( |  a& y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. C3 r7 I% t) q* V1 q

1 P6 l, _+ t) ]# i9 v7 u, d
$ r1 Z' L5 K3 V, C+ r! q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 02:35 , Processed in 0.039017 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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