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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; r  `( c) U+ I6 Z
  1. [code]EDMA sample test application; Z& z: H$ Y" z) C* J9 e3 y$ f% O2 k
  2. /*4 j$ A5 o3 \) W" Z5 q" Q
  3. * edma_test.c
    . {1 k! A. m- z0 S2 r; g2 r
  4. *
    8 P% \" R. P, {0 g; {: |9 C
  5. * brief  EDMA3 Test Application
    % Y+ T; d- Z5 ?6 i- Y. h( o
  6. */ \- z3 R0 K* P7 r% }
  7. *   This file contains EDMA3 Test code.
    % @2 [# i" L: W4 s' f
  8. *
    9 w" n  Q8 Z; Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : L3 L6 S9 ]9 d7 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , \( V( ~, H) b: |; [
  11. *         TO CHANGE.
    ! }. `* X# d# `! i& B2 P9 H
  12. *
    & u1 x6 ~, W5 ~4 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; z5 y, g4 S' r1 Z, @
  14. *
    , ~; q& j+ H9 c/ L) w  {5 P/ m* q- x
  15. * This program is free software; you can redistribute it and/or9 V1 z6 a0 n& B2 k! B, Q# b6 f/ V
  16. * modify it under the terms of the GNU General Public License as
    5 ^8 w* \. ~1 b2 V, w5 Z! q/ }
  17. * published by the Free Software Foundation version 2.
      E; Q2 T" l$ n
  18. *
    # E3 Q3 a7 ?; R( l' k; K' {# Q  K  M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! u. a6 }( X: n: ~
  20. * kind, whether express or implied; without even the implied warranty# R; C$ x7 V, ?1 t- _9 z( K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 _; z+ _4 D! q  N* X- T9 ^  z
  22. * GNU General Public License for more details.
    1 L8 @5 U4 F6 ^
  23. */
    ' N+ w/ H2 z' H: j, d+ @
  24. % U: i7 O% s5 ^& t7 S" F
  25. #include <linux/module.h>
    # V  l% j6 e7 R8 H% w* D
  26. #include <linux/init.h>/ O8 U0 q$ V1 e' }
  27. #include <linux/errno.h>
    6 \. [* v" J0 J% @  ?& J
  28. #include <linux/types.h>9 V5 b1 e# b2 `. |* y
  29. #include <linux/interrupt.h>5 \2 p' ^- j( S/ w$ e5 I# ~
  30. #include <asm/io.h>! s$ ~! ~5 k7 p. A8 g6 _
  31. #include <linux/moduleparam.h>! B) f  L4 T. s9 L8 ~4 W
  32. #include <linux/sysctl.h>  o: W" h. T; j3 w( |
  33. #include <linux/mm.h>
    4 G7 y) [4 v/ R% Y) t
  34. #include <linux/dma-mapping.h>
    ! p7 g! L5 W( V; R; F( z7 b

  35. 3 @0 ]# a! E9 k6 N1 x
  36. #include <mach/memory.h>5 R) y' B" n( O7 p" v2 o; j  _& I
  37. #include <mach/hardware.h>  I8 s6 h6 ~. c3 O4 E, x
  38. #include <mach/irqs.h>
    1 v& `. Q& C& A- Z1 `
  39. #include <asm/hardware/edma.h>8 v- j5 ~, K/ O, Y
  40. ' A3 b* V# |4 f2 c/ t9 @. k( C
  41. #undef EDMA3_DEBUG/ I4 e( W8 t0 r( U; l
  42. /*#define EDMA3_DEBUG*/* {5 O, Q9 R' I' ?3 R+ M

  43. 3 }& `0 W" g( L6 i+ Q
  44. #ifdef EDMA3_DEBUG  ]% a8 U# A9 {/ x3 H) N6 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 F9 P6 a  [5 b$ E( c, e2 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" G6 _8 J6 _  C, y8 y0 h; d2 k; V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; X& i1 X. ~0 N$ R% l2 @
  48. #else
    9 n" M& c2 D. [/ G
  49. #define DMA_PRINTK( x... ), F* E; f' a7 e  j8 u; l
  50. #define DMA_FN_IN
    1 e. N( E0 d; Q4 a/ G8 U
  51. #define DMA_FN_OUT) V3 ^& X, R1 o  ~
  52. #endif
    + }7 T  s+ f0 F3 L' _

  53. / g  z8 L" t( K" E) }+ v* {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  E8 m8 l3 |0 m
  55. #define STATIC_SHIFT                3
    0 K2 r& p5 o" u: K: |
  56. #define TCINTEN_SHIFT               20- E4 s! q4 t0 z7 o
  57. #define ITCINTEN_SHIFT              21
    * F' Z' L) ?1 p) l
  58. #define TCCHEN_SHIFT                22
    0 `3 S, Q) r1 q7 s4 s
  59. #define ITCCHEN_SHIFT               23( F" ?1 h( D; ~/ V7 K
  60. 3 Z( v0 o) F0 K) k+ N
  61. static volatile int irqraised1 = 0;' P8 V8 b5 q& w' R* N) h( S
  62. static volatile int irqraised2 = 0;
    % t; G0 r& H# P; X
  63. 0 ?' z9 t* E/ A3 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! c% t; y9 N3 s* z7 {) z4 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 l4 Q' r" }$ |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . Z% O: u6 @2 h) m6 k# Q

  67. 2 a+ X0 i, O- m8 T& ?0 y) f
  68. dma_addr_t dmaphyssrc1 = 0;
    : G7 ~; t, ?% u
  69. dma_addr_t dmaphyssrc2 = 0;
    ' j5 P2 K% b" [( ^
  70. dma_addr_t dmaphysdest1 = 0;
    / p( ?" H1 _# V. }+ P
  71. dma_addr_t dmaphysdest2 = 0;" d6 @* |+ o3 q% S3 j) N* |
  72. + z( [  T7 l- Q6 w. t4 G
  73. char *dmabufsrc1 = NULL;
    / s& M4 L0 z! x& W4 f6 h
  74. char *dmabufsrc2 = NULL;: J3 a, ^) ^3 \* O- F" }; s
  75. char *dmabufdest1 = NULL;
    8 D+ J& j2 W, J! v3 o0 G+ C
  76. char *dmabufdest2 = NULL;" h1 `3 p, m2 H( t" f9 C  G; N
  77. & }0 g$ ]' o! W5 ~6 T7 Z. P+ r" C
  78. static int acnt = 512;
    ! N" G  h: k7 ?  e  Y/ K
  79. static int bcnt = 8;  j4 J% G$ r* N: A  v
  80. static int ccnt = 8;
    , N. E' ^+ g1 }8 \: C4 s( |
  81. ( q7 @1 S# n& x# Z" Q+ ~
  82. module_param(acnt, int, S_IRUGO);( J4 a3 {4 T! Z& V
  83. module_param(bcnt, int, S_IRUGO);3 F7 ?$ w. Q+ a! u. a. F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" I1 i& B6 k2 q' j: `5 N( a5 N* a3 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, I5 O7 e* p: O7 l/ l0 F- d1 x1 S5 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# O" v+ M  z/ _) h; ^+ s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 D4 Y) v5 G, Z
, o; b% W% m! w8 _0 j% ^3 K0 e
, m% M! h% k) K- B/ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 03:17 , Processed in 0.038578 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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