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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% q$ S; u7 E. j% z
  1. [code]EDMA sample test application
    . g6 N* d8 t/ y: V3 V5 r. R
  2. /*
    & d% m2 S7 ]% w. x; k/ X
  3. * edma_test.c
    9 I0 Q; k. X7 H) m* q. _% X
  4. *5 Z; G# J% R0 ~! X; \0 j
  5. * brief  EDMA3 Test Application
    ' @# ]  i9 F$ P. _
  6. *) V0 R( J# l5 U; r& C
  7. *   This file contains EDMA3 Test code.1 X7 c& V% V- @! I$ m# e
  8. *
    4 E% w, d& z$ m$ _) ~8 {  G9 x5 ^0 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 L2 V8 c" _: H3 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# R& V- y4 M3 w* {9 N0 M3 @
  11. *         TO CHANGE.
    8 V7 ]' B+ }7 B# l5 ]8 Y
  12. *, V& x; r# @% B: v' F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 o. ~' Q- h8 I( z6 b0 [9 \1 [
  14. *3 E$ B- |6 d5 x( {9 s4 N
  15. * This program is free software; you can redistribute it and/or
    0 |+ V' @( H9 f/ ~" g8 f
  16. * modify it under the terms of the GNU General Public License as
      s2 f$ g. V( H; W  r
  17. * published by the Free Software Foundation version 2.
    - H+ B0 p) x3 \
  18. *
    + S- s; L" s9 D% k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' Z6 Z! W$ R# v. O# ^( @
  20. * kind, whether express or implied; without even the implied warranty) `! v) d2 [) I( |* m6 J; {* Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 [) u! }$ G9 x# y! B& [6 O# B+ s
  22. * GNU General Public License for more details.) `% \' X  P, l( d2 k* p
  23. */' P' Y0 X/ o/ Y1 p, I

  24. ( }7 p/ g# Q2 Q6 R
  25. #include <linux/module.h>
    " S1 N" N( h, U( L$ i
  26. #include <linux/init.h>- c7 z/ b+ x" w
  27. #include <linux/errno.h>
    / ?7 }+ L1 J% D$ z9 a
  28. #include <linux/types.h>
    6 }; E/ j0 e  N8 R  Z+ P# M
  29. #include <linux/interrupt.h>" t8 F4 l4 w4 C7 j( |7 U
  30. #include <asm/io.h>) `; I& H! {9 `
  31. #include <linux/moduleparam.h>- J- c8 G$ |8 p2 T) P/ s
  32. #include <linux/sysctl.h>
    9 L4 B& [- x: }- a* Z" y$ @/ p0 |
  33. #include <linux/mm.h>
    7 i2 Z7 u( M# B2 h3 o0 ?- p
  34. #include <linux/dma-mapping.h>  l! B& A5 T+ N( }% H

  35. 6 ~5 |( G& v7 t9 s: M% C: ?7 C' L
  36. #include <mach/memory.h>! X1 h; s. l1 u4 i# K
  37. #include <mach/hardware.h>
    ( n' j! H2 w' B$ u
  38. #include <mach/irqs.h>
      w% d5 U3 ], {7 b+ ^  Y7 F# R
  39. #include <asm/hardware/edma.h>
    5 I* e5 V* n7 f# B$ _7 y  l
  40. # l3 t. n0 J2 F7 w! s7 K
  41. #undef EDMA3_DEBUG
    7 c8 e6 l; e% [2 U( M
  42. /*#define EDMA3_DEBUG*/& K0 D6 S1 K8 W8 \# i. d+ g0 O- \  u
  43. 5 [! x. g" J" G0 L4 d0 t
  44. #ifdef EDMA3_DEBUG
    ; d* N' Z) R; h6 ~, s( ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & ^/ {  s2 G! ]& K6 e# g3 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 T5 F' E7 A1 R' k3 C& Q) k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! A: _& E8 O7 ^4 T, r
  48. #else
    2 P2 J/ {2 F. M8 I/ ~
  49. #define DMA_PRINTK( x... ): {8 W! @4 `, n- J# i' ?
  50. #define DMA_FN_IN
    % y8 _0 ^. {' D
  51. #define DMA_FN_OUT/ J7 v# m* g/ x, Q$ Z
  52. #endif4 g5 `, \( r+ V  O5 F9 y! H

  53. * h3 p! x* U- n. g( T- k/ m) n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) w8 Y* h- B) g0 v. ^( M2 G9 X8 Z
  55. #define STATIC_SHIFT                3+ z0 N/ \3 K6 ]5 y  S0 U; i+ L
  56. #define TCINTEN_SHIFT               20
    " q* U" K3 |0 w# I! S; z
  57. #define ITCINTEN_SHIFT              21
    ( }! |+ B/ B9 p, q' f+ v
  58. #define TCCHEN_SHIFT                22% E% h" \3 {5 }8 Z$ A. k% T: y2 m
  59. #define ITCCHEN_SHIFT               23
    2 |/ o6 z  N& a  i7 M- _

  60. , B* u2 A8 Y% X$ ?% u9 p; A
  61. static volatile int irqraised1 = 0;% H7 Q6 [; A6 [, U- }
  62. static volatile int irqraised2 = 0;8 j2 J0 u+ K- K+ e3 G3 Y
  63. , P! K( O& j* D( `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% _% J* y' I( y0 R1 b- K8 D! K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; |$ U' J9 P8 z$ f8 j7 z: {  i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : d. B$ t; O, B6 P2 e

  67. 5 @+ @6 ~. z: J- U( H5 I( K
  68. dma_addr_t dmaphyssrc1 = 0;
    , q/ g: d: r* q4 y$ i, h5 Q- D
  69. dma_addr_t dmaphyssrc2 = 0;9 L: s6 l6 S$ T* Y5 o
  70. dma_addr_t dmaphysdest1 = 0;) p$ T) u! e# A2 a# N8 r1 k
  71. dma_addr_t dmaphysdest2 = 0;
    ' p$ g7 ~9 z* Y0 e
  72. 4 U& s* n. i( }
  73. char *dmabufsrc1 = NULL;/ `) x( e5 V/ T& K3 g  g7 u
  74. char *dmabufsrc2 = NULL;
    + @& V3 C! c" [
  75. char *dmabufdest1 = NULL;
    + V$ Z" F6 [! Q
  76. char *dmabufdest2 = NULL;, w, p) d0 y1 r6 V6 o
  77. # m/ j  ]( h$ l! x* Z+ W
  78. static int acnt = 512;
    3 y% z6 E1 }" c0 ?* N! ^# T
  79. static int bcnt = 8;- {& W2 N. {' C
  80. static int ccnt = 8;
    ' F  A( ?' `* ]! e/ b1 w% v- p: N% y
  81. * p5 t! z6 d& A9 t# `4 I& K
  82. module_param(acnt, int, S_IRUGO);) \# O# `7 A2 S
  83. module_param(bcnt, int, S_IRUGO);
    0 Y" r  }9 u7 C& C6 L1 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ k  M$ e# ~, M. g
# e# k& v' ~0 J2 \" K( R' w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' x6 b& I6 K) @% Z' [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) M( B. K) [- z/ I& ^0 {; A; ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ l3 r+ J. A9 O# }  P0 i7 [
0 @( j: H$ r9 _( K
9 J' k# L: T& x' |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-13 10:25 , Processed in 0.040564 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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