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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* v6 a4 Y5 J, D" u0 t
  1. [code]EDMA sample test application1 }. v+ D* A  B* P4 Q
  2. /*
    , L* n/ f2 O2 l  u2 Q5 Y# f
  3. * edma_test.c, s* y% G" T0 t, c
  4. *
    8 I4 h# c/ S$ M: v3 D5 |
  5. * brief  EDMA3 Test Application
    . a# R3 x6 f# T- i# t
  6. *
    , D; U3 l9 z6 ?3 j, u% K
  7. *   This file contains EDMA3 Test code.
    & ~+ u& p8 p7 n! H/ W- c
  8. *
    1 A  ^- t3 o( Y$ K; x1 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) \0 E# B+ l4 x0 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , Z  o% o- h# _4 j
  11. *         TO CHANGE.
    0 [" b+ M5 R. s; f
  12. *( J" z/ |% j, Z0 ]; g* V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      V' n$ r- ~5 U4 O
  14. *
    . g0 P5 K" e! L8 k5 }0 x
  15. * This program is free software; you can redistribute it and/or+ c5 ~5 e% ?0 b8 U7 H
  16. * modify it under the terms of the GNU General Public License as5 n7 j9 X) [# s4 x3 D  l$ \0 g3 c
  17. * published by the Free Software Foundation version 2.
    7 P8 d/ |1 e" S3 ^1 j
  18. *& n+ I$ ^4 P5 h5 {! ~; |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! t2 A0 t: o* }- c4 A% s
  20. * kind, whether express or implied; without even the implied warranty2 D' r+ ~" O8 V/ E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 h1 G* ~0 I5 I/ t8 n
  22. * GNU General Public License for more details.
    8 Q1 B8 W  y* P% b$ G
  23. */
    0 i  |9 i4 i6 |; M9 }; E, `

  24. 8 z" @) s/ e7 C2 `
  25. #include <linux/module.h>
    % x) H7 C- J# E1 `+ O
  26. #include <linux/init.h>& N  z1 K+ m5 e6 U1 U
  27. #include <linux/errno.h>
    # W$ w6 T1 R, s$ s! n6 d# r
  28. #include <linux/types.h>
    3 Q2 {1 i3 A" S9 E& b6 e  A
  29. #include <linux/interrupt.h>/ ^9 L( Y/ W+ \7 i
  30. #include <asm/io.h>
    1 u5 h6 G, R. }+ u; d7 G; R8 H
  31. #include <linux/moduleparam.h>2 M( k0 g( Z" y7 f) r' o
  32. #include <linux/sysctl.h>
    & C" ^3 x6 Y( J* a7 H
  33. #include <linux/mm.h>
    ( l* U, u  x; m1 g0 @# ^, ]7 s
  34. #include <linux/dma-mapping.h>9 ?  u" o, e$ ^9 h

  35. + w/ g# h  {. H: c
  36. #include <mach/memory.h>
    9 A5 J4 H% b- I. w# W
  37. #include <mach/hardware.h>8 w8 w% s+ o5 I7 {6 B
  38. #include <mach/irqs.h>
    4 o4 s; I) p3 k) J* h* u
  39. #include <asm/hardware/edma.h>
    ( O, [# y4 j& n" K* Q4 |' A6 x
  40. ( |: Y; p4 m5 P) j# G9 ^. a" z
  41. #undef EDMA3_DEBUG% Y( B# T) I6 r! O
  42. /*#define EDMA3_DEBUG*/+ S/ G/ e5 G0 h; H
  43. * B' R4 G" _! P* ?) v8 e0 Q% }
  44. #ifdef EDMA3_DEBUG: G  u  L7 h* ^: a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 M0 v" O) R4 k; L4 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 h. U% t' a! U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  E6 Y5 _8 j$ g: x9 {
  48. #else
    3 d$ J" {$ H; M! [+ h* w' R* ~8 t
  49. #define DMA_PRINTK( x... )% p8 {: P# K! Y# y8 Q4 q
  50. #define DMA_FN_IN
    # y! p! O6 t: p% l
  51. #define DMA_FN_OUT+ U$ |4 H+ Q' e; [, l
  52. #endif2 O: `- _# T1 k& m' M/ ^

  53. # ~' a5 W% U6 H# j- ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 F% W. l$ {, J6 a- j9 k
  55. #define STATIC_SHIFT                3
    & c' U0 t" k$ N  T
  56. #define TCINTEN_SHIFT               20% G1 p6 D. R6 d! r% N- C5 a
  57. #define ITCINTEN_SHIFT              21) R* z8 y) `" d8 _! P! N
  58. #define TCCHEN_SHIFT                22$ P4 \* u- r$ s) N
  59. #define ITCCHEN_SHIFT               23
    ( L3 s* h" t& D

  60. 6 P/ s" i% k2 @% Q
  61. static volatile int irqraised1 = 0;
    % V; f( D% t7 `5 ?- Z7 A
  62. static volatile int irqraised2 = 0;
    - W3 ~; r" e$ l8 k6 o6 E- M7 T

  63. 7 K# _1 y( e: p, ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 u8 d& B( x; y) y$ {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + Q& H$ v2 K7 E$ @$ N( P8 _6 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# @% n$ |  s. ^. Q9 _0 u4 j9 U6 m

  67. * F& P* T  E. g: Q
  68. dma_addr_t dmaphyssrc1 = 0;9 ?. ^6 M! ?$ \- i4 a" F" U
  69. dma_addr_t dmaphyssrc2 = 0;4 z. J; W1 k( `0 J" ?2 K. m" c& j
  70. dma_addr_t dmaphysdest1 = 0;: ]5 B" [: }2 {: p9 Q
  71. dma_addr_t dmaphysdest2 = 0;
    " L5 `  X+ x. f" ~! h

  72. ; Y8 {' U' B4 a6 z' {
  73. char *dmabufsrc1 = NULL;' g' ?9 @- e9 H: e
  74. char *dmabufsrc2 = NULL;
    & ^0 g$ _+ e! T& z) s+ A
  75. char *dmabufdest1 = NULL;, Q" g9 |# d+ o( A4 T: P; B& U
  76. char *dmabufdest2 = NULL;
    2 S! a6 G; f8 q

  77. 9 {$ K3 ]0 T' y) ?- j
  78. static int acnt = 512;
    . `8 H& |( ]0 Y/ W# D) d
  79. static int bcnt = 8;
    / {& I8 Q( A( \0 d
  80. static int ccnt = 8;: d3 I/ ]" b( `* k( k7 @

  81. ; X" b+ U; @+ s6 W# [
  82. module_param(acnt, int, S_IRUGO);
    * M8 y: V# C) S" G) V& v2 ~
  83. module_param(bcnt, int, S_IRUGO);
    " c! y+ v- ]" Q% s. w$ j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 `- ^8 V9 z$ w% _" \; [7 W& m
: |% F. a4 f4 d, T5 h5 e5 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 c) N+ w9 }( R6 }0 }6 O  [, g5 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( I6 p! w3 W3 R7 `5 ^8 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; I; o) @- F1 Q- }* u5 d5 G$ J; f/ s2 p1 `7 G1 S, K. @
& u( l0 g; ?5 J: B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 11:29 , Processed in 0.062496 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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