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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 N: w" V. f5 Z7 P& F
  1. [code]EDMA sample test application/ X# k# ^  H. H$ B; z5 |% d' |
  2. /*
    + j' N+ _0 B4 G& G7 I  C; r
  3. * edma_test.c
    # @. }. }  {) x1 L# p5 G' z- ]# F6 o9 v
  4. *6 }& ]9 [4 K4 F2 J
  5. * brief  EDMA3 Test Application
    0 V% G8 z/ ]) P9 Z5 C( ?
  6. *# J% h7 d6 x; a: t3 I% ^
  7. *   This file contains EDMA3 Test code.
    7 z8 |8 J7 M' D' [7 D7 J
  8. *
    ; t, L6 ?8 S& P3 m3 |. X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 h6 t+ y" y# j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ h! F! ~2 J( l) f) V. s: i6 j
  11. *         TO CHANGE.
    3 d) [2 d* v! c
  12. *+ k& M. M' d' T2 N) Q' t" ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 f  A4 ~; V. B9 S- B) W- t
  14. *8 g" }( x! e& I& N9 f$ `6 j
  15. * This program is free software; you can redistribute it and/or$ x5 X% I' v& ^# i, @8 k
  16. * modify it under the terms of the GNU General Public License as5 f( V( K) u( i9 f. [0 X
  17. * published by the Free Software Foundation version 2.
    6 a0 @- {9 ^2 m
  18. *
      ~' W$ n  j* W- ~* S- Q7 U5 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 S# L4 v. I  K
  20. * kind, whether express or implied; without even the implied warranty
    " ?7 V- U/ M- a1 E) G9 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 B( Z9 A. j; Z2 @  N
  22. * GNU General Public License for more details.: n8 Y8 U5 N" t4 P
  23. */9 h5 N; L6 }5 `
  24. 6 u3 J/ d  n7 L( p2 J
  25. #include <linux/module.h>7 K! _+ ~2 F. K& V2 ^
  26. #include <linux/init.h>
    # u9 \" ^2 z  ~; D: h4 u& W- J
  27. #include <linux/errno.h>
    * d# I' d% X; _2 \7 s! @
  28. #include <linux/types.h>7 r/ g$ c2 z0 O# }: x/ \
  29. #include <linux/interrupt.h>1 o; f6 S) ^9 G1 k2 F5 s$ j% {
  30. #include <asm/io.h>
    ! `: F9 U4 ^; W% j
  31. #include <linux/moduleparam.h>1 _# R% `+ W/ X; H) A
  32. #include <linux/sysctl.h>
    . d+ @6 z5 A& |1 U6 L
  33. #include <linux/mm.h>( v7 Z* z7 I5 {# e) \
  34. #include <linux/dma-mapping.h>
    7 f. z# Q; d  ?
  35. 6 X  y( B6 S& ]# r6 c# ^; K- j# w% \
  36. #include <mach/memory.h>
    & J0 r: l" c4 ~# K$ i( V
  37. #include <mach/hardware.h>
    : E! M, \' A5 Z1 U
  38. #include <mach/irqs.h>
    + s2 C0 k/ v4 d* C7 z$ Y( D
  39. #include <asm/hardware/edma.h>9 f0 F! r$ a4 l9 C9 q1 d, n  o

  40. $ z0 Q2 D' L; }% n! M. K' g( f
  41. #undef EDMA3_DEBUG0 y% d6 H/ w4 \, \6 E, f
  42. /*#define EDMA3_DEBUG*/
    * }& w$ ?. X& J1 v5 v! ?& R( f5 v( o' D
  43. 7 r/ G- `2 U% r6 n; L. V" P, R4 C( |4 x
  44. #ifdef EDMA3_DEBUG8 l3 O1 |' O5 R% t9 j8 V, O2 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 p: U: ^6 T0 L  Q3 `( @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : g' ?' I+ q" _+ d! Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' D# L0 n" R) M7 j' }# b" S
  48. #else
    . I" |- f. |% }2 [$ E# P
  49. #define DMA_PRINTK( x... ); A7 V6 n( M1 P/ G0 L0 |; o
  50. #define DMA_FN_IN  l- s7 o6 i9 k0 o( M* m4 F
  51. #define DMA_FN_OUT
    2 _2 h' q7 R# d7 J& @' P
  52. #endif9 S3 ^$ X; D$ O% n# U8 T

  53. 5 Z! R* G* k  _2 P5 u4 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  z0 V8 r# k9 _# c5 e! K% c
  55. #define STATIC_SHIFT                3- Q+ r( A8 X1 Q2 U$ i7 o) [
  56. #define TCINTEN_SHIFT               20
    3 u( e& \; m- H" p# J
  57. #define ITCINTEN_SHIFT              21' d- s, ]4 n% v0 o
  58. #define TCCHEN_SHIFT                22
    ' y, K4 m4 {: V; F" e- D- R
  59. #define ITCCHEN_SHIFT               23
    ' B1 U3 F& n) {* T, A% e+ ~* f
  60. 2 C0 I/ ~! e: e! c8 n
  61. static volatile int irqraised1 = 0;
    / R' ]) N' M7 X/ }, P# r  q0 V
  62. static volatile int irqraised2 = 0;+ P" t5 K- `% Z5 P" m
  63. ' V9 b( _& R) g' b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" C* y( Z; C, D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 s+ M" {! a5 z6 A9 v  Y4 T* d: L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " }2 c7 A" w' h+ L5 ?
  67. 7 @& B# @& o3 s6 c8 o
  68. dma_addr_t dmaphyssrc1 = 0;1 a& V8 i  I8 A: q6 \( p. _2 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    7 H6 Y% \1 u" M/ R
  70. dma_addr_t dmaphysdest1 = 0;: W9 \, w. {8 e
  71. dma_addr_t dmaphysdest2 = 0;& Q; h2 Y: Y0 _% E% H
  72.   \; c; ^" d& {) g3 i4 a
  73. char *dmabufsrc1 = NULL;6 }" L5 B. j  w9 F+ f
  74. char *dmabufsrc2 = NULL;
    3 @$ l, O1 W* u, J; ?
  75. char *dmabufdest1 = NULL;# o, B5 X  w, k  A
  76. char *dmabufdest2 = NULL;
    ! f" q1 R& s9 F
  77. * l! R: }7 v5 c' [
  78. static int acnt = 512;
    ) r+ j+ A# t9 w0 |4 j/ q4 v
  79. static int bcnt = 8;
    ' O6 Q. y: e! E% [8 u  R
  80. static int ccnt = 8;" s: N7 j+ y6 Y$ ~# P$ j+ s. b

  81. : M4 E( w/ ^7 d2 F1 j( C. J# \/ X; A
  82. module_param(acnt, int, S_IRUGO);
    , }% q) L. h$ v5 s0 W- J4 Y
  83. module_param(bcnt, int, S_IRUGO);% `3 R* Q6 m( ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 X( z& M* c, y

' w0 E% @3 a0 }  H' Q5 w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ H) ]% g2 `' m4 X. U7 D# ^" c) e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- P; g( D' D9 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- }& e" i7 ]) G) s" B, E$ l2 {& u) U' J' m+ F) a
% i6 a+ X' b2 q% G, f4 N0 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 19:37 , Processed in 0.040449 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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