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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! j; ?# N5 p0 D( A" i; y- H$ c
  1. [code]EDMA sample test application1 z8 J7 _7 Q& Q5 p% y
  2. /*
      q1 e8 N: i- B8 f5 K% n
  3. * edma_test.c
    * a2 h9 Y2 a+ Y5 X0 F5 [
  4. *
      I5 m6 G$ M5 M- Y
  5. * brief  EDMA3 Test Application
    : O/ d( j, B3 ~+ C' l. Q
  6. *! ]; F6 \  D7 K) f4 `
  7. *   This file contains EDMA3 Test code.
    5 k! }5 `4 k/ F6 _5 R" ?  e# z; _
  8. *
    ! X  H" P) I; v8 B% x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 i; H' f/ B2 _& i' V& i4 e/ p8 C# T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) |6 i0 u& A: c9 ~. I
  11. *         TO CHANGE.
      s8 p& H+ U$ X$ t
  12. *6 u9 B' T- p8 |  ~9 ~' j! I0 _. l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . @/ B8 S6 d/ J
  14. *& o7 d7 `; z& Z$ D
  15. * This program is free software; you can redistribute it and/or
    3 q' \! M3 Q3 `& [
  16. * modify it under the terms of the GNU General Public License as$ g1 R5 [: \% l% t& e  p+ G* y: R
  17. * published by the Free Software Foundation version 2.
    + Z5 f+ \# F3 G# J- ?, \* c
  18. *' ~, @' ]! ^& O3 A: n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ M' m2 N2 M7 p% K5 A1 F# P! ?& l% k
  20. * kind, whether express or implied; without even the implied warranty( ~+ x/ E3 B; N5 O0 f' n! L8 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ Y) L) ?: [6 Q$ i" s
  22. * GNU General Public License for more details.- @! J# E  g/ q5 t+ k
  23. */. B0 ?7 c" C9 J4 Z" F$ s3 I

  24.   O1 Q6 O. O) A9 l
  25. #include <linux/module.h>  M: n, V7 s( e7 }- s4 }
  26. #include <linux/init.h>9 V. X* F( `4 h7 g" I) k
  27. #include <linux/errno.h>
    , v- s' {3 B0 D! A8 T
  28. #include <linux/types.h>
    $ O2 e/ }1 n- ?$ l& m' z
  29. #include <linux/interrupt.h>  X8 q* l/ G# i5 c, i* o9 L
  30. #include <asm/io.h>% T( T4 G& x5 p0 w- I. R" N: i% R
  31. #include <linux/moduleparam.h>
    & f) x. G) u" ?* D" A# Z
  32. #include <linux/sysctl.h>0 W. x% C3 Q  ~2 M
  33. #include <linux/mm.h>
    - E% Z$ q, [0 M( O* _/ n
  34. #include <linux/dma-mapping.h>6 }8 I) Y! v2 ^, L

  35. # i+ b  _7 O! B0 O; G- S9 J( `: E
  36. #include <mach/memory.h>5 X2 G' O. X2 ^' e6 Q8 z
  37. #include <mach/hardware.h>1 q% q* F, Q4 D( @2 w1 V
  38. #include <mach/irqs.h>
    . B9 w% g- I4 }/ G7 V& s
  39. #include <asm/hardware/edma.h>
    + ~, W/ ^8 t2 g8 T% _
  40. : T8 V* c/ v" N9 a  s# E) q
  41. #undef EDMA3_DEBUG; N% w% K1 g2 A9 P) a+ e
  42. /*#define EDMA3_DEBUG*/- y, w3 k& C& f+ I1 F- c# Q' ]0 H

  43. & ~/ |( s' q; a( o% E/ d( `
  44. #ifdef EDMA3_DEBUG
    4 C1 U  o! ?2 |# f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* [, l/ `% v$ @  n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 v: o& S% A% y. K, p' ]7 l! }: [. s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& i9 d! F# J: G8 N, j9 v
  48. #else3 H4 @3 j1 i, G* G+ A
  49. #define DMA_PRINTK( x... )* V0 q. y% \3 Q% t8 ]9 w7 d. d
  50. #define DMA_FN_IN
    % L, Q% z, j7 _+ j9 ]& J& C& g
  51. #define DMA_FN_OUT8 @& o2 D. l0 r" Z
  52. #endif
    ) m! _1 l4 e: S+ I3 p

  53. / \$ R- B, Q- c1 B' ~$ P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) z! i8 v3 K# F4 P6 ^; C
  55. #define STATIC_SHIFT                3
    ' [2 h* B; E+ z' z. P- r+ U7 \
  56. #define TCINTEN_SHIFT               20* E$ V: l# R# `
  57. #define ITCINTEN_SHIFT              216 {! j1 ?1 x- W& E7 s6 [0 J
  58. #define TCCHEN_SHIFT                22' k- t4 c! |: t
  59. #define ITCCHEN_SHIFT               23  P2 n9 |) M! _. R# L$ I

  60. " A8 {7 P1 v4 O# l& S5 J, y
  61. static volatile int irqraised1 = 0;9 ?$ J# O. Z* R/ f0 h, Z  @
  62. static volatile int irqraised2 = 0;
    8 H/ ~6 M' c* }, L& _( y3 P7 D9 a( {

  63. , f$ t3 y# ~$ a2 J/ n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L. _/ Y2 l3 T( S8 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; b+ q, T- k% `& Y, f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 K' ~# n4 ]! \- P' |3 h/ f
  67. 1 J5 l% u& W& m/ V# D2 w9 o
  68. dma_addr_t dmaphyssrc1 = 0;
    2 Y: ?0 t$ k. m: U9 F
  69. dma_addr_t dmaphyssrc2 = 0;
    : S/ w+ ~3 T" l4 ?
  70. dma_addr_t dmaphysdest1 = 0;' \+ v& A# ?  k; ?8 z: e& L
  71. dma_addr_t dmaphysdest2 = 0;0 S8 ]/ L3 L6 s* n3 c
  72. & N" B) m0 G6 r9 K! U; A& W
  73. char *dmabufsrc1 = NULL;
    2 }* s1 s5 ^" J' s* a
  74. char *dmabufsrc2 = NULL;* d! C6 G# C% q8 i% E
  75. char *dmabufdest1 = NULL;
    % ^8 D; {1 B# k7 F3 Y8 {9 X* \/ D9 t
  76. char *dmabufdest2 = NULL;
    " ]8 l9 ^0 @6 X# G" p8 t" Z3 @

  77. 8 @+ R- X8 M( P; w" x2 i& o, G# A1 |
  78. static int acnt = 512;
    : L% h1 G! [$ U5 O; j2 |9 e
  79. static int bcnt = 8;/ j1 W% h! H5 U
  80. static int ccnt = 8;
    2 r3 `' S4 o. F

  81. % r3 q* g; p3 [8 `4 h
  82. module_param(acnt, int, S_IRUGO);5 b- L: r" @2 k+ i6 L
  83. module_param(bcnt, int, S_IRUGO);9 S9 m1 M* O7 f7 f+ N. x5 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ _, \8 d- Z9 k" b! m* Q  T$ f" q0 \9 [. k' y: j/ L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* W! ?0 f4 C; W3 V/ r* Q: Z$ Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; T, S3 `, t' Q7 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 e' J5 H1 V6 V5 {! |1 o+ U+ M! ]/ S9 t) `( l3 F! l$ ^# S* S$ g

) }9 `0 k7 a1 H+ n: z5 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 09:07 , Processed in 0.042625 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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