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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # F: |4 v2 [7 M" A0 l; o2 b
  1. [code]EDMA sample test application- I% F3 }: D5 b0 [7 X
  2. /*, j4 U5 \& Y3 B, b! s5 k3 X
  3. * edma_test.c6 j1 F9 A/ o6 g' y
  4. *1 Z) B1 P% L8 F$ }% b) |2 @
  5. * brief  EDMA3 Test Application. ~+ q3 g6 Q- V1 A1 @  ]5 @) @" E
  6. *8 L# x3 M) M7 I; O1 {
  7. *   This file contains EDMA3 Test code.
    3 v: I" L/ u* V6 T  x
  8. *
    ( H4 l6 {# A% L: G/ U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 W, ~* X- v5 d) v6 U# o" `% e( H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) n+ E9 Q, C" v6 N- N* \; M# f
  11. *         TO CHANGE.
    ' ~0 N% M3 p3 ~2 k2 W0 U. o( `
  12. *. `  \  _: k+ k4 @4 [' K9 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 n! _4 J, R( v, P# L! U! I
  14. *8 [2 t2 f' W% |" g$ E
  15. * This program is free software; you can redistribute it and/or+ q2 j$ U- T) Q6 x: B
  16. * modify it under the terms of the GNU General Public License as# j. W$ c( Z. Q5 N
  17. * published by the Free Software Foundation version 2.1 i! Y' H5 B9 y9 u: T% K( B
  18. *+ |- V7 o7 u8 E0 ?4 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # b' S, J. O' d; f) D) X# o( p
  20. * kind, whether express or implied; without even the implied warranty2 k, e' i( _) G/ X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 w3 [1 a$ n) J
  22. * GNU General Public License for more details.
    6 E8 y+ V" \- E* c
  23. */, D5 }7 {  h" ~2 ~/ {; l( s
  24. ; [1 l8 b5 @# T# O+ r
  25. #include <linux/module.h>
    7 z. T9 W6 B0 u1 @9 q
  26. #include <linux/init.h># p3 Y3 }4 [1 t3 E
  27. #include <linux/errno.h>+ X2 x1 e4 F1 o: i' c
  28. #include <linux/types.h>
    3 K1 }" M7 i8 S
  29. #include <linux/interrupt.h>
    # _  @$ v% ], N1 O1 J
  30. #include <asm/io.h>
    # [2 N* _) i) u. Q" U1 P( K5 N2 m
  31. #include <linux/moduleparam.h>
    7 ]  V- e1 d# F& `( }
  32. #include <linux/sysctl.h>  y# _: |9 v" C; i
  33. #include <linux/mm.h>& U6 a' M2 F- t6 h
  34. #include <linux/dma-mapping.h>$ N/ M% U( [; v% W# }# F
  35. + a, K# ?3 T' L2 V, n& t
  36. #include <mach/memory.h>
    ; P* n7 Y# t8 c, p! r
  37. #include <mach/hardware.h>3 o( [6 A+ P  L, f: }3 i
  38. #include <mach/irqs.h>
    : p) o1 D  Q  @- P* C) o
  39. #include <asm/hardware/edma.h>7 S& f6 A6 x# m8 x

  40. : Z8 Q8 R& }% F  `- [
  41. #undef EDMA3_DEBUG
    $ K& F/ ^% U! P4 ?# t+ ]! @
  42. /*#define EDMA3_DEBUG*/
    5 _4 r3 _2 V9 A/ O# e

  43. : }, h* O% _0 |9 H
  44. #ifdef EDMA3_DEBUG
    " z$ I. j3 r1 ~: [, C: K  T& D6 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , r2 Q( n2 z, f# ^# m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) g- o9 f" t: d7 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 I- f- S5 a7 n7 e3 K8 k
  48. #else
    , f% q- O- P8 x$ h0 ^+ F3 u% d* r
  49. #define DMA_PRINTK( x... )
    ' `3 K* R% ?* f' U* B) F
  50. #define DMA_FN_IN
    ; Z7 ~6 ?* `9 S" F+ H+ ~+ `
  51. #define DMA_FN_OUT
    0 p( T) \% `9 }, S) w0 @( g' W9 L
  52. #endif, [  |6 z! J1 u6 V9 k2 I5 U
  53. - e: i5 t8 S* l! b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # X, `3 O# O; ?9 S7 E
  55. #define STATIC_SHIFT                3% J' V, O8 K+ j% ]8 O
  56. #define TCINTEN_SHIFT               20
    * J# F9 M/ X9 k" j$ m8 A: L7 k
  57. #define ITCINTEN_SHIFT              21
    # M7 [1 `" H( F' L: ]
  58. #define TCCHEN_SHIFT                224 d6 m1 P0 X) a. ?+ g: s3 [; H2 w
  59. #define ITCCHEN_SHIFT               23, {! V4 N- g" E3 Y4 H
  60. ( N" F  i* t+ q8 O( @$ C7 `
  61. static volatile int irqraised1 = 0;
    " ~; i, V5 w0 l. V, e& d4 z+ U
  62. static volatile int irqraised2 = 0;# e; b* g% p3 \1 x! A

  63. . V% \4 N% n* E& l7 e* s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ]8 Z+ a: H1 A' B' Q2 t4 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ }! {; R- S! B) x  O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Y. A! t# ?( `+ R2 m$ y) [: t

  67. 2 T* e" }5 ?) D9 U" t5 ?: q
  68. dma_addr_t dmaphyssrc1 = 0;5 _. Y# B9 e" d/ G3 e$ w
  69. dma_addr_t dmaphyssrc2 = 0;: I+ P5 Z( M; _- _! I
  70. dma_addr_t dmaphysdest1 = 0;
    2 W! }2 t0 g; @) D% V4 i: X
  71. dma_addr_t dmaphysdest2 = 0;! v4 t  D4 X$ H
  72. 6 t/ f& s/ X- w% p: q7 ?
  73. char *dmabufsrc1 = NULL;. j4 B3 ?1 i7 M% [7 P; R, d
  74. char *dmabufsrc2 = NULL;
    7 D9 w9 H2 B2 o/ O+ L4 g/ F5 f/ X/ h9 e
  75. char *dmabufdest1 = NULL;
    4 u( L0 l1 ~! U/ n9 h6 \
  76. char *dmabufdest2 = NULL;
    ! t8 }0 i# m$ ?" c  r. [

  77. 2 @4 j! M" U# L* ~; n
  78. static int acnt = 512;( k2 i, U( S# L) G
  79. static int bcnt = 8;
    6 M: {! k" z7 u9 m, }) p; E
  80. static int ccnt = 8;" R. k9 Y  S; }

  81. # P1 Y- g# z+ E' g
  82. module_param(acnt, int, S_IRUGO);8 I/ r3 r1 c6 a4 h: b
  83. module_param(bcnt, int, S_IRUGO);. C% D  @5 U) b9 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) t- Z3 d2 [3 p+ s4 ^: ^7 O
& t8 Q4 }* N1 @) f) I: A8 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 v' Z2 D% w$ L2 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 [$ W& m) G& G: v! [) W0 ~/ Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& L# \6 q8 ~) e: E2 i, G* j7 b# G0 s9 }& s; b' w/ U
& @# V4 y# U* Y" g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 13:20 , Processed in 0.039680 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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