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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 d$ e1 u9 L- D8 f
  1. [code]EDMA sample test application
    / i1 U; ^- L" U6 O7 R0 `0 w% I" i' N
  2. /*
    % H+ L9 W$ [0 m! }, [( r  K
  3. * edma_test.c
    & Y, h$ @5 K$ W: v1 L1 D
  4. *
    - `# C% Z) {3 \3 T0 i- y
  5. * brief  EDMA3 Test Application
    $ Y0 r$ l" Z" W1 e6 L; g" B
  6. *; @! E7 H6 l4 T; `" h
  7. *   This file contains EDMA3 Test code.
    0 G: X9 O( ^" j8 v3 ^, [8 m6 M
  8. *2 x* h- w0 M- \- x- b# j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! I- g" l3 ~2 X" r! G8 W9 m. Y, W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) ~6 h8 M- y5 k
  11. *         TO CHANGE.
      w: o2 U4 F! x3 O8 |9 ^: V5 H
  12. *
    / a7 r: @0 e" y% |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 J: h2 E7 G/ k! a; k
  14. *
    0 ]2 c1 a8 N. U& X
  15. * This program is free software; you can redistribute it and/or
    1 Y9 \! c# V. H( r" j: Y. G) k) M
  16. * modify it under the terms of the GNU General Public License as9 |; m5 l9 E3 q% p5 I% R
  17. * published by the Free Software Foundation version 2.# E$ i! e: I, Z& `( S7 G
  18. *
    + P9 |- S  v3 q! t0 k5 Q0 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % h6 V. d  O. N7 @* c, \
  20. * kind, whether express or implied; without even the implied warranty9 `: Z  c7 Y6 ]" ^  s! Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- [& b/ T& ?( \0 X
  22. * GNU General Public License for more details.
    ' f; T5 f5 ~6 o$ h: b
  23. */4 G7 y7 D3 F5 u
  24. # j/ Q! p& A( [/ Z1 L7 b0 \$ e9 G
  25. #include <linux/module.h>
    ' m! W! N- i5 L3 g4 ~: r2 ^! K
  26. #include <linux/init.h>
    & \4 d* d1 F# K$ }
  27. #include <linux/errno.h>
    2 ?8 h# [2 A; o5 |
  28. #include <linux/types.h>6 U+ w5 z' z" {7 P
  29. #include <linux/interrupt.h>0 r2 U! t& G  M8 W  x7 n) j; V
  30. #include <asm/io.h>/ U# `9 R" u  t% B9 N# k3 L
  31. #include <linux/moduleparam.h>
    . b$ g) l8 U7 l, B
  32. #include <linux/sysctl.h>
    " u" Y8 T' m8 g5 y9 n% h
  33. #include <linux/mm.h>
    1 R0 }- C/ e) T- u1 O# a' j
  34. #include <linux/dma-mapping.h>; ?- X/ T& A0 z  O$ v- h' z

  35. ; |. b2 U4 P/ b  M
  36. #include <mach/memory.h>
    ) I8 [3 v7 c6 s0 ^
  37. #include <mach/hardware.h>6 F2 y4 `8 y$ W- M8 A) Z! J
  38. #include <mach/irqs.h>& h+ i# G& E' s1 P3 P3 X
  39. #include <asm/hardware/edma.h>- N- W0 R6 A/ C, s+ |" m+ q5 S4 |
  40. ; k( S+ C+ N. O( Y
  41. #undef EDMA3_DEBUG
    " ^* ~4 k6 |! g
  42. /*#define EDMA3_DEBUG*/# F4 @  {; p/ f! b$ Q
  43. / B: b8 l! z6 @) Z5 l) N6 Z
  44. #ifdef EDMA3_DEBUG( c  B0 E2 K" [+ O) l# x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 x$ d8 V, o6 Z, M! J7 I: ]. O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; K* V' t4 p- \4 @9 p3 m% E: X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . c$ Q- L! A: G" s
  48. #else. s; i& K9 d3 D7 j
  49. #define DMA_PRINTK( x... )
    7 ]0 K, r4 r* x# o8 Q* J3 ]* y
  50. #define DMA_FN_IN* k$ J0 k3 d6 V8 s, a1 a
  51. #define DMA_FN_OUT
    8 f! }' F5 \0 \- [. G2 F6 X
  52. #endif
    + `5 R0 a9 M* R# v5 a% S6 Z2 z

  53. ! p2 W3 \2 q) s: {' B9 h  {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 n$ w4 \7 B6 m3 e1 {0 j
  55. #define STATIC_SHIFT                38 p, t; `1 I# o$ v
  56. #define TCINTEN_SHIFT               20
    / T5 E% q9 K, X; V% i6 @. Z! y: E
  57. #define ITCINTEN_SHIFT              215 ^5 ^, k/ v* C" Q
  58. #define TCCHEN_SHIFT                222 H% Q1 ~" D# p: |9 ?( H; {
  59. #define ITCCHEN_SHIFT               231 ~, X6 K7 x% ^. h, @4 n, X! F

  60. * {: q4 R8 u# b# J/ ?
  61. static volatile int irqraised1 = 0;+ d4 X7 h8 {1 g/ l1 r2 p3 s) G
  62. static volatile int irqraised2 = 0;0 l, W7 |8 g* P. x1 \. O+ Y$ ?

  63. ! B/ U' s" ?! s3 k' q% i2 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f+ {* b+ W0 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% P$ o7 Q9 a9 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 T" b4 Z) _2 ^4 d* s4 z! H, p' ]$ z" e5 k
  67. # T  S4 h- g* b5 _; C
  68. dma_addr_t dmaphyssrc1 = 0;; b& y  g& }" ^. f
  69. dma_addr_t dmaphyssrc2 = 0;3 e% M" M/ Q& Q# Z3 Y
  70. dma_addr_t dmaphysdest1 = 0;! _- ^( v7 X6 V
  71. dma_addr_t dmaphysdest2 = 0;
    & r6 w# K& A9 x0 w% c

  72. 4 y/ O& u: N9 C: d' ~" g, ^5 u
  73. char *dmabufsrc1 = NULL;4 e2 j5 b. w# k2 R% H  E' f
  74. char *dmabufsrc2 = NULL;
    7 ?9 \6 g7 o6 b; J/ v6 N( k
  75. char *dmabufdest1 = NULL;% Q7 u* G3 v, L
  76. char *dmabufdest2 = NULL;7 v3 R, T* \/ B# z
  77. $ B8 P4 b# w# o$ q1 h$ m$ C, S
  78. static int acnt = 512;
    ! g) S% d% e: u( z
  79. static int bcnt = 8;7 T2 t5 T4 R: J  C- Q" d0 |
  80. static int ccnt = 8;
    ! R$ P' A6 H' b3 i( p3 C4 s5 f

  81. " u1 Q# y) t$ s7 n+ [
  82. module_param(acnt, int, S_IRUGO);5 |6 s! l. j! O6 a; @: ]
  83. module_param(bcnt, int, S_IRUGO);: G, b' G" L' u  V, m3 L4 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 C% H0 W# b% D" w$ Z7 A! H

$ {3 v1 q9 i, ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: n6 V3 O, ^. c2 N) s0 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; |. J  a8 g1 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 g; L+ L( x: t5 y+ y" P* C% A
& h% X8 l$ `$ k0 Z5 G" b& T6 m

7 n, V6 A+ c/ b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-15 21:39 , Processed in 0.036410 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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