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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 B* V" U9 }$ D. F
  1. [code]EDMA sample test application
    2 Z' P' S% `* A: z' r
  2. /*
    & f/ Y2 ]* ~: }* W! s6 ]
  3. * edma_test.c" {+ D& F" }& Y3 W" q
  4. *
    7 c, A0 n' E2 L4 T) L1 D7 i
  5. * brief  EDMA3 Test Application, \1 X) D/ x( F8 l
  6. *- {2 K% S3 l- v; K% R
  7. *   This file contains EDMA3 Test code.+ f7 T. C! y& S
  8. *) O6 y5 ]* f8 F9 y( w( B; G( _( R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' B% H" c# t$ K1 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 K( w' a7 v/ A- V; Z# L
  11. *         TO CHANGE.) o/ H5 f2 C# H) ?( k3 a
  12. *# X8 X" f$ e! n  [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ]6 H4 y: r' r5 C0 c; ]$ h$ T" _
  14. *) X7 a# N/ |- W" ~' M
  15. * This program is free software; you can redistribute it and/or9 ^9 d4 x+ M4 J5 j, m+ k
  16. * modify it under the terms of the GNU General Public License as
    0 M0 m# D3 l/ K' t- t
  17. * published by the Free Software Foundation version 2.$ {/ j3 X& b* |: m: r! Q5 E$ q
  18. *& t8 T2 v9 A0 p+ T% ^4 l& C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . T6 d( B4 ?* l0 d! Z1 v
  20. * kind, whether express or implied; without even the implied warranty
    5 M; B0 p8 R2 C2 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + o3 `# ?- V. `! F! c+ Z
  22. * GNU General Public License for more details.
    1 ^0 r$ k! Z9 f2 F
  23. */
    # X( l) n* s. J# K

  24. * _! p5 @+ g0 K8 u2 E8 L5 m9 U
  25. #include <linux/module.h>1 A: W- o* |. ^
  26. #include <linux/init.h>! z% h# y7 }# O
  27. #include <linux/errno.h>, q$ c- Z- J) D* e8 \
  28. #include <linux/types.h>
    + s4 h# x* G7 F+ J5 E. E) `+ k
  29. #include <linux/interrupt.h>
    ( u6 r( c8 ], U
  30. #include <asm/io.h>
    % v5 Q# N7 C6 H' B' _5 w) a# _. C
  31. #include <linux/moduleparam.h>3 V% r# b! t4 `" a
  32. #include <linux/sysctl.h>
    # X4 C  c  y+ p% R& X9 u" c, W2 ^: ]
  33. #include <linux/mm.h>
    * W* v0 [+ Y% A0 W1 D; d
  34. #include <linux/dma-mapping.h>" T/ k: M# y1 |% w+ K. @

  35. + J* ~6 d. m3 A7 S
  36. #include <mach/memory.h>
    , g# n( Z8 v! ~3 {8 `% i- M
  37. #include <mach/hardware.h>8 o# i% D& I) a% q6 A+ x
  38. #include <mach/irqs.h># z! F2 k" t8 H
  39. #include <asm/hardware/edma.h># k! g, U' J/ D9 J$ c

  40. ! `) D7 n4 G& W& h
  41. #undef EDMA3_DEBUG
    5 n. \; P9 M* v2 l1 ~  L1 A
  42. /*#define EDMA3_DEBUG*/
    % n. t5 p5 Q* D' U. q+ ^4 U

  43. 0 |, w" Y, ~8 S
  44. #ifdef EDMA3_DEBUG6 u% g9 H7 c  |% }& d, H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 W# G8 }! u4 V7 m# J; |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 i' W7 r% d+ Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 k+ c1 Y5 y( Y' l
  48. #else1 ~5 j' ^& o& N' L3 L* u- i
  49. #define DMA_PRINTK( x... )
    * i( K; l1 N. J& o2 h
  50. #define DMA_FN_IN7 S" Q1 f1 Y5 d: o& w
  51. #define DMA_FN_OUT, h! y' G( @: X6 A! k9 \; y
  52. #endif8 Y3 O  w( K3 v9 ]5 @5 D

  53. : v+ C# B5 i0 S, a1 H' P( Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( J" P& B! d( w! W3 E! n7 j
  55. #define STATIC_SHIFT                3
    , r+ ^$ J1 k: n# @5 S9 J. {
  56. #define TCINTEN_SHIFT               20
    % Z& G4 [$ I2 b5 k* y6 ^  X9 F
  57. #define ITCINTEN_SHIFT              21. ]# h: Y( Q" J! [
  58. #define TCCHEN_SHIFT                22
    1 G. \$ B9 M) A
  59. #define ITCCHEN_SHIFT               23
    5 `* {$ y8 p8 X! \3 V
  60. 2 o7 D3 b- c$ e2 F
  61. static volatile int irqraised1 = 0;- T* A2 g' U9 a
  62. static volatile int irqraised2 = 0;
    + Z0 V5 P0 R7 l# {, V3 f

  63. 5 e0 j* o  I+ |/ P6 ~) i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' J: c! s6 b7 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! [6 I# X- B, y# G- T. S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; \& B4 w: \  S% U$ C4 u

  67. ' x, }. s- r0 A0 _, a  x
  68. dma_addr_t dmaphyssrc1 = 0;
    2 }+ r. _& t" A2 q
  69. dma_addr_t dmaphyssrc2 = 0;0 L  ?* m4 P/ P! L/ d( ^' T; S
  70. dma_addr_t dmaphysdest1 = 0;6 A! F* h! {( p% q& l+ j) K/ P
  71. dma_addr_t dmaphysdest2 = 0;
    ) P% g: e7 `4 X5 b

  72. ) v3 o$ D- a  I- f: h. ]# q
  73. char *dmabufsrc1 = NULL;
    4 {0 ~' V& t# d1 M* q" Z  }
  74. char *dmabufsrc2 = NULL;
    / I( w8 E! x5 U6 V( P2 H2 m
  75. char *dmabufdest1 = NULL;
    9 r4 |, }% x7 q/ q
  76. char *dmabufdest2 = NULL;. b7 l+ a) \- ~/ {: P
  77. : e# V# ]/ A# W1 A. p
  78. static int acnt = 512;
    % r) ^4 a  ]9 c7 h7 e
  79. static int bcnt = 8;
    1 A% ]) m, _2 @" Q$ e
  80. static int ccnt = 8;1 Q; G" O) e) }% D3 ?

  81. 6 J5 k5 s8 C( L
  82. module_param(acnt, int, S_IRUGO);8 X4 p3 w: y. B  p3 O- Y- B
  83. module_param(bcnt, int, S_IRUGO);
    # e+ J2 T* l. W* w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& u- c' W) n; }0 C
1 K6 B; @+ ?( u7 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 J# A) q6 U6 f8 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 H/ l: n& K4 b6 S" ?& @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" E0 z+ j: m" `) {4 d& J

0 Z( m* h' g9 d, \) X
. u. Q' D5 Q0 K' v0 B! R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-23 11:45 , Processed in 0.045594 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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