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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 l) Y. X6 }8 H9 S0 @3 S, H
  1. [code]EDMA sample test application5 @( K( h. u( m
  2. /*  x! `% r$ k3 \& t$ N
  3. * edma_test.c
    - d6 T' k, Y( J8 Q, v
  4. *
    ) b# Y2 d, N+ g3 I9 }
  5. * brief  EDMA3 Test Application1 p0 l" v, d& v; X# {- m
  6. *- `3 a# H( ]4 A
  7. *   This file contains EDMA3 Test code.5 Z; r$ `8 ?  d. ]% e) ?3 k! n
  8. *2 \1 Q6 Z, {& e8 L' q% P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - L/ w9 s+ [: s' K2 g4 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; Y/ d8 v, O3 q; {' t9 f" l
  11. *         TO CHANGE.5 Q! m0 z1 w: _
  12. *9 L" d6 X( ^( h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  R7 J8 K5 P+ I/ J# ^2 ?, |0 o
  14. *+ y; a9 O1 w, e1 s/ O( e8 t
  15. * This program is free software; you can redistribute it and/or0 f" ~. j4 b* X6 ?- j4 ^! l
  16. * modify it under the terms of the GNU General Public License as/ H" m. {" K+ X, `8 ?) E9 U, F
  17. * published by the Free Software Foundation version 2.& ~, a  V" ?: b3 \4 ?
  18. *
    ' ?" R4 d% L9 w9 M0 b" W" A: R, Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' V4 h5 B4 v. C& A+ r/ p& n3 v
  20. * kind, whether express or implied; without even the implied warranty
    ; d8 e3 c8 b: j$ I5 i5 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" L  H- C+ I6 [( Y! \
  22. * GNU General Public License for more details.
    & z. x( G, Q: }0 b4 @: s& G
  23. */
    $ f$ Y( Q3 K4 o2 `. C

  24. 0 g" `, P2 ^% z! t  F
  25. #include <linux/module.h>: V) ^8 }4 O9 Z* p4 P
  26. #include <linux/init.h>
    " s+ r  T7 X( D6 h2 ]' h
  27. #include <linux/errno.h>6 n7 ^* B8 A! C# }5 }
  28. #include <linux/types.h>
    / r$ X9 C* t( Z& X- X
  29. #include <linux/interrupt.h>/ p- H  b+ f- ]$ z$ X
  30. #include <asm/io.h>
    ; S# x# B* c, o6 g
  31. #include <linux/moduleparam.h>* ]8 `" z* G4 T6 O, C8 c' ^0 ^6 H
  32. #include <linux/sysctl.h>
    ! b2 J9 k) H5 q1 u6 y
  33. #include <linux/mm.h>
    ; D2 I8 x2 E1 K& d
  34. #include <linux/dma-mapping.h>2 h- ]1 \- y: h6 q5 M3 N9 c* W
  35. 8 b  k3 D! A  @4 J- T% e& Z
  36. #include <mach/memory.h>: l. ]9 E/ }2 n# S
  37. #include <mach/hardware.h>4 b- n5 m3 m9 V" Y9 f4 C
  38. #include <mach/irqs.h>, ^; ^+ a9 e+ _) U1 r1 @
  39. #include <asm/hardware/edma.h>
    2 B: |4 V4 D: d2 ^
  40. : d7 @1 r8 E( o9 r" @$ J3 G2 P6 y
  41. #undef EDMA3_DEBUG' z2 ?7 x; z1 M( e  I
  42. /*#define EDMA3_DEBUG*/* w# g# s/ x7 r, x9 h" f; N( b( f7 D

  43. 3 r) G! x$ K( O
  44. #ifdef EDMA3_DEBUG) _2 ]; Q7 ]' }2 |* j1 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). p$ l. T1 v, o' V% W' C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): K4 N, q0 W* Z% M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& ?& t% p4 ?+ N, F4 R" E
  48. #else# P; y$ E- A) m. U
  49. #define DMA_PRINTK( x... )" f5 x$ v0 y* T) y/ A) X
  50. #define DMA_FN_IN# j: I) K- Y9 t1 |
  51. #define DMA_FN_OUT: W2 t0 J- {- n* ^# `$ x/ Z
  52. #endif
    6 v8 l6 G! n9 r6 ?$ V

  53. % Y3 D- {/ {! J9 I7 l9 O# k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 F& p# K6 f( i9 ^: U
  55. #define STATIC_SHIFT                34 t6 X4 s9 e4 ?7 D2 ?4 E; G5 F
  56. #define TCINTEN_SHIFT               20
      r! S5 e3 M( ^1 @% |) c& h
  57. #define ITCINTEN_SHIFT              21
    7 _3 U% D# E& R
  58. #define TCCHEN_SHIFT                221 a2 y" c* O) [( K2 S5 `. |
  59. #define ITCCHEN_SHIFT               23
      T- R1 ^& H; ?0 y

  60. ! ^7 A' r! k; [7 |0 w
  61. static volatile int irqraised1 = 0;
    % R% I) R! z& R; X8 b/ Z+ Z
  62. static volatile int irqraised2 = 0;
    : y, N) v6 d6 T# x

  63. 5 T& F% n$ Y4 v) R& i+ I! u! M9 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u' U/ N( ^% C  ^: r8 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |$ E& y5 X0 P- N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  n1 X2 e. E, @! I3 ^

  67. . B4 W% Z* @- D7 v, v
  68. dma_addr_t dmaphyssrc1 = 0;
    1 u$ S5 E1 q* l$ Q( }
  69. dma_addr_t dmaphyssrc2 = 0;8 S3 s4 L5 y# M0 V6 d- c8 d: N( c# a
  70. dma_addr_t dmaphysdest1 = 0;
      J( H) c" B0 I5 z
  71. dma_addr_t dmaphysdest2 = 0;* i# A3 B" G. s4 S6 ]8 v( g5 U

  72. , V' i; i" _7 k. s5 ^
  73. char *dmabufsrc1 = NULL;, w1 f/ U3 t8 G. O2 b* P1 S* C
  74. char *dmabufsrc2 = NULL;+ V! [# T2 C- {
  75. char *dmabufdest1 = NULL;8 H- i  e9 E8 C
  76. char *dmabufdest2 = NULL;
    % e! }3 @/ w: o% l
  77. 4 D: |% I0 ^, g0 |& r" }
  78. static int acnt = 512;
    % g2 T1 V+ f5 f* B$ n( w7 [
  79. static int bcnt = 8;* s- b0 f& ?0 v$ ~  q7 P0 R- m
  80. static int ccnt = 8;
    ; l( L; C9 _# k6 m
  81. ' R: n" g( n0 D
  82. module_param(acnt, int, S_IRUGO);
    3 o* d# V6 Q1 }, N$ I4 c
  83. module_param(bcnt, int, S_IRUGO);5 H8 w# P1 r1 Q" \- ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& C, C. B5 `9 w0 h7 D0 @" D

4 M- \% Z. A! u8 @& }2 L: V/ Q& u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) J+ o% V" J. J8 G) P, m- T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, s: L2 j1 U% W5 k7 l; q* e/ f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" E2 e5 k+ f! i2 x8 W1 u& K0 t# Y5 o9 c

- ]. l' D, s+ m' o) M9 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 21:33 , Processed in 0.040003 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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