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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( t2 T2 B$ Y: h- H6 o
  1. [code]EDMA sample test application
    7 y+ C! C$ Q2 P( n
  2. /*3 I4 q% ~0 h6 ]4 v; p1 ]
  3. * edma_test.c
    . c0 u! [+ X9 n' Y
  4. *
    " b6 @9 ?7 C9 C
  5. * brief  EDMA3 Test Application
    & X8 c# @# S8 t. c( T; z. {
  6. *' U$ X, R; R: R, s! g
  7. *   This file contains EDMA3 Test code.
    * C  Z4 a% b' q$ H9 [% R
  8. *( p# i  E$ v8 S  K, O: Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 R; j. [$ M- W. V, i/ w5 b; m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ h: }# s( |/ _9 O) b- @" L
  11. *         TO CHANGE.
    3 d0 A* \" J  m3 h+ s5 I# J2 C
  12. *2 }) I; P5 u0 `6 i" k0 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 v- D; Z+ [0 e1 y& b  [! a! I
  14. *7 t/ n! r6 v5 c0 @( Y$ p4 u! Z
  15. * This program is free software; you can redistribute it and/or
    8 s  @" L) H8 z5 n- }; r+ z/ o& M6 h
  16. * modify it under the terms of the GNU General Public License as4 {1 T- u8 z/ t* z* P
  17. * published by the Free Software Foundation version 2.6 j9 W; n! S9 n' ?' F) }
  18. *
    ( R5 u4 t* q! ~* F) z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - N2 A. C' w3 l4 \( A, C
  20. * kind, whether express or implied; without even the implied warranty
    . `8 C2 K. ?, J9 ~: G- @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + \* C% y' |- B1 x! [& r
  22. * GNU General Public License for more details.2 S, s5 A% M/ @9 T0 K2 G8 \5 }2 P) L
  23. */
    / p2 M1 I# Z3 ?% r8 u4 ^1 q3 x" |
  24. $ y$ D# I. l! y) o
  25. #include <linux/module.h>6 m$ `  H- ?  w9 R
  26. #include <linux/init.h>9 K7 a" u# N& R0 y2 A9 A: t
  27. #include <linux/errno.h>* b' I4 s$ o9 Y2 _
  28. #include <linux/types.h>" B: W( _% q* X# p+ [8 M
  29. #include <linux/interrupt.h>
    + {. V0 Y- j' T
  30. #include <asm/io.h>
    4 m2 `) }4 |7 t' T3 ?
  31. #include <linux/moduleparam.h>
    ; O2 G6 n0 m& H: ~1 D
  32. #include <linux/sysctl.h>
    9 e& [) r& J- a6 |7 E
  33. #include <linux/mm.h>/ Q; b$ P: e: x
  34. #include <linux/dma-mapping.h>
    2 A- F/ O% N8 n2 s

  35. ' X9 U/ E% X: h( G# K2 H0 C
  36. #include <mach/memory.h>- M3 h/ x; b; L! h2 U) p
  37. #include <mach/hardware.h>
    2 e" u9 ~) O; p' m$ o
  38. #include <mach/irqs.h>
    6 i% [4 `; Q- \; [0 T
  39. #include <asm/hardware/edma.h>" R. m0 [  u4 E( A4 ~8 r

  40. % y% {) M9 |- o2 {! a
  41. #undef EDMA3_DEBUG
    ) k6 W; n$ F+ [! W
  42. /*#define EDMA3_DEBUG*/$ i$ O5 p* L6 B9 S& p! h+ W
  43. ' q2 D& z& p& Y$ q! p; P7 R
  44. #ifdef EDMA3_DEBUG
    2 f8 I2 J; F9 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' w; o* @3 y: O; e) Z4 d, n% G$ n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , ^( l& R6 _8 q0 w+ z+ Y; ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 i2 k7 E9 i" k! p! k% v+ H( j
  48. #else* c- ~' `6 v& |$ O( x  q
  49. #define DMA_PRINTK( x... )
    * O3 Q3 P0 x) {7 f: l' }2 j
  50. #define DMA_FN_IN
    4 w, V: [( h! p8 M6 \% o; e$ a
  51. #define DMA_FN_OUT
    # _1 p' f  l! j: y7 B9 Y
  52. #endif6 n  S; E+ Z+ R" U' X  U+ b

  53. . [$ ^4 K4 C# I; T7 j3 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) P; h0 ]4 g% j' G& u
  55. #define STATIC_SHIFT                37 s1 @, V; g( z  y$ }
  56. #define TCINTEN_SHIFT               20$ }4 @% H5 P" j& {: W
  57. #define ITCINTEN_SHIFT              21' w6 T0 m6 H+ V4 L6 U
  58. #define TCCHEN_SHIFT                22
    % D' Z9 L6 p" u! N0 Z. x1 s; h0 @
  59. #define ITCCHEN_SHIFT               23& d3 p. B* M- F# ?& e

  60. # b$ F+ M* w# Z
  61. static volatile int irqraised1 = 0;# O4 p0 }$ ^+ b9 X' ?9 q
  62. static volatile int irqraised2 = 0;3 h& s: e( c+ ~' v7 ^- U+ b" T

  63. 4 d1 I& K5 ?& z8 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ^3 B4 K; c, X. h% F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 f3 N5 R5 O4 _( C( W+ }: c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 A4 O1 Y# a+ c% |
  67. 5 w/ m0 v2 ~; q8 Y! ^
  68. dma_addr_t dmaphyssrc1 = 0;3 T% b3 ^2 D4 m- c- k( M( }- X
  69. dma_addr_t dmaphyssrc2 = 0;0 p" ^5 j) u$ f
  70. dma_addr_t dmaphysdest1 = 0;
    ! S8 e! d, r3 y: M% F% i) a0 l
  71. dma_addr_t dmaphysdest2 = 0;
    / a1 k) b2 t' G- I5 Y3 J

  72.   k- _. U6 p" k) [
  73. char *dmabufsrc1 = NULL;
    3 a# c2 e3 t( ^% P# g) C; j, t/ Z
  74. char *dmabufsrc2 = NULL;5 |& K5 [* M  Q2 H
  75. char *dmabufdest1 = NULL;
    , [5 j8 J1 ~$ B0 a% v( r) \5 r
  76. char *dmabufdest2 = NULL;
    & }; \' f" B+ ]

  77. 5 o3 x9 l0 S: y2 K' {2 Q$ v* i
  78. static int acnt = 512;  _1 |' f/ f4 K
  79. static int bcnt = 8;
    + q+ `+ a7 s# ~- C
  80. static int ccnt = 8;
    + f2 z( [* s% t) n7 d# N  M0 Z

  81. 8 j6 k$ R2 Z  Y0 z! K
  82. module_param(acnt, int, S_IRUGO);
    ( c4 v5 r* j' y+ U9 r/ Y: v9 g5 |. B
  83. module_param(bcnt, int, S_IRUGO);5 X1 E% N6 k4 v+ f( v4 a7 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 Y' O3 Y# v4 J, N$ W, ~; i

# p" S  [/ G, K9 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 Z6 y( f. e# U! H. R3 i0 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 V9 N- r/ _- z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 F) h- w# d' L  K

7 u+ z& q1 `; W/ o: C0 v6 ~" x4 B, T8 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 13:23 , Processed in 0.040529 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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