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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( \0 _* h* r* y7 x- t
  1. [code]EDMA sample test application1 q8 f; J; w. s- |
  2. /*
    4 R. V% l8 G% k* s" e4 S5 j' R
  3. * edma_test.c$ a2 o: o) @6 B; K- [$ Z. M* M# Q
  4. *
    + v  K6 b/ `; H0 X: S7 S: ?6 Q
  5. * brief  EDMA3 Test Application
    1 c  J! x, N) j7 F$ p6 ~) I- D+ I
  6. *
    + f8 P7 b2 C0 Q
  7. *   This file contains EDMA3 Test code.
    6 U. ]4 w! m8 Q, @# ^
  8. *0 o. U7 n- E5 Q3 M! \9 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! S9 ]5 v5 I: Z8 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 k7 m6 l' u  n& q, q
  11. *         TO CHANGE.
    8 p! h8 S$ h" I- G: W$ }
  12. *
    # x* [' L# {( `5 u  u! m: v8 e7 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - C2 D- T, y+ ^/ h" X
  14. *
    ( L/ l* E) G+ S6 n4 @
  15. * This program is free software; you can redistribute it and/or, ~3 T1 K5 Y- k2 y5 B' u
  16. * modify it under the terms of the GNU General Public License as3 B2 I6 A% r& E; {8 [" C. }5 S
  17. * published by the Free Software Foundation version 2.
    * ^) f# E  O# [" ]9 @7 ^, d5 t7 F3 o  @
  18. *
    6 n) s) L: A. G3 N2 h+ H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 x: {! T2 K/ U: a
  20. * kind, whether express or implied; without even the implied warranty
    2 A% m: V. G6 G4 n  A  V9 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) U6 D; y6 |0 w) l5 l2 \* \
  22. * GNU General Public License for more details.4 ~9 x( ~3 q; W" K; v
  23. */
    1 ]5 A) F$ N" \' {; ~/ ~

  24. $ f, d4 B; }4 d3 |0 s' O/ w
  25. #include <linux/module.h>& _( {# T& D1 T# ^. y5 I- h5 t
  26. #include <linux/init.h>
    8 j* f& W. X, `
  27. #include <linux/errno.h>
    , g1 s9 s9 b2 Y3 q
  28. #include <linux/types.h>
    + K  W9 h' P/ W. R, g
  29. #include <linux/interrupt.h>
    - ~' j5 V* S) l  y" _6 C0 H
  30. #include <asm/io.h>
    : a, J- E4 o6 D1 S* K9 F( a
  31. #include <linux/moduleparam.h>
    ! a5 F: O2 R. }8 a
  32. #include <linux/sysctl.h>
    . q8 g+ {' K& ^) B
  33. #include <linux/mm.h>
    5 V1 E7 K; o5 m
  34. #include <linux/dma-mapping.h>
    , ~! U; S) [# E# j# _- e9 `+ I
  35. 9 e5 z& S) P1 e, }& E
  36. #include <mach/memory.h>; e4 \# K3 ]+ u" N$ |
  37. #include <mach/hardware.h>3 b9 q* E: D( _0 k4 C
  38. #include <mach/irqs.h>, D0 o* }/ [' i4 m2 G5 @% g! @1 x
  39. #include <asm/hardware/edma.h>
    ) j; {2 K5 u( N3 b

  40. ' }4 D3 f1 S  \
  41. #undef EDMA3_DEBUG% ]5 r4 h: A( a5 }8 }
  42. /*#define EDMA3_DEBUG*/
    $ O# p# ^: I/ H7 C+ C

  43. $ J7 x0 @& X! L
  44. #ifdef EDMA3_DEBUG& z0 `7 X. _; I* U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * S& }1 |4 r8 q0 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 w0 d7 ?& w7 r; |* n1 z* n/ u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), X% ?# I4 m* ?8 ^0 }' ^% y# V  p
  48. #else
    : c/ \% o+ M1 Y8 z
  49. #define DMA_PRINTK( x... )2 U" g7 y# V- s* e+ Z  q
  50. #define DMA_FN_IN
    " s, T+ `" ?8 x
  51. #define DMA_FN_OUT7 i5 ]" D- F. s9 p9 @* T3 e/ I) r
  52. #endif
    7 x& ?: u3 K2 l0 B  n
  53. & {: n/ [9 i" X: @0 r) Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  P$ w1 Y* ^. ~! s( A' g- c0 s
  55. #define STATIC_SHIFT                3' L5 v; ^& T! {9 [
  56. #define TCINTEN_SHIFT               200 ~, x, d! m$ A# H* {: I6 |  r
  57. #define ITCINTEN_SHIFT              212 Q$ J1 x9 l/ @! o! |
  58. #define TCCHEN_SHIFT                221 _9 K$ M2 D# R3 H
  59. #define ITCCHEN_SHIFT               23- o8 D" X+ x* S
  60. 8 @6 _/ ^& o  y1 h+ g
  61. static volatile int irqraised1 = 0;
    / ]: x, s5 @. N0 r
  62. static volatile int irqraised2 = 0;
    - j5 c$ L( f% Z0 k  t
  63. / {. D5 v- X7 j+ ?5 d% ^; c  m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 {( D& _4 x- d/ u) q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Y7 f( E: {0 h$ l9 \; z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& L& Q$ Y. q: g$ k& c( e7 W0 z6 t

  67. 7 R: D  d0 F' w7 c+ L
  68. dma_addr_t dmaphyssrc1 = 0;
    ; f  Y# J1 B! q" D% u5 P2 b- E
  69. dma_addr_t dmaphyssrc2 = 0;. [4 M( O3 x& L) W" M
  70. dma_addr_t dmaphysdest1 = 0;0 f9 s$ M7 m) R! m
  71. dma_addr_t dmaphysdest2 = 0;; f. @1 L0 c- A; q# L' _. d: _& f

  72. , c# i% x, a7 p+ G* q# y9 C6 g/ `
  73. char *dmabufsrc1 = NULL;
    2 f* u7 A. z6 T' f" }
  74. char *dmabufsrc2 = NULL;
    7 z- t% E0 g. j/ u3 W0 X3 }4 u0 f& Q
  75. char *dmabufdest1 = NULL;
    0 y( n; }; C; |; u5 O
  76. char *dmabufdest2 = NULL;/ @$ k2 Q" u6 {4 {. v: ]/ S

  77. 8 A( Q% |5 X. I2 z+ m  {. T  [
  78. static int acnt = 512;
    , c( C7 Y( i, I* _& `+ }& `/ ~, y
  79. static int bcnt = 8;1 K, K, \1 ]( e3 i( @
  80. static int ccnt = 8;% b; e+ h& Z1 \2 Y/ E. H; P0 }4 g
  81. 9 T% ?! _/ F" V' P. U1 h+ Z
  82. module_param(acnt, int, S_IRUGO);
    1 C0 Z& g! W. j- z3 ^
  83. module_param(bcnt, int, S_IRUGO);3 R9 t6 N& h' J" a, L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 M8 d: H3 q1 O. z' h* S8 N
! }3 s6 u. V1 r0 F2 N/ a0 |+ R6 x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' K- d! O- |% _! w) a' Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 F; k2 E; t. V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 S4 A+ u. |; g, y4 w

& `7 }5 W+ p, s0 j9 d' a, T+ F6 P. ^5 U+ g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 03:28 , Processed in 0.039200 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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