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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ^& x! G6 n' q6 D  L
  1. [code]EDMA sample test application
    8 \( e) p1 z+ O# i3 N3 n
  2. /*  I* t4 V% T9 o; f0 C6 V
  3. * edma_test.c. e; ^: u6 @0 E" d8 _' I
  4. *  s2 f6 O$ ?: y( {
  5. * brief  EDMA3 Test Application/ v+ k6 @# u5 w1 n& e4 R
  6. *. ?' T# p7 N% p1 y' @& J) p, O! O" ]
  7. *   This file contains EDMA3 Test code.# J) Z9 B# H( I$ E4 ~  D
  8. *2 g# y4 F% K$ H( K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 ^* s+ k- P. `8 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : j8 f4 h; U( Z# b$ q
  11. *         TO CHANGE.
    # t! d! f+ w+ `4 P- M" w( O5 C9 }  x. \7 J% x
  12. *6 N3 j6 c+ G( q/ S' h% R( q9 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ j, V% `& n* S, r+ J5 a9 h1 l
  14. *# T+ b3 L3 F; M+ k! V
  15. * This program is free software; you can redistribute it and/or1 c. H4 o+ v$ O+ x* g0 C) V. j/ T5 R
  16. * modify it under the terms of the GNU General Public License as
      S/ x+ R8 W* r8 R4 @2 T
  17. * published by the Free Software Foundation version 2.
    : b  ^+ f/ w$ A! o
  18. *
    $ ], }# o$ |3 D( w9 N% K, V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; J9 l+ n, c% L, y- G4 N
  20. * kind, whether express or implied; without even the implied warranty/ Q- X9 ]  v, \% F" @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + ?' }) P) @( c8 {4 N
  22. * GNU General Public License for more details.
    1 N# ^% N! ~1 U2 J9 ~' {
  23. */, p* `8 |& M) O0 G: S0 P

  24. 5 |1 a+ M2 f" G5 g
  25. #include <linux/module.h>' ]9 }( ~* Z' E0 N! a% `
  26. #include <linux/init.h>
    % Y0 }" i+ d# r! L6 s9 c- n
  27. #include <linux/errno.h>
    / B5 c. W) M0 ]: o
  28. #include <linux/types.h>' m9 c5 v+ u& I  F
  29. #include <linux/interrupt.h>
    2 b( `2 F7 Z! |+ N8 L$ a
  30. #include <asm/io.h>5 m0 d- }, ?1 ~( w& F
  31. #include <linux/moduleparam.h>
    1 b# }: X3 m4 M& {
  32. #include <linux/sysctl.h>
    ; H) V3 I) p# I! C% r
  33. #include <linux/mm.h>
    6 u+ T, @1 f" G" Y9 c* H2 n
  34. #include <linux/dma-mapping.h>. c: r% ]; M/ p2 |0 Z0 E; y
  35. 3 E3 a4 h; n1 |' _
  36. #include <mach/memory.h>9 F5 ?" u+ X' I% Q
  37. #include <mach/hardware.h>
    , n. M* h1 _, v  O3 Z
  38. #include <mach/irqs.h>3 J/ o( x: i+ \' a) Y7 G
  39. #include <asm/hardware/edma.h>
    9 b& D9 `5 I: w3 q5 ^

  40. + L7 d3 W; u' k; q% J, ]" F
  41. #undef EDMA3_DEBUG
    % B6 T6 B! ^/ X% I' J
  42. /*#define EDMA3_DEBUG*/* P% V$ s  M7 t* s2 a

  43.   M3 E2 V; F$ L7 u
  44. #ifdef EDMA3_DEBUG5 d& K) G' s5 t! I5 I" k0 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 }$ [5 n# b8 t( {5 `  O; B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 ^: F- e, O9 G& I0 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 P* u% X  I* L
  48. #else1 V- K) h- X6 z6 P! ?: ?/ i4 K
  49. #define DMA_PRINTK( x... )
    3 t; G( {' _: X! j5 y* s' m
  50. #define DMA_FN_IN
    + }! P8 [- L; o! ?4 n/ B+ a7 S
  51. #define DMA_FN_OUT
    , h* m7 l2 W4 z
  52. #endif' i& J2 }2 t: u1 f: D- F/ H) Q

  53. 8 P$ z3 ?3 l) p7 V/ k* V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 J9 K# @9 c  o5 ?9 B6 y
  55. #define STATIC_SHIFT                3( |( w4 u( d% e
  56. #define TCINTEN_SHIFT               20# I5 ?. V  L3 E& D5 u( x
  57. #define ITCINTEN_SHIFT              21
    1 X# a* U$ B4 G$ p# ^9 d6 F- Y
  58. #define TCCHEN_SHIFT                22, l: N/ \9 g$ @; n- L/ F, l
  59. #define ITCCHEN_SHIFT               23, P" x% {3 O- b
  60. # _2 d4 ]& w4 ?( P/ B0 J
  61. static volatile int irqraised1 = 0;$ P4 ^# {; F$ k& L) p6 V
  62. static volatile int irqraised2 = 0;7 }  w& O$ s( D7 t) m; F

  63. 7 S) t2 \$ h+ P9 r; }. {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; m3 U8 O  f, q* P" l( K- P/ X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# N0 K# l* f- O4 y# L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * C! U) {: i8 p4 k6 X

  67. 4 `! W  b8 x# \6 L1 d5 X
  68. dma_addr_t dmaphyssrc1 = 0;4 U8 X& Y- @, B
  69. dma_addr_t dmaphyssrc2 = 0;: G1 |6 ^# I% Q. p+ l' L
  70. dma_addr_t dmaphysdest1 = 0;
    . S8 S9 l5 K5 \8 s) @4 H4 }
  71. dma_addr_t dmaphysdest2 = 0;# U& d5 B5 O# `6 w  u
  72. / n7 q+ B( Q: r- t1 p
  73. char *dmabufsrc1 = NULL;( y7 Z5 m6 P! n# H# P2 Y
  74. char *dmabufsrc2 = NULL;# A  W  H9 F, A+ M
  75. char *dmabufdest1 = NULL;, T3 `$ w, w$ z! X# D5 S
  76. char *dmabufdest2 = NULL;9 `, z% G/ H7 X

  77. : D, H9 E* d) ?. M1 B) L$ o
  78. static int acnt = 512;$ J5 z& I0 \. i" m  r
  79. static int bcnt = 8;
    * W- X5 f" u& p* z# O# T5 H
  80. static int ccnt = 8;
    ; R0 T/ R' g! L2 y6 J/ |* o

  81. / q6 A2 _4 B& j2 F7 u" q2 w( {
  82. module_param(acnt, int, S_IRUGO);$ R1 e7 n' W6 J0 M
  83. module_param(bcnt, int, S_IRUGO);. C+ |0 `2 i1 |. |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( C- W0 G& v( W" _

5 U) c9 J9 F+ R# M3 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ~# t. K% o  E0 G$ Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 B6 s$ d. b$ G) m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 c% y$ U: h! y* A5 l
' I8 }3 W6 q3 F' ^
4 g- }: r: A% q0 G# b/ {; c- s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-3 07:35 , Processed in 0.045375 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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