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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" s; U" c# g; u+ |' F% J
  1. [code]EDMA sample test application6 r5 q- Q; h; a( v2 Q3 o) }
  2. /*0 W& N( o; \0 j2 J+ b
  3. * edma_test.c: j% t2 A2 j) ?( N) D8 a, `% W8 w
  4. *
    1 W$ ^5 V1 d: h: _8 O! ~( t
  5. * brief  EDMA3 Test Application
    6 ?6 c& e. O! b/ U/ A* O. v
  6. *
    4 X- ~1 [8 V  `0 G
  7. *   This file contains EDMA3 Test code.$ ]$ F9 s: @7 E! G  A) i; A6 d
  8. *0 s5 M. U9 @- i& H1 O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 j3 B- S8 P& O8 j3 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* Y) O% c5 j; o9 r
  11. *         TO CHANGE.% {  x, \# }5 F
  12. *
    1 l' j  b2 h  g& m! s  c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; X( ~/ z( P" \  \. K- U
  14. *% w" B: Z- o, Q9 E
  15. * This program is free software; you can redistribute it and/or# ]. A, D- p" }4 T& A' N! L
  16. * modify it under the terms of the GNU General Public License as
    3 f! F# I. z- f* f7 T7 Q) L, E& f
  17. * published by the Free Software Foundation version 2.
    ; W' m2 Q; n) \; \1 s0 A* G. a, q
  18. *
    6 |( J, b8 w3 K8 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 |4 f' S8 ^9 W* J
  20. * kind, whether express or implied; without even the implied warranty7 h8 Z3 I$ _- z8 E" F% m  D3 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : y. `6 [1 ]# g6 u
  22. * GNU General Public License for more details.* p- b3 u. H8 e9 V) x8 F! r# A, Y5 A5 O
  23. */
    ( _4 t& g# R: U0 q3 n* M! ^8 s$ e
  24. : Y0 q, d  U! E' H. k
  25. #include <linux/module.h>
    5 K+ d9 w* C' O- ?* D- C1 @  A
  26. #include <linux/init.h>
    0 }8 N9 q/ Y* h, g
  27. #include <linux/errno.h>
    % C( _: U7 B! n" ~. C
  28. #include <linux/types.h>
    + i0 z$ E% p  g8 C  A  h5 H+ V
  29. #include <linux/interrupt.h>  X+ n' d* L# q6 @+ h3 _
  30. #include <asm/io.h>
    & U: b+ o" D' S' L$ i3 L  H# G
  31. #include <linux/moduleparam.h>
    5 Z5 E. s% ?2 c* h0 P; s
  32. #include <linux/sysctl.h>
    ! t. h1 h( n' E* C$ J
  33. #include <linux/mm.h>
    2 G9 u. F" t5 v  ~9 R# `
  34. #include <linux/dma-mapping.h>
    ) k3 P6 t# a7 [. X

  35. 1 I  M) e% [9 Z# `3 |
  36. #include <mach/memory.h>
    ) [# @9 W/ X2 A" |5 x0 ]
  37. #include <mach/hardware.h>
    * ?* T9 G# C, M6 Y3 F- y( {
  38. #include <mach/irqs.h>, b0 t" r! R9 B9 g
  39. #include <asm/hardware/edma.h>( w, K1 i( w) T; O; f2 ^
  40. 7 }( j1 v& n1 S4 ]* d+ n
  41. #undef EDMA3_DEBUG' y- Y$ ~5 I4 f: i* s
  42. /*#define EDMA3_DEBUG*/
    + t" o- }) I) P
  43. + ~* p) |3 A, Y+ r2 d4 d0 T# }
  44. #ifdef EDMA3_DEBUG
    2 A) _4 k* @0 T; \+ N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , g; c" J9 c: O" c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ X$ U( I) p9 f' r' N6 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 t: s$ e- P8 Y/ s' L5 o) A
  48. #else  z) s7 j; P  H0 ]- r& W
  49. #define DMA_PRINTK( x... )
    8 y! _0 h+ F* q9 N7 S
  50. #define DMA_FN_IN/ l: @5 ]3 P/ A1 u# O
  51. #define DMA_FN_OUT
    5 J0 b  Z* [/ d! ~# s* b
  52. #endif5 w4 O: J& h* N0 k1 C5 }
  53. 9 O9 A4 M' J6 p0 [$ i. G' z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 |9 z' X2 v) o3 [4 s& U
  55. #define STATIC_SHIFT                3- f# g  w. C- y9 k/ L& `
  56. #define TCINTEN_SHIFT               20
    . w+ U3 D4 F" }' H% v' m+ ?
  57. #define ITCINTEN_SHIFT              21
    & Q) Z) d: c- N. C
  58. #define TCCHEN_SHIFT                221 d/ v! b& C9 F- C
  59. #define ITCCHEN_SHIFT               23
    4 t/ c( V8 u: K- u  O9 U
  60. 0 t! E/ `0 Y3 F' S# g
  61. static volatile int irqraised1 = 0;; P  v8 x8 B. A( o9 G2 R+ U
  62. static volatile int irqraised2 = 0;, y- z% n& C% N

  63. 1 k3 t) `! }$ A% H3 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( T2 H6 \0 Y5 P- E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 B3 v7 c, w( }' V( j/ g& C% t& _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 p5 x% h; I9 Q( L' {
  67.   H4 H/ X( f6 X! q$ ^8 K
  68. dma_addr_t dmaphyssrc1 = 0;3 n; [/ g: t0 B1 y$ H3 P
  69. dma_addr_t dmaphyssrc2 = 0;
    1 c6 i5 V  w, G# j, F. _$ F6 q$ \
  70. dma_addr_t dmaphysdest1 = 0;" W* o4 w% ~" |
  71. dma_addr_t dmaphysdest2 = 0;
    3 n2 F( R# j2 [% S) Z- s( D4 }

  72. " C" m& D. l' e, r( K& G7 v
  73. char *dmabufsrc1 = NULL;
    * i2 ?" V- V9 q$ D1 E7 ~0 v# N% |' `
  74. char *dmabufsrc2 = NULL;
    - q: d7 M' p; R- k. J/ N6 I
  75. char *dmabufdest1 = NULL;
    0 S4 {: L' J% J. k6 }' H, w5 e3 l+ @
  76. char *dmabufdest2 = NULL;* F5 H, U3 W% K: X
  77. 5 S2 d5 I1 U8 ~4 G8 L1 v- c4 a. h+ I
  78. static int acnt = 512;
    / Z# i! G$ {: B" P2 Z- A& W
  79. static int bcnt = 8;! f+ o/ I5 Z( h3 u
  80. static int ccnt = 8;
    ; X. `% K% b% Y
  81. ) e' G) L. A: M* ^  v) i# t" S9 y
  82. module_param(acnt, int, S_IRUGO);
    7 p& d5 q. S* b9 ?
  83. module_param(bcnt, int, S_IRUGO);2 h# X. {; Y9 F( B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' X, v; H: z7 V0 U8 X
0 ^9 e% i+ v- b) q% @7 w: n8 o1 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( T7 `7 y, n$ S4 ~, ?; l& k+ c
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 ~! ]6 f) Z1 W( }& g$ U& l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; N9 d* c: E9 z0 \2 j* }. Y) |2 z( w. }
+ z/ v5 t* ^* O# [2 ?# T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 04:36 , Processed in 0.039366 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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