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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : J& F0 ^$ j' c
  1. [code]EDMA sample test application
    % x) y# m2 c$ x( B' J
  2. /*; E, l/ [& U; C% y
  3. * edma_test.c- d; A1 a9 d; R& N; {1 N2 C
  4. *, q/ X6 |/ @+ B
  5. * brief  EDMA3 Test Application
    ; A$ v, M7 v! v1 a9 {% r6 F
  6. *$ J+ R5 t; @4 ?2 B- Z* e& `
  7. *   This file contains EDMA3 Test code.4 j4 f, _2 w# `5 |1 \
  8. *
    - Z6 x6 ^; I2 e' J3 M8 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# W8 T% O( D- X. {/ W, J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # X  h. D2 x9 F% d. p) O
  11. *         TO CHANGE.
    5 Q; J. T8 D0 D3 y' `- x
  12. *
    : ]2 u  L# l. J4 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : J7 Z/ W" `6 m* u' U; V: L
  14. *4 x% A$ t9 @$ l- C) V) l8 J0 `0 M
  15. * This program is free software; you can redistribute it and/or
    - \, ?$ T4 D/ _% j( X+ V) s
  16. * modify it under the terms of the GNU General Public License as
    % m* s; ?/ s. Z9 ?
  17. * published by the Free Software Foundation version 2., s& v) ]: J$ w
  18. *
    ! a& e" R5 e8 t/ K8 S) o& o# H3 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " T; X: _* H! P4 _
  20. * kind, whether express or implied; without even the implied warranty, V# y# C* P! M  A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) [( I8 V9 G& k6 S3 \
  22. * GNU General Public License for more details.; r6 Y3 {# S# L0 n3 y( ^
  23. */
    ( Y9 `0 N0 L& T' i
  24. 0 q% ?8 C2 f- t6 C2 z7 I* X  U
  25. #include <linux/module.h>/ y/ H' M" \: c5 |  T
  26. #include <linux/init.h>  U. d/ {- G' A5 u  o; ]: J3 s( }
  27. #include <linux/errno.h>
    ; I% _( E- G  R+ g
  28. #include <linux/types.h>
    $ _( U, d: X4 d! ~' g6 j9 ]# @
  29. #include <linux/interrupt.h>
    $ a  Q( \6 C6 u9 I& O! I& @
  30. #include <asm/io.h>( q! D' F8 F  |- i
  31. #include <linux/moduleparam.h>
    7 B  z+ t" |5 B( W9 B+ ~3 N
  32. #include <linux/sysctl.h>3 h2 B- O6 Z( c& |3 p
  33. #include <linux/mm.h>
      u: o1 Z# V. L# G6 d
  34. #include <linux/dma-mapping.h>% O3 o. B3 |2 L. t4 ?
  35. - U: r9 _+ c" P/ B
  36. #include <mach/memory.h>
    8 Q4 j! A, v7 E; u
  37. #include <mach/hardware.h>
    6 A* g. q3 o. v  [0 N  Y$ Z+ b
  38. #include <mach/irqs.h>
    0 t4 [0 ^$ @' p" E2 H
  39. #include <asm/hardware/edma.h>
    / S, i6 X* m7 i. G( i

  40. # m; W& N# R) z& E9 V& e3 U( S: I
  41. #undef EDMA3_DEBUG
    9 @' u- L5 w* |& Z. K6 X) U
  42. /*#define EDMA3_DEBUG*/
    6 m& e  u- A. Z( |. [6 Q

  43. - a6 V& M& t% D/ `
  44. #ifdef EDMA3_DEBUG
    * O! p! j" a& i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' ~8 B# p, F% ~& x/ \0 V* u" T) _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 m0 W, z& U1 J2 @6 K7 ^! A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), r$ D; p% g4 K! t! _* g
  48. #else
    9 v/ |- L, \2 d* i4 k) {' q
  49. #define DMA_PRINTK( x... )
    % }; Z$ W8 V, T4 ?% i5 Q: \- O! C
  50. #define DMA_FN_IN
    - C2 h$ i/ J& t" i
  51. #define DMA_FN_OUT
    5 i% P' [9 |' W. i, V) q" E% G# Z
  52. #endif
    1 B3 W2 }7 }8 A/ B6 e6 C& W: D
  53. ) g$ `, c3 C2 o0 r# z- L, Y: w7 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 g/ k5 ~# O4 ?" Y" u& Y
  55. #define STATIC_SHIFT                3
    6 Q; A- H- g8 ~/ W1 N
  56. #define TCINTEN_SHIFT               20
    ' ~, E# ~1 s0 W0 x
  57. #define ITCINTEN_SHIFT              21
    / q: r% K; v7 ]# i* k$ [# M
  58. #define TCCHEN_SHIFT                22
    # t& L+ h# E2 `! ?9 [5 w& t
  59. #define ITCCHEN_SHIFT               23
    3 i' C' x. Q6 z1 c3 v- h( q
  60. + Z! o0 C& \8 J  a# I( M9 n
  61. static volatile int irqraised1 = 0;
      o8 S$ ?: ~% }
  62. static volatile int irqraised2 = 0;
    * u! a& z: v/ c$ o' J
  63. * @. ~, f: E& F0 y+ G) H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 V  i% s; D: V* [% M2 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  T& A  N. Y: l* @; _! v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G; v$ _$ t; Y3 T5 ?7 |

  67. : v% _2 N& n  X, y3 V2 ^
  68. dma_addr_t dmaphyssrc1 = 0;; ~- O1 X# y* a9 x5 e- p
  69. dma_addr_t dmaphyssrc2 = 0;- `! u) O8 ]0 e# A
  70. dma_addr_t dmaphysdest1 = 0;+ e  L6 ~0 X  S, J) x" F. v
  71. dma_addr_t dmaphysdest2 = 0;
    ' b; q! K, x% n  ?& z$ c3 f9 a5 K
  72. % M' g7 C- e1 }4 N: [
  73. char *dmabufsrc1 = NULL;
    : R7 L$ F) p; y/ @+ n. c' u
  74. char *dmabufsrc2 = NULL;
    1 C5 b4 w0 n$ r$ K4 E
  75. char *dmabufdest1 = NULL;% C& T3 w8 _" b8 M# p$ T! q, ~
  76. char *dmabufdest2 = NULL;; i* O: Q$ F5 y4 a* W- C  U
  77. ! h- V% ?" c' E) B; a& l0 B: Z% M
  78. static int acnt = 512;0 r6 g& f* R) ~2 z% D
  79. static int bcnt = 8;
    # [+ \$ q* T& m+ u
  80. static int ccnt = 8;9 ?" V* y9 ?, h8 @8 n" D
  81.   L* j& T* |  ]* y6 T+ @3 [
  82. module_param(acnt, int, S_IRUGO);4 I& K/ h& p2 v- \- u0 O9 D% d4 q
  83. module_param(bcnt, int, S_IRUGO);
    / R' L: M% @* _0 g* b3 q+ e  ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# Q$ r. l# c9 a! a9 w% L
% }! Z. A9 C" D/ D; U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: V) g5 t3 Y, G2 E  q: Sarm-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 g+ ^4 t8 ~- s( C: K5 a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- ~. f& D& Y' S+ A4 U) k% O6 [; }  [* O) ~1 p( _+ k

6 s) s, f2 e: i1 n6 N1 e1 V8 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-4 19:32 , Processed in 0.047166 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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