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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , H6 K) P7 l0 l+ z, Z
  1. [code]EDMA sample test application
    6 g* A' w2 _! s0 u) u
  2. /*6 @% q1 ?5 Q$ ]7 l5 I7 s
  3. * edma_test.c
    , i, u" T/ p8 G# ]6 Z5 }
  4. *
    9 e/ ?5 M3 p; H
  5. * brief  EDMA3 Test Application  S$ v( h2 Z! p8 k
  6. *
    & s+ Q9 D, ^1 j9 E" ~
  7. *   This file contains EDMA3 Test code.
    % c" C# z  g& I7 j+ W, O  K" b0 \
  8. *
    - o- t6 D, m8 E' F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - ^$ Y& m7 C9 s2 x% ]0 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* j( f- p  ^: O$ o% j6 \. R0 f& C
  11. *         TO CHANGE.
    5 t& C$ S' y* K& ~1 _/ g, h7 o
  12. *
    ! U. }% S2 U+ @/ E- b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 t0 e, ]( }& G9 D
  14. *# t7 D/ ?7 K) A: e
  15. * This program is free software; you can redistribute it and/or
    # j# J& a- Y5 H2 ?4 t2 B0 _* f0 ?
  16. * modify it under the terms of the GNU General Public License as
    : n. a. Y, T# U9 H1 u# h  q9 ?
  17. * published by the Free Software Foundation version 2.7 J- K( g0 ]4 m  j7 J/ C) {6 y
  18. *, |! ^( }8 x/ e/ [8 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + h# n% m: G0 p9 {
  20. * kind, whether express or implied; without even the implied warranty
    % [! R1 M( c$ F- |' O, L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 X  I( r% P" G4 {' f
  22. * GNU General Public License for more details.) j' G5 n/ X3 |
  23. */) G% F: O0 l( ^0 V  ?: L
  24. # z3 ?$ o$ ?9 |7 R" ?  a( e( A
  25. #include <linux/module.h>
    9 ^4 A1 n3 M8 b4 G1 |# L
  26. #include <linux/init.h>. e! k) B) ^5 }" D6 B2 J% K
  27. #include <linux/errno.h>
    - Z; y, S. T# z5 i* ~: [
  28. #include <linux/types.h>
    # }1 J0 f% @' d& `, n% U
  29. #include <linux/interrupt.h>
    : e5 p" x2 O1 N8 {' a9 f( k
  30. #include <asm/io.h>& A% ]. m; g; D. |7 v3 X
  31. #include <linux/moduleparam.h>! v1 V: B6 w# [, U8 W
  32. #include <linux/sysctl.h>
    3 s' A" }0 [7 [+ W( p- q
  33. #include <linux/mm.h>; h7 R/ |8 M: e6 t& H
  34. #include <linux/dma-mapping.h>" [* K7 U8 ~; Y! j
  35. , R: c  A6 |5 P7 I6 `6 }: n
  36. #include <mach/memory.h>
    . x' A: f. t5 Z+ L
  37. #include <mach/hardware.h>, d' O. Z9 G. {; r; {- y
  38. #include <mach/irqs.h>
    . k! b. P6 N; ]6 n8 H: O# r; {
  39. #include <asm/hardware/edma.h>
    5 h. }4 {- J- `, P8 c% y

  40. 4 T  |* b3 H% j6 F) v4 R
  41. #undef EDMA3_DEBUG4 C9 w5 Y1 ^  u' {+ j
  42. /*#define EDMA3_DEBUG*/. N$ C9 P$ M9 Y6 t" y6 u- D  a
  43.   b# @% S  l; V+ a9 _4 [
  44. #ifdef EDMA3_DEBUG4 }; ], c9 K/ h$ p) I; L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' a1 G/ a& ?; [, C- ^- ^4 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " f4 i) z+ ?0 w; n1 B& @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" g8 u& x) j, [% j4 \2 ]: ~: ~
  48. #else
    4 f1 h# Q( Z, v+ `0 p/ [
  49. #define DMA_PRINTK( x... )
    1 Q3 @$ [) Q( U& U
  50. #define DMA_FN_IN2 ?% L- Q# m2 j5 N% ]
  51. #define DMA_FN_OUT
    8 s& J4 E+ r* j5 p7 ?3 G3 @  |& \
  52. #endif1 V& J$ {  E" k. _; S

  53.   c# O3 }; a3 D+ \* r+ R. d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 E& P/ w- m5 n/ b% K& w
  55. #define STATIC_SHIFT                36 {, T# s8 B8 |) |: n6 O, s
  56. #define TCINTEN_SHIFT               20
    / {8 @; W# O  N
  57. #define ITCINTEN_SHIFT              21
    - J# g- t! _: `3 v4 H
  58. #define TCCHEN_SHIFT                22
    + B* C8 ]/ Y! U- p# Z) G
  59. #define ITCCHEN_SHIFT               23
    9 q2 G& u9 R6 U- m; L
  60. - m" C! }& c/ t! T7 t' @
  61. static volatile int irqraised1 = 0;
    1 [+ j3 h  Z: [; X" I: P# X4 m
  62. static volatile int irqraised2 = 0;
    % }2 i* w; w1 I% \+ X* {- t
  63. + {% v' Y' h" Q  W. M6 ~( u! w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C0 r' n& z5 _  q7 X1 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( S! r) u* u6 k: B, M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( p4 O. @7 o! h' r
  67. , f. O# E; }0 O/ r5 W
  68. dma_addr_t dmaphyssrc1 = 0;
    2 N! l5 n! ]8 x" h
  69. dma_addr_t dmaphyssrc2 = 0;
    " E) Q! l. K: q* O! Q/ M3 Y
  70. dma_addr_t dmaphysdest1 = 0;
    " ?6 K5 H# q" t" s6 h4 ?
  71. dma_addr_t dmaphysdest2 = 0;
    , S& S& F, Z. ], P- T  ]; ~
  72. 0 V" |3 E/ ^& _  F6 U* S0 W# w
  73. char *dmabufsrc1 = NULL;6 o" K6 P. N" X
  74. char *dmabufsrc2 = NULL;
    * i  {( ~( N# ~. u
  75. char *dmabufdest1 = NULL;
    9 Y0 _/ {4 N! k* ?0 _2 [
  76. char *dmabufdest2 = NULL;# e$ a  O- ?+ J

  77. $ z3 k. S" H# m/ C1 e& u
  78. static int acnt = 512;
    : K2 \! j- p7 d& p, n% _
  79. static int bcnt = 8;
    4 t) X( K( T7 ~/ b9 n
  80. static int ccnt = 8;6 m3 H# f$ F% M. t, j
  81. 7 Q9 o. i! e( {. A
  82. module_param(acnt, int, S_IRUGO);
    & l$ c. q$ j; w# a. n5 m
  83. module_param(bcnt, int, S_IRUGO);
    ) |5 m0 X1 R  `( H( n7 ]9 F7 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ Y' `; F/ s* H, ~: Z( V$ ?: U6 {
- E  J* _- |* `& y4 c+ e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ O, X0 C3 o" N* Z! j* K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& g, l2 f4 g8 c# _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; B6 a* G' H0 _: \3 g% n$ r: d9 M
) N6 }7 g/ k* ~, @' O: _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 11:19 , Processed in 0.042924 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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