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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " M/ I5 A- c7 G3 v3 l( i
  1. [code]EDMA sample test application
    1 I+ ^* o* O- g8 g' z6 N8 S/ z; n
  2. /*2 R( Z# l- j0 S) z
  3. * edma_test.c' M$ t* t' _. F
  4. *( H# B4 g4 V8 _% e3 o( U
  5. * brief  EDMA3 Test Application
    + V1 h, x6 c$ c3 o8 W. L" x, b5 y* g
  6. *
    3 M- }! g, E, p: `. u
  7. *   This file contains EDMA3 Test code.1 }) w9 h! H% u
  8. *& H$ D5 G4 y% q3 o6 l5 J  U) L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      K5 O' Y5 n/ L- \2 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & V9 h1 [7 ]0 H, s1 w! K
  11. *         TO CHANGE.2 v6 m. o7 o8 F+ H% Y0 O  f
  12. *
    : e. O. b! U( g7 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' B& ?1 |- R1 L
  14. *
    , e; z1 q, u9 [7 K! i
  15. * This program is free software; you can redistribute it and/or
    * y, ~8 [" `0 n1 K3 U
  16. * modify it under the terms of the GNU General Public License as
    + p. a* M+ V  L" B' V; S& |
  17. * published by the Free Software Foundation version 2.6 @* A1 m+ Q' I/ P1 Z9 y
  18. *
    0 H  v$ s* {( X! @& S) g  ^6 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' a+ a# s0 ]7 t
  20. * kind, whether express or implied; without even the implied warranty* p8 e* n( I8 w5 |' G' Z; ]2 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: c6 D6 J$ ?) C' i
  22. * GNU General Public License for more details.4 u/ e% z) h$ T2 K- N
  23. */
    1 F/ }8 T& E& [4 }' c# E. l

  24.   ]9 ~8 a5 c4 O
  25. #include <linux/module.h>
    , c9 J' G; i/ e( y
  26. #include <linux/init.h>
    : s* d/ m& w  U: J" S$ ?
  27. #include <linux/errno.h>
    : x, K  q: s: e2 E
  28. #include <linux/types.h>2 `" b/ p* L8 O6 m3 {" @  f
  29. #include <linux/interrupt.h>8 p* p6 t! u, ]% u- A
  30. #include <asm/io.h>7 M8 }# @$ \4 c0 j
  31. #include <linux/moduleparam.h>) _( }' E3 K/ f2 n$ `: M: h% G
  32. #include <linux/sysctl.h>
    8 ]* o( k7 N" P% A
  33. #include <linux/mm.h>2 V+ U8 l9 V- y" l! P
  34. #include <linux/dma-mapping.h>
    ! \5 V) F# J0 |. u+ H" V. m9 E& x

  35. - t1 B, g# B, B6 i- N
  36. #include <mach/memory.h>0 S& L- o2 V( r) U+ z0 q
  37. #include <mach/hardware.h>! B: U) `) t1 O8 A- C' L
  38. #include <mach/irqs.h>
    % ?8 n! N% o! U2 \, g- }
  39. #include <asm/hardware/edma.h>
    * t  p" \& |* r6 R+ D- E" r3 b

  40. 2 J1 H) u: S8 c! m. Z- f
  41. #undef EDMA3_DEBUG  o6 R2 k1 S1 F4 `8 ?2 D& n- C  I
  42. /*#define EDMA3_DEBUG*/9 c" N9 n  ]0 R( c
  43. , c: r$ n7 X  o. J
  44. #ifdef EDMA3_DEBUG
    & z# `5 o5 t9 S! R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 e) h+ _4 D$ o6 S: @5 F7 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  U$ N1 O" Y) V2 C, }; Q8 c" [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# R+ z: @6 e6 Y2 I, a
  48. #else1 Y1 j4 }1 a+ E6 r
  49. #define DMA_PRINTK( x... )# w$ Q) i3 L, P' ~# y  Y3 k: h) Y
  50. #define DMA_FN_IN3 U1 `! |& w! T7 g8 O# j0 t1 K! G/ X
  51. #define DMA_FN_OUT
    5 s) \5 r4 k- n( F
  52. #endif
      T) _, {. N+ y" F# A3 \

  53. 9 S# ~: ?- Z) E+ `# m" v5 o+ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 A) W, n  W- t6 b9 ^5 l; h
  55. #define STATIC_SHIFT                3/ F0 F( D, b% F, ]1 C: N
  56. #define TCINTEN_SHIFT               20; ^% G/ T2 V9 v
  57. #define ITCINTEN_SHIFT              21
    # @! j, W  Y% h& C2 Y- i9 Z# y
  58. #define TCCHEN_SHIFT                227 k9 W7 N% O* D) r7 o
  59. #define ITCCHEN_SHIFT               23% d9 Q2 g& Z! Q4 E" u* ^) G

  60. / W& j. z& J) \. z* e7 C' k
  61. static volatile int irqraised1 = 0;  M. ]% J7 P+ o2 I5 w& N
  62. static volatile int irqraised2 = 0;
    ' Z, Y" m/ R1 V4 {
  63. 6 u; B5 z& o8 U0 k  ~) t/ G  L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) X) m9 }' x* X# D+ F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . c: ?& W2 f: k! `4 _: @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 j. q* t4 T7 f' M
  67. 2 T' {2 F5 ?$ d" ~. \- n
  68. dma_addr_t dmaphyssrc1 = 0;
    ; L6 a+ ?1 m7 c8 S
  69. dma_addr_t dmaphyssrc2 = 0;
    " P* G- M7 s1 G
  70. dma_addr_t dmaphysdest1 = 0;
    + x" S- i  m% }+ Z+ C
  71. dma_addr_t dmaphysdest2 = 0;
    6 E& z& ~1 F$ F4 N

  72. 7 H) I: `' Z+ y7 g
  73. char *dmabufsrc1 = NULL;2 \7 l! |8 r! |1 M3 U5 M
  74. char *dmabufsrc2 = NULL;7 i" J& ^5 i' c; ]0 I
  75. char *dmabufdest1 = NULL;
    0 o8 y; l1 U" J* w& o7 t
  76. char *dmabufdest2 = NULL;9 H3 `( ^0 V* ]  }

  77.   W) |& m, v, l4 |! a
  78. static int acnt = 512;& t" j- p, a7 t9 }' A6 W. X
  79. static int bcnt = 8;
    " c& p5 }. j8 J/ x2 X
  80. static int ccnt = 8;) e9 j( ?# l1 k: A2 x

  81. / X4 D# p1 E% I. ?  g* _, b
  82. module_param(acnt, int, S_IRUGO);* m9 i2 W. j6 l: S7 v$ N) R. Q
  83. module_param(bcnt, int, S_IRUGO);1 N* ]/ g/ m! V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 \! l! _4 X" L4 u7 p9 k
) d( Z9 U8 _! S* h! Z. D* m4 k* H5 I3 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ v/ M/ U% b9 f/ g2 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' K0 w" R0 h+ \; [- ?6 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) _+ S8 J1 z3 J8 M
; u; M+ B/ S, e8 i; v! S

8 d/ f/ q: G; K0 {0 }6 s5 x+ p8 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 20:05 , Processed in 0.040233 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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