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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - N' S4 e/ o5 D8 n3 `) i  ^
  1. [code]EDMA sample test application
    . ?. {5 z( ?7 s% n* `
  2. /*
    3 Y3 b9 X4 b+ ]( `- E3 L: f
  3. * edma_test.c8 ]) n3 x+ \( p# A) ?: B( c
  4. *
    ) U4 q% G1 j( Q  b- [2 @) u% I
  5. * brief  EDMA3 Test Application2 _( n5 L6 G7 I5 }8 |
  6. *5 V* I1 p% N% s+ }6 w
  7. *   This file contains EDMA3 Test code.
    2 l- o1 E) S. V2 \" ~
  8. *: ?% B- G0 m" z* x1 D( J) y2 e. f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 H% q" Q6 o# K8 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% Z: _5 I( Z& s) a6 y! i* g& ^+ K$ b
  11. *         TO CHANGE.
    ! S* f( P/ {" F1 U
  12. *& [4 J; V3 S9 m1 F+ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ~. y: V7 m; N* @
  14. *
    8 c  E# m+ M9 H- Z% m! l
  15. * This program is free software; you can redistribute it and/or
    2 u& f1 d9 i0 E1 H5 i! h
  16. * modify it under the terms of the GNU General Public License as# v0 K9 r9 b! L& q0 J6 p
  17. * published by the Free Software Foundation version 2.( z! ^8 v5 \3 v0 y2 Q% ?' Z
  18. *
    / J- V3 }0 n0 Z" d* n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( P% m# ~4 s. `7 G: m
  20. * kind, whether express or implied; without even the implied warranty5 X' Q& D, U' }0 ^! ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ A8 K: ^. w( a2 g: Q, `2 ?
  22. * GNU General Public License for more details.
    $ m" S* s: r; d, B
  23. */
    ' _, ~% y" }! \3 ]* {. G0 D: p, n
  24. # Q0 t8 ?6 n; C, L
  25. #include <linux/module.h>" ?# T; o5 I/ j# Q, y
  26. #include <linux/init.h>* Z# g8 w! }& W" Q& S
  27. #include <linux/errno.h>6 p! l& @  N: d7 N
  28. #include <linux/types.h>) E: a; P+ ]; V" R& a, c. S
  29. #include <linux/interrupt.h>
    2 o! Y. d$ u6 g+ @# Q; L0 D
  30. #include <asm/io.h>
    / g5 I% `) ^9 C
  31. #include <linux/moduleparam.h>
    - e' r( X: f4 Y+ W  E; ~0 [
  32. #include <linux/sysctl.h>/ K/ r" l1 V# v0 r; K" P" |
  33. #include <linux/mm.h>3 V7 M1 M( ?# h' R) w1 }5 e: _
  34. #include <linux/dma-mapping.h># H& f4 m4 n" q/ J

  35. / U5 x! h; L$ E$ L1 K* S
  36. #include <mach/memory.h>
    ( H" r& I# r# R% o+ e$ S
  37. #include <mach/hardware.h>' `( W& A% x  A5 a( [
  38. #include <mach/irqs.h>
    # n5 ^% ?( |- W1 T% C
  39. #include <asm/hardware/edma.h>
    # p) V) ?6 U7 E! O9 w' @$ Y7 E

  40. . \/ g5 h8 N" H: Q
  41. #undef EDMA3_DEBUG) v5 z; C% K) R  ?1 h
  42. /*#define EDMA3_DEBUG*/, `5 u( Z% l, T% O0 B  W1 C
  43. % J  K% n$ f3 P$ e0 c0 |
  44. #ifdef EDMA3_DEBUG
    ) D: G* T6 |- l! s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): ?# o& D% v# D4 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # m5 E. Q( n0 f. i; F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * X# s1 t& o  ~( q
  48. #else
    ' {, c0 S& _. H1 U! G% p
  49. #define DMA_PRINTK( x... )  S$ M. R/ C9 }; Y1 }) v& Z8 f
  50. #define DMA_FN_IN
      w! B! s7 ~! y4 _6 X0 r
  51. #define DMA_FN_OUT+ \1 u$ q! C4 {6 |, G
  52. #endif
    2 C/ J6 `1 y1 B' _

  53. $ U, \4 c5 d# z5 b2 y6 I7 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ d/ s6 A% j0 T
  55. #define STATIC_SHIFT                3
    3 I2 `. m0 D0 M$ G  E7 S, d# J
  56. #define TCINTEN_SHIFT               205 M" n7 `) f1 R8 k" K! R: D
  57. #define ITCINTEN_SHIFT              21) w" u- w- Q' g. J
  58. #define TCCHEN_SHIFT                22
    3 `0 t+ z% C& b
  59. #define ITCCHEN_SHIFT               23, \; x; O* e; B* T
  60. 6 n# h! ^% B+ m* `3 i% \1 ?
  61. static volatile int irqraised1 = 0;+ T; @& J) T$ ?% ]. g7 V& {+ C
  62. static volatile int irqraised2 = 0;
    ; A( @: l6 p2 P; x; t; u
  63. ( w: ?5 P+ t4 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# H4 q: Q9 h, T5 L' U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 L4 T: b  |2 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Z2 _. b+ J9 r/ `

  67. 9 e& e, c+ u/ ^+ p  Z
  68. dma_addr_t dmaphyssrc1 = 0;* e( p/ j( B, Y* s1 r! ?! Z. \: Q
  69. dma_addr_t dmaphyssrc2 = 0;
    ; e' `( w1 I  V8 r6 W! u
  70. dma_addr_t dmaphysdest1 = 0;; D. I( W; o3 _
  71. dma_addr_t dmaphysdest2 = 0;
    3 J# p8 G  d/ G+ Z8 m( v7 K) Y

  72. ' B- A. ^- d4 v% `
  73. char *dmabufsrc1 = NULL;
    + T/ g$ [) L! i% H
  74. char *dmabufsrc2 = NULL;4 y5 j$ X& L% b0 M6 [2 h4 n8 i
  75. char *dmabufdest1 = NULL;
    . ~+ D. D2 p  W1 x( k
  76. char *dmabufdest2 = NULL;
    3 @/ ?' T9 }9 G( c3 P; X6 H
  77. 7 F- d" k' B8 v) C) f$ Z; r' B7 A1 v8 s
  78. static int acnt = 512;
    2 z+ _$ D0 o1 s1 _0 n
  79. static int bcnt = 8;
    1 v2 \; h, U7 l5 S
  80. static int ccnt = 8;9 i$ |' E- w8 \$ M4 D, [
  81. 3 E' ?2 c/ ^* T- K7 X6 W4 F9 U
  82. module_param(acnt, int, S_IRUGO);5 ?$ q# V- C  @; s" _
  83. module_param(bcnt, int, S_IRUGO);) I, y: }9 X! I8 R( {7 N1 {2 B6 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* \1 }7 Z/ ^, `2 N/ ?6 r3 c, r3 }. S: c) {$ q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 B- s: U& g' o0 w" q* h; m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ @. R" ]) n. O& U8 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% J* n( I: F9 y! c
9 g( P& D/ R4 R$ P" B; c: r

( ?( [3 d0 X( S' \  c3 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-9 05:43 , Processed in 0.037811 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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