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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 `3 o7 Q# ^/ i- g, |
  1. [code]EDMA sample test application+ ?/ y3 s3 k3 |, v" J" _* R
  2. /*; _. d. M4 k3 d$ n0 n" _) y
  3. * edma_test.c
    # m! y4 @) l2 D- s) H0 f) A. k
  4. *
    - Z) \3 ]8 x2 V2 Y% J7 x  v
  5. * brief  EDMA3 Test Application
    ; n6 q4 Y0 i9 L6 D, t5 q
  6. *
    + V9 s) ]5 U  n# y* k, y8 M; R
  7. *   This file contains EDMA3 Test code.4 }7 n( _* J/ q& h5 f9 H
  8. *
    ! U# I$ C$ J' d0 a5 r) ^" ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 }. f$ B% }$ s6 t) _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 p* g1 l3 l% X- |0 l
  11. *         TO CHANGE.& E0 @. x3 S; }
  12. *7 Z' _, v$ j  P- R3 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" U5 l6 d1 f/ g, L8 A  t1 _
  14. *
    2 }7 f, u' n  l2 ?+ f6 J
  15. * This program is free software; you can redistribute it and/or% u4 w) u& @1 L3 m
  16. * modify it under the terms of the GNU General Public License as8 F4 r3 h: Z* s
  17. * published by the Free Software Foundation version 2.
    1 t* n3 Y. |9 h9 M
  18. *# O$ F! Z( j/ U# E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ ]6 Y# b3 E) V( P* M. b* L
  20. * kind, whether express or implied; without even the implied warranty
    - C& i) `, g) C4 M7 W9 n) {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 J" K) s3 g5 p; n$ L3 \
  22. * GNU General Public License for more details.
    % h+ g, `6 K. ~9 d5 l; |
  23. */
    4 `3 S+ \7 F5 z" N

  24. 4 h: K1 {# S! @$ q: ~6 C
  25. #include <linux/module.h>
    0 X8 }% C* M. p# n
  26. #include <linux/init.h>
    2 o- a* J& G/ ]2 n! R; W- h
  27. #include <linux/errno.h>
    * V/ b. y% Y5 A, N- F3 i
  28. #include <linux/types.h>6 \4 w( m( Z  _
  29. #include <linux/interrupt.h>) b  m2 D* \. ^/ u/ E$ |
  30. #include <asm/io.h>( n. q4 D) g- g6 d% r! J
  31. #include <linux/moduleparam.h>: Q  s$ l& |% B2 X0 D, h/ b
  32. #include <linux/sysctl.h>
    : b- D& M/ O+ S" ?# P/ L; A. K: A. I; V
  33. #include <linux/mm.h>9 v8 b+ N- _' n- O0 r0 C
  34. #include <linux/dma-mapping.h>9 U" b1 a2 P* \/ _. K, F' p- J' y

  35. 3 [- n' _8 F5 {& Q  Q% a
  36. #include <mach/memory.h>5 M6 d0 a2 p& u' ~' [' s1 n" V
  37. #include <mach/hardware.h>
    + X7 P0 a% `, \. W" S8 ?9 U
  38. #include <mach/irqs.h>
    9 q7 U! d5 Q7 r
  39. #include <asm/hardware/edma.h>
    . r/ T6 p  W6 w8 q5 u

  40. + ~. Q8 z  ?  Q/ H' G
  41. #undef EDMA3_DEBUG7 z" O. O8 K7 O+ U' h% R
  42. /*#define EDMA3_DEBUG*/
    0 l  [  x8 U3 q. p6 L9 j4 g4 Z9 z& f
  43. 7 Q: H3 }+ s. h
  44. #ifdef EDMA3_DEBUG
    ( ?: E' _3 W- q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 S) J( D# {# V& d4 X: Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 j7 V) Q. V2 A8 a/ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). _( p! _# B! w- N7 y2 U
  48. #else2 F$ U. |# G" m- X& \6 K
  49. #define DMA_PRINTK( x... )3 ~. Z4 |, g* e2 a) V  {" G- \  n3 p( E
  50. #define DMA_FN_IN+ Q8 v; H' Y7 X# l# y+ x- c
  51. #define DMA_FN_OUT2 Y( I+ W+ |: ~. z5 g; ?6 n
  52. #endif8 v/ g+ T3 ~' e. \3 H  @% m( b

  53. $ O" U+ ~# _* `+ z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); I6 |" k8 [8 b0 n; h  j3 q& Q
  55. #define STATIC_SHIFT                3
    3 \& t) H8 g; o3 }
  56. #define TCINTEN_SHIFT               20# a: h  S5 L3 g  Y3 o6 F) i
  57. #define ITCINTEN_SHIFT              219 z& _$ k$ m, g7 `& S9 y
  58. #define TCCHEN_SHIFT                22
    0 o- i) r5 y; Y6 u) ?
  59. #define ITCCHEN_SHIFT               23
    ( V  K" b! X% i% g
  60. - r' J: K) \+ U7 i8 w
  61. static volatile int irqraised1 = 0;$ O) q. d; `: D( U) y1 }4 R
  62. static volatile int irqraised2 = 0;& K. \& v! H* w/ W' L2 U6 z
  63. 2 g- {9 c: ~) h6 Q2 z7 n; l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 n) V& n. I0 K- o0 Y$ A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  V4 H( |  n% d) M/ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 F+ B5 d0 o5 ?/ n# a$ V

  67. . [/ Z$ b1 k/ I9 J
  68. dma_addr_t dmaphyssrc1 = 0;
    7 C; o* g0 X0 [7 K" D
  69. dma_addr_t dmaphyssrc2 = 0;& l7 t3 W* H6 O/ E3 a% A
  70. dma_addr_t dmaphysdest1 = 0;
    $ D3 }) i2 ~0 i. F+ c
  71. dma_addr_t dmaphysdest2 = 0;2 S# K  f2 K* h
  72. / f- s- ^8 ~: p  E
  73. char *dmabufsrc1 = NULL;2 _1 t7 N4 H5 r# O& k* L
  74. char *dmabufsrc2 = NULL;
    3 B9 h! C) z$ q8 }5 [
  75. char *dmabufdest1 = NULL;$ C3 X0 Q1 ?$ ~
  76. char *dmabufdest2 = NULL;' i$ Y% A9 R3 d# T2 ?( g5 y
  77. 4 b$ S& q7 s- M: ^4 A- d
  78. static int acnt = 512;5 b: D' m3 t# f7 u3 |
  79. static int bcnt = 8;: H4 I5 d- c. I" I: }/ T+ K8 z
  80. static int ccnt = 8;$ A* w; O$ Z, D6 N% c2 w! X5 W

  81. % i, F( {1 R2 h
  82. module_param(acnt, int, S_IRUGO);; {% Z6 ~. M2 _0 v9 `
  83. module_param(bcnt, int, S_IRUGO);
    8 `/ y; |" H# l9 R; B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' _' `. B! N' k8 e3 ^. v, R& i, g2 G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* j3 S. B: s# [4 ~2 c3 d3 e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) U( I+ B( A7 @, }" P% V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# R3 D' E3 v6 \* x( F, N
5 T+ E* V) T$ s" N  l+ `  H1 z
/ f) `. f" S2 A* {* M, Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 13:51 , Processed in 0.040222 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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