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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# S; t7 z1 D0 H! D, k. a+ c
  1. [code]EDMA sample test application
    ! A+ F2 C5 a2 G9 [+ l
  2. /*+ v+ J0 W* s# x* ~" Q
  3. * edma_test.c* B% z3 k$ [4 _  ], e* W# _" G
  4. *
    ) m) o: A# l" ^6 i  |3 i( ?* z, t
  5. * brief  EDMA3 Test Application
    4 i5 h* K8 B3 E! m
  6. *" B- j" k1 ], J( v
  7. *   This file contains EDMA3 Test code.8 y; \3 n! i2 ~& R& q3 Z; E9 A
  8. *" M' |! B$ z/ T+ m: F- O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 U# o5 q+ k+ c8 h% Z! S; h6 e* G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) W. N9 z. d* s# F
  11. *         TO CHANGE.. ?( i9 A; y' ]% d8 _* W. ^  U
  12. *
    8 Q1 b; N& |6 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 m3 Q6 ]8 D! h  z; a, k9 X1 P
  14. *9 @* c3 d- Z. }3 t& b! J; `. p
  15. * This program is free software; you can redistribute it and/or
    & s+ s* r) D  e- _
  16. * modify it under the terms of the GNU General Public License as% p8 |& n# L) l2 F% {
  17. * published by the Free Software Foundation version 2.
    9 z/ J; e" u* O( Q/ J# H
  18. *; {! {) c& k4 l, {6 A8 ?/ p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 W, E2 J% {9 T" k
  20. * kind, whether express or implied; without even the implied warranty% V. B4 j, T) [- g: q( R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 l( |, H6 N* [0 u+ e7 f
  22. * GNU General Public License for more details.
    6 t( G$ a# ~; n5 f( u% {
  23. */1 p: s3 E/ \: D5 x* i! ]. z! z
  24. : P3 q/ n% |6 e) t. O$ \4 q
  25. #include <linux/module.h>4 D& K! Y9 L/ }; u/ _
  26. #include <linux/init.h>
    4 _# _( Z( ]% u+ K3 q" f6 _
  27. #include <linux/errno.h>
    0 m2 K. I* f) p/ W8 u
  28. #include <linux/types.h>
    4 E; G# m* t9 u
  29. #include <linux/interrupt.h>
    ( Q1 t# Z1 X) K( J' _9 J, w( H- i
  30. #include <asm/io.h>9 C. V3 R0 `" M) G, A
  31. #include <linux/moduleparam.h>
    8 o$ K1 A1 t+ L3 g% r2 }# g
  32. #include <linux/sysctl.h>
    $ ]( N. A4 ]5 |' t, ?( ~/ B
  33. #include <linux/mm.h>" o5 _( n  R0 v8 q6 O2 A
  34. #include <linux/dma-mapping.h>
    7 v6 X* M5 j/ o. r

  35. - ^4 z! B- p/ a; _, k
  36. #include <mach/memory.h>) G! j9 Q) s+ S  _
  37. #include <mach/hardware.h>6 L- H$ q: T+ W( T& O# o- a% F
  38. #include <mach/irqs.h>4 J& @' |9 F; Q+ _% O7 |
  39. #include <asm/hardware/edma.h>
    ) c* H6 S3 B& t5 L

  40. ! n" j* o2 g3 D5 R7 F7 Y5 |" O
  41. #undef EDMA3_DEBUG
    % C" f0 s" _0 E, j2 o
  42. /*#define EDMA3_DEBUG*/( F: j- |% y# E4 C: V

  43. 5 P. n* I3 H" Q8 K7 u
  44. #ifdef EDMA3_DEBUG
    % ~- S' b/ g2 `: |* G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! _2 g' M7 _" H8 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 A/ b0 q" j3 f$ N) C9 g4 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + u6 T' c$ a, z- l# a6 |
  48. #else
    8 l; _" \; d7 v5 o
  49. #define DMA_PRINTK( x... )5 `( U7 G2 V; k: A$ |# X( y
  50. #define DMA_FN_IN
    ( e2 h( G, S* A  S* Z- w# G) S) A
  51. #define DMA_FN_OUT
    " x- n4 k8 k5 u% s& R& k
  52. #endif
    # o+ O" W% Z: p. ?" {
  53. " w6 y# W/ G) b9 d7 W1 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- y3 V8 v7 v" H/ I2 S6 k4 O4 C2 T
  55. #define STATIC_SHIFT                36 m  A& N- m6 a7 v6 J- k
  56. #define TCINTEN_SHIFT               20$ d5 r0 l5 {8 E: F6 ~4 C5 t* |- P9 M
  57. #define ITCINTEN_SHIFT              21' W5 q: E" U/ A
  58. #define TCCHEN_SHIFT                22$ U; d$ ^" P( g. u7 P; j3 `
  59. #define ITCCHEN_SHIFT               231 m$ j- o) B7 g% u6 o; E

  60. / _8 ^" K" t7 Y) M6 T0 h5 J) \% X
  61. static volatile int irqraised1 = 0;: W! y; n4 y' H( J9 O( z
  62. static volatile int irqraised2 = 0;
    ' N% x/ G4 K' e- E; E, e

  63. ) d9 |0 \, S7 _# X8 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ^0 _! _1 @! f+ a2 n. d. y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 x9 W! A4 f+ g% D7 Q8 Z: E1 Y2 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- e, A! k" V5 m: d) Y
  67. * v* J* W+ H4 r! M. I4 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    3 `9 S: S# @& J
  69. dma_addr_t dmaphyssrc2 = 0;
    # \# e3 _+ m$ i& G+ ^+ g
  70. dma_addr_t dmaphysdest1 = 0;$ S0 ^4 B( s: R, g
  71. dma_addr_t dmaphysdest2 = 0;% _; h* p+ \0 O  {$ ^$ ^, V
  72. 2 g7 n- N* u( C8 j* V3 _0 u
  73. char *dmabufsrc1 = NULL;
    2 x* O8 j! T# s( e9 {, K
  74. char *dmabufsrc2 = NULL;- |- z  P9 d3 \1 T
  75. char *dmabufdest1 = NULL;
    / x3 K$ D8 C; i  P0 F( g+ t7 J
  76. char *dmabufdest2 = NULL;$ ?  Q* y0 f2 ^3 D
  77. 3 I6 l- W) J  @
  78. static int acnt = 512;
    , q1 ?" h- U9 P, g  i
  79. static int bcnt = 8;
    ) W6 V0 |8 z9 s. x
  80. static int ccnt = 8;' E+ y% [+ o9 F3 b) R( {

  81. # `: Q5 K6 `# t3 Q( o: W7 u' u
  82. module_param(acnt, int, S_IRUGO);
    1 N6 A/ ~. m& e* S
  83. module_param(bcnt, int, S_IRUGO);
    - I; ~# A- C2 `( s9 F$ B% v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" }. Z% @: [6 A; B: C2 g* a! h
1 O7 |7 I) i& S7 a4 K6 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- Q: s0 ~. s6 i2 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% d' r6 {0 L9 k+ P$ ^1 P# Q+ m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 N6 b# u0 a4 v8 j/ ~4 ]. ]: j6 F: x
9 b  t- Y( G, K; A
1 t8 U* e4 y7 N' {# y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 00:12 , Processed in 0.041753 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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