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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; g4 S/ I# J9 O  r
  1. [code]EDMA sample test application
    ; h( K( O! J+ R  p
  2. /*  H: d1 y% t4 m& t* i2 d! r
  3. * edma_test.c
    9 K7 P2 i3 {% m* e, j
  4. *4 s2 U! S6 Y: X5 E, N' j" ?3 p
  5. * brief  EDMA3 Test Application
    " B' s& ?) v& `: h( s0 S& e
  6. *
    4 t  J! U! r! x2 F# J* Q5 W
  7. *   This file contains EDMA3 Test code.$ J) n3 I3 f: c( B
  8. *
    1 f7 k6 ^) A4 N1 q4 U$ [2 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, F% S; ]( B9 I& J$ [- m8 p, r8 W2 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 s! u' Q, D8 e3 R; N+ D
  11. *         TO CHANGE." W' i% H$ B& a7 u9 k1 j
  12. *
    # v4 J" V7 _* d5 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- A; }+ h/ I# }
  14. *( {4 B8 f$ D4 u+ W4 H  j! g
  15. * This program is free software; you can redistribute it and/or
    $ F8 Z# ?: i0 F9 ?" M
  16. * modify it under the terms of the GNU General Public License as
      `' P5 l" X8 J" `! z% V
  17. * published by the Free Software Foundation version 2.5 S& G) z2 }: b& e1 Z
  18. *
    2 {1 O9 ~+ n" P% Y' c& l" W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 W# x$ P/ L9 L) P3 j/ o
  20. * kind, whether express or implied; without even the implied warranty% l1 ]2 G) @& O4 ^( B) D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, Q9 S4 x$ z: i3 V6 m  k0 x
  22. * GNU General Public License for more details.+ L( Z6 V8 M' u) n! ^3 I  k
  23. */
    % w6 x- F4 {/ w$ z' m4 t/ G

  24. ' M% A- d- I6 g6 Q' q% E3 d
  25. #include <linux/module.h>
    7 F' r" O4 m3 g3 h, Z
  26. #include <linux/init.h>
    ' {- z$ ]5 I/ A8 |/ E0 O) _5 m/ s
  27. #include <linux/errno.h>
    # }; ]+ _( y  J3 [' z6 x$ Q2 `
  28. #include <linux/types.h>
    - S5 _* L  Z$ x& ~, m: }
  29. #include <linux/interrupt.h>( E* X$ u8 _: \& m8 q) H
  30. #include <asm/io.h>/ P0 @3 V6 `/ w* c
  31. #include <linux/moduleparam.h>
    5 O, _8 D4 |1 r0 w, [$ F) b8 _
  32. #include <linux/sysctl.h>
    # j$ Y6 q! c0 U, z  R2 T
  33. #include <linux/mm.h>
    " s% h9 K8 E6 n
  34. #include <linux/dma-mapping.h>
    . V+ G: l; X7 \
  35. ; o; [8 V$ k3 O/ j" X& m* }
  36. #include <mach/memory.h>
    0 K/ ]# u7 [# U3 s3 ^. f% ?
  37. #include <mach/hardware.h>
    ' }  I0 ]( ]& q) B* c0 M+ d- z/ ]
  38. #include <mach/irqs.h>
    % @9 D1 m2 O! s8 L! E* E
  39. #include <asm/hardware/edma.h>
    . t9 O, _( A3 y/ g. l; N2 ^# ~
  40. 3 W  V. j5 |, w% J
  41. #undef EDMA3_DEBUG8 l( Y; u/ e- l. B+ |
  42. /*#define EDMA3_DEBUG*/! q; i  H! B4 J+ ?# H5 h/ `

  43. ' K$ D1 G2 j/ h5 ?1 }# y
  44. #ifdef EDMA3_DEBUG
    7 ?9 B% A4 I9 ~9 k; a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& r/ U. n3 l3 W8 O  L3 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) F3 q1 C/ r7 x5 r, Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 w0 y% Z* i2 D! G) d: D
  48. #else
    ' g+ U7 L7 E" S5 W2 D& Z, z0 E2 K
  49. #define DMA_PRINTK( x... )3 u' O5 V. L* V" Q
  50. #define DMA_FN_IN- i! o. ^% L0 f6 S9 R
  51. #define DMA_FN_OUT  T, K7 E# `3 u; ^0 U, _
  52. #endif
    9 ?' J7 f: t$ r; j  R# l
  53. % y( ?$ F" V  y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); S- b* t* P! b- h% M
  55. #define STATIC_SHIFT                3
    8 K: ^; K, @5 b0 \- o% z
  56. #define TCINTEN_SHIFT               20* c# ~3 `3 Z; e. w* P! K
  57. #define ITCINTEN_SHIFT              21
    4 Z' P% {5 o! v5 |1 r4 K
  58. #define TCCHEN_SHIFT                22- h! f& F: W: ?9 V9 s# s
  59. #define ITCCHEN_SHIFT               232 I: E$ x- c( n' v( i% Z! j" r+ N
  60. , B& ]" {0 ]$ F4 c# p) [6 K; N
  61. static volatile int irqraised1 = 0;
    / L1 J4 e. h9 s# C0 x, k
  62. static volatile int irqraised2 = 0;
    6 }4 I6 J" ?/ \2 B0 X/ |7 Q- k
  63. ! G1 T9 y- X9 J- |: P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& F  r7 e7 o2 j9 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * p1 d! i* B# `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 o1 e7 p$ |  B6 n! l
  67. 4 k# u9 t+ F- ]/ b8 z
  68. dma_addr_t dmaphyssrc1 = 0;5 M( _- ?8 B8 e1 T0 q# H6 u+ {6 X; @; f
  69. dma_addr_t dmaphyssrc2 = 0;- O- B7 B9 u& j" h7 \
  70. dma_addr_t dmaphysdest1 = 0;
    * V8 n9 r6 i5 i5 @/ \1 k' ~
  71. dma_addr_t dmaphysdest2 = 0;
    ( \# ~" O8 a/ m* ]0 H0 m1 h

  72. ' m, j% _7 n( z2 ?+ j' r
  73. char *dmabufsrc1 = NULL;: o6 \* A& G2 t3 y  a
  74. char *dmabufsrc2 = NULL;3 S% ?% k( c  y2 v3 a1 F
  75. char *dmabufdest1 = NULL;7 n- i* w7 s% F, ~
  76. char *dmabufdest2 = NULL;2 l' Q% c/ o$ D4 y" `

  77. & [+ o  I$ R1 }: y# F: M! s
  78. static int acnt = 512;1 p0 G7 P6 C5 h! t9 ^8 c6 k
  79. static int bcnt = 8;6 S8 A2 ^  o5 Q3 b% H
  80. static int ccnt = 8;
    7 x7 v7 U8 D& C( `/ u0 Y$ T
  81. 4 v0 R3 G: R6 {
  82. module_param(acnt, int, S_IRUGO);6 |  y) |  Y$ _5 W* G
  83. module_param(bcnt, int, S_IRUGO);+ T' ?1 Z  W+ p# T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 s8 u9 X) R5 \8 q- U( ^1 u9 K4 c3 f2 \$ Q& b3 w7 U4 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; X" `; K0 K2 [  A% P6 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 Y# a; z. O8 ]- W% o7 W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) D7 c  f5 X% ~6 y. x$ `- ^' a9 y( k( E5 w

, I) }# T4 T) x1 ^7 Q- u$ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 11:57 , Processed in 0.042312 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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