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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ T$ s! L# G( {3 h5 A( M
  1. [code]EDMA sample test application
      I2 l; X7 c- L4 d7 \
  2. /*0 f1 A4 t; B& c& x6 N
  3. * edma_test.c
    - D2 B3 L0 }( a: m6 \
  4. *
    8 d% G- E% U& U: U: L4 T8 Z: E
  5. * brief  EDMA3 Test Application
    - O, c4 }; V" B+ X7 R( Y/ z
  6. *
    9 g4 K  ~9 @! m
  7. *   This file contains EDMA3 Test code.* f( c1 i& h0 K9 W; q
  8. *  B/ m5 _4 l) P' ?. Y7 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 A  L( f; @2 k+ V# j. ^  ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, @$ c* e' I. N! q/ _) B0 Z, [
  11. *         TO CHANGE.6 T" j- x# m7 b3 K8 m
  12. *
      {3 U$ e4 U7 k6 E% ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : Y+ M  O6 U0 G# \, |
  14. *5 t0 {. x' Q* Z2 Z
  15. * This program is free software; you can redistribute it and/or0 k! D4 y8 a* p$ G  i
  16. * modify it under the terms of the GNU General Public License as
    - f2 s' K4 M" R+ v7 b
  17. * published by the Free Software Foundation version 2.  e, ?# L# u( r. R  A, m: R1 e: t: e
  18. *, \5 b0 `* O7 b0 E; m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ^& T9 Y' w+ G4 p3 s
  20. * kind, whether express or implied; without even the implied warranty
    9 S/ ]7 T9 w" M- b7 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 t( x' w7 d% x
  22. * GNU General Public License for more details.$ L0 Y  ^0 z/ _2 r- S" Q( Z
  23. */
    + l9 Q! r) {; _* l5 K

  24. + l: c9 @  V" I
  25. #include <linux/module.h>
    + J0 d7 E( g- L2 u& [
  26. #include <linux/init.h>& g. g% |5 F. E! x2 w
  27. #include <linux/errno.h>5 n( L& m+ I$ {' `3 ]# V0 W) \2 `( O7 @
  28. #include <linux/types.h>
    6 y) n, T: g: X
  29. #include <linux/interrupt.h>
    - ^. H) W; R  h; _" w% r
  30. #include <asm/io.h>7 x7 U2 Q8 `4 U0 t  p+ {( o
  31. #include <linux/moduleparam.h>% r  n  `) Y; \3 p7 R
  32. #include <linux/sysctl.h>0 m  e4 t& K1 j+ d
  33. #include <linux/mm.h>% u- B6 k; f' o9 x% Z& K4 P# g" K
  34. #include <linux/dma-mapping.h>
    3 ^* H2 D: P. p6 Z4 N# v# T5 j, l

  35. ' c  N& ]. y2 _' G1 h* B, R+ {$ Z
  36. #include <mach/memory.h>5 d' c2 Q' b! d! h- G9 F) P3 j5 A
  37. #include <mach/hardware.h>
    , |% w$ N( a8 u& d( P! U2 B
  38. #include <mach/irqs.h>& S/ \: C# E6 b$ B& M
  39. #include <asm/hardware/edma.h>
    " M8 }5 l3 L% x* D: s7 _8 Q* B, |4 S

  40. 6 g5 E, ]/ y- Z7 I" R+ }
  41. #undef EDMA3_DEBUG; t, A7 v. F$ {) H1 ]
  42. /*#define EDMA3_DEBUG*/
    * d, d- I5 c3 o
  43. * u' u! d4 D( ^; p, `
  44. #ifdef EDMA3_DEBUG
    7 p5 e7 ?) X; u3 m( f$ @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 Y% c$ A1 T6 s9 ?, A" R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! \1 p' l# v# A, G% w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) R% L+ F+ J/ _5 P7 k' b
  48. #else
    % m/ M4 Z7 w4 O5 g; q# b- }
  49. #define DMA_PRINTK( x... )7 c+ a5 x4 w$ N+ t# x, m9 A
  50. #define DMA_FN_IN5 |$ E7 z* G# R8 [
  51. #define DMA_FN_OUT
    . q  B4 V9 s& b# }
  52. #endif
    4 Y$ m0 r$ [: o
  53. 2 G; ~0 v9 N  H# Q/ Q/ \$ R8 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 }3 J1 z' R, x8 e- {7 e
  55. #define STATIC_SHIFT                3
    , E5 w0 P+ F" |. F! i- y
  56. #define TCINTEN_SHIFT               20: I4 ]* M- F' ~1 k1 ^# E2 U7 @+ J
  57. #define ITCINTEN_SHIFT              21
      V! U. s& p, U7 F3 R) R& T
  58. #define TCCHEN_SHIFT                22
    , d9 H2 O2 j/ N- H; S* J
  59. #define ITCCHEN_SHIFT               23
    / p3 u5 F; F5 j- l/ J9 a
  60. & @+ [" n* R9 L. b
  61. static volatile int irqraised1 = 0;) [- i$ Y& F8 h. ?
  62. static volatile int irqraised2 = 0;
    + y% w! j. D* r0 K

  63. 1 c7 `9 f! }3 y5 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * K* u! P  ?$ w  }- v( S9 Q* ~0 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, u6 E! A9 b2 c: Q0 H' v6 {1 l) i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * S; B1 d$ y* T2 {$ `

  67. + V: ?8 W' ?! Z, u' t0 E4 _
  68. dma_addr_t dmaphyssrc1 = 0;
    ) }  c* Z7 `& V2 b
  69. dma_addr_t dmaphyssrc2 = 0;
    1 f* M$ M% b" J/ |/ x' `9 g
  70. dma_addr_t dmaphysdest1 = 0;* [: {8 [% y4 l, f* @9 @7 I2 T
  71. dma_addr_t dmaphysdest2 = 0;- g+ u5 w, P" @3 s- P# Y- h

  72. 0 Z( @- ^& D" z6 l, ]' }) ~
  73. char *dmabufsrc1 = NULL;
    9 L; u' P( W- ]5 x4 V# g
  74. char *dmabufsrc2 = NULL;0 d( b: e5 @  ^% x% D1 A
  75. char *dmabufdest1 = NULL;
    % y) i1 x6 Y5 }, y
  76. char *dmabufdest2 = NULL;- A. [. u( T$ C/ u5 f9 L
  77. ! J" |% M; T% }: }
  78. static int acnt = 512;
    : D! |. x6 [7 }& z4 s
  79. static int bcnt = 8;) t' G; y7 b7 E' Q6 u& A9 e
  80. static int ccnt = 8;
    ; {" B/ @$ v: g
  81. 1 ]: s. z: ^6 L4 Y8 M
  82. module_param(acnt, int, S_IRUGO);% k% }+ ]" `" I: D
  83. module_param(bcnt, int, S_IRUGO);: T* h2 R+ t6 X; E6 r& Z' s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- u- U0 g$ I7 ?: z9 X6 e- ?

+ q( z3 U! f; K6 m2 w0 d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, G& l$ o+ D# N) V' k$ Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: V( Z; c/ s9 s# v. Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 t/ z9 @! J8 }# l8 i
  f6 G3 P, S- @# j& q
% |( e8 P, H- o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 06:48 , Processed in 0.038001 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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