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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 G5 e4 ~% {4 ^/ q/ p7 e! m
  1. [code]EDMA sample test application8 e+ c( X% A' n/ h
  2. /*
    0 A" b# j5 r; @7 @+ u
  3. * edma_test.c
    " [" [7 m) M; Z5 Z. x7 h
  4. *
    . Z0 U6 b  D5 Z# ?" K% `( d1 w5 x
  5. * brief  EDMA3 Test Application
    9 T- X, r. c1 {2 v4 R0 H8 ?& P
  6. *! k) r, j( V, }7 \
  7. *   This file contains EDMA3 Test code.  q5 }" q+ V" O. K4 L( [; I: U
  8. *
    8 B: w) q' a! ^8 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( x9 y) ^! d+ X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # e0 B) X1 }" [* H. e, U/ Y
  11. *         TO CHANGE.
    ! [' [2 T( n8 M, }5 w  y
  12. *
    4 }( {1 G) c' R- [$ m1 `2 `# ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& B3 @1 h3 p. m, I
  14. *
    2 {; ^/ U. W' ?. ~
  15. * This program is free software; you can redistribute it and/or
    # H! f3 C: Y6 B  |; F: t
  16. * modify it under the terms of the GNU General Public License as
    ( ~5 w" [) Y6 d, ]4 T( j' r
  17. * published by the Free Software Foundation version 2.; K1 w" l: C- w! g; C' S! o8 J
  18. ** e4 f( }, Z7 r% V! o4 v% n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 C/ r" Z- h$ [" d# T
  20. * kind, whether express or implied; without even the implied warranty4 N& [+ \. x  l) A  j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % _8 i- _0 U. D4 u5 R# l# m9 p
  22. * GNU General Public License for more details.4 Y: ?8 E# d7 c: I3 I1 `
  23. */2 c& I2 @( ^( m# W

  24. + X) z: E, L' L+ q7 A: Y: X3 Y9 a
  25. #include <linux/module.h>
    9 U$ c8 ^/ u  n; z( V6 {
  26. #include <linux/init.h>
    3 V/ r# ?, t7 l# A" J. |8 {% ]; J: K
  27. #include <linux/errno.h>7 q& H5 K8 n4 K& _) f3 r
  28. #include <linux/types.h>
    ! r1 Y2 z4 b5 I) K, S# Z8 H
  29. #include <linux/interrupt.h>
    4 u  t: T' i7 v3 z
  30. #include <asm/io.h>5 X! n# d( v& ^* N) t4 H6 G: m
  31. #include <linux/moduleparam.h>. j" g% L4 v4 K
  32. #include <linux/sysctl.h>
      s8 h  l% d/ W
  33. #include <linux/mm.h>
    ; i$ a' h8 C0 ^3 O
  34. #include <linux/dma-mapping.h>
    - B- E1 h: i: L  r- g

  35. 5 I, S  x( m! i& d9 J/ a- f
  36. #include <mach/memory.h>' n' A, h. S2 q0 z
  37. #include <mach/hardware.h>; z8 K' O1 z1 e  O# ~; S  U4 W
  38. #include <mach/irqs.h>
    9 ^7 i6 L( D. U, J3 Q, B7 x1 H
  39. #include <asm/hardware/edma.h>; \( d1 _6 |! m: P
  40. - V' u; ^' |* ^' G8 f) w5 ^- _) c  ]1 x
  41. #undef EDMA3_DEBUG
    : T& V& H' ^1 o& F& [& b
  42. /*#define EDMA3_DEBUG*/- F9 O( Z& N8 [

  43. % a! t( F, r2 A9 H2 c) ?
  44. #ifdef EDMA3_DEBUG
    , |' L) ?" x5 O# C, S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : P( r' ^; `" X9 l2 K3 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 _: p3 F* U9 q, L9 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); N4 v, D& v1 K/ g& Z  i% E
  48. #else
    4 x8 q$ f. _9 G. C
  49. #define DMA_PRINTK( x... )
    ' W( Y3 ~8 n5 x5 {+ r& M- Y
  50. #define DMA_FN_IN
    5 q6 m$ A3 Y" m3 W4 {8 k
  51. #define DMA_FN_OUT( i+ C; Y6 _9 N; L, G! p3 |
  52. #endif
    - O: {! o1 S; F# {9 X5 b3 U

  53. % ~! G  G% C% k) ?2 {9 p7 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; b6 N! ?9 o; m# S: ]! ^- F
  55. #define STATIC_SHIFT                3/ e) R5 ^9 W1 _9 u8 d' H
  56. #define TCINTEN_SHIFT               208 u9 ]' `( \. l( h- X* `
  57. #define ITCINTEN_SHIFT              21
    6 f% x( V% r8 M) z
  58. #define TCCHEN_SHIFT                22: E" z# a" w0 b5 E" e
  59. #define ITCCHEN_SHIFT               23
    ( u. r! ^4 E) @0 h! N  \

  60. 5 z% S% a6 c# k0 T: e2 ~/ O
  61. static volatile int irqraised1 = 0;
    8 j# O$ t6 n8 e
  62. static volatile int irqraised2 = 0;
    : R5 I! R4 P1 J5 z: @

  63. ' H, S: o$ h  u/ R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; j( Q( Q- P% u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  i. f$ \8 h* @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 |4 ^+ H4 v/ q% ^; d
  67. ! a* Y% k! [8 u- I; u6 q
  68. dma_addr_t dmaphyssrc1 = 0;
      x  \! `, a- c/ Q0 O
  69. dma_addr_t dmaphyssrc2 = 0;0 l- ~4 B- ~6 l
  70. dma_addr_t dmaphysdest1 = 0;: U- j3 u6 ^) S1 J! E  B9 p
  71. dma_addr_t dmaphysdest2 = 0;
    % \( `  ^! w3 M% y
  72. * v0 L( }8 b3 O: g/ }
  73. char *dmabufsrc1 = NULL;
    " M% E" v" |) d! P5 U4 h# U
  74. char *dmabufsrc2 = NULL;
    # i7 B8 F' w: c" ~
  75. char *dmabufdest1 = NULL;
    - N! Q1 [: L( M( m6 V/ l" _3 R7 d
  76. char *dmabufdest2 = NULL;0 c0 g0 {/ D2 V- p  h

  77. 2 k6 E  z; r( ~; m! N7 q' I: w
  78. static int acnt = 512;. s3 u9 E  u3 d
  79. static int bcnt = 8;
    0 B7 j+ F0 k" i7 n0 v+ ^
  80. static int ccnt = 8;! k, U2 U0 Z  W- [' i

  81. 2 p% I- N2 w: r. P. R
  82. module_param(acnt, int, S_IRUGO);
    - g3 L3 w+ ], N9 \
  83. module_param(bcnt, int, S_IRUGO);# T  H: m& F+ T4 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* @4 t, l6 n$ N' C4 B& q8 a) [- [( G5 v" j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 R3 i; b7 r+ L0 P# e. x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ]; I+ F) X' q( w' A( b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% g. \* z5 D: a1 T  M% h
5 ~1 p- K( h4 A, ~7 I) b+ L3 e

* S$ @9 O! r) E" ~. D0 {+ b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-15 00:56 , Processed in 0.038366 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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