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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( `7 k" b1 h  X# q- p) W0 X$ u- g
  1. [code]EDMA sample test application+ g( H0 _& a& e  L
  2. /*
    ( x- X/ _/ p9 ]8 u# Z: p* |
  3. * edma_test.c
    & ^" Q& K8 X/ }7 N* f
  4. *
    0 ]- E! t; z8 Y" W1 v
  5. * brief  EDMA3 Test Application
    & y/ U$ g5 h( Q  J7 u2 p: M* a  L
  6. *
    5 v. s# I4 Y: |! ~
  7. *   This file contains EDMA3 Test code.0 E! w6 D1 C! Z# M2 x) W% S
  8. *
    % x+ |# C8 \5 E# x/ E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 K  }, R$ g7 N5 F; M; a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* E" O) ]/ X& R6 \3 ]
  11. *         TO CHANGE.2 Q3 y( h6 }9 i/ m
  12. *0 \/ v, S& {8 K' M( }* g8 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 B  g0 d9 d% m% S& M: W4 e/ a
  14. *
    . t: B' `! J! i+ `& `( S; q/ r
  15. * This program is free software; you can redistribute it and/or# w8 @$ t! ]3 O+ n
  16. * modify it under the terms of the GNU General Public License as+ U  h7 }5 E) S% I/ ^0 _$ R
  17. * published by the Free Software Foundation version 2.
    % R5 z) g+ W+ j: b9 l
  18. *
    $ {5 R8 F" \3 G  T' g/ Q4 c% e3 J* ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      H0 u6 `  G7 j6 P
  20. * kind, whether express or implied; without even the implied warranty
    6 Q; [7 M+ c: v" {5 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " }. A0 s( i! R- B
  22. * GNU General Public License for more details.
    / z% d3 b& ]3 H. D( u6 X
  23. */# ]+ [" @  A4 Z7 ^1 x. a! w' @. s
  24. 0 D  }) H' \- k1 u7 U
  25. #include <linux/module.h>
    3 U: `  C! P4 c( I; L
  26. #include <linux/init.h>& Y; B' F" y9 y- G2 q
  27. #include <linux/errno.h>4 p8 I4 A  e( w* _
  28. #include <linux/types.h>
    . |7 m: q, |4 t
  29. #include <linux/interrupt.h>1 J' r: u0 a1 r, m
  30. #include <asm/io.h>
    ) v2 A  v7 L/ h* U+ m+ \
  31. #include <linux/moduleparam.h>9 C" x( B! m5 ]6 n$ C
  32. #include <linux/sysctl.h>
    $ d" P- ?: D  X( {
  33. #include <linux/mm.h>
    : k2 K* h1 P, w% |; m8 O
  34. #include <linux/dma-mapping.h>. T# b0 a. A/ @6 }4 J4 o$ b9 y
  35. + Y0 K/ _& D% t% o- ~
  36. #include <mach/memory.h>
    * f; v5 l3 k6 s' o' a' _& h" S
  37. #include <mach/hardware.h>8 U6 l2 r  b1 U. Q# L. e8 g
  38. #include <mach/irqs.h>9 y; P/ v/ @! U' H0 N' ]
  39. #include <asm/hardware/edma.h>
      m/ x/ \: B1 N! C
  40. , ]4 U4 N* b) ]: e& Z: g
  41. #undef EDMA3_DEBUG3 D9 L$ c, q4 {! M% j
  42. /*#define EDMA3_DEBUG*/% q6 d5 y7 x* w( h6 P

  43. & a* b$ {( X0 D) ]8 U. d
  44. #ifdef EDMA3_DEBUG
    3 x. B8 Z/ j2 h/ `9 g! q, ?4 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * \" p9 E/ P) [, L0 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( {9 b% N) _$ P; [: b2 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , D+ [' N! q' w0 M+ N" l' k/ m2 h
  48. #else
    6 p6 e( k. T: p) d" }
  49. #define DMA_PRINTK( x... )' B) Y" o4 ]6 ^. v1 q( j0 h3 M* }
  50. #define DMA_FN_IN
    3 z/ C) f) i/ [& \( g
  51. #define DMA_FN_OUT3 F% T* q) g6 i9 ]3 r
  52. #endif
    . F% H! P8 E! M2 @: g+ I7 b/ a& q

  53. # y; ^, _$ `6 P  y6 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      }/ \. N6 N3 _  ~0 A
  55. #define STATIC_SHIFT                3
    + A* Y" j, [; @
  56. #define TCINTEN_SHIFT               20
      T* o7 o" I6 l( u2 W
  57. #define ITCINTEN_SHIFT              21
    ) D: B$ m5 K' S9 z5 u
  58. #define TCCHEN_SHIFT                22! }: h: T8 m1 R
  59. #define ITCCHEN_SHIFT               23
    & ]: ~( f9 g8 `$ s: R
  60. * n9 S, r( r7 b* y" t4 \" x3 h
  61. static volatile int irqraised1 = 0;
    5 S& i5 {. ]! K( [
  62. static volatile int irqraised2 = 0;+ C1 N0 T8 w* J7 [& [4 ^

  63. 5 f$ B" |+ X3 i5 h* A8 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + i9 M) |! K1 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G: h$ Z6 a! Q+ H- c% ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 e. C8 Q* |/ B# o+ U+ g7 W1 P3 d% w1 e

  67. 2 P8 g, A% e: r- H% B
  68. dma_addr_t dmaphyssrc1 = 0;
    ( V0 n) u. a0 o( u
  69. dma_addr_t dmaphyssrc2 = 0;
    1 V# m9 l, w/ x
  70. dma_addr_t dmaphysdest1 = 0;
    & r1 U: X/ Y, I2 u; s# Q
  71. dma_addr_t dmaphysdest2 = 0;) j9 N/ o5 f) t8 \* }5 `2 N

  72. 4 X! r) I6 J7 e% v4 N, {
  73. char *dmabufsrc1 = NULL;
    ( @, v- L1 r+ T7 I: t8 F  l
  74. char *dmabufsrc2 = NULL;5 }% `4 ?8 D4 I- b. L- d8 z/ c
  75. char *dmabufdest1 = NULL;: }- t$ f, t  N, w* ~$ y5 e6 S$ P6 h* N
  76. char *dmabufdest2 = NULL;
    9 Y% W4 r3 d. X+ d+ y0 u/ g

  77. # P4 p  y1 c" \
  78. static int acnt = 512;) _  q5 m( t& G0 v; \2 ^$ a/ o& s
  79. static int bcnt = 8;& `% o; p, k! c2 h$ i0 g; l
  80. static int ccnt = 8;, K, d2 Z/ G& l9 K& ^) j
  81.   N# Z+ B9 M+ D: S) \5 K) o) \
  82. module_param(acnt, int, S_IRUGO);& P5 o- g2 m3 d! G+ Q
  83. module_param(bcnt, int, S_IRUGO);+ g1 y2 E( c. \6 B  ?0 ]2 l8 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" O4 Q1 R9 p6 o$ u

, _. t' W2 [4 X1 Z- i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ U4 Y, S1 x# u' y/ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 G+ G( U, H# J* @: v+ d# a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" U: R8 J2 t0 I
+ ]; A! A; ^, _- s+ Z2 e3 i4 D& J1 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 22:34 , Processed in 0.037843 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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