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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 _7 |4 ~: @& W3 T( \, {
  1. [code]EDMA sample test application1 ]1 K$ c+ {. x
  2. /*
    - Q, d/ U* j) b1 {; N9 \& J  Q
  3. * edma_test.c% R8 A" e8 r5 ?5 F5 D- b+ L+ E+ E
  4. *& O0 g4 |& V/ U7 W8 j) l. i/ s0 [; e
  5. * brief  EDMA3 Test Application
    9 m* S$ ?; c: R; {% ^7 E
  6. *
    - v  U8 |: p9 L; d2 ~
  7. *   This file contains EDMA3 Test code.
    & C. i; ^9 s9 d! M9 E6 S- F* l
  8. *$ S& Z( P$ C: e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. I3 x7 ]+ y/ j; |  h8 G! u0 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& L$ l( N3 e. N& J% X# j1 d
  11. *         TO CHANGE.* y, F& k6 p  W) ]
  12. *" z3 h- v4 Z, s* e, O" r. p# W% [  N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 v) ^: A3 }9 N" z0 ?" C, C. D
  14. *: U! G) |6 W4 r: V' _7 B
  15. * This program is free software; you can redistribute it and/or
    ; z5 W: O% J2 L  U) z
  16. * modify it under the terms of the GNU General Public License as" F0 u0 ~6 D" i1 t1 {& B
  17. * published by the Free Software Foundation version 2.( v3 }0 ~1 x( b, l
  18. *
    / @9 c" r" ^& W* n6 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 P" L* C! g4 v1 h* P3 o  |
  20. * kind, whether express or implied; without even the implied warranty
    ' ]. u0 l1 [7 L* b% ^2 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# A2 d6 d. ~9 I* c! \
  22. * GNU General Public License for more details./ n0 Y+ K7 |+ O) m' J) z) u' o5 E- F
  23. */
    ! o; U$ a+ N7 z9 R

  24. 2 k: W2 W( @* X6 U" g4 t1 v/ X
  25. #include <linux/module.h>
    ( _" F' i; R9 O: c9 E% o. F9 V
  26. #include <linux/init.h>
    & u- q4 y1 P3 k; e) s+ x. `. K. b
  27. #include <linux/errno.h>9 O1 t7 j: r: T' F
  28. #include <linux/types.h>
    $ X1 r1 h# {; D' i* T: B7 _0 u9 p
  29. #include <linux/interrupt.h>' g! m% L: {+ K: |" l0 v
  30. #include <asm/io.h>
    $ h0 v$ ^" f6 t* s+ B/ J& c
  31. #include <linux/moduleparam.h>
    ! k' B. _; w/ c9 @. i
  32. #include <linux/sysctl.h>
    * k1 V8 Z/ {. y* g7 \3 r
  33. #include <linux/mm.h>' g: J3 {% j# g0 u1 K+ b$ H
  34. #include <linux/dma-mapping.h>
      @7 A1 q- j9 n% r  G0 t' o6 E2 h
  35. ' S# t/ K8 t5 N/ p; Q
  36. #include <mach/memory.h>6 z& M) O" B& @- x
  37. #include <mach/hardware.h>
    3 W; A1 z1 \3 a2 j; |' X
  38. #include <mach/irqs.h>
    + Q8 |( @) i0 t  ~9 i
  39. #include <asm/hardware/edma.h>3 z; m8 a3 Q  ?0 D+ b" o

  40. # H: n" s7 N8 n
  41. #undef EDMA3_DEBUG( _' _1 C$ D8 x4 D
  42. /*#define EDMA3_DEBUG*/: S' n3 n1 r  @: d

  43. + s; D+ j3 ~1 L- e  a5 b
  44. #ifdef EDMA3_DEBUG
    4 w- R3 n/ L* k# \1 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : f4 x2 `4 Q3 e" f5 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * [- _2 A/ E. B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! o: S+ B  |% i# c- |0 n* }- e; Z6 B
  48. #else& X2 ~/ U9 q: g( H$ {
  49. #define DMA_PRINTK( x... )
    5 ?1 P0 {/ ]" b* I
  50. #define DMA_FN_IN
    8 ^3 ^2 K, y* t2 ]" w& b6 E
  51. #define DMA_FN_OUT* x$ J" w4 {# x$ w+ [0 a. U
  52. #endif
    ( J) Y3 g4 P) a' B/ p# G) P: H0 \
  53. ; ^" B1 w: H/ s; [  t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 M+ k5 V; z3 H% G. F
  55. #define STATIC_SHIFT                32 z8 m& F# _7 L5 }% I
  56. #define TCINTEN_SHIFT               20
    5 i. w2 ]  m9 F; D* U
  57. #define ITCINTEN_SHIFT              211 H9 E# s# w$ r/ k4 m
  58. #define TCCHEN_SHIFT                221 K' B7 E2 g  |; q6 ?
  59. #define ITCCHEN_SHIFT               23' W# H2 g+ a9 q0 P  p

  60. " y/ X) o! t/ l# i6 A: [
  61. static volatile int irqraised1 = 0;, Y* O4 M& a# L0 L. X9 Q2 Z# k
  62. static volatile int irqraised2 = 0;
    $ c: p' O: j5 r) s# j8 B
  63. 7 M  z8 M/ K8 G) e+ i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, `4 L. X7 \8 k/ J. W1 J* L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # b2 @; p3 j) o9 @+ J& z1 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( G0 V/ M9 v: _3 C
  67. & {, s, g0 e, `0 K6 y* F3 E
  68. dma_addr_t dmaphyssrc1 = 0;3 ]1 P/ p3 `$ s
  69. dma_addr_t dmaphyssrc2 = 0;/ v' V- P; J% p
  70. dma_addr_t dmaphysdest1 = 0;% |9 X  _; ]8 d% [1 Q  i
  71. dma_addr_t dmaphysdest2 = 0;
    ! ?, j& ^' u& E' G9 l

  72. ( c" ~/ r' w' I2 j, U2 L
  73. char *dmabufsrc1 = NULL;% z, `* u5 k, O1 x5 p
  74. char *dmabufsrc2 = NULL;* E7 U9 l$ m0 {
  75. char *dmabufdest1 = NULL;
    , A1 W/ ]* ~" L; _
  76. char *dmabufdest2 = NULL;/ G% \4 M( }9 x1 c# A3 o- o
  77. % I6 D7 F3 }; v9 Z- ?2 {
  78. static int acnt = 512;5 G# O: l7 ^  X& \
  79. static int bcnt = 8;  Z* k9 L) D  Z; W% p
  80. static int ccnt = 8;
    $ L+ _( t, o: z) z2 a- I
  81. " K' n' `& c" `- k. s
  82. module_param(acnt, int, S_IRUGO);. Z, _) Y1 k; [/ t0 R
  83. module_param(bcnt, int, S_IRUGO);+ |2 j9 u/ J0 `. ~) ?- ~# E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 H& \2 I& G" N9 s* l
. i4 ]( a3 r- S7 X% e4 f8 j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ F, o5 h, J1 Q3 v* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ |% i/ \1 l% B* o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% E0 q; N6 }! J9 I3 ]

: h# o4 m4 @6 b% e6 s
7 v! H8 i3 }" `9 t0 s  d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 06:27 , Processed in 0.039818 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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