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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 u$ K; G+ b% f4 k+ `' |8 I% {; G
  1. [code]EDMA sample test application
    5 B, c  }+ Y- [$ e3 ~4 y
  2. /*; }3 `+ o) u; a, F5 L; h
  3. * edma_test.c
    / E+ E. B% l) B  f: ]6 s) l7 e
  4. *
    5 Y* A& n, b! E, u# M: H
  5. * brief  EDMA3 Test Application' {5 i8 `- e' o) K
  6. *5 d: U7 h) G; D% Z
  7. *   This file contains EDMA3 Test code.+ l1 Y  P- ?# o1 q+ q5 Y
  8. *2 H$ _# z$ E7 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& W! }' `) P9 v8 c0 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' F; Y7 Z' G8 m$ }2 ~  a
  11. *         TO CHANGE.7 Z0 h9 @- S+ P
  12. *
    2 t& o8 c: q1 s/ Y0 X( @4 U" O5 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) |* V2 @5 j6 G# R2 i  y0 g% B( {
  14. *3 m  n$ `% j: x. _; T  h
  15. * This program is free software; you can redistribute it and/or
    # U$ Y+ [  O- y! x3 N
  16. * modify it under the terms of the GNU General Public License as7 C; f9 a7 m; W0 N$ J! C
  17. * published by the Free Software Foundation version 2., j/ q( `" U; C$ Y/ Y# \  y' S' }
  18. *
    , R& x* |; a+ t9 m6 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; ]$ Z0 d& l$ C9 @: e' w
  20. * kind, whether express or implied; without even the implied warranty
    ! u6 ~' q+ k& x) n" f: N3 q$ t+ B# [, i. z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 [4 }/ l8 h- C+ d
  22. * GNU General Public License for more details.7 B& U" M0 u$ }
  23. */
      e: `* R- N# M
  24.   O/ X# O3 L; x' c) U
  25. #include <linux/module.h>
    . w% g1 K5 y- B5 S
  26. #include <linux/init.h>
    % j, U* s* z* C, l/ i8 z$ |
  27. #include <linux/errno.h>
    % @1 N6 N" N) g% _
  28. #include <linux/types.h>7 A! m0 b0 u$ H; Q2 {) }
  29. #include <linux/interrupt.h>
    : A6 i$ x6 n& I, I6 n
  30. #include <asm/io.h>
    ; u) D: B% K1 R2 x: s
  31. #include <linux/moduleparam.h>1 K' x2 D7 a% y( L( Q& x
  32. #include <linux/sysctl.h>
      s$ n8 v/ B4 }: ?
  33. #include <linux/mm.h>
    & a3 U4 f9 x, P' U4 S# K
  34. #include <linux/dma-mapping.h>% i* K; o$ |3 a" _
  35.   U) N* P0 j- {% g$ y8 X
  36. #include <mach/memory.h>1 M: q. P4 P$ Q1 w  u0 o
  37. #include <mach/hardware.h>+ ]9 D3 d: n. N+ S! Z. @$ L
  38. #include <mach/irqs.h>+ u$ v$ l: j& h: |2 }. l
  39. #include <asm/hardware/edma.h>
    6 Y) q* k8 X& w; j' @

  40. ' l) N; |0 X( G, K' f% E
  41. #undef EDMA3_DEBUG/ Z0 Y) V4 U1 T2 J4 L' `- _
  42. /*#define EDMA3_DEBUG*/" e8 U1 K+ H2 H
  43. # `# A5 f/ |/ N1 r' B1 G  e& }( y
  44. #ifdef EDMA3_DEBUG
    & h9 B% J$ o/ ?0 i- M9 W( u6 L. M' w; [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" Y' q% W# S1 c6 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - [; i1 P) f# A# h, g3 r# ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 g4 |4 P6 g- H" A% E: h
  48. #else
    ) x. p. t) \3 j2 [: c, y9 _2 n! ?
  49. #define DMA_PRINTK( x... )
    1 v2 G  _2 X2 f
  50. #define DMA_FN_IN
    4 G% S9 a: z+ [1 E! Q- u
  51. #define DMA_FN_OUT
    4 {/ p" }1 Z9 J
  52. #endif
    5 ~$ s! B: y3 v3 R: A+ Q

  53. ( X1 e0 P4 J8 ]/ H2 \2 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! ?* V) L# C9 A. s' W5 n" [
  55. #define STATIC_SHIFT                34 i: W- k( _/ d# p! s
  56. #define TCINTEN_SHIFT               20# S% T2 r9 x" l
  57. #define ITCINTEN_SHIFT              21
    ) f. w, _7 g  B( [
  58. #define TCCHEN_SHIFT                22
    9 l7 s6 _% u. J: g1 U) g
  59. #define ITCCHEN_SHIFT               233 t: ~. o- G0 L
  60. 9 T+ {/ a- u4 c. N1 d
  61. static volatile int irqraised1 = 0;
    % p8 H- ?; o: |" N$ q# ?
  62. static volatile int irqraised2 = 0;
    ( W/ q! |! I# E. ?) c0 t; h

  63. 8 d0 ~3 u. O. s2 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! h: w( `& D3 \) i8 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. C- R" ^6 e( [8 {$ j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. \0 S0 ^. Z- n

  67. 0 d& T& h' T& e7 F1 G! u9 U
  68. dma_addr_t dmaphyssrc1 = 0;" T; w. ]2 b6 T+ F+ x( o: o' w; A
  69. dma_addr_t dmaphyssrc2 = 0;" G; W! K( r' K
  70. dma_addr_t dmaphysdest1 = 0;
    6 B0 D6 Q7 z+ o: [' ^. S
  71. dma_addr_t dmaphysdest2 = 0;) g( |2 `5 c" U- o2 Q# b. n

  72. / x2 x3 T$ Y  N; b9 G
  73. char *dmabufsrc1 = NULL;" X6 ^( V$ n. E. Z5 x$ c- O5 Z
  74. char *dmabufsrc2 = NULL;" t4 t9 z: N9 o
  75. char *dmabufdest1 = NULL;
    ! w: O5 r' P' x" i, R8 Q
  76. char *dmabufdest2 = NULL;/ B! r( Z7 [% E( ]: M! ]3 {
  77. , V, M( T$ x8 e1 C% j5 D. `
  78. static int acnt = 512;1 {# @! q1 U1 E9 i% B" |& ?0 M
  79. static int bcnt = 8;
    ! t' v: `$ Y2 x3 `+ {' ~$ ~
  80. static int ccnt = 8;
    , P) D1 q! X- [* T
  81. - Y3 P. y* {2 N; H
  82. module_param(acnt, int, S_IRUGO);
    3 s0 r+ p3 e+ e
  83. module_param(bcnt, int, S_IRUGO);5 M2 {4 `6 }- d0 U7 o  O; w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: |4 ^' Z3 ?- W

$ @( z, ~/ Z0 w3 H5 s) [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& s, C# [2 l$ Z- P) S. D6 x" Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 u  ^4 n2 }8 I" N1 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; `5 b! Q. g5 E& c; ]- B% s
$ ^& X# h- g6 U$ y( E( j+ C/ e( p1 \+ a  n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 07:40 , Processed in 0.038525 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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