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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 O7 S; h0 U! t* P; N/ M
  1. [code]EDMA sample test application
    & {) {7 D3 H) @: y" S
  2. /*7 V/ \! c6 r( t3 |/ o
  3. * edma_test.c: P0 D9 r1 f1 }: X
  4. *" n( [- c/ P8 w- i( {2 L. N( K4 D
  5. * brief  EDMA3 Test Application
    ) f8 e' g: |7 B8 c. [
  6. *0 m1 u; r. E1 ?. v  h; A2 v3 Q& B
  7. *   This file contains EDMA3 Test code.$ I3 p) L5 ^- M( c7 L/ c
  8. *# x5 X$ i/ ~8 k7 {: ~: R$ |* ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ k' u! T$ g' V# W; M5 z  {& b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      f4 a! d% J0 a, P
  11. *         TO CHANGE.
    / O8 t" p& [; X1 g6 J
  12. *
    + {) J* d7 R9 n2 Y* \+ [+ z& E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * [) j0 g( {+ y$ m( Q2 ^
  14. *5 O) [# C$ {! c& }2 _
  15. * This program is free software; you can redistribute it and/or
    3 p$ t+ e, Z0 J* ^5 r" o9 O
  16. * modify it under the terms of the GNU General Public License as
    + o; q$ G6 S0 M2 t+ I
  17. * published by the Free Software Foundation version 2.
    # V2 F$ M- E$ Z+ w' @( S( V. _
  18. *
    ' g$ M, @0 e( @, M, M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 k2 q. R0 f1 Z. Y
  20. * kind, whether express or implied; without even the implied warranty
    & g1 L  `; a2 B1 f" D2 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 z% M3 S: `$ i4 o, ]5 f
  22. * GNU General Public License for more details.# B: ]6 L% N) G8 y
  23. */
    ; r/ m) z; n2 K0 I$ Y
  24. + C7 j1 X, W6 k2 I3 ]9 t
  25. #include <linux/module.h>
    4 y9 W9 K6 E& a6 G+ R9 {+ @
  26. #include <linux/init.h>
    % x/ P/ E- ?0 T" V7 o
  27. #include <linux/errno.h>+ n+ ?" y0 ?2 Y$ ?% n
  28. #include <linux/types.h>7 ~1 K1 L- {! P# O/ E; K
  29. #include <linux/interrupt.h>4 R5 a3 d. C2 S3 e9 J
  30. #include <asm/io.h>
    7 Y$ @% A$ j* D
  31. #include <linux/moduleparam.h>1 _  M; _# U+ N  T
  32. #include <linux/sysctl.h>; Q5 y  y& E# I' o  `( Z
  33. #include <linux/mm.h>  ?5 C) D  t8 W+ q
  34. #include <linux/dma-mapping.h>  [: f) P, S  q1 s! [7 K5 ?$ `
  35. + F$ |* E) t; v
  36. #include <mach/memory.h>% ]# [; w1 b3 F8 A+ [8 a- l+ [
  37. #include <mach/hardware.h>; F, D' F. e3 i4 e* Z7 m
  38. #include <mach/irqs.h>* B8 ?  y" D0 ~) M1 @
  39. #include <asm/hardware/edma.h>
    0 {) S2 s+ |+ l+ L: e' j" U0 x
  40. 7 ~3 F# s( n9 z; [9 b3 |
  41. #undef EDMA3_DEBUG
    : k1 l# U# b/ C6 P- c
  42. /*#define EDMA3_DEBUG*/0 R. D+ z, _; Q' t+ K, M
  43. 7 H, r: k( m: J3 [
  44. #ifdef EDMA3_DEBUG
    4 {( o4 @4 |( c  ~* j' Z5 E6 D4 E% R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' z# b& ~; ]& v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 s! ~+ U6 S; T' I  O0 B, @+ O' }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * |: `  V5 l: w1 m8 `
  48. #else
    5 o+ h9 B6 n- o  K
  49. #define DMA_PRINTK( x... )
    ; Q% F! @* R$ \' J
  50. #define DMA_FN_IN: G2 \( D4 a2 u: Q) m  b$ J. n
  51. #define DMA_FN_OUT
    ; |' B5 ^$ Y, E& B
  52. #endif& L' U8 Z9 }2 J. c

  53. % A! p- {4 }1 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 j- H! H4 ]0 D3 {
  55. #define STATIC_SHIFT                3
    ' Z) i5 w( F3 N5 W6 j$ ~# S% W& E
  56. #define TCINTEN_SHIFT               20/ o6 k- e& u2 L4 N7 E: c
  57. #define ITCINTEN_SHIFT              21. y$ ?/ \+ _$ d* U
  58. #define TCCHEN_SHIFT                223 s* ]* n; z1 F, g' r' B1 m2 Y& p' @
  59. #define ITCCHEN_SHIFT               23
    + ?* u/ n- }% ^' O) B% F2 Y

  60. 5 v% g" E* i3 }/ a7 i& V
  61. static volatile int irqraised1 = 0;
    ! _& d/ Y4 k; |4 n
  62. static volatile int irqraised2 = 0;
    , O  A' F+ Z" J# \- @5 ]1 b# t
  63. 6 |2 G5 j# r- W( j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- \& O& \7 }3 I3 G+ D$ }' X' E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D. C/ ^& Z) u$ e: K# F7 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o* G- Z" W( C. P( L  B5 K$ ]
  67. 7 q; a+ |( b+ m: m
  68. dma_addr_t dmaphyssrc1 = 0;# c" E6 L* z* Q' s0 f7 e
  69. dma_addr_t dmaphyssrc2 = 0;8 v4 @& Y+ W0 H" k# b" B5 G* c
  70. dma_addr_t dmaphysdest1 = 0;2 D" r2 m$ ?! X; T& l( c
  71. dma_addr_t dmaphysdest2 = 0;
    : `2 G/ V$ ?3 w0 w0 E
  72. # e0 P: Q8 v# `- P! A
  73. char *dmabufsrc1 = NULL;; O% o/ \  x6 B+ C# \  ]2 o2 `
  74. char *dmabufsrc2 = NULL;; u% ?- M; L2 k% K) Q
  75. char *dmabufdest1 = NULL;
    ' _1 F8 c. U3 ^6 _9 V  Q
  76. char *dmabufdest2 = NULL;
    , [) s4 V, S- H$ j) i: N

  77. ) c: Q) O% T) U( O8 \2 c0 w8 G7 J- B
  78. static int acnt = 512;6 T7 v4 E+ g. B: r, _
  79. static int bcnt = 8;1 ?, a3 D' |7 f1 @1 n" C
  80. static int ccnt = 8;8 L$ ~8 g8 V% w( o8 P) P- ?1 G

  81. 1 M* }* q0 C3 \) c+ \6 i
  82. module_param(acnt, int, S_IRUGO);, @; D3 D0 a1 Z1 `- {
  83. module_param(bcnt, int, S_IRUGO);; p& F  N8 M9 w8 b! ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% G$ \8 Z8 t4 E, d+ m6 N, ^
& `3 O( Y9 G/ ^3 R+ L6 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% |& ]) w; c; u5 E- U) Q1 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 p5 Q5 w0 t$ h: ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 K+ g: S- K* W0 b- g! p: |. u  Q: s8 G$ L7 M" r

0 y' V& U8 b7 o- r7 x0 T/ D9 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-18 20:20 , Processed in 0.037783 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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