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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 b6 L# E; v1 i1 s, V+ E
  1. [code]EDMA sample test application
    ) F  O2 Y/ x/ S5 n% K2 S: ^
  2. /*
    ) T- T: j2 Q: U
  3. * edma_test.c
    ' E3 W( A2 [/ I( P
  4. *
    0 [; {( `+ F9 a1 M
  5. * brief  EDMA3 Test Application1 P3 _1 e3 j' \1 h! m: v* R
  6. *5 @, B0 H4 l' _$ g+ l% |& L- [/ @
  7. *   This file contains EDMA3 Test code.
    ! k( ]# a* g0 D; R  h6 I$ W+ ^3 z
  8. *5 z: ?& Y2 N, r7 O- |6 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % V. c6 v6 ]. E9 H; k" G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 X% r. u4 r1 t9 q
  11. *         TO CHANGE.! i1 r3 A8 P' L' p$ K
  12. *% s4 a# [( ?$ H# @! B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . H4 M" j( h& c6 T: t( i
  14. *
    5 K1 q- A( l$ r/ e, M# _8 U0 O+ I& M
  15. * This program is free software; you can redistribute it and/or
    . B3 u& ^8 \6 C2 b3 j# ]
  16. * modify it under the terms of the GNU General Public License as; x( D! V! P9 q1 e# l  L
  17. * published by the Free Software Foundation version 2.
    8 x0 L" u" ^2 V5 P9 {
  18. *- A% v- H6 U- h4 w. b( }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* m3 E0 }) P! \' P. b* t( m
  20. * kind, whether express or implied; without even the implied warranty
    ) S4 S- C$ ~* E" [1 U) h3 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* p; b; _+ F* P! W- q0 Y
  22. * GNU General Public License for more details.
    1 S- L6 K! P3 C- ]
  23. */) i: F* ]+ b- J( S  Z: s1 ?5 W

  24. ; ^: M+ B3 m$ \/ V
  25. #include <linux/module.h>
    + s- [7 r# X" p  m8 S
  26. #include <linux/init.h>
    ) [! }; n3 ]7 f
  27. #include <linux/errno.h>) u, X: n: L! c5 R% M: I
  28. #include <linux/types.h>, w# P; O: o: \$ @$ o
  29. #include <linux/interrupt.h>
    7 C6 y! Y2 v6 e1 j% @
  30. #include <asm/io.h>
    $ C* r0 m2 T4 q9 s  c
  31. #include <linux/moduleparam.h>
    $ |% j/ F9 G+ S' W" }2 e# N$ V+ o
  32. #include <linux/sysctl.h>
    6 L% R2 Z1 B( h+ \5 l. i
  33. #include <linux/mm.h>
    ' Y* r5 z1 t+ l) D7 ~
  34. #include <linux/dma-mapping.h>
    2 E2 f" m7 G, V5 p
  35. 2 k! v4 w! S* G9 W0 x, a
  36. #include <mach/memory.h>
    * \$ Q/ m) x; j6 B
  37. #include <mach/hardware.h>
    & N! Q8 V- |# _
  38. #include <mach/irqs.h>
    0 \$ @6 n! V/ Y  c/ s+ j- A. {
  39. #include <asm/hardware/edma.h>
    7 {. J. s+ @; q

  40. ; x# }1 U; \" m' U  n, Z+ T
  41. #undef EDMA3_DEBUG
    2 ~3 P4 @; C  Y% \( A  h. Q
  42. /*#define EDMA3_DEBUG*/8 n" C" J+ L5 E' X: R% P) Z. [

  43. 0 _' `0 W% z: D: t
  44. #ifdef EDMA3_DEBUG, t! A0 L5 R" R% s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% I0 }/ S& \6 Q9 B- t- O, X4 a* r3 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 o, m, _; A9 n# w3 h! q% ~/ g: c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). e" V. E) W& I, F
  48. #else  `* `5 v) k/ Z  T$ p9 J8 k+ b' A
  49. #define DMA_PRINTK( x... )
    * K3 z. c+ E& ^4 Z5 M# v2 x3 V
  50. #define DMA_FN_IN; t. {8 \$ L" ]/ P4 ^$ s
  51. #define DMA_FN_OUT
    ; y. ^. K+ V  w. f( Z! ~
  52. #endif
    9 n$ L& S4 n. m  K

  53. , `+ T) s6 W  G" G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : ~  V6 G. `2 L8 t
  55. #define STATIC_SHIFT                3
    2 h/ b. k5 t2 y* O# O
  56. #define TCINTEN_SHIFT               20! k* d+ @0 b0 k7 X: m" W
  57. #define ITCINTEN_SHIFT              21$ f' f/ D$ V9 _1 i
  58. #define TCCHEN_SHIFT                22& G8 h/ x( L6 B4 q
  59. #define ITCCHEN_SHIFT               239 h- A5 J7 _  W6 J
  60. $ z0 n/ A- w" ]2 h4 V' v% P
  61. static volatile int irqraised1 = 0;. b1 W8 Q% m& C6 i9 c
  62. static volatile int irqraised2 = 0;
      C5 Q0 u  Q; x9 P4 Q2 H

  63. 7 O0 `6 o8 u' D4 A& Z( R6 u" o7 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " F4 ]: e6 q4 k- _7 ~9 ~& S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * G1 E3 `) c$ Y. @6 c1 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 \; u; \# L- z) j. R

  67. * v& n4 W  ]* B3 E( m3 `$ {
  68. dma_addr_t dmaphyssrc1 = 0;2 V1 p' {: o5 G5 v0 M# z8 {8 ?7 l
  69. dma_addr_t dmaphyssrc2 = 0;
    9 J* t0 S. V& m+ V( N
  70. dma_addr_t dmaphysdest1 = 0;
    5 a; _6 t# `! l. X
  71. dma_addr_t dmaphysdest2 = 0;
    4 |( c/ ^% p7 J; C( A6 v

  72.   ?( b1 v- @  a6 W$ d% H1 l0 O- v
  73. char *dmabufsrc1 = NULL;9 h8 h5 o1 Y( Y2 P
  74. char *dmabufsrc2 = NULL;
    + U+ D" ]* C# A4 [4 `, {7 d
  75. char *dmabufdest1 = NULL;& I: T+ A# Y0 d1 v' W9 m/ H
  76. char *dmabufdest2 = NULL;0 y3 L& q" g" q. R( S$ F3 Z
  77. # h! M" v, q6 B8 t
  78. static int acnt = 512;
    & g6 g* x# {& {, B# P7 ~3 F
  79. static int bcnt = 8;
    ! b- H  V+ q/ o4 i) J5 {' k6 W
  80. static int ccnt = 8;
    9 p( H* N- f1 o9 N* b
  81. % X! r9 T" O: P
  82. module_param(acnt, int, S_IRUGO);' S' p- f- J: e* w- T7 a6 C/ \
  83. module_param(bcnt, int, S_IRUGO);) @8 H& L  n6 b7 g2 j3 [$ a* U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! A/ F: D, z" L: E
8 w% e( W5 B" F# m4 D% M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; A. T! `0 l$ Q- Z; f+ {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 ^1 V9 ]( B4 u# |" T% p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 z  i) N% i! ?4 h# R

" Q# j9 T& e0 z) v
# h4 D# \+ W. H; ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 15:25 , Processed in 0.039273 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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