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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 j4 @% U& ?3 O$ f. t' E
  1. [code]EDMA sample test application8 a! L+ z8 q8 n0 N( G% h0 u. E2 P
  2. /*, z3 L. K. `0 T5 Q
  3. * edma_test.c
    ' q2 d) n  X* F( ~# H9 q7 U, k% c
  4. *
    2 G9 S/ n' m/ X7 y( W
  5. * brief  EDMA3 Test Application
    5 w* c# r1 l5 P* x; O
  6. *
    9 Q- J& G8 |9 I& y
  7. *   This file contains EDMA3 Test code.% O( W* f  s6 z4 R( ~
  8. *
    ! j0 D8 M1 Q2 `) b3 R, y* L2 e" H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 L- k9 r% i4 X/ d2 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - p# X1 o  P3 g% G& g
  11. *         TO CHANGE.
      H; {: J& ^4 \% y1 T% K8 e: _- i
  12. *% V( H2 v2 L( \3 x% T# M9 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , O# q6 n) R( z. f6 _
  14. *6 ^- g- w, u/ U- h/ L
  15. * This program is free software; you can redistribute it and/or
    " e0 P9 `* \9 ]) Y
  16. * modify it under the terms of the GNU General Public License as$ d& T" Y' S- {2 F6 q: m
  17. * published by the Free Software Foundation version 2.
      o1 B7 ~0 e( R1 `% U  E
  18. *
    , f$ p+ q8 r. j' ^% i+ c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . W1 q  `, t. e5 F& g9 r' D
  20. * kind, whether express or implied; without even the implied warranty3 t/ b6 W  D* ^: ?3 s5 |3 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% c+ P6 m, \9 z. ^5 [9 @
  22. * GNU General Public License for more details.
    0 ]1 v: f) I  a  P. t5 B( }* S+ q
  23. */
    / V+ a) j0 e5 u7 g5 G; H7 j2 Y4 u6 C

  24. 0 G5 h9 b1 j# F6 X
  25. #include <linux/module.h>* m; n, V' i1 X8 k* G
  26. #include <linux/init.h>) o" j/ |9 [5 `: c5 @; ^
  27. #include <linux/errno.h>3 `" p0 W. R. D
  28. #include <linux/types.h>* x* h4 W9 C! |/ }! j
  29. #include <linux/interrupt.h>
    ; U) l  ]0 k* z! x5 P
  30. #include <asm/io.h>
    ( \) M1 M* M8 [; n: q
  31. #include <linux/moduleparam.h>6 t( I3 M. ?, c" G5 J/ M
  32. #include <linux/sysctl.h>, d# D) A" {7 @
  33. #include <linux/mm.h>
    - ]' l) T% r5 U5 ]3 Z8 J& ]
  34. #include <linux/dma-mapping.h>+ n# a5 H9 e6 ]6 l8 L  S1 @( K

  35. 4 F% T; q1 c  d5 c9 n& }& f# z
  36. #include <mach/memory.h>: W5 f: @" S+ b9 E7 a3 @1 Q
  37. #include <mach/hardware.h>
    6 M* E; e4 _6 j6 R, z
  38. #include <mach/irqs.h>/ o% [2 k% g: P# z* B. y
  39. #include <asm/hardware/edma.h># E8 L5 M' x3 H  g' y
  40. . q9 H  p* |- w" ]+ t9 x, Y
  41. #undef EDMA3_DEBUG. U5 T( j! D' s: G
  42. /*#define EDMA3_DEBUG*/
    , [0 x7 u6 F8 N+ U

  43.   j! `0 P! d  I4 t, X* v( \, i
  44. #ifdef EDMA3_DEBUG" }& C7 G8 y' S, u, k/ h1 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 |& C. H- G& s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : t  q+ T2 k0 R4 j0 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 f' @/ d4 u& C/ w* K
  48. #else" ?% T9 H- q, I; X* ^, ]
  49. #define DMA_PRINTK( x... )4 c3 N- G( D% R" D8 p
  50. #define DMA_FN_IN( C0 |1 F1 z3 M$ Q8 i  v' G
  51. #define DMA_FN_OUT
    7 E( ]4 N$ ]; F$ d. X3 Z
  52. #endif% y* f* @  \4 [6 G
  53. # Q  T" S5 X# P9 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( `! u7 g2 B: v, N9 @: \0 U: C2 X2 ^! _7 T2 h
  55. #define STATIC_SHIFT                3
    / g  \4 z) T% ^' o
  56. #define TCINTEN_SHIFT               20( c* \/ \" Q& w" u3 O+ k; p% Z( P
  57. #define ITCINTEN_SHIFT              217 _; e8 {+ E3 g7 g) j
  58. #define TCCHEN_SHIFT                22
    - R% U3 N2 B" ~' b$ R% S  b
  59. #define ITCCHEN_SHIFT               23
    & ~* i& m1 [6 w5 U  x. O
  60. 6 S+ G- L) V9 T& F. m& h. d$ F0 ?
  61. static volatile int irqraised1 = 0;$ G! j" A2 ]4 I. X
  62. static volatile int irqraised2 = 0;2 d( ?8 K! d8 E1 N- n  n

  63. 2 K6 e9 v4 y' s+ z$ D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! i* h/ T8 [  S) p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ w. r! H; j. ^" ^1 N: D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % X, ]' Z/ f- X9 F# x3 ~; E8 k
  67. - ~0 R0 b. a3 K: z6 G
  68. dma_addr_t dmaphyssrc1 = 0;/ g- i; h  A+ v: p7 R2 T2 a
  69. dma_addr_t dmaphyssrc2 = 0;
    : n' U0 z8 {! G  k( n
  70. dma_addr_t dmaphysdest1 = 0;
    / e/ ?/ L( @3 ^& W, d, D
  71. dma_addr_t dmaphysdest2 = 0;! `. r8 ]" ^7 l, `/ M: K

  72. 5 n8 B$ W$ N$ L* L
  73. char *dmabufsrc1 = NULL;
    & `. p4 e8 `5 L" Z) [7 m
  74. char *dmabufsrc2 = NULL;2 y6 b1 r# b, R6 r* ~
  75. char *dmabufdest1 = NULL;
    5 z$ z6 \1 n- D/ `+ i4 E8 i
  76. char *dmabufdest2 = NULL;, @' T; {9 X3 w' W$ v  z
  77. 4 e7 s2 J; p  n4 k6 }+ q* M  M1 d
  78. static int acnt = 512;
    ( n9 |( H9 f: k
  79. static int bcnt = 8;
    ) W7 D8 p0 z& ?5 o, d. m' u
  80. static int ccnt = 8;
    & m+ y( D) Q& x2 C+ n- `

  81. 2 }/ v; b6 h! R8 {( W; ]1 L
  82. module_param(acnt, int, S_IRUGO);
    & y8 c5 c+ w0 D* L& D
  83. module_param(bcnt, int, S_IRUGO);
    * V+ q) ^( B' @$ V) |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( [# k" k# J' U. r* d1 _' v8 l
% t0 Y* B0 V$ _. Q- t$ R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' C8 g- x3 M. t- `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 D5 y% Z' [+ I' t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" i. ]8 G# n# s3 O+ S( s# m  a

: J. f6 o4 e7 Z) y# [" t) y# T- X) Q- \7 r6 Q$ a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 07:14 , Processed in 0.045601 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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