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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   v) N. [# @; z) S
  1. [code]EDMA sample test application
    . O5 J% n0 x: B
  2. /*
    / T+ L7 ]0 X5 _4 m8 h; r
  3. * edma_test.c9 m0 h# A% b8 \9 h5 M1 T
  4. *
      o/ `3 ~; t! i, l
  5. * brief  EDMA3 Test Application
    & B" ~. R; o1 m+ Y9 Q+ j0 n& {" \
  6. *$ A& j- ^6 _1 a
  7. *   This file contains EDMA3 Test code.
    + O# Z0 z! j- n
  8. *& b& }6 V. G2 g  K* h- h8 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 P. H" E8 T. [# F! n/ c; F, j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 f0 m& s6 R. }+ B/ X- E: r, A9 g
  11. *         TO CHANGE.! ]* k$ J+ ^% ~, A+ B5 i. |* f
  12. *- s; {- d* A" V. C% t" {" {/ [2 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// o9 |6 N( E# N) }, R
  14. *$ o; E: p6 J+ p* |2 j" f" `
  15. * This program is free software; you can redistribute it and/or
    % R2 L' v) \+ g
  16. * modify it under the terms of the GNU General Public License as! u/ L& O) F/ g1 Y; w  [
  17. * published by the Free Software Foundation version 2.
    6 i  S7 e: q# n+ P
  18. *2 H" M+ t2 T3 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 O* ?$ K. y6 g; ~3 [7 G
  20. * kind, whether express or implied; without even the implied warranty) t# `' H9 u- a8 B, [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ ]& C8 q) ]7 C# u7 y( L
  22. * GNU General Public License for more details.; m# x: {/ M' i% Q
  23. */
    % }4 N. Z, Y5 m- f6 U& G' c: ~4 m

  24. 1 m! E' I- p4 B
  25. #include <linux/module.h>
    * M2 w- X9 l: J  F" L
  26. #include <linux/init.h>, x, ?# k% D5 X9 P  e# \! M
  27. #include <linux/errno.h>
    # u+ b' E, {8 R, p7 \. U
  28. #include <linux/types.h>
    0 Z: O! H5 t5 Z* g: j
  29. #include <linux/interrupt.h>; F4 ]  V7 C  a7 G, v' a% g6 G" x- c
  30. #include <asm/io.h>
    ) {- v, W5 `: m
  31. #include <linux/moduleparam.h>4 N9 j: U/ t7 K; h* W% ~
  32. #include <linux/sysctl.h>
    ( d, S$ n7 [& G6 P/ X9 A+ Z
  33. #include <linux/mm.h>
    , S8 q; R6 o. z, y
  34. #include <linux/dma-mapping.h>: G: W. J' i7 S' K. W3 H; G' H) C

  35. 2 |. }; H# ]; q8 V& N, l4 X
  36. #include <mach/memory.h>
    3 v! ~; v2 X9 j. d$ E3 Y" k1 K
  37. #include <mach/hardware.h>0 r; O1 a: @- M3 Q. j- J
  38. #include <mach/irqs.h>! v9 x9 Q6 r$ Q, {+ F# I) t
  39. #include <asm/hardware/edma.h>! @0 W% d9 T1 }1 W& M
  40. 1 z/ {1 ~. g, u) ~& G( t
  41. #undef EDMA3_DEBUG7 j  g- @  p9 }* w
  42. /*#define EDMA3_DEBUG*// V1 \* e) W) e% M

  43. $ R4 p( h4 d4 W( L" G4 ]( j
  44. #ifdef EDMA3_DEBUG
    1 u0 x" `. H1 o! |1 V& P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' R& M: O8 x  e  Z% b& o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( p3 a; Q6 b2 d  \  Z4 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), y1 V+ o: A  Y4 |9 Z9 U
  48. #else
    ' H- z4 b6 E$ ]/ V2 [* m
  49. #define DMA_PRINTK( x... )0 |: t6 J1 a+ d* |0 q" }% t
  50. #define DMA_FN_IN
    2 D. r; n; ?' x! r( v8 a
  51. #define DMA_FN_OUT$ y, A9 g) D0 O+ z: d  v6 I' D' {2 b
  52. #endif; d8 P/ Q8 B: J2 y$ W0 N! J" Z
  53. ! M  |+ s/ {' W9 E8 L8 ^8 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& X: A1 Z  l4 Z: u9 `
  55. #define STATIC_SHIFT                3* j) G/ p. |$ l  V% X6 ]6 n+ G# J. |
  56. #define TCINTEN_SHIFT               20# U5 e+ U: @* I) ?/ K# q) N6 ^
  57. #define ITCINTEN_SHIFT              21
    6 e# A% L0 |: Z% j. Q/ J
  58. #define TCCHEN_SHIFT                223 n# T4 r0 o0 c( a5 I8 x
  59. #define ITCCHEN_SHIFT               23
    5 g  L  Y9 _6 L& A! M

  60. $ G5 g" p* s6 s- s) }8 g* K7 U8 h; W
  61. static volatile int irqraised1 = 0;8 z4 p. }/ s, v7 V' B6 w0 f0 K3 j2 v+ b
  62. static volatile int irqraised2 = 0;
    # v4 z: r$ f. ^9 c1 k# I3 c6 n  p
  63. * w  R% G' D' a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 Y$ Q& f, B" }* B, a( n' H, ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . o$ R$ K: A* M% p! g) g+ m3 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 G9 P0 q; P$ N6 a" P' Z
  67. / h5 D: ^1 g( B  v, J+ Y
  68. dma_addr_t dmaphyssrc1 = 0;7 e! |% [2 m6 U& j
  69. dma_addr_t dmaphyssrc2 = 0;/ v$ v, @9 y, J# y" ^% m
  70. dma_addr_t dmaphysdest1 = 0;3 ]3 T5 b7 P6 J2 z: \& D1 I
  71. dma_addr_t dmaphysdest2 = 0;9 ]3 F" b2 ]3 s

  72. , `  F4 W0 k( V- E
  73. char *dmabufsrc1 = NULL;
    # m$ E: j: Z0 o
  74. char *dmabufsrc2 = NULL;3 {1 G! W9 ?6 |2 P( h
  75. char *dmabufdest1 = NULL;6 S7 @; r, Y* L2 t/ S+ T
  76. char *dmabufdest2 = NULL;! A( m; c0 S9 e& [( U- I
  77. 6 V! B  g: L" Z( D
  78. static int acnt = 512;& o6 \3 g+ C9 D$ r  C
  79. static int bcnt = 8;4 x3 v, Z, ~4 n  h
  80. static int ccnt = 8;
    " I9 L4 t* g9 K$ w6 y
  81. * v" o. R" B' a
  82. module_param(acnt, int, S_IRUGO);
    : i6 M6 m, Z* h4 k5 m, D) T
  83. module_param(bcnt, int, S_IRUGO);
    2 X4 m% e2 H& L& t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ P2 ]+ M, y& G5 L- L* e

8 G9 a/ h, {- m/ ]4 _+ o/ z) i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! h1 o. w9 L. F# m) \7 R8 |- `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 u# W5 C% F! H3 f; k4 ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% x5 ~: s+ m2 F# ?. h3 [. ~$ E; x7 _2 [6 j* |+ O, d
6 [1 P7 L& R( Y% h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 22:08 , Processed in 0.052890 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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