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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 O. c% N: s, b  C5 j8 @1 ]7 H7 G, b
  1. [code]EDMA sample test application8 O3 L/ R2 u- o' p4 J" i* k
  2. /*
    6 q0 i7 g* @% }
  3. * edma_test.c7 A9 w, C' ?; ^7 {% G, g
  4. *1 X: m3 B% m+ d/ Y; P1 b* B8 W/ v
  5. * brief  EDMA3 Test Application  w) u* J6 L( R
  6. *
    % f: a5 n1 ~$ n! x: ^7 b4 ?. M
  7. *   This file contains EDMA3 Test code.
    - M/ k! `* }. |0 `
  8. *2 u% F4 a) o6 v8 X. A" m/ g: L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , i# d- m" \5 w3 h0 |9 u' L- @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. S0 x" N: I$ F% M% P
  11. *         TO CHANGE.
    / R6 U* c5 ^5 `) G$ }2 o+ W
  12. *8 q  u9 M  y4 V; ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! ~( q) y& f9 \- Q
  14. *0 M# F* S' C6 X( l) x8 z
  15. * This program is free software; you can redistribute it and/or* Z- B9 o- R/ F2 m0 h, f! t
  16. * modify it under the terms of the GNU General Public License as
    ; N4 O% l5 |! l7 P) }
  17. * published by the Free Software Foundation version 2.
    / _/ C! X, D0 F- Y4 I
  18. *
    # _( V% W3 R. b7 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 I- k/ ?) {2 k, b" B
  20. * kind, whether express or implied; without even the implied warranty
    5 g% A& _+ a9 l" t, {2 p7 }& y8 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ s3 B. c" Q. f/ I# d3 Q0 }
  22. * GNU General Public License for more details., ]+ o2 z0 L& H
  23. */
    : l) n+ h( e8 R+ C8 u" s

  24. . v5 ?8 u2 G, B6 g0 e% `
  25. #include <linux/module.h>
    9 r# l+ ~4 i' q2 e# x
  26. #include <linux/init.h>
    ) U' ?7 F2 i8 z2 R3 j2 j
  27. #include <linux/errno.h>1 \$ \4 P% d$ M* g/ i& n
  28. #include <linux/types.h>1 \" x" G8 M. f) z! w( N, i0 |8 C
  29. #include <linux/interrupt.h>
    5 ^/ z0 J( P" V
  30. #include <asm/io.h># }5 ]0 S- j; t* m
  31. #include <linux/moduleparam.h>6 }0 {* M  W  }7 |2 z$ k* ~
  32. #include <linux/sysctl.h>
    $ J" ~, Y* d% }! M1 [
  33. #include <linux/mm.h>9 N8 H. R# }" @
  34. #include <linux/dma-mapping.h>
    ( a5 u5 u3 V" p6 a2 t
  35. ( {+ L3 X1 D+ y% ?
  36. #include <mach/memory.h>* \% c! a" Z; J- S5 F" \
  37. #include <mach/hardware.h>
    ! V# g1 }/ ^/ I8 U
  38. #include <mach/irqs.h>2 F. L* l( P, ?4 o
  39. #include <asm/hardware/edma.h>
    5 T& ?/ l" h( ?' ?

  40. 7 }8 z( y) q* w3 |& [# H
  41. #undef EDMA3_DEBUG# e2 b' ]3 @6 B. Z. P; \
  42. /*#define EDMA3_DEBUG*/6 Y' H' e, p- O! S2 T

  43. / A9 a6 U1 R0 o$ t9 f
  44. #ifdef EDMA3_DEBUG! _) n1 n4 j, r# K9 c. l& I3 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 h4 r( N+ u1 \. C( \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( X* r; ?8 x3 B9 Z5 |3 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; s0 e+ j# }$ s8 J$ O3 p3 s
  48. #else- a+ N" V) e' E! d  h1 e
  49. #define DMA_PRINTK( x... )) ?8 M" T/ g& X! P- s9 z9 {! n
  50. #define DMA_FN_IN
    : c1 c; V/ L0 i% h
  51. #define DMA_FN_OUT, v' N9 }- v$ `, g# m& c
  52. #endif
    6 x) c1 D, ~+ y
  53. / V; L: _' a! M" p' i: R8 c4 j# x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - C  N0 A# X4 H/ e  ^8 L. ~
  55. #define STATIC_SHIFT                3
    2 j" ]3 x, ^- ?# E* d! [  p2 [
  56. #define TCINTEN_SHIFT               20/ B: a3 w+ B$ V. t$ P' B
  57. #define ITCINTEN_SHIFT              21
    0 P4 X; E) C% ^" u
  58. #define TCCHEN_SHIFT                22
    ( Q% m! n; X' Z
  59. #define ITCCHEN_SHIFT               23) f' k  d4 j) e3 B7 t
  60. 3 U- a) t, Y" y+ _3 |* h1 Q
  61. static volatile int irqraised1 = 0;) n6 ~8 l; F* P* _- ~% h
  62. static volatile int irqraised2 = 0;
    6 d3 `. S2 K+ h4 n3 w6 D
  63. ( O- |; O$ l5 G9 e  b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 I3 O& y5 z$ Z" |& P- t; @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ]& J1 k1 `$ ?3 e. x0 ], {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 X9 c# x1 V- o2 F! U

  67. # \2 K) W5 W! W& k. |9 H( e
  68. dma_addr_t dmaphyssrc1 = 0;/ A# f9 D# g, ]  ~" R# R; H
  69. dma_addr_t dmaphyssrc2 = 0;1 P" r  B9 A6 ^- e
  70. dma_addr_t dmaphysdest1 = 0;
    " ^2 \0 D0 Y2 u( S4 m% }
  71. dma_addr_t dmaphysdest2 = 0;; ^/ Y. g' w+ r$ |$ {& u" [; {( h
  72. - ?/ N# p  q9 h& ~8 T9 V
  73. char *dmabufsrc1 = NULL;
    9 l5 ^# k# d! ~  {
  74. char *dmabufsrc2 = NULL;
    . O; C. i' h; \" D/ b, b
  75. char *dmabufdest1 = NULL;
    ; D! ^: P7 g  N4 c" A. X7 P
  76. char *dmabufdest2 = NULL;. z, n; u( ~1 C- t' i
  77. / W! A( C' _6 q/ j
  78. static int acnt = 512;5 _* v/ e8 n, W
  79. static int bcnt = 8;
    : e9 l# e# \& C/ ]8 g
  80. static int ccnt = 8;  I  ~# _. N1 z2 L& H* h3 s9 l
  81. 2 [$ B& R2 E/ U6 O0 f% j* m
  82. module_param(acnt, int, S_IRUGO);
    ; K+ k7 ~8 z2 i) E1 m2 n0 \
  83. module_param(bcnt, int, S_IRUGO);
    2 w4 k8 @4 |  X! d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. t2 {4 ]: k6 @) ~
' W; ?* p1 ?: N2 S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  C# c! y9 s* uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 o4 }9 i9 Q1 d1 G/ o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 d7 t# d& ]8 j3 W- S3 j3 _, k
4 e1 }* Y' L3 ~$ T+ C6 V
' ^/ J, A5 r6 T8 A6 J5 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-9 12:15 , Processed in 0.038947 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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