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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , V9 q' u* n- M
  1. [code]EDMA sample test application/ n- }7 I. @. E# |
  2. /*$ m7 p6 g. X6 ~$ d" S7 D
  3. * edma_test.c
    + ]( v( C8 q, k' h: ~
  4. *. C) `6 j0 [# a3 q  n
  5. * brief  EDMA3 Test Application
    * x- p0 j, G. ^4 \7 U% \6 o7 l
  6. *" t9 i. y0 {( h/ X; k4 e
  7. *   This file contains EDMA3 Test code.
    2 t/ c) j* y5 M7 u
  8. *, Z1 q" r( z- ^3 C0 t- P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " B. W9 m7 c: F8 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / c( d+ g$ g' ^
  11. *         TO CHANGE.- z3 W, S  H2 s
  12. *- C* ~) D9 L' D) q3 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) {- d% r8 K1 w2 p1 X( o% M
  14. *! S4 \$ H( \% g+ D! A  a
  15. * This program is free software; you can redistribute it and/or
    ( X* J- N9 D! c# Y
  16. * modify it under the terms of the GNU General Public License as. D/ z9 i6 {+ _) ]  M; E( W
  17. * published by the Free Software Foundation version 2.
    4 t, ?/ A% [1 L! g
  18. *9 E! i% A; M& c* R& n# F* X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + Z1 i4 [& ^" i, m& P
  20. * kind, whether express or implied; without even the implied warranty
    2 }$ ~  u3 V; \: [7 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) V9 L3 a7 ~# k9 @) x- W* e- s
  22. * GNU General Public License for more details.
    : F! }9 P/ \2 l( C; h- {
  23. */  ^  R" e- r! A5 l& U

  24. ; a* a) b% s4 `
  25. #include <linux/module.h>1 k6 Y. }7 R8 x- ~0 U1 }
  26. #include <linux/init.h>8 ~. r( m* t: O
  27. #include <linux/errno.h>( [0 T7 h, z. [- D/ D1 z/ b% H3 L/ @
  28. #include <linux/types.h>
    & O' c7 x( P! U8 L
  29. #include <linux/interrupt.h>9 f4 S: V" s2 R$ ?1 |. l( _
  30. #include <asm/io.h>: F8 F7 _: z# @
  31. #include <linux/moduleparam.h>
    2 f6 q, J) l% f+ ^8 Y3 y7 n
  32. #include <linux/sysctl.h>
    . o9 C, w) X+ i; b! Y
  33. #include <linux/mm.h>
    % K) W$ {1 y) x! r: S9 T! {
  34. #include <linux/dma-mapping.h>( ~) h1 Y: ]# q3 v- ^
  35. " b+ O+ e# {6 J# k- ]
  36. #include <mach/memory.h>" U4 ?* ^7 Z: A+ C" b
  37. #include <mach/hardware.h>
    ) @9 r: C- K" J) l2 [0 E2 x
  38. #include <mach/irqs.h>
    4 q4 C9 Z  f$ u" R( [/ Y. |
  39. #include <asm/hardware/edma.h>
    8 G4 {3 z5 u6 E/ w+ S9 X
  40. 1 L3 Z( ]$ g/ p: x0 T0 [
  41. #undef EDMA3_DEBUG
    3 R" z2 x. R# _! w$ B$ T" R
  42. /*#define EDMA3_DEBUG*/
    + b! e8 \# s0 ~
  43. / }$ O. n4 x! x2 e7 E
  44. #ifdef EDMA3_DEBUG, C: R- [6 Q$ t* P/ X) y/ ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 P! u9 a  ~9 n: n; T* U$ H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* L5 ?; Y5 T8 h1 E, I1 v, t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' c0 s6 l8 u6 _: L1 d
  48. #else
    9 O# S3 |8 `' T8 X8 W0 C4 K
  49. #define DMA_PRINTK( x... )
    6 G0 d6 O# U3 h( T
  50. #define DMA_FN_IN, T$ l) w, r* }& A6 d  N2 K, i) n4 y" u
  51. #define DMA_FN_OUT3 n9 i$ v& x: N
  52. #endif
    0 v3 D9 b1 S- \
  53. 6 `: W1 F2 R* W% e) k1 e8 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) Y6 s0 w4 Q9 m' Z* D4 Z
  55. #define STATIC_SHIFT                3
    . W- p* V8 D3 Z( E
  56. #define TCINTEN_SHIFT               20( h2 \9 E3 E+ U$ N0 ?
  57. #define ITCINTEN_SHIFT              21
    . J! E7 Z/ j' z) o+ X! B+ L
  58. #define TCCHEN_SHIFT                22
      |. ?5 ~( F: N! U# i' U% @' t
  59. #define ITCCHEN_SHIFT               236 H5 [# G# |+ b' O5 Y1 v6 ]' O

  60. 0 N% T& v/ Q( ]+ b1 K1 m( ?, Z
  61. static volatile int irqraised1 = 0;
    ( C& ?" D' T" Y6 s
  62. static volatile int irqraised2 = 0;2 p5 i5 L! m: j  o( ?* d! L
  63. 8 X0 z% w: P7 S$ f; c) x" H1 A: I! Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : R9 Q% ?1 Z/ ^! Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 u8 |8 C; N) a; }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 o* ?1 B. P2 |) M
  67. ) S, z+ D+ k6 y$ b$ V
  68. dma_addr_t dmaphyssrc1 = 0;( G# U+ F! T" U" x: H! Y1 r
  69. dma_addr_t dmaphyssrc2 = 0;
    ! |4 ]3 b& n1 t, g( W" H, P8 [
  70. dma_addr_t dmaphysdest1 = 0;( u' f* _" d( l: U$ E
  71. dma_addr_t dmaphysdest2 = 0;' b, v4 y+ d1 l0 S3 W. ^
  72. . `3 b7 K: T1 d0 F' t
  73. char *dmabufsrc1 = NULL;
    9 \0 j8 n( \6 A; G; Y8 _7 @
  74. char *dmabufsrc2 = NULL;$ q6 f' y; I: C+ o9 U! u7 M
  75. char *dmabufdest1 = NULL;
    ( l0 O7 }4 O+ M5 ?
  76. char *dmabufdest2 = NULL;
    / S- U9 e' U$ C9 f8 o

  77. ! R" G+ E* n% G- c5 d
  78. static int acnt = 512;( w$ D$ K! m4 x2 g& w2 v& u
  79. static int bcnt = 8;( `8 N+ H5 y$ A, d' w* `5 |2 u
  80. static int ccnt = 8;
    & Q# r4 L6 r+ x0 z6 h6 r! m
  81. & f; Y% d, T* h% U4 X
  82. module_param(acnt, int, S_IRUGO);* ?3 Y" S+ O* t
  83. module_param(bcnt, int, S_IRUGO);3 }( M+ m+ ~8 V8 c6 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 x1 Z- G, I- j7 j1 L( N3 r/ z' M. l& W- P6 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ a0 m" A4 @. W0 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ G, g3 h( |& t+ w- J4 C( b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ w8 [6 ~( {% @7 }3 t# z
( O2 Z6 M" ^7 K: @5 N3 i* M8 a* X9 k2 D$ O: d! M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 09:28 , Processed in 0.039730 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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