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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 f6 j% @$ a8 O1 e
  1. [code]EDMA sample test application2 H! M5 f* l0 {
  2. /*
    1 O. }6 d% L  ?9 ^
  3. * edma_test.c
    & e7 D& _4 f  E& ~
  4. *# C$ s' ?7 Y9 ?4 r9 [
  5. * brief  EDMA3 Test Application
    : d8 p( ^$ d& T
  6. *
    & s9 W# \5 m: B1 T" ?
  7. *   This file contains EDMA3 Test code.- m* h& u3 S3 ^/ j& J7 {
  8. *1 \+ @; Y1 K# x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 z9 Z1 C% |3 t! {! e  i0 a) g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & I- ^6 }+ a8 n; R1 ^' a: K; V
  11. *         TO CHANGE.
    7 M) r  n+ V9 |' @* a% \/ k
  12. *2 V5 J& U( P. X/ j% W7 ]& `+ v" @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  y3 ]! [" q$ u! S. H' d
  14. *3 b  \2 j5 d! {$ C' p6 I" p
  15. * This program is free software; you can redistribute it and/or- t6 G9 g7 r8 F3 h
  16. * modify it under the terms of the GNU General Public License as+ l4 N$ Y' `2 P3 o
  17. * published by the Free Software Foundation version 2.3 t4 H9 V+ r, w$ T0 o
  18. *
    : J9 A1 `+ A: G" _$ Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ K( l( u7 Z+ H: o  ?# o) _
  20. * kind, whether express or implied; without even the implied warranty( h( ?8 }. O' B1 F4 ~" u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' u% v7 H% G7 O4 `; A+ J9 U  Q
  22. * GNU General Public License for more details.6 j  C, Z! [" P1 l
  23. */8 O" X! s3 R/ p  F

  24. 2 L  P+ _, B8 Q& O! x3 ]
  25. #include <linux/module.h>
    * j; O4 Z; s. f- a7 i$ R3 `
  26. #include <linux/init.h>3 x# I  \/ ^' [4 C8 b! n' O
  27. #include <linux/errno.h>
    - G9 q: K4 }7 |' x& N" |
  28. #include <linux/types.h>
    ( P0 V3 f" ?$ \+ ~
  29. #include <linux/interrupt.h>9 Y, ~  G* s' B8 {2 M0 b! u
  30. #include <asm/io.h>
    / `7 Z3 d1 L* V0 }: y, ]6 M9 ~$ y. G
  31. #include <linux/moduleparam.h>
    6 K2 y, O4 O0 n, {% V
  32. #include <linux/sysctl.h>
    / [, G4 M9 C& i  Y& r) I
  33. #include <linux/mm.h>+ S9 G, P+ D' n7 k5 ~  f
  34. #include <linux/dma-mapping.h>; S. a4 [0 h" v6 X8 T

  35. 7 C: s3 d5 v- {0 n' V+ v
  36. #include <mach/memory.h>
    8 O: h( {! q  [5 R* h3 a
  37. #include <mach/hardware.h>, n" Z5 x6 E3 M
  38. #include <mach/irqs.h>
    ( y( K& q( {! e6 {5 Z. }- _7 r
  39. #include <asm/hardware/edma.h>1 Z# W1 T. ~: G) k4 J0 ^3 m# N

  40. ' J3 e8 c2 @& Q# U0 Q5 u5 U
  41. #undef EDMA3_DEBUG
    . _. `; ~- }9 A7 G# u
  42. /*#define EDMA3_DEBUG*/* V3 A) h" _" v3 I2 [
  43. " p* w" j- Q; j# B, _7 a5 h
  44. #ifdef EDMA3_DEBUG* s4 J8 J2 K8 P9 e+ |: F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 G7 |  N% C1 z2 x0 d- k% O5 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' R( S0 l" _" I9 E) i4 S3 W) M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' {, M3 ]: ?9 h% u# F3 M
  48. #else# M' N  o6 W9 h+ c& K
  49. #define DMA_PRINTK( x... )0 {3 Q, Q: E4 o# H" j; O  z
  50. #define DMA_FN_IN
    - V, _+ N4 z7 f3 c) F
  51. #define DMA_FN_OUT2 w% o* T* ~  ^2 G
  52. #endif
    ) h* d( ?0 S) I+ f0 @
  53. # K! z2 C) {( z) H4 w% f2 x4 `: ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / d$ a8 [4 Q( c
  55. #define STATIC_SHIFT                3
    9 u! A) q( z. h! M
  56. #define TCINTEN_SHIFT               206 u5 L: D/ |5 m$ l  r1 V  R) @
  57. #define ITCINTEN_SHIFT              21. S5 u0 |2 `; g) G7 }5 q2 s! n
  58. #define TCCHEN_SHIFT                22
    6 f, H3 V' {; C3 W* f# c0 T
  59. #define ITCCHEN_SHIFT               23
    % L/ ~: o, M9 i+ u+ @

  60. , s* A' f( U! G  }4 e% n" B8 Z
  61. static volatile int irqraised1 = 0;
    & [$ X  j) I; F0 u; i( [
  62. static volatile int irqraised2 = 0;
    ) K+ a% e4 a7 H/ ~8 R. h
  63. ) W8 E8 v6 K$ t& d; _; k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. u) q8 G8 ^: m  j' g: W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" u0 y" }8 d1 f1 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% [3 F/ p3 g/ q# n' I9 F

  67. : h5 k( X7 e8 X( D, R- `
  68. dma_addr_t dmaphyssrc1 = 0;. w2 c/ V; d7 z' w# ?$ |
  69. dma_addr_t dmaphyssrc2 = 0;
    2 `5 A. E* }$ f0 O" b- T
  70. dma_addr_t dmaphysdest1 = 0;
    8 S, ], {4 j6 Y$ R3 s0 M' k$ T7 k
  71. dma_addr_t dmaphysdest2 = 0;
    ! z: W( Y4 c) J

  72. # i  y" ]( T& p8 S8 q9 s# c5 T
  73. char *dmabufsrc1 = NULL;; h& k  u) [! P( i$ R" Q. ?7 x
  74. char *dmabufsrc2 = NULL;
    ! N1 j2 f" [. [) y$ u
  75. char *dmabufdest1 = NULL;5 d9 D) a; V+ P$ N, S7 j' K
  76. char *dmabufdest2 = NULL;& t. B+ V* A: I& @* d9 S% Y
  77. 7 i% w% Y5 v4 l
  78. static int acnt = 512;
    - c: I4 Y' S6 r% p! I3 p- q' Q
  79. static int bcnt = 8;+ i/ {/ H* m  N! E
  80. static int ccnt = 8;
    0 R4 Z, f2 L  P- O/ C; n- s

  81. 5 [9 a& |! B, F# D. s% J. B
  82. module_param(acnt, int, S_IRUGO);
    6 t: t2 U" z* ^8 k
  83. module_param(bcnt, int, S_IRUGO);
    % f) D5 }5 U2 K$ V' ^9 s7 N3 K0 e. A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 \' B/ p9 T0 y; y( F! R1 U% Y! M

! D& ?4 [% w( ]0 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, f0 T5 o( [6 t$ ?9 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 \  w) T' K2 h" f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 I1 I+ q. B4 j& p- s( j

9 h8 u2 h7 t% X, c" r5 P$ d+ T; T: e: E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 18:49 , Processed in 0.041867 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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