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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 o3 P7 V9 l. \
  1. [code]EDMA sample test application
    9 _! x. ^9 N- n, G
  2. /*9 A$ B6 [1 q5 t- g' c* H& c0 E/ {
  3. * edma_test.c
    2 k0 J4 {! w  v  e& C( F
  4. *# b& f5 H( e: |$ ^
  5. * brief  EDMA3 Test Application- ~* V9 j0 @0 o% \
  6. *
    8 u) `) O( [/ M, p9 h. |
  7. *   This file contains EDMA3 Test code.
    5 Z; {: T% j4 r1 l8 L
  8. *
    # o) c' p1 T$ }4 I- {1 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + f# `. m. D& s6 A5 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 E$ s" Q' M/ K/ N
  11. *         TO CHANGE.
    # S4 L( K' T- ^
  12. *
    9 I" C# f! U" N- x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 F; _$ s  e1 Q) o9 i- f: r
  14. *
    ; z( N/ |% J2 `3 b: q2 j
  15. * This program is free software; you can redistribute it and/or
    ' B% e4 v( i) D8 W
  16. * modify it under the terms of the GNU General Public License as
    2 z- d) j  \9 |. I; n! ]
  17. * published by the Free Software Foundation version 2.4 j. U; O+ }% D+ G1 |0 K
  18. *
    5 }" A& F1 {5 I  z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( I& Y1 f' \* i% E% R
  20. * kind, whether express or implied; without even the implied warranty
    1 i6 B" B5 Q1 {9 X; D. T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % ^1 W1 E; \: u3 D
  22. * GNU General Public License for more details.
    # m2 w. U3 m5 V2 e( [
  23. */
    * L2 e/ J7 j8 D' }, i

  24. & q! Y8 t& k& n) J& s4 C3 q0 `
  25. #include <linux/module.h>6 v# p. d7 g$ A/ o, T$ u+ B
  26. #include <linux/init.h>
    8 [% ^2 d* X' F4 j" _7 \
  27. #include <linux/errno.h>
    / y$ `/ h' R8 J: S) H
  28. #include <linux/types.h>
    / Y2 D* X* K/ _" T) s
  29. #include <linux/interrupt.h>
    & q; P: g: Z+ t2 a; ~" Z
  30. #include <asm/io.h>8 t* e" h% S. Z, Q" \  E# \
  31. #include <linux/moduleparam.h>
    1 V5 ]+ s" Z& Q6 ~7 a5 y
  32. #include <linux/sysctl.h>
    ) f. f6 E0 N; Q: ?2 V
  33. #include <linux/mm.h>" ^3 @) ]/ F6 Y, p6 W
  34. #include <linux/dma-mapping.h>
    5 M; C2 ?  K- j' g, @

  35. 5 @' o) @2 D" g$ @5 ~+ Q! |- Y
  36. #include <mach/memory.h>
    ( |6 [$ Y% H2 j
  37. #include <mach/hardware.h>
    5 ^2 X" U* M- Q
  38. #include <mach/irqs.h>
    2 h+ T& n" i- i7 Q. b
  39. #include <asm/hardware/edma.h>
    : T2 d) t! o' B
  40. 0 i- L8 v4 l' k4 O  j
  41. #undef EDMA3_DEBUG
    ; o$ T& \$ ]( A
  42. /*#define EDMA3_DEBUG*/
    8 ^( |9 h; w$ s& ?! y
  43. 2 q9 J" E6 Q, q! G
  44. #ifdef EDMA3_DEBUG
    ! A0 Z* q0 D0 `9 w( [! o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; E! S4 q; B! `  y# V7 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      t6 Q$ J  N) N* [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 F" y1 C" {+ u
  48. #else
    9 x5 C7 q/ d& T- _2 G. \) m/ Z
  49. #define DMA_PRINTK( x... )
    + d0 {# V. D9 K9 K
  50. #define DMA_FN_IN
    6 b) f* z6 A! r8 u9 V2 |# S
  51. #define DMA_FN_OUT/ y# A, D# G$ R$ R7 C8 s$ H
  52. #endif
    . m) J: i* {' {
  53. " q9 Q* N; O, P) O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 S$ b9 _" Z: a
  55. #define STATIC_SHIFT                3/ k8 R8 w" I+ H. f. Z
  56. #define TCINTEN_SHIFT               207 G3 @, W& x0 x, W4 P3 J7 V  N
  57. #define ITCINTEN_SHIFT              21
    ! O- n5 d+ H6 N' ^, S3 g. q7 Y
  58. #define TCCHEN_SHIFT                223 o0 _; y: }- y! @' R8 z
  59. #define ITCCHEN_SHIFT               23
    / o. N& O( I, c( d/ n+ P' }, s+ Q% s8 ]
  60. $ }- r+ G4 Q% h9 e$ W# p1 D
  61. static volatile int irqraised1 = 0;
    % M3 z$ Z' p! V, j
  62. static volatile int irqraised2 = 0;
    " L. g, y3 Z; P( T+ n! X" L

  63. ! e  F) A% k- T6 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; |1 d3 Z1 G3 X2 l# J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f9 b" F0 E+ c5 i+ n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! D, v- C$ f+ V6 L0 J. ]: v( p

  67. 5 l4 f# t6 F3 ~% P
  68. dma_addr_t dmaphyssrc1 = 0;* G/ h. f# o6 n( N6 _
  69. dma_addr_t dmaphyssrc2 = 0;# p2 u0 }! j2 K5 B
  70. dma_addr_t dmaphysdest1 = 0;3 k  J% G2 f6 L0 I0 |% W
  71. dma_addr_t dmaphysdest2 = 0;
    ' F7 X4 `6 m4 b% \8 N

  72. " q6 D) j! ^# {" y3 r
  73. char *dmabufsrc1 = NULL;' p0 E6 M5 R  P. E' \2 k
  74. char *dmabufsrc2 = NULL;
    8 Q8 k( D. K7 r9 T; E  z& O
  75. char *dmabufdest1 = NULL;
      G8 p2 E( V: z/ o3 C5 a
  76. char *dmabufdest2 = NULL;6 u" U4 s" _6 y9 K- n' Y6 B0 G

  77. ( i' U3 _6 K  @( U
  78. static int acnt = 512;
    $ ^  U$ o- ~1 w& b* h) B, Y4 C8 }
  79. static int bcnt = 8;; T* `, i: Z4 R7 s+ d
  80. static int ccnt = 8;
    8 q0 k6 J, ]8 [9 O8 K3 R
  81. 5 ~+ s; v$ h7 Q7 @4 d
  82. module_param(acnt, int, S_IRUGO);
    " V. |; O% \; F+ b
  83. module_param(bcnt, int, S_IRUGO);
    / P! N6 U- o6 e- v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: Y6 A, C. v# c) `
* O: m# w' y, ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 [* T$ A' y, B; J7 R4 b  w1 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; ~. x4 W  w8 Y8 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 L2 p( i/ ^2 k) k5 j8 d

3 p1 N9 U5 W* V4 t$ V- p
  B8 w5 Z/ F4 m8 R. }* c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-10 13:23 , Processed in 0.039616 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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