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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( O: @# T" x; p) l5 y8 `5 {
  1. [code]EDMA sample test application: X; y7 s! F$ Q# n' }' {( {9 ?
  2. /*
    . P* }" R' n6 F) g% V* o4 ~
  3. * edma_test.c6 }. v' z. e2 V/ Z4 V+ A+ r) ]- e
  4. *
    + G- E5 M4 W( ~. X. Q" P  ^
  5. * brief  EDMA3 Test Application5 W, [- O8 m: B" e
  6. *( @, J, Y7 Q/ E. H; N' e
  7. *   This file contains EDMA3 Test code.+ n3 Y  t. u1 s- Z4 ~
  8. ** O1 o& w- ?- b  g) |3 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 H/ Z0 Z6 `/ X3 b+ n  [* H/ X* R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ Q, P2 T: A* j- S+ t" ~9 P* t
  11. *         TO CHANGE.
    0 i% `: U6 K8 M5 p/ ]  P$ s
  12. *% W3 o; w. `) r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 [$ T4 U+ Y3 n" A. d
  14. *
    ) H5 S% K9 n% R/ j5 A
  15. * This program is free software; you can redistribute it and/or4 Q1 ?4 q% P9 t: H! \& x: I
  16. * modify it under the terms of the GNU General Public License as6 I  ~/ U& X- c
  17. * published by the Free Software Foundation version 2.6 f3 m) ?$ L- N
  18. *
    ) x, o- C( ~1 h; q/ @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : W/ q3 {- n/ S0 Y7 J
  20. * kind, whether express or implied; without even the implied warranty4 r' N( |8 L, \; I0 u$ S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + z! k6 |. q* h
  22. * GNU General Public License for more details.. ?2 r3 }6 O) C$ p. A
  23. */& J5 L5 Q1 K, v, F/ M5 M" N" r

  24. " E# W4 ~3 L1 j: r
  25. #include <linux/module.h>
    % W- T8 `& {$ ]5 x9 h6 ]
  26. #include <linux/init.h>
    ; g3 U* K( p; G6 q6 R7 R
  27. #include <linux/errno.h>
    3 z( X$ A8 g, h( Z! X- z
  28. #include <linux/types.h>
    ) s' z; F, K+ Q- b* [3 p, T
  29. #include <linux/interrupt.h>" x' a9 ]# f0 `
  30. #include <asm/io.h>
    + ~/ D  R2 H4 s  U
  31. #include <linux/moduleparam.h>
    " G9 Z9 O; a$ p/ ]8 `9 I" r
  32. #include <linux/sysctl.h>
    9 U" S, q' v$ k4 j3 `% x
  33. #include <linux/mm.h>+ [/ Z  X: L; Y
  34. #include <linux/dma-mapping.h>- ?" u' O& g  D5 {

  35. " E4 u4 y1 x8 B3 F, a* @0 H0 I
  36. #include <mach/memory.h>2 P! D1 X% u$ o% F( N8 ]! D; V
  37. #include <mach/hardware.h>9 V* |) _6 I, v# }/ d0 ^5 y/ R3 r
  38. #include <mach/irqs.h>" M& x0 D4 ?: N( ^0 ]- B6 T- `, \# C
  39. #include <asm/hardware/edma.h>1 u; J. `" M* U! S

  40. / p+ ~2 j# P- u; a6 o
  41. #undef EDMA3_DEBUG; r+ h8 M% G0 u" {' ^3 R
  42. /*#define EDMA3_DEBUG*/
    7 Y$ z9 L9 Z# x/ b
  43.   k+ B; `9 _9 u# A6 B
  44. #ifdef EDMA3_DEBUG# q% h: M! s7 U% J4 W; V: K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ^% \" A1 ?" W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 Y9 m& N& k. l/ [6 d; l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 h  v: L& g, B/ Y7 c+ |, i
  48. #else* U9 p4 R! w- S
  49. #define DMA_PRINTK( x... )
    7 m0 i( e+ W  d+ e
  50. #define DMA_FN_IN
    * B4 ^8 ~' Q6 H5 R5 \0 d
  51. #define DMA_FN_OUT
    7 n9 I/ ^8 T7 @* E) ~, u8 j/ `
  52. #endif
    ! y5 T- h) p$ i0 g& H; c0 {6 }  d+ a

  53. 7 L3 `& P1 w- w% ^0 H, X( o' E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / d  j+ l( T7 o& r
  55. #define STATIC_SHIFT                3* }+ l. P0 X# o2 J: }8 t) v
  56. #define TCINTEN_SHIFT               20( ?8 Z8 l4 o1 R/ l
  57. #define ITCINTEN_SHIFT              215 O* u& ~0 m" W5 _) r& F
  58. #define TCCHEN_SHIFT                22
    ) \5 V# V+ Y# E$ k4 y- V5 f9 N
  59. #define ITCCHEN_SHIFT               23% ^* Q. E3 G  w

  60. # ~" b) C! V2 U3 k; Y5 W
  61. static volatile int irqraised1 = 0;  U# a# G/ q1 ^- X' D
  62. static volatile int irqraised2 = 0;
    * t8 R- h" x' W5 w; Q& s6 x

  63. ; v" `6 G( F* a4 z7 S7 @% }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; O7 n4 `! I/ i) I; t2 b8 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& l2 V4 m  B$ F3 T0 W1 {8 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % i5 ~5 f! a/ q1 L0 K

  67. # C6 I8 d" S* j( }& k- Q; {% |9 J3 i
  68. dma_addr_t dmaphyssrc1 = 0;
    % k0 E: {+ N; R
  69. dma_addr_t dmaphyssrc2 = 0;5 o. Y! Q0 F$ ^3 j4 C5 K
  70. dma_addr_t dmaphysdest1 = 0;7 q1 `+ t* u0 _" h6 f' w
  71. dma_addr_t dmaphysdest2 = 0;
    - b: T0 ~9 }) b
  72. * _& C1 j4 z& o7 w
  73. char *dmabufsrc1 = NULL;
    : n7 T9 y2 ~' @# J, M* d3 W9 V7 |
  74. char *dmabufsrc2 = NULL;
    6 g6 ]. z) s$ S$ ]
  75. char *dmabufdest1 = NULL;. u  g. l  Y# X9 A8 @
  76. char *dmabufdest2 = NULL;
    3 s2 Z& _1 N8 |9 y+ P$ j+ C

  77. 8 i( s1 l2 c. J, w" G
  78. static int acnt = 512;
      M! p4 ~7 [' ~$ U
  79. static int bcnt = 8;* G0 t3 A0 w" ]& ]
  80. static int ccnt = 8;$ K& Y$ G5 l: R
  81. " E; H' Z$ X# S& z' s
  82. module_param(acnt, int, S_IRUGO);
    ' y; n" R& O! c. f7 i+ c
  83. module_param(bcnt, int, S_IRUGO);) d1 n( Z2 r  A2 ]! z6 z  X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- T1 e+ {  C- V0 N$ s5 [3 a

$ M. b! Y, F8 t) R( @1 F1 ]( _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( G8 b* P% n- ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; q# A/ w/ y! B( A3 u  G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 [) S6 M- B* T6 h6 X4 v( L& |6 i) v# Z: q  s  S& s- [

% u0 {$ F4 \1 W" X$ N: d7 Q6 _# A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-10 12:58 , Processed in 0.040666 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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