OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. [# T7 L" |+ j( c5 q, j+ i- z
  1. [code]EDMA sample test application& D, t* O* A  D" p# r% s
  2. /*& _2 h6 t4 o, V$ b1 k# s
  3. * edma_test.c- L: Y3 a- z/ o8 U1 U
  4. *) \7 j* e; ?% z4 C
  5. * brief  EDMA3 Test Application
    / y( W4 ]2 [: V  V! Z
  6. *  f" j9 ?1 y* c* q% x2 [
  7. *   This file contains EDMA3 Test code.- ]+ E# H3 V% F# {, n  i4 y7 z6 v! L  y" \
  8. *
    # F6 m' X; [: F0 n1 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( Y: b$ \/ \4 G5 D" S6 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' l5 Z: ]" ?$ ^6 \0 S) ^
  11. *         TO CHANGE.
      Z/ }8 z5 L' q. r% |8 ?; T$ W2 ?
  12. *4 r: Q$ D8 u# B  X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 A6 V! `4 V# o% S/ c0 Z4 a
  14. *
    , D7 B1 o1 S* @8 p
  15. * This program is free software; you can redistribute it and/or
    5 `/ ?: m6 I0 L5 p% G5 t2 j
  16. * modify it under the terms of the GNU General Public License as
      L2 ~0 R9 ^( C5 A
  17. * published by the Free Software Foundation version 2.# j4 r" A! s) E& D
  18. *
    5 J; g& E  E# D8 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & f5 V) y( e7 w# `
  20. * kind, whether express or implied; without even the implied warranty
    , h! d5 Y; v" m3 f. t* [) K; W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 x) a. h% S% {' ]
  22. * GNU General Public License for more details.  c+ N9 D! [2 A3 r0 L$ x) ]- O
  23. */( e9 ]7 q& z: ~3 }9 M9 I! a
  24. " u0 r. P! u% C/ S% t
  25. #include <linux/module.h>6 B0 {% S5 e2 f1 Q9 S
  26. #include <linux/init.h>6 B5 A& a9 u# c# `
  27. #include <linux/errno.h>
    1 s2 r+ T& k$ J/ ^8 M
  28. #include <linux/types.h>
    & `" F: N9 b. t6 ^
  29. #include <linux/interrupt.h>
    ( e  P) B$ T! c4 ^0 ^7 ^
  30. #include <asm/io.h>+ Z# i$ E: C+ R' i3 J7 l; X. U, c3 ~
  31. #include <linux/moduleparam.h>( O0 `8 O7 h8 S7 t
  32. #include <linux/sysctl.h>! v/ i& L1 k- Z  \" h5 ~9 u
  33. #include <linux/mm.h>. t" D. x4 @' `$ t3 X! ^
  34. #include <linux/dma-mapping.h>
    - s  L, v+ \# v

  35. ; J1 Q, n& l8 ^8 \6 L
  36. #include <mach/memory.h># E( n' c) x; H
  37. #include <mach/hardware.h>
    # X  u- l, q* i
  38. #include <mach/irqs.h>! X2 X! L" w. v) o- Q
  39. #include <asm/hardware/edma.h>, ~# x1 i; i* B; a1 q! E" ^3 d
  40. 8 v& T6 A; Y1 a( ~
  41. #undef EDMA3_DEBUG
    " V8 z& t5 }/ G% B0 W  s0 _6 x
  42. /*#define EDMA3_DEBUG*/
    ! b, J+ \# G: e

  43. , M" a) b* ^. d* M. k( }/ U9 H
  44. #ifdef EDMA3_DEBUG
    $ h3 T$ [2 x! f! G7 [$ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 F: w& n8 U) t5 k- n' g$ w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" M$ C* u% i1 X, X8 B" P) [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , k) {0 n5 }/ g- C6 D
  48. #else' J! E9 s( p& m
  49. #define DMA_PRINTK( x... )
    / |: W% C, d( l! I" M
  50. #define DMA_FN_IN
    ; h; j( ~1 @3 o1 X
  51. #define DMA_FN_OUT6 G# Z4 q; N6 R' w+ K0 @1 y' a
  52. #endif, |% y2 d% u: Q; u# ^) ^3 F+ U  @) C
  53. 5 q* x: j4 {2 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); q! K& H+ j* u% f2 R5 Y3 C+ G+ Y* }
  55. #define STATIC_SHIFT                3# h, q- F" Z8 K* T( X: J( B: H
  56. #define TCINTEN_SHIFT               20" t. E1 E! ?- N' h4 n
  57. #define ITCINTEN_SHIFT              21! c2 x! V& I+ D) O( v- d, x
  58. #define TCCHEN_SHIFT                22
    2 i) w* a6 c' K4 M2 H
  59. #define ITCCHEN_SHIFT               23) b! o# O3 m' U' U
  60. " K' X! ]# J% V1 V
  61. static volatile int irqraised1 = 0;) q% l$ W( ^* s! e' ]
  62. static volatile int irqraised2 = 0;- @  l# Q  I# T7 s' f

  63. * @3 K) \) R! n$ p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) |) Q/ k  Y( i5 a0 X- L: D  y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 C7 y1 q2 l/ y/ _: T7 d0 G2 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ~$ m# l0 H' c* R& g2 T

  67. ' Q  R: ?4 a* X7 s% L. I/ B( W
  68. dma_addr_t dmaphyssrc1 = 0;+ d0 F) h0 _# z: R1 Q1 g
  69. dma_addr_t dmaphyssrc2 = 0;
    # }/ B! _  v& k4 W% ^
  70. dma_addr_t dmaphysdest1 = 0;1 a2 L. G: F  f; U
  71. dma_addr_t dmaphysdest2 = 0;: ?1 f1 V7 S8 z6 N- w1 X& y

  72. $ H8 n7 x# D. K5 f6 ]) L0 t
  73. char *dmabufsrc1 = NULL;
    . a2 V1 \3 }% r3 X+ t( n
  74. char *dmabufsrc2 = NULL;
    + o* y0 V' a% h
  75. char *dmabufdest1 = NULL;1 ?- A7 l' Y( S1 H* \: E
  76. char *dmabufdest2 = NULL;
    # }# M, `* r! S1 P# Q2 D# G* X
  77. 2 v2 H" H6 U& I. Y  S
  78. static int acnt = 512;
    . y1 n5 W5 F' @* f, F
  79. static int bcnt = 8;
    . p2 R5 @  {6 F' s
  80. static int ccnt = 8;/ j$ S) M+ F- j: f+ L3 m& o
  81. % k; F9 e% p! I8 t0 ?& k
  82. module_param(acnt, int, S_IRUGO);
    " C! g5 C  ]3 M3 c' R
  83. module_param(bcnt, int, S_IRUGO);8 U# T0 ?; v$ Z% U8 w( D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ P7 r! F( L: y: q* j2 V8 t8 j
1 d5 `. A$ u$ H* a( T& e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 v4 d; ~& t# V; yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 w( Q, \/ W* A$ g8 |( G/ r% i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 @7 b& q' f. h, ]; q  @$ C( M; d5 [; E3 @' K4 b3 r  x& C9 ~0 h

. q) {# d- d% Y% j) y6 D- o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 00:39 , Processed in 0.036863 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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