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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 s' G' v7 k# |9 I
  1. [code]EDMA sample test application# K$ V4 \# _6 p% o
  2. /*( ~! H" z# G8 [, S2 S4 L
  3. * edma_test.c
    4 r; r% f# e0 d! P8 b; A, a0 a5 |5 c
  4. *7 {0 S$ v4 @( d* }( r  z7 m' D9 [" j
  5. * brief  EDMA3 Test Application
    4 Q6 z: T6 D  g9 b9 ]5 i+ I$ l2 K
  6. *7 h6 k0 m3 W7 ~/ S- |
  7. *   This file contains EDMA3 Test code.
    3 @  V; ~) B# }! }* a
  8. *4 ]) `! }* J# J0 K5 U" x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' f2 G# H% i$ W6 `  ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, H$ H1 D4 c' U$ r; e2 Q
  11. *         TO CHANGE.( Z' v8 @/ U) z, G! B- h8 C
  12. *; R; [% S% x" I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 E" L9 n# W. k( Z) R3 j9 w
  14. *
    - e% U/ a) S- U# q/ |
  15. * This program is free software; you can redistribute it and/or& p* y) S7 F% O5 Y
  16. * modify it under the terms of the GNU General Public License as5 b8 i. o* S$ Y" \# G
  17. * published by the Free Software Foundation version 2.
    * J9 `" U$ S( M/ y( w
  18. *5 l% |8 n( N4 W( O- ^* a( f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ v' b* U9 L& X4 `
  20. * kind, whether express or implied; without even the implied warranty
    ' H; v% A; w8 Y+ _' P. M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ O, X. k5 \& v  q( I" h
  22. * GNU General Public License for more details.  S, n. T& h5 W$ T
  23. */
    & b2 g% c; i, J+ ^
  24. 0 S6 ^9 U4 i+ N  Y0 H2 X
  25. #include <linux/module.h>
    3 r, a0 C% O  R9 n* l- T& o( N# R
  26. #include <linux/init.h>
    ; i4 s3 g8 L, w) T$ P* q9 L7 H
  27. #include <linux/errno.h>
    - Q/ r) G% F* @8 `, W4 p, w- g
  28. #include <linux/types.h>
    ' S% G# t$ [$ s# B( F; b
  29. #include <linux/interrupt.h>
    % V. i) P$ ]. G7 x4 c8 O. z& `9 i
  30. #include <asm/io.h>' W' p0 ]  f* N0 d, ^  {# [
  31. #include <linux/moduleparam.h>
    & h2 N' B/ `1 T$ |2 `6 ?0 G
  32. #include <linux/sysctl.h>. z2 J1 k  C- U4 n- L4 W4 n5 @
  33. #include <linux/mm.h>( J+ Y4 P# _7 K, W: Z4 _
  34. #include <linux/dma-mapping.h>" d: M. f+ v4 X( m5 K

  35. " B) d; U- ^- B
  36. #include <mach/memory.h>
    / w$ h2 A; Y% l+ O
  37. #include <mach/hardware.h>
    ! D& c( g- C2 v  D2 _7 ~- H
  38. #include <mach/irqs.h>
    ! L# _- ~0 _; f0 o, A
  39. #include <asm/hardware/edma.h>* q# P9 E6 z* }1 N; @4 }, h( L

  40. " d! k/ b  ^6 K* M% q  L
  41. #undef EDMA3_DEBUG5 F* g  ?7 ~2 ?8 u) I0 m' I8 ?
  42. /*#define EDMA3_DEBUG*/
    - l) ~8 y* g5 N4 o, x& K# Z/ y

  43. 5 ~9 n. a6 Q. j- P5 u2 I" q
  44. #ifdef EDMA3_DEBUG
    " b8 i; [" l9 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 G. x7 l3 C7 T3 d) X* P' k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  y8 H- ?- Y$ v1 f% |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" \* g4 ]0 N1 Q& h( B% a" t/ w2 K
  48. #else. [- Q  e$ p$ Q
  49. #define DMA_PRINTK( x... )
    3 I, q0 Y/ k4 J! b4 S; u
  50. #define DMA_FN_IN
    - z2 g' I6 ?5 x' {. F: X, f
  51. #define DMA_FN_OUT* j" H; h7 _6 B: @) h
  52. #endif+ B9 R; r- U% d. t  V8 U
  53. - B3 ~6 Z) N% X" f2 T5 Z% v, K. L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' B2 d7 I. e1 n- N. _" m
  55. #define STATIC_SHIFT                3/ ]5 `; S4 B( Q. r* g
  56. #define TCINTEN_SHIFT               20
    * z+ j1 e: y) D9 i+ g* f% n
  57. #define ITCINTEN_SHIFT              21
    7 x! |3 l6 ]% }6 Q* ^
  58. #define TCCHEN_SHIFT                22
      f2 g4 p$ R8 [3 u- G5 S. h/ @
  59. #define ITCCHEN_SHIFT               23
    ; y7 i. O# [, a3 P
  60.   G5 q- K; O5 W% i& z/ _
  61. static volatile int irqraised1 = 0;) i! A7 _$ e1 `5 A3 K! w
  62. static volatile int irqraised2 = 0;
    / x" A( |  V: n$ G
  63. 3 e; @4 f: e8 |' ~2 ?% u7 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: |4 z& Y3 K! \- A- x  N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F! j' F- h. A% Z0 g; i" D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ P! p3 A! ?- h6 v6 q) {; N

  67. & K' B* m# [1 a( _+ Q9 V
  68. dma_addr_t dmaphyssrc1 = 0;! V$ s% I6 t  y! D5 X& |# Z4 @5 p
  69. dma_addr_t dmaphyssrc2 = 0;
    % k  w" R7 F  R! p, ?* U
  70. dma_addr_t dmaphysdest1 = 0;4 R  M/ R; p6 o
  71. dma_addr_t dmaphysdest2 = 0;" a# v! @* f  K( M/ e

  72. ( h. i2 D# \) B2 L! _
  73. char *dmabufsrc1 = NULL;
    1 i9 Q0 `: @* h4 ~/ y9 s
  74. char *dmabufsrc2 = NULL;
    - C: M$ R/ |" `) F
  75. char *dmabufdest1 = NULL;
    " |- e. I4 V! y9 w6 r- D
  76. char *dmabufdest2 = NULL;
    ' n" E+ I' g, \) @+ `# G- u

  77. 8 U- d% U  }" B. {
  78. static int acnt = 512;+ _' J' b  c; |$ r. T6 ?4 l
  79. static int bcnt = 8;7 W+ |5 u, T3 ~" O7 R0 J
  80. static int ccnt = 8;7 {7 v# }  }* o* V: _; ]4 V7 T

  81. & t) K* h) v7 o$ v7 @
  82. module_param(acnt, int, S_IRUGO);5 @) Y1 _- Q/ k0 s( J' H
  83. module_param(bcnt, int, S_IRUGO);" Y% m4 c, k: T) q3 ]' |' N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) x5 l0 Y; m: M
, u" T, Q" i; l6 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) L1 }; |4 }" f! _9 larm-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 Q# Z9 ]* H0 R& B  O( O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ~9 V3 l6 ^# \9 m4 F/ v! S/ K$ K# w8 ^4 y
% {$ u5 p+ R0 i) h% C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 17:14 , Processed in 0.037048 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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