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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 H6 C( o& K8 A' _6 H1 s0 J
  1. [code]EDMA sample test application. ]% @- B# `% B5 \' y  c
  2. /*
    ' v+ E  X  E, J1 f7 J* I
  3. * edma_test.c
    " u1 `% r3 f# K. ?# N6 c! B
  4. *% K4 ^7 b7 t5 B  j
  5. * brief  EDMA3 Test Application" W# t3 Z4 X- t
  6. *
    ; ]( [" T0 s% O; C
  7. *   This file contains EDMA3 Test code./ e; _# q! {9 U1 j, I
  8. *. ?8 s  Z/ M# \; S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 K' R; s! q3 N; B1 {& d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 C/ F9 ]& S) h2 ?
  11. *         TO CHANGE.5 k2 i* T$ y8 ]6 A- U
  12. *4 U6 j, l5 ]! K' ]. x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  H. h( o7 c6 V) E0 R
  14. *- x% U* T: Y% Z: }
  15. * This program is free software; you can redistribute it and/or+ o5 o; B" V, C
  16. * modify it under the terms of the GNU General Public License as
    ) I1 G- y# D7 x4 L
  17. * published by the Free Software Foundation version 2.6 G5 b! h- N* X8 I4 H
  18. *
    " H1 A* m' k, W7 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 x: [0 V5 A3 v9 Z7 g: N- Z4 h
  20. * kind, whether express or implied; without even the implied warranty7 q2 _" o  z( w* W' b( m$ w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 V4 H% n9 A' B+ U8 V8 N
  22. * GNU General Public License for more details.+ [. T- r2 K8 [7 r0 I3 @; S* K# M
  23. */
    * V: {2 w6 _" f7 r: o2 J% c+ z/ ?$ f

  24. & S3 A# H4 p; q  S9 V
  25. #include <linux/module.h>
    5 U: D1 c* Y9 `1 g( F- H
  26. #include <linux/init.h>$ V2 H, o; L6 N" x  D; l5 \
  27. #include <linux/errno.h>
    " k6 s! h" v. j, Z+ C& ]' _
  28. #include <linux/types.h>' H' z& |2 q. a  i" m
  29. #include <linux/interrupt.h># h6 f9 G, Y) p. g. K: W* G
  30. #include <asm/io.h>
    ' Z! ?9 X! N, c# F6 V
  31. #include <linux/moduleparam.h>7 W& e! F1 L6 }1 [
  32. #include <linux/sysctl.h>% |" i" x+ e5 q8 C
  33. #include <linux/mm.h>
    8 _! z! j) \, r1 Z& y
  34. #include <linux/dma-mapping.h>* j% W( A: {; c, M: @0 v+ V. Z9 @

  35. + k+ q7 ^$ b6 G( {2 f
  36. #include <mach/memory.h>% t% M: \' `' r% L
  37. #include <mach/hardware.h>
    7 h% a# V5 n9 y/ m6 H+ H4 V
  38. #include <mach/irqs.h>
    9 i& }' Y# u) ^- x
  39. #include <asm/hardware/edma.h>
    , ^" J0 x4 F$ Q2 S! {; s* F, l$ H
  40. 8 o- |4 L( o. z! h9 @
  41. #undef EDMA3_DEBUG
    " A& K5 R$ K5 n& a2 O) m4 D$ t+ y
  42. /*#define EDMA3_DEBUG*/. H/ b5 V9 g' d& Q

  43. 3 B$ w' i) _* [4 A0 B
  44. #ifdef EDMA3_DEBUG3 f2 s+ }/ {" h1 [4 g: Z1 u  H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& d7 w8 B; h6 }* r  l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 E+ R8 r; l9 S: u. Q, R3 Z& P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      x2 W5 A' Y% t1 u+ |
  48. #else
    4 E% v4 x7 ~& w* M& X
  49. #define DMA_PRINTK( x... ); X+ d: H; d' o8 O. a" ^* s
  50. #define DMA_FN_IN$ y% W( Y) a, L% J! `* d0 N( F
  51. #define DMA_FN_OUT: C4 V' z: L/ W4 }
  52. #endif
    1 L6 W; S$ i" ~6 @. F/ f
  53. : u5 ?' R: R! P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ p/ E% b7 m6 b6 j( ]1 ?1 @7 ^
  55. #define STATIC_SHIFT                3
    # l8 C9 x' s, z& h, Y7 o
  56. #define TCINTEN_SHIFT               20
    0 X4 w7 Y/ j4 e& _0 |; T
  57. #define ITCINTEN_SHIFT              21
    & H% s4 Y1 c/ @. I1 L0 n
  58. #define TCCHEN_SHIFT                22' C' P0 B- ]( @9 E$ Y$ r* f4 |
  59. #define ITCCHEN_SHIFT               23
    % J! h( d& Y) B4 ?6 [

  60. ! v6 S- |! m' d- M
  61. static volatile int irqraised1 = 0;
    3 I1 O7 ^; @/ T) ~
  62. static volatile int irqraised2 = 0;9 h6 _: v2 K2 U0 K. N6 T9 x& |) P

  63. ( K) P$ O. ~) Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* l' V4 k! Y0 L0 u+ C0 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 d% e. d! X3 d, v' s; }( q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ^& q9 r3 u/ l2 T5 ?* m9 Y; q" L
  67. + n/ ?. ~9 u2 Z7 _8 o6 J
  68. dma_addr_t dmaphyssrc1 = 0;: X) D/ }# e/ \. ^3 q' s* }0 {& U- `
  69. dma_addr_t dmaphyssrc2 = 0;
    + K7 {+ h( o' _. b
  70. dma_addr_t dmaphysdest1 = 0;
    : \# z1 m$ m. C+ s- c
  71. dma_addr_t dmaphysdest2 = 0;2 E  s# ^3 h% W( F6 }
  72. & |4 j  u5 Q9 W" y* g. I
  73. char *dmabufsrc1 = NULL;
    4 H% D9 }% I+ }- N+ g
  74. char *dmabufsrc2 = NULL;4 ~" N) b+ J& [" D, S+ D) y: t$ a
  75. char *dmabufdest1 = NULL;" ?% |1 [) Y# {: w/ I) S/ x
  76. char *dmabufdest2 = NULL;. ]4 X9 n, w. G1 E1 s* |2 T
  77. 7 b5 r& `4 e  [* k) {6 a
  78. static int acnt = 512;
    / U6 D1 j5 ^3 e! j1 C! z/ L
  79. static int bcnt = 8;
      k3 @# w2 w' r- y; u. x% c
  80. static int ccnt = 8;; M' V  s4 q6 j5 n1 w6 b' ?

  81. # |) d' W7 m7 e  u5 @" m, K9 Y9 h6 u/ W
  82. module_param(acnt, int, S_IRUGO);6 f, L! L. P6 B" o, a& e
  83. module_param(bcnt, int, S_IRUGO);
    6 @) V) i' P: T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* B7 f$ H. Z* F( e1 [7 `" K7 N' A* Q7 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: u, S9 J; P% m' t: c, w7 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! G# q  H/ w" i+ t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* `  Q# u; L) R/ W& n4 d

' ?+ T1 j3 }6 B4 q
) M8 ?' ]& T1 N+ i& a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-20 10:54 , Processed in 0.041482 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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