OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & e% ~1 Y7 Z2 [" X' k# B
  1. [code]EDMA sample test application- m; m: D" E0 u# G4 F: T7 j* {
  2. /*8 R/ P/ d  J! B
  3. * edma_test.c+ ^# m! u/ X; \! R% A- Y
  4. *# A" p# o# A" m) q
  5. * brief  EDMA3 Test Application
    & O0 T/ z/ P3 V8 P' R, a
  6. *- n; n/ f2 z& Q( o- Y$ r! M1 R
  7. *   This file contains EDMA3 Test code.
    ( r  l- ?! O, r
  8. *
    * E4 l, |3 l  h  \0 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 h7 Y. k  D: p$ V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) U. V$ t/ n% j7 M
  11. *         TO CHANGE./ P6 G- w2 _* h9 s" P. O
  12. *  V. x: r1 d9 S" x2 V0 S4 g  d# G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ _7 V. t0 U! i+ h+ _
  14. *
    4 H  a" p5 D! ]+ Q+ B
  15. * This program is free software; you can redistribute it and/or3 ~( B- E& v5 Y* C3 \8 b( `
  16. * modify it under the terms of the GNU General Public License as$ k) j4 c5 `; d$ r
  17. * published by the Free Software Foundation version 2.7 V  ?# {1 Y! \: S+ n& H( _+ X/ r! G
  18. *) [9 l7 U/ I0 u% P$ J: G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " [4 o+ b4 O( B( \# p9 n# i2 P
  20. * kind, whether express or implied; without even the implied warranty
    & h! T3 i& ^7 u9 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / I  O6 n/ F/ m8 G7 Q
  22. * GNU General Public License for more details.% T3 ?, g, m& c4 }
  23. */5 |) |3 ?2 M' \" G
  24. / y" p, e& i( ^( ^/ g; T# ~
  25. #include <linux/module.h>
    0 d4 g+ W- i% b% T
  26. #include <linux/init.h>
    ) ]2 q# m8 }2 n$ J6 u8 _3 N( L4 O
  27. #include <linux/errno.h>% Y/ ?" U$ {4 f7 p/ ]% k0 u
  28. #include <linux/types.h>9 t" W4 @* ~3 i) T, S
  29. #include <linux/interrupt.h>
    ! _" b1 V- U) x- [2 n
  30. #include <asm/io.h>
    , A, K) n0 s* X7 x4 I" Q' O
  31. #include <linux/moduleparam.h>
    $ P4 |9 g6 w( Y
  32. #include <linux/sysctl.h>
    , I7 h; M) G; m/ M6 n: o. S+ s8 C# S
  33. #include <linux/mm.h>. V6 G" m. H0 m7 M' h
  34. #include <linux/dma-mapping.h>* b3 [1 q. g0 h
  35. % A! e! M- R$ j9 ^
  36. #include <mach/memory.h>& A+ b3 U5 g5 [1 ~8 P
  37. #include <mach/hardware.h>( S+ p  g8 a8 x
  38. #include <mach/irqs.h>/ l3 h' d- [0 E. i1 }3 E( z
  39. #include <asm/hardware/edma.h>
      r8 K* D% J: C6 R- P' _7 `
  40. + G+ f6 y$ Z7 N: n# W
  41. #undef EDMA3_DEBUG0 @! I6 T- G2 U
  42. /*#define EDMA3_DEBUG*/
    8 {1 h; x3 b) e9 X
  43. + D$ |6 [# o. Z: O! E1 D/ V
  44. #ifdef EDMA3_DEBUG
    0 Z& u- X8 S) Y& R& R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 @! X& `: G; s# k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; H1 _, }: h+ C2 f- t3 _* y2 K* p6 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Q8 h% ]5 C+ V; z; i$ @3 }
  48. #else/ J; b1 a5 b( K# Q0 m
  49. #define DMA_PRINTK( x... )
    7 l4 o* @: _9 S" J, g  m" f
  50. #define DMA_FN_IN
    ) h" k7 ~8 j( b2 A. A3 Z
  51. #define DMA_FN_OUT
    - f/ G5 o. K& v( d+ E8 C& z
  52. #endif
    3 F5 h1 Y) X/ P; _; n7 m- o6 @  N4 n

  53. . n6 d* P9 K2 l+ b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # u& L9 J2 X3 l; J
  55. #define STATIC_SHIFT                35 x) R/ s' |3 j# m, B
  56. #define TCINTEN_SHIFT               20! {+ G0 ]; r1 W: v1 D
  57. #define ITCINTEN_SHIFT              21% ~, n( Z( Z5 S8 |
  58. #define TCCHEN_SHIFT                22
    1 v7 B. L! K) |# S+ n* [
  59. #define ITCCHEN_SHIFT               23
    , s5 j% v" v2 `1 W/ d

  60. 5 t8 h; a  H" O; Y
  61. static volatile int irqraised1 = 0;
    % K/ _6 i8 J& c+ w( E' l
  62. static volatile int irqraised2 = 0;/ }- a5 a) S  w" R" _9 c
  63. ! j5 H7 W7 L/ s" B8 Y( Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 b7 _2 r  k5 A6 @0 Y! n/ `4 A) }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 a. c, V$ K, E" d8 X0 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 a; ]8 V% g6 B$ E

  67. 8 Z4 W# X+ |8 o& H
  68. dma_addr_t dmaphyssrc1 = 0;2 `3 P' G' f# R3 S
  69. dma_addr_t dmaphyssrc2 = 0;( O. C3 I. o  O" l% a8 j; m
  70. dma_addr_t dmaphysdest1 = 0;
    1 g8 s3 l5 V) Z" e% V
  71. dma_addr_t dmaphysdest2 = 0;
      |2 B7 o: \2 |1 o5 Z/ y7 W
  72. # F- W9 M& e- @
  73. char *dmabufsrc1 = NULL;( J% }4 \$ y7 Z, L4 S1 R% t
  74. char *dmabufsrc2 = NULL;. q1 i  C5 P& H" e" L
  75. char *dmabufdest1 = NULL;* ?8 p  R8 D" x
  76. char *dmabufdest2 = NULL;8 v% Y% t; ?6 H9 k

  77. 1 l. o& Z! n* d; a0 S+ D
  78. static int acnt = 512;( Z% [2 S! P# q1 j, V7 S8 L" C3 V
  79. static int bcnt = 8;
    - U8 U  Y7 j) b; k; U/ D3 j
  80. static int ccnt = 8;
    # ^3 E  X% ]* D2 ?. G

  81. 2 z- |4 }0 @9 K  X9 B3 [
  82. module_param(acnt, int, S_IRUGO);: r- K' O5 X( [
  83. module_param(bcnt, int, S_IRUGO);' N# r% ?$ |" V6 @  y9 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 S0 ~! W& Z/ u3 `; Z& l5 t( Q& C8 f7 Q5 v/ F( k& b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: j" N, `3 v* O5 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 v  K8 S) R! o, Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# K$ b5 H7 \2 i0 B( f; c; P2 k$ B: R; Z+ l9 u
; w. H9 J( ^* E, p# h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 02:58 , Processed in 0.037764 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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