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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % a; O4 I$ h. p2 W' n) L7 V
  1. [code]EDMA sample test application! s: R1 r/ C- U, j$ e0 F$ E( _
  2. /*
    7 m/ `3 y) |$ [
  3. * edma_test.c) ]' Y0 d' L, K, T5 p  Z
  4. *  k! i2 N+ x9 B. F' J1 S
  5. * brief  EDMA3 Test Application/ u  R+ [; K7 [' h0 w  q9 \" H
  6. *
    7 S  l% I  q9 y% J1 `% O2 t
  7. *   This file contains EDMA3 Test code.8 F$ o! n, s  j  B0 _3 T
  8. *
    # `/ `9 E8 u/ {6 i; x8 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 m- a5 n9 q8 A! Q: B- x; j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; W+ p& U8 d2 ?8 y# G1 R3 j& P
  11. *         TO CHANGE.; I  \2 T( @- Q  r$ s$ e
  12. *
    . z6 S6 _; N, _# O% ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 a* l  ~4 j7 w
  14. *
    ; V4 U# {6 d5 i+ m+ X
  15. * This program is free software; you can redistribute it and/or
    5 ?" S7 L$ @! P. ~+ @* }
  16. * modify it under the terms of the GNU General Public License as
    9 u' J2 z+ I5 V! t1 ^: I8 _9 N
  17. * published by the Free Software Foundation version 2.
    * e" B+ T& b8 i% B4 z
  18. *- h0 U2 K" T) E; R  z8 X! K! a3 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! v- }, L1 S' X4 s8 V
  20. * kind, whether express or implied; without even the implied warranty$ D7 U% N* f( Y# Y4 E# V. \8 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & @# X; S" s/ P: Y% s5 Q! R% k9 J
  22. * GNU General Public License for more details.2 Q8 o' B8 m2 X* y0 O
  23. */4 |- o) W7 n0 g

  24. + F9 f: W6 z7 V. y$ i& m
  25. #include <linux/module.h>) _; @* i6 d5 [/ A
  26. #include <linux/init.h>
    1 q: T4 w; P  g  ?% ^. f7 _( ~" w5 K
  27. #include <linux/errno.h>
    ; e5 L# |  N7 P# ?) s. s
  28. #include <linux/types.h>
    . ~+ o8 T' X* C* K) e1 [
  29. #include <linux/interrupt.h>. s4 |! q3 m0 o$ x8 K
  30. #include <asm/io.h>/ d4 ~* F' |# J! f" H# l
  31. #include <linux/moduleparam.h>' v* c  x9 P# y) y; W5 e) P+ i% ~
  32. #include <linux/sysctl.h>
    9 i. ~* Z4 e, o
  33. #include <linux/mm.h>
    % }2 Y7 z* l' ?: |
  34. #include <linux/dma-mapping.h>
    4 ^: i) ]* B! F$ s
  35. $ K& ^5 u6 L7 D) E% d1 w$ A% ~: x
  36. #include <mach/memory.h>
    2 [' G( M& C3 u) H% O7 Y5 b
  37. #include <mach/hardware.h>( j* l0 ^$ J' Z: @" Q% v  o! x4 m
  38. #include <mach/irqs.h>
      @7 \7 w: t  O1 n; I4 a0 Q& ~/ u/ M
  39. #include <asm/hardware/edma.h>3 p* {3 h& D6 D) d4 x2 |

  40. 8 O$ {1 _# d/ ~% m: S8 I" ~
  41. #undef EDMA3_DEBUG, N1 Z9 H& R8 G* u+ E) o
  42. /*#define EDMA3_DEBUG*/5 j' m! L3 m! ?7 Z- [

  43. # {, _& i$ |; D* z% F8 c& v4 O
  44. #ifdef EDMA3_DEBUG
    $ q- z& ?( x) L; Y1 ]$ q2 q5 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 x4 `+ A+ Y+ {8 l6 ]2 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' o6 l4 z6 m+ k/ h# @' e' t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% N2 M: @; D9 P7 |
  48. #else7 T- M: Z1 O  l0 f
  49. #define DMA_PRINTK( x... )
      O* Z( P1 Z. ~$ x' w" H0 v
  50. #define DMA_FN_IN
    - [3 _% i7 ]' w7 R2 `) p# x
  51. #define DMA_FN_OUT/ Q8 b( }  \0 P  B1 j* u0 l
  52. #endif8 E( Y* q1 J$ ^. k+ N) \

  53. ' P" f% Y0 H+ K+ Y9 u* ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % Q% _8 {$ O* n0 J6 B
  55. #define STATIC_SHIFT                3
    : G# F) N* |9 W8 L: R2 J% J
  56. #define TCINTEN_SHIFT               20
      _% x( k4 o9 l: S) p
  57. #define ITCINTEN_SHIFT              21
    7 J4 U4 P2 k% k
  58. #define TCCHEN_SHIFT                22
    - q0 i8 W7 K5 ?* t- K. X/ S
  59. #define ITCCHEN_SHIFT               232 n! u( o3 }  `, ~* }% `

  60. " x/ {0 P5 [4 w- x
  61. static volatile int irqraised1 = 0;
    ' D' C$ Q& v! G9 g9 P1 E3 F
  62. static volatile int irqraised2 = 0;
    % h, g6 r; @# h$ q; A* b. Y

  63. # I0 {8 p* o4 s8 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 J' K! b* ]+ d# m( H, |$ v. N% A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 q2 w! X6 j9 m2 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# R+ J- p  Z- m, v7 d* }3 T) e

  67. : X+ e3 e9 {: ^; m$ y9 Z6 b# g
  68. dma_addr_t dmaphyssrc1 = 0;0 d& C0 _& G9 F" y; Q( U7 V! f3 Y# m
  69. dma_addr_t dmaphyssrc2 = 0;% e8 U; t+ `& B) E) j
  70. dma_addr_t dmaphysdest1 = 0;
    ; G" u: G+ g. I. i& K
  71. dma_addr_t dmaphysdest2 = 0;3 o' Y0 t8 g) _" e, G

  72. ' x1 d% _$ o- e$ R; f. l/ s
  73. char *dmabufsrc1 = NULL;
    & d# y: n4 f& o( P6 M
  74. char *dmabufsrc2 = NULL;
    5 P5 E1 S0 V& E  L5 ~# r: ?
  75. char *dmabufdest1 = NULL;  D. x* d, C9 [( m: L
  76. char *dmabufdest2 = NULL;  r3 d1 Q5 b) V; P6 `: h; u$ Q5 M2 \2 H

  77. . r$ r6 U1 m& e. \
  78. static int acnt = 512;8 A7 f& |6 @6 z: W+ Q4 T& a, p/ j8 t: [
  79. static int bcnt = 8;' L8 P4 t+ o: t2 e
  80. static int ccnt = 8;
    % |& t/ z2 Q# ~1 K0 R: V

  81. ; C& t& \3 ^$ Y0 z3 g! o7 v
  82. module_param(acnt, int, S_IRUGO);
    ' J7 Q- F5 C: c  X& f$ G6 r
  83. module_param(bcnt, int, S_IRUGO);; v! q4 n0 j5 H; h% f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' H( `5 V  M% |4 _; E) ]5 O, H6 h; X" n0 w$ k, u0 R0 V0 j. L( P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ m" s7 \" D  ~: \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, A+ [4 g% e% p0 D7 w! E* H% F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: A+ b8 m5 e4 V* H
6 F3 a5 f& g8 |) n  y5 X' t1 L
8 n  b7 x7 H1 G8 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 11:38 , Processed in 0.040752 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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