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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ `/ U0 }0 V8 m
  1. [code]EDMA sample test application
    ; b5 X) g; P9 L" A3 |* N
  2. /*$ L7 Z! |' @3 u* T, F3 V6 w
  3. * edma_test.c- p# x. p) _: v6 h
  4. *
    , i# b' W* [5 n) |$ i0 Z
  5. * brief  EDMA3 Test Application
    ! f. V: ]. Y# c0 s
  6. *7 f3 o% e  s6 o% M, v+ h
  7. *   This file contains EDMA3 Test code.* H; j! a0 J" l# Z8 o
  8. *
    $ O: l9 K1 G* d  b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * H* e* ~* u* c8 [  `4 p9 V# x( H1 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 C4 M4 x: A; ]# f
  11. *         TO CHANGE.' ^+ m: w; z0 I" ^9 d& B8 E
  12. */ ?5 \" Z4 B( B8 ?3 Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " d! I5 w5 H8 G- E; B  I4 o
  14. *' Y& R7 i% I9 a4 h1 j
  15. * This program is free software; you can redistribute it and/or
    6 R) y8 V% M1 f6 A7 H& G
  16. * modify it under the terms of the GNU General Public License as
    , A# |% ^4 V/ f, @
  17. * published by the Free Software Foundation version 2.
    ) o1 L& _' a% x' I9 i" E7 N7 j
  18. */ e& T# [, E" b8 z  V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % d0 {# a1 A: m" A, t) r
  20. * kind, whether express or implied; without even the implied warranty
    $ d) J4 b/ Q. @0 u1 \( q+ ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # t# B) p' N; X" ~; w. H
  22. * GNU General Public License for more details.: t5 i* ~! r0 d6 Q3 N* Z
  23. */+ N4 ~5 P( T% E, R) Q
  24. " W8 e" ]3 A: ~0 `+ g
  25. #include <linux/module.h>
      o# _/ y1 Q3 i& l2 M& J
  26. #include <linux/init.h>
    " j; f. H5 i, b3 ?- O1 i
  27. #include <linux/errno.h>
    , J  [# Q* x$ ?" f6 C
  28. #include <linux/types.h>" ~3 @8 a* s+ n) X* v% [! ]9 S
  29. #include <linux/interrupt.h># G+ Q6 N1 @0 g' m
  30. #include <asm/io.h>1 e  y  j/ n# b3 D
  31. #include <linux/moduleparam.h>" x/ c0 K7 C3 a5 C
  32. #include <linux/sysctl.h>, v3 A: I& M* d5 E
  33. #include <linux/mm.h>
    7 ~! |) l5 U; C. x& o% q+ v
  34. #include <linux/dma-mapping.h>4 ]9 |) W  I2 |. X% b

  35. # m/ \- J: }2 U9 E
  36. #include <mach/memory.h>( g& ?. Y; g2 J& L7 w# t
  37. #include <mach/hardware.h>
    8 M# E' m/ `2 f  r1 J: V
  38. #include <mach/irqs.h>1 L2 j6 s6 C3 h
  39. #include <asm/hardware/edma.h>% B) A' S5 L! D. u; K( s  q
  40. % N. D8 E  p( b- `- t' X/ K  W
  41. #undef EDMA3_DEBUG1 R1 {3 K; ?+ Z) q0 l1 \
  42. /*#define EDMA3_DEBUG*/
    " H2 Y9 X* C  m$ K
  43. 2 t' l6 w4 `+ ~4 J- C$ c: k
  44. #ifdef EDMA3_DEBUG
    * x+ o; i% W% s/ B+ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& o4 L8 o2 y# G# m1 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 y& G) [# ?9 Y, m4 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 F5 x3 U) g: n- h. v$ k8 V
  48. #else- i3 O7 p9 q: {3 D! b
  49. #define DMA_PRINTK( x... )
    ) \% n: \$ d9 |$ X1 Y0 H3 G" x( X1 T+ f
  50. #define DMA_FN_IN7 X, R9 h  d7 B. ~; i% H
  51. #define DMA_FN_OUT
    , G/ V; C& [. [
  52. #endif3 }" p# _8 _/ M0 g( T
  53. " ~  J9 \1 K$ ?0 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' H  H) D* @8 [! s$ e! z9 \
  55. #define STATIC_SHIFT                3
    ' r( J& C$ m* H- S, B7 R
  56. #define TCINTEN_SHIFT               20
    ' l+ S. a  |+ e; e* K4 b# w; z/ K. w
  57. #define ITCINTEN_SHIFT              21
    5 _. l7 t3 H3 C7 @% b
  58. #define TCCHEN_SHIFT                22
    - [9 K4 e: B, U- P, P1 O  \
  59. #define ITCCHEN_SHIFT               23
      @7 p! @4 X/ U' E
  60. ! p. b* R" o& g
  61. static volatile int irqraised1 = 0;3 ~4 r  ]) s  I3 O  W2 y
  62. static volatile int irqraised2 = 0;
    ' m! q2 q% v/ f% l1 _

  63. ) F; W1 X2 @7 c8 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 v& F# }7 ~: v, @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 w6 E* @7 ]- _' U' ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , b$ e0 A5 u& K6 r2 y# z3 y

  67. ) [% \3 U" _& ]) }0 A+ X
  68. dma_addr_t dmaphyssrc1 = 0;
    . i  N  g, W( N, G0 o
  69. dma_addr_t dmaphyssrc2 = 0;
    1 Y2 `  z( N; m) d" K, t0 Z
  70. dma_addr_t dmaphysdest1 = 0;
    7 B5 J, ?! ?4 E- F! I
  71. dma_addr_t dmaphysdest2 = 0;
    1 ?3 }6 K/ B& {. `" ~4 Q& x7 B& [
  72. ! ~# Q# Y0 E; B$ N0 N3 Z
  73. char *dmabufsrc1 = NULL;
    & i$ B6 Q, r  V/ O& g5 z
  74. char *dmabufsrc2 = NULL;9 w& v$ g5 S6 f# L" C5 U) G
  75. char *dmabufdest1 = NULL;9 O% Q! V  c+ p% d5 o  K
  76. char *dmabufdest2 = NULL;6 F7 I/ e! k; o3 u
  77. - s+ Z, v  v) e3 C7 e/ X# o
  78. static int acnt = 512;5 v& q/ X' G9 h! F( L& ?- \4 g* g- [
  79. static int bcnt = 8;
    ! g& H/ w1 Q& |
  80. static int ccnt = 8;
    9 g; ~- S7 y/ I* A# |

  81. + t: G' E* k' k) Z5 q' O
  82. module_param(acnt, int, S_IRUGO);6 Q$ n, G5 }" q6 U/ M* w1 c
  83. module_param(bcnt, int, S_IRUGO);
    - |/ Q/ ^* Z1 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 j, Y4 R0 \5 h6 {% p. e4 a* x
0 L. C$ n8 I, ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- u- e9 i9 G0 F  g( }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 e- H0 o, `; S3 k/ Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 b; u7 ~9 a+ a1 i. n* J0 G
9 C$ e% M! O6 z+ d5 `3 u6 e& R, z% R) L9 Q. e# I* b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 08:54 , Processed in 0.040043 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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