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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; W4 L. B: w7 E* S8 q
  1. [code]EDMA sample test application
    " b$ x8 c  c( S* N- Z$ C2 E
  2. /*# r7 r1 G) n  A
  3. * edma_test.c" O! U# T/ o/ @" v3 Z; y8 \" k
  4. *
    3 M9 d8 }9 U5 A3 i6 }# `) E" T
  5. * brief  EDMA3 Test Application6 O$ z5 S, A  a- g5 }
  6. *
    0 C" q- ]1 _# D
  7. *   This file contains EDMA3 Test code.2 K) W8 p/ K1 n; }- n
  8. *- [( g% S4 u# T, P" }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# x7 ]- l# m/ g- ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 [# |# ?/ u& C+ x
  11. *         TO CHANGE.$ v. i1 D# F2 V/ N- O$ u
  12. *0 `0 D, B8 I7 C" d* c0 ?: O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) h; _3 M& U2 U4 f6 Z! ^" X+ f
  14. *
    1 V2 Q$ V2 P, S9 n. `! Y
  15. * This program is free software; you can redistribute it and/or
    ' [% v7 U* |9 `2 M
  16. * modify it under the terms of the GNU General Public License as
    3 `2 |6 k/ E1 F
  17. * published by the Free Software Foundation version 2.
    7 V6 p9 D1 t0 o8 A8 m2 g3 @1 q
  18. *0 w* d5 x" l, K" Z2 V0 P# `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( z+ Z  `' p" x  G# c) R# x, m
  20. * kind, whether express or implied; without even the implied warranty+ F/ A: I6 L( r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' M6 j1 g  G5 y+ J, T( B5 _# y
  22. * GNU General Public License for more details./ }' y! _7 c9 `! H% o! {3 }
  23. */8 _9 R& p* d' j+ ~* w' B

  24. - C8 w/ q( Q1 K1 m
  25. #include <linux/module.h>& N7 D- J# l  I6 [/ l9 z( W. B
  26. #include <linux/init.h>
    * T8 x* I; c5 \, u+ s! M6 F
  27. #include <linux/errno.h>! v: o/ x0 L5 u  B
  28. #include <linux/types.h>8 e5 u  M/ ^9 ~" R5 n
  29. #include <linux/interrupt.h>
    1 z" ?7 _8 r0 e0 f* H
  30. #include <asm/io.h>3 z  Y, }, q# ^) e0 r1 P& ~% V+ R: h
  31. #include <linux/moduleparam.h>6 N7 t7 ~( C# E6 I) ]
  32. #include <linux/sysctl.h>
    ) T* h0 n$ u$ ^4 b! V" `
  33. #include <linux/mm.h>
    6 X, R, Z( d  h$ l  G7 f5 v
  34. #include <linux/dma-mapping.h>) ?  Z" V! ^6 V  g& w4 `
  35. + {( C5 ^7 {* B, d, [( {
  36. #include <mach/memory.h>: P7 I+ w  R/ U( B* d
  37. #include <mach/hardware.h>  c8 P! n' ^- F) b$ g2 m  V
  38. #include <mach/irqs.h>
    8 }& b$ k( [5 f+ Y+ @
  39. #include <asm/hardware/edma.h>
    7 K! \) g- d3 x: Q* f  y

  40. 5 o9 S) J8 z+ ?
  41. #undef EDMA3_DEBUG
    8 {( d9 K! y# E; P
  42. /*#define EDMA3_DEBUG*/
    & |/ G$ d( G  i
  43. : T4 |, N: D8 q/ {% a4 n
  44. #ifdef EDMA3_DEBUG0 Y) Q* l% V. b7 q3 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " i% p$ d2 t, {4 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ^0 I) ~* m' u1 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% O) y( \. h6 e4 `
  48. #else
    ) y, z; Y2 D  N/ v& s/ \6 j5 e$ a
  49. #define DMA_PRINTK( x... )- u4 c9 P1 u% g, L  o
  50. #define DMA_FN_IN
    3 P% x! A: G7 z# Y" U4 I; I
  51. #define DMA_FN_OUT" Q( y9 A/ i4 q- d7 F
  52. #endif, p  v/ G7 P) e  y- V

  53. 3 a- c7 Y, t5 |2 G  _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 t+ o( g" p1 N6 N/ y1 p& o
  55. #define STATIC_SHIFT                3/ M6 g' _7 V# B/ A7 Z  C# @
  56. #define TCINTEN_SHIFT               20  b$ X! U* R7 _
  57. #define ITCINTEN_SHIFT              21
    3 ?: }# A! v, {  k5 X
  58. #define TCCHEN_SHIFT                22$ q4 X" Y! f% w( G
  59. #define ITCCHEN_SHIFT               231 h% Y5 c+ ?# K

  60. " `/ q- A" b7 T9 n+ {# s
  61. static volatile int irqraised1 = 0;; b, U# C; a2 A# }5 Y6 |; a# k, K0 W
  62. static volatile int irqraised2 = 0;: Q, q7 Q2 C2 H( v; l, c

  63. 3 v' q: i2 K$ ?' c+ ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, L* m5 l' K) c9 T. `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% F) W; J: }1 Y% d6 l# ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* S/ i0 A2 n4 O0 @) [

  67. 0 n: H5 I  }  B+ ]' G9 }
  68. dma_addr_t dmaphyssrc1 = 0;$ p9 m; c- K9 Q8 ^9 B" R' Z
  69. dma_addr_t dmaphyssrc2 = 0;6 [( x8 d4 r; W8 `; e- J$ Z
  70. dma_addr_t dmaphysdest1 = 0;
    * G" z0 B0 l& H2 U2 Z" l
  71. dma_addr_t dmaphysdest2 = 0;
    " P* \9 E' M2 T5 Z  H# e* j
  72. 3 q6 K6 B" y% |) c- u" H5 {
  73. char *dmabufsrc1 = NULL;1 P- h/ J1 \& b6 f7 c4 r8 J' G
  74. char *dmabufsrc2 = NULL;
    ( A  ~; X5 m6 V0 s
  75. char *dmabufdest1 = NULL;3 D" h3 E& d! r
  76. char *dmabufdest2 = NULL;
    & B6 p  P. ]' f$ j( a

  77. 8 k/ y+ j- I& P. Y: \8 ^+ r
  78. static int acnt = 512;
    7 T" n( s; @1 ~7 I1 ^* j3 i
  79. static int bcnt = 8;
    4 b4 ]; P3 M  I$ s
  80. static int ccnt = 8;, p" B  Z) Y8 p6 W. n' Z5 Y- y$ g4 K. ?
  81. 0 q! p$ ?, K/ A2 l. q% Y: |
  82. module_param(acnt, int, S_IRUGO);: ]& }% D2 M& d% ]# e7 b
  83. module_param(bcnt, int, S_IRUGO);( r. C+ B  W! i0 f( [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( A/ s# m1 `4 r3 x3 a
- ~- r" A$ ?( w( C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& o9 a) G- c# x; V; }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 K2 L5 M4 O' E- ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 }3 a( N. p( A( O0 j

; [& L' K- b: [$ i! F
9 W$ ^. P& @6 a: V. Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 16:24 , Processed in 0.040096 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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