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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 n: a* ^& a  @5 X- C+ w
  1. [code]EDMA sample test application
    ; s5 ~$ q( Q4 Y
  2. /*
    - p  _0 }, t8 S5 {2 H- N) L; |
  3. * edma_test.c8 p+ G3 }- {4 N
  4. *- p; M5 d. q0 ?; {" `4 P& P5 z
  5. * brief  EDMA3 Test Application9 L; V3 _' H/ e8 H0 F/ b# t; M  Y% y
  6. *; J/ I$ k6 R4 R7 j
  7. *   This file contains EDMA3 Test code.
    0 @4 c+ i! u% M1 P3 ]1 d
  8. *% E' B4 B$ [0 V- T$ I7 q0 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # x# \: p* c, f% P. p, T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ s1 E, i  L  P
  11. *         TO CHANGE.6 g0 H( |; n  I! i8 U
  12. *
    ) {1 g, V6 p3 H. N& `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 t  c$ B0 M( Q& Q" N4 Q% W& Y
  14. *
    & B( p+ ?6 h9 N# R% {+ N8 O
  15. * This program is free software; you can redistribute it and/or+ q" h% w/ A" I& ?8 N+ z
  16. * modify it under the terms of the GNU General Public License as
    5 g; u6 p- |3 S
  17. * published by the Free Software Foundation version 2.
    # U' y* a: W+ X' I' [4 D
  18. *& O3 z4 i1 F* W  e5 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 N4 J  ~2 t% S; q, t
  20. * kind, whether express or implied; without even the implied warranty( d3 U9 _3 g2 L) [) I  k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 H4 Z+ t% F6 N4 [+ R* n. g
  22. * GNU General Public License for more details.8 Z# h) e( E1 V  B: Y& _7 r
  23. */
    4 t) G* H9 p) e* t, ]& u2 L
  24. ; f3 U* q; M$ A$ ]+ I) r' }
  25. #include <linux/module.h>8 i) @5 m5 A. N; X& Z
  26. #include <linux/init.h>
    ; o4 O. T7 m( I
  27. #include <linux/errno.h>( Z* }- i0 K: {' b
  28. #include <linux/types.h>4 v/ ~! y$ L; @2 s4 l
  29. #include <linux/interrupt.h>" t( w0 J1 Q$ T9 R
  30. #include <asm/io.h>  Q( Z4 r6 q- g' I# E4 `
  31. #include <linux/moduleparam.h>
    , K- u" ^9 Z+ U$ a: r& h: W
  32. #include <linux/sysctl.h>2 a( M3 A8 [! M0 q+ ~7 W. j
  33. #include <linux/mm.h>2 O7 i& E3 Z$ d. A
  34. #include <linux/dma-mapping.h>
    ' k3 Q$ E9 ^$ N

  35. ! H5 y7 S) K" s8 w# H) ^
  36. #include <mach/memory.h>
    " y9 `+ p3 n% F. [8 D
  37. #include <mach/hardware.h>3 h9 @1 d" H5 w  ^  s# c! A
  38. #include <mach/irqs.h>
    ! H2 A0 J4 l0 V; S
  39. #include <asm/hardware/edma.h>
    3 S: Z6 N4 n8 }! y9 m% R

  40. ! B& W+ `2 ?  b' j
  41. #undef EDMA3_DEBUG
    & U  }, k7 \0 P) ^: n6 q- v" `
  42. /*#define EDMA3_DEBUG*/
      I% t! f# v- Z+ O9 J; G$ A6 C- x5 c
  43. % Y" b! I8 F5 a
  44. #ifdef EDMA3_DEBUG, h# f  @; _) {1 n% X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! b1 D# M5 }# x4 n4 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! g1 J! A; `, ]8 O+ M: \% W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 g  s  A. c1 Z) y% c6 I
  48. #else
    " F. d0 m% q: [4 K8 L; G/ q# d8 d
  49. #define DMA_PRINTK( x... )
    ! p6 o( M- S4 J
  50. #define DMA_FN_IN) z& u: y, ~# H1 b- {, ?
  51. #define DMA_FN_OUT$ i/ P& N4 `8 o7 l1 O
  52. #endif0 s  P( J" Q, g
  53. . t/ P5 O0 p. R9 K; n; c- K; Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 z' o) N6 T6 ~3 X
  55. #define STATIC_SHIFT                35 X2 q2 m6 P' b) g
  56. #define TCINTEN_SHIFT               20, s5 \' z! v0 T; Q
  57. #define ITCINTEN_SHIFT              21' H! B, s) I* ~2 V3 f4 {8 M
  58. #define TCCHEN_SHIFT                223 U* Q* J* k2 c! \& B
  59. #define ITCCHEN_SHIFT               23
    ) c% q' [2 D/ K5 q

  60. , e0 j, m* M0 e
  61. static volatile int irqraised1 = 0;. q! X, W/ t  S: E" l$ W
  62. static volatile int irqraised2 = 0;9 x9 |1 u9 G# S* @

  63. 8 v1 p' G, B$ [; F% A& e9 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! H6 c# C: k5 t3 |' Q- F$ S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H) o) @4 ~( J5 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q# D; [7 C& N# f: }) o

  67. 3 |% N7 A  w& G0 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    5 d5 X* W- a4 A3 K" Y
  69. dma_addr_t dmaphyssrc2 = 0;6 d1 J0 u" |0 q% }8 N) l& F
  70. dma_addr_t dmaphysdest1 = 0;  _8 i0 y2 J  Z, @- K
  71. dma_addr_t dmaphysdest2 = 0;
    2 L6 \' d2 m2 _
  72. " S! |5 U8 w! N3 R  E; v: v
  73. char *dmabufsrc1 = NULL;
    4 @9 S* }* R6 {
  74. char *dmabufsrc2 = NULL;" A' U. W% Z) q' }) ?- v) i
  75. char *dmabufdest1 = NULL;0 E% {/ q2 Y7 I0 m  T. y+ V
  76. char *dmabufdest2 = NULL;
    . @1 `; w' t$ k+ s

  77. 6 p7 H9 f( i& B, G+ o; p  T  C
  78. static int acnt = 512;5 s) g3 q+ ]/ A; {/ F7 m
  79. static int bcnt = 8;
    . c8 c! @2 X& K8 `; F, X) e
  80. static int ccnt = 8;
    4 h8 N8 X* j$ @

  81. " _' r: J4 z( i! p
  82. module_param(acnt, int, S_IRUGO);9 e6 w& Q, T3 `
  83. module_param(bcnt, int, S_IRUGO);) M9 N+ d4 k1 l7 @5 Q$ B+ A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* j& H2 t$ e2 B* Z+ a' o
6 {9 j0 N8 n8 o. s" g, S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; Q8 K6 m" U6 E6 l2 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 I+ G# m9 _  l* n  u( K& ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& R( K' p  B5 j0 e2 Z7 N+ _3 q( Q" {/ O

' v! a! Y# m% y3 y* |0 x+ j) N6 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 20:53 , Processed in 0.040375 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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