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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 }# [  W0 J+ Y9 ^3 O, l! h
  1. [code]EDMA sample test application& V9 b* l6 Z" Y" D, \
  2. /*3 e# f; ?' k0 S! o; a
  3. * edma_test.c( r8 h' D% B+ b6 P- U
  4. *; b2 h6 N$ _! n. Z
  5. * brief  EDMA3 Test Application+ ^  B: g0 n' h" o+ M( b
  6. *
    ; a. R2 Y* T; M) D) C, r1 |
  7. *   This file contains EDMA3 Test code.4 Z, n# r6 d* Y
  8. *. J! E& G, d3 ^! R( g1 H  o2 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" O0 o. l1 }3 C) `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + {5 E! k" t4 O& w7 w# G& y
  11. *         TO CHANGE.
    * ~5 I0 Y# ]2 M- r5 t
  12. *
    1 a0 d4 i- M; Y+ F# K6 l1 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, w8 P6 N: f2 ~
  14. *
    1 e' |5 G) J. d. T/ f' ~7 A7 p6 M
  15. * This program is free software; you can redistribute it and/or! h5 }" y; s& V: |5 ~
  16. * modify it under the terms of the GNU General Public License as
    6 w$ [0 F4 B: {% E$ M/ q( T
  17. * published by the Free Software Foundation version 2.
    ; V" U" Z8 H/ n3 a. I
  18. *5 M& W7 H+ \" s  v$ n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 K1 b5 i* w& `9 ]. a5 V
  20. * kind, whether express or implied; without even the implied warranty1 c) l3 u. a, h+ B/ F- l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 `: K4 A" z3 Q' a
  22. * GNU General Public License for more details.% a, B7 l2 L+ D3 l4 y9 P
  23. */
    0 ^: q. @: u/ F9 A5 M
  24. 1 d6 I9 d# G# p0 K* X/ [8 D
  25. #include <linux/module.h>
    & e2 d' k: @/ s
  26. #include <linux/init.h>
    & X: O3 l) P3 y
  27. #include <linux/errno.h>
    3 N) O# ]1 Z, |- f3 T
  28. #include <linux/types.h>( [3 d# W8 `+ W2 n' m) ]
  29. #include <linux/interrupt.h>+ e8 n' ?2 g1 F& k% m: C, w4 Y
  30. #include <asm/io.h>4 s) c6 P3 H+ L
  31. #include <linux/moduleparam.h>0 S" N$ P! @/ K8 D4 A3 q9 ]
  32. #include <linux/sysctl.h>
    9 K, z( {9 ?  V$ D; G
  33. #include <linux/mm.h>: Z4 d, ~: y; K6 }8 j- O0 p9 o
  34. #include <linux/dma-mapping.h>. y2 l% }- w8 I, P
  35. 1 m% S: B3 \. |3 X* I- e6 f
  36. #include <mach/memory.h>' y7 n. ]* s( s6 f5 I' ]
  37. #include <mach/hardware.h>0 r7 R4 w, |7 {) w" ]
  38. #include <mach/irqs.h>
    ' x& E$ B- L0 C) n8 L* K/ p
  39. #include <asm/hardware/edma.h>! Z; N0 O1 r: M2 O) k! |
  40. * w$ v' V1 Q# z6 Q
  41. #undef EDMA3_DEBUG+ q5 u: I0 b2 z8 w
  42. /*#define EDMA3_DEBUG*/
    6 r1 {0 g: h( u8 X% a

  43. # ~3 P) v( r8 f  n: v
  44. #ifdef EDMA3_DEBUG- d/ |& S$ t7 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 l5 Z: D) Z8 T* C9 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 k6 r" ~5 Y/ J* L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* n, X0 O# n$ b8 F' [
  48. #else+ C" R" V( P8 P& ?* T; ^
  49. #define DMA_PRINTK( x... )
    ) q% r% G, M% n: b
  50. #define DMA_FN_IN
    4 ^' h' ?! Z( [" I1 ]
  51. #define DMA_FN_OUT: `, Y! t! G# s9 R
  52. #endif; ^, ?9 Y/ s6 V9 j& ^" g' M% o8 Z

  53. 3 g  F+ L) W  [, V; b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 ^  _; a* z5 x) h- I
  55. #define STATIC_SHIFT                3
    * E  c# q. f6 d# R9 S
  56. #define TCINTEN_SHIFT               20
    / c: W; Z0 `9 R# c
  57. #define ITCINTEN_SHIFT              21
      @. }" k' ~# c$ Y7 B4 I0 A3 o
  58. #define TCCHEN_SHIFT                22
    " |+ B7 M4 M4 @& @1 @6 `
  59. #define ITCCHEN_SHIFT               23
      H' {/ c& h1 t1 m# q: b0 H7 U9 l
  60. - g% b3 [+ M2 O+ Y/ p! [
  61. static volatile int irqraised1 = 0;: i1 o) \$ C8 y+ Z# B
  62. static volatile int irqraised2 = 0;
    9 k; W9 Y8 y5 r$ m: i/ I, \

  63. 7 |: J$ m! J; o) f  D2 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 e* N  i5 F% d0 E  V& K3 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 [' d& Y9 L* M1 ]  `& b& O- u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- I# `% L2 o$ _5 O  Q( F6 [
  67. + c9 O' p5 R3 `" a
  68. dma_addr_t dmaphyssrc1 = 0;
    ( s+ T) e% `' K7 ^+ O
  69. dma_addr_t dmaphyssrc2 = 0;5 b+ w; Q$ Y& ?7 ^& `
  70. dma_addr_t dmaphysdest1 = 0;
    ) X2 F! _' @' [5 P) I
  71. dma_addr_t dmaphysdest2 = 0;: U+ a7 J7 J; Q) p

  72. ' v) p% j, j; O! m
  73. char *dmabufsrc1 = NULL;* H9 R. n' }9 ]+ X- o
  74. char *dmabufsrc2 = NULL;% L" Z0 C8 _6 Q3 O/ b% z# }5 Z5 p' H
  75. char *dmabufdest1 = NULL;- X+ Z, l) X9 E& U1 t$ r1 i
  76. char *dmabufdest2 = NULL;
    : ?* ?( A/ A& A) Q" a

  77. " A7 A" t; W) V, K; j$ T$ V0 D  G6 X
  78. static int acnt = 512;: E, m, k& j7 ?" {9 l
  79. static int bcnt = 8;
    9 a, Q  m7 i$ b
  80. static int ccnt = 8;8 k$ b8 Z; p" _6 O9 _! R$ \  W) Y5 }
  81. / r7 r0 t6 y8 u) n) R2 g# h
  82. module_param(acnt, int, S_IRUGO);
    # e  ]: R! I3 B" v9 B
  83. module_param(bcnt, int, S_IRUGO);; e6 G* t) a5 J# a: p2 F' H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) G6 |3 Z. m2 [. D" R- B4 k( g, _- u4 J; O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 K% `. i0 V' g2 G- [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" }! Z: m' ]; y; R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  H7 P/ y$ c3 S2 z  K

9 |. \, `7 O! \/ S+ J2 O, m8 N9 k& G: C- v7 ~, [1 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 00:17 , Processed in 0.038189 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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