OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 b- M9 I( u0 m2 [; `
  1. [code]EDMA sample test application6 h$ _+ g" x3 _1 {' q4 r
  2. /*4 z3 @2 Q- Q- ]% y
  3. * edma_test.c" Y1 H& b/ i$ O; s, O
  4. *
    # z# E* E2 `, l
  5. * brief  EDMA3 Test Application6 {# y2 p) W8 j
  6. *
    0 @2 ^8 B6 M# F/ g
  7. *   This file contains EDMA3 Test code.
    + w4 ^9 r0 n: x9 O5 C, k
  8. *
    / t! \# I$ B) x3 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 r; a2 p$ E3 D9 |/ h, ]3 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  M( ]+ @/ P7 }9 K4 `
  11. *         TO CHANGE.
    9 L" S% e: W$ n+ Z+ s2 `! f
  12. *
    $ }8 r4 Q1 x0 @1 x0 Q( N0 [! T: ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! |) O: q0 ~9 Z# g8 O/ t2 }# c
  14. *# d" O) m9 G; E# }5 V5 c
  15. * This program is free software; you can redistribute it and/or# ]1 |; Z7 \* {/ V/ w
  16. * modify it under the terms of the GNU General Public License as
    " }$ R& \( W+ E" h- [% [
  17. * published by the Free Software Foundation version 2.
    " y9 X* U# R8 g. g2 v7 h4 H2 k
  18. *' c* k) F$ j. D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 t# _6 e4 Y+ i0 ]! P
  20. * kind, whether express or implied; without even the implied warranty
    : q5 ^, R1 {  E6 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " \  {- h4 Z8 c+ _5 I
  22. * GNU General Public License for more details.3 l! b. K( N; {" E$ C/ z0 t
  23. */& G& b( l* z5 J
  24. # v6 t9 h/ _% f% A
  25. #include <linux/module.h>; f0 `& {: S  W
  26. #include <linux/init.h>/ I% V0 Q; C: I1 d# `3 U1 [
  27. #include <linux/errno.h>
    # F7 x1 R" f4 o6 M: x) F( M
  28. #include <linux/types.h>& o6 ^) Y0 C. f
  29. #include <linux/interrupt.h>, @6 `/ k# Q( x# [3 y2 ?
  30. #include <asm/io.h>
    , @2 I7 g6 k; o0 f; V; V8 g
  31. #include <linux/moduleparam.h>: [1 J- |4 O# U7 f
  32. #include <linux/sysctl.h>
    ) J6 n6 H$ I, X8 R+ @
  33. #include <linux/mm.h>
    / m2 b* O* o: a* s; {* Y' O$ ^
  34. #include <linux/dma-mapping.h>
    . X! h+ X$ ]- _! O3 I

  35. ( C+ @. k( [' `% F: l+ I
  36. #include <mach/memory.h>
    1 [# b+ \6 |8 w6 u! e  J, c' o
  37. #include <mach/hardware.h>: K& c4 u9 o, b  Z% N8 ^& c1 s2 I( z
  38. #include <mach/irqs.h>& O1 W6 t* J0 K2 U1 z* b
  39. #include <asm/hardware/edma.h>
    5 f  E0 o- h. f- _# e4 o: S3 x
  40. # ?9 P5 v% x6 U4 \
  41. #undef EDMA3_DEBUG
    0 L; ?$ L& [: f- l6 i9 ^6 q+ l1 D
  42. /*#define EDMA3_DEBUG*/* X- a/ ?; Q& A3 P' u
  43. & ~$ s% Z' p! i* M
  44. #ifdef EDMA3_DEBUG1 h# t; I% f" n& `0 M4 O% \/ G2 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & L9 ~% i1 ^4 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! L" R0 M& {* k1 }; F! g' a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % }# r2 ~% ]$ {) `
  48. #else1 J$ Z  ^6 t9 j2 D$ ^3 g2 V  f
  49. #define DMA_PRINTK( x... )
    ' f  J7 H" N+ M$ V+ H
  50. #define DMA_FN_IN8 g! [- E0 N* v. f' n% R) T
  51. #define DMA_FN_OUT
    . i* D4 H. ]2 E8 @
  52. #endif2 A& h& H3 y$ _0 N

  53. ( x, W0 g6 |9 d8 i/ c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% z$ o1 q$ T9 A- ^# O& M; p, t
  55. #define STATIC_SHIFT                3  L: u- b6 J) m0 ]  t
  56. #define TCINTEN_SHIFT               20- c* Z, W7 \; f0 c7 W3 V5 d
  57. #define ITCINTEN_SHIFT              21* J1 }, q5 x0 K. r: c, ^) B
  58. #define TCCHEN_SHIFT                22
    8 E' B8 O/ |% z! G9 Q
  59. #define ITCCHEN_SHIFT               23( @' A+ e! Q; v# {1 @
  60. : B2 o) B4 X& z1 `. t3 z
  61. static volatile int irqraised1 = 0;
    7 U) Q  O0 [2 d3 u, x: p
  62. static volatile int irqraised2 = 0;5 }7 L6 t" N0 @
  63. 0 c, V. t7 O9 Z3 {5 ~+ D$ h2 g5 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. J& I: w4 Y" L6 g, K  K7 m9 n7 _* h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 K) r  D8 R7 j- g5 I. ~0 t; {6 K9 u8 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 }) l6 ^5 I8 |* e. ~

  67. $ b2 I0 c# u- Q! z/ c
  68. dma_addr_t dmaphyssrc1 = 0;
    , q6 h1 H' ?- F5 L7 g
  69. dma_addr_t dmaphyssrc2 = 0;' M  D! F& l. }
  70. dma_addr_t dmaphysdest1 = 0;9 x  @+ J/ f* p' G2 j. v2 u
  71. dma_addr_t dmaphysdest2 = 0;. e; t9 J; i9 z8 {

  72. ( w* P/ p) }5 u# S1 o0 b; G
  73. char *dmabufsrc1 = NULL;
      q0 \3 F  u6 y* c+ `; f" U4 }
  74. char *dmabufsrc2 = NULL;
    . W. f6 Z' B/ M/ u3 Q4 S% R( x
  75. char *dmabufdest1 = NULL;
    ; Q7 Q, Q7 z  b6 d' f6 }& G
  76. char *dmabufdest2 = NULL;
    ) ~0 J; D3 P- M* H+ q& Q$ [

  77. % L" m& X& Q* }7 o8 S  ^7 _
  78. static int acnt = 512;# ]' G7 N$ ^* F' T( H
  79. static int bcnt = 8;
    5 s( a1 V5 i( j) E& Q4 `
  80. static int ccnt = 8;( [8 t+ U7 w2 j2 N0 e6 @
  81. ' q' u! ?8 n0 {& s5 M8 w' A6 F
  82. module_param(acnt, int, S_IRUGO);7 N8 P4 M+ ^5 C( |) W8 T6 {
  83. module_param(bcnt, int, S_IRUGO);' O& a4 n+ l" D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: C% l* W, H* B* q- Q+ z) J
2 _0 g5 T5 i8 o  }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Y! Y3 w3 l3 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, t4 k  u8 m9 |0 ^$ H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' Q% _" t4 u. a# o7 p% i7 k/ n7 I$ D
; S( c; s. i  b7 n3 F1 O# U1 U1 o
8 W& @5 I0 }5 x  O- _6 e8 O4 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 07:36 , Processed in 0.038542 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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