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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * I$ \/ Q9 S1 R5 h0 l% s: o) K3 d
  1. [code]EDMA sample test application
    4 s$ P( a1 s: Z0 \
  2. /*" m$ B+ G) d; Y7 }+ a( F! ~4 K7 \
  3. * edma_test.c$ X4 x. G; U/ [: S% k* U
  4. *
    - Y& I1 ~& @! F$ \5 q0 p; s
  5. * brief  EDMA3 Test Application
    8 O) K, z6 ~, ?  n+ G
  6. *
    # J# W& h6 @8 b- o
  7. *   This file contains EDMA3 Test code.8 _9 _. d6 L: \; `' B
  8. *; A, L# _2 O  B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 t8 E0 O4 K& O4 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , S; v. y; G( ~
  11. *         TO CHANGE.+ f% m9 i) a+ ?! J$ `4 y
  12. *- f0 L0 F9 K. ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* x/ G% D: k3 F7 X
  14. *8 y5 _7 a3 z* |$ \( {
  15. * This program is free software; you can redistribute it and/or  {: |6 y* g$ S
  16. * modify it under the terms of the GNU General Public License as
    2 z: m( ?5 E# `1 Z( C* u0 w% y& z
  17. * published by the Free Software Foundation version 2.
    5 C+ K( S+ K+ `+ V0 A) x
  18. *# {! W% J% G  p$ t+ `/ i6 Q1 I7 e5 |. t( x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 h: {' A- p$ c; i  W4 I5 F
  20. * kind, whether express or implied; without even the implied warranty, }4 g/ j; l) U' A; e( y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 r! K& j6 b, J2 Q5 w
  22. * GNU General Public License for more details.
    - V6 `" F/ j9 I: G
  23. */
    - k6 S0 W0 s: `  R

  24. 5 c' n! g  w- }/ D# r; P( c1 i# n' U
  25. #include <linux/module.h>
    3 q! P7 S) T! U1 Q
  26. #include <linux/init.h>
    % e. R; A& c. b9 B6 e
  27. #include <linux/errno.h>5 ]% g; J! X7 O# [
  28. #include <linux/types.h>
    6 X6 D- v) \2 \, t
  29. #include <linux/interrupt.h>7 K( Z+ F  I9 [+ V: S. R3 t
  30. #include <asm/io.h>
    % I, d' }: b, I5 D: |( d
  31. #include <linux/moduleparam.h>
      z; J# C  n  R/ g
  32. #include <linux/sysctl.h>
    8 K! T( k8 b" G! B" p& G3 D; K0 ^
  33. #include <linux/mm.h>
    & d- D+ f% \0 \' u/ K3 ?
  34. #include <linux/dma-mapping.h>
    1 V- F" Z3 m* s) G
  35. 6 T$ h" e6 t8 `3 h% B0 e( Z
  36. #include <mach/memory.h>/ E$ r9 K7 I/ u$ Q9 Q; @8 @4 f
  37. #include <mach/hardware.h>
    ' w" `* Q! L" ~. {3 R& K/ }
  38. #include <mach/irqs.h>2 z0 D. @( L- L* V7 z1 \; z) @- Y* E
  39. #include <asm/hardware/edma.h>
    % D9 m+ ^& C% Q' O# c2 N

  40. 8 g8 m- g5 ^+ _- o( s/ Z
  41. #undef EDMA3_DEBUG& G6 p: M# J/ Z) s
  42. /*#define EDMA3_DEBUG*/
      i+ Z8 [+ U8 w
  43. " J3 F& ?  @# x; p
  44. #ifdef EDMA3_DEBUG
    $ ]3 ]$ `" _4 C  Z$ e# U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 |8 N# Q  k# B4 ^7 E- L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 U9 u9 v" Y" v" h& M9 `3 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& ?# x- l/ n! d7 A
  48. #else8 q0 N6 \* A+ \1 x+ _3 L
  49. #define DMA_PRINTK( x... )! U. S) N2 ~' k9 y+ {/ e, |
  50. #define DMA_FN_IN
    " o* w' s3 y& e! R
  51. #define DMA_FN_OUT
    / S% \. _6 t' h5 @, l6 m
  52. #endif
    . @) S( x) m2 `& i/ H

  53. 6 k" K+ W  `" n2 Z' _9 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : ^: Q8 _( b$ ]
  55. #define STATIC_SHIFT                3# I6 g) `( s' o. M5 Z
  56. #define TCINTEN_SHIFT               20# b, U# u6 y& O0 d% A
  57. #define ITCINTEN_SHIFT              21
    , i7 d' S- a4 \1 \1 j
  58. #define TCCHEN_SHIFT                22
    - F" }7 B& ?, D
  59. #define ITCCHEN_SHIFT               23
    - G; I' k( b# g8 t, z

  60. ! t. ^  x* \4 B4 P" P# u
  61. static volatile int irqraised1 = 0;: Z# C( H- [* H) i9 l
  62. static volatile int irqraised2 = 0;0 s* J; l8 P: }9 W9 Y% M: Q8 C; l

  63. 5 N: F) T7 r& D( }2 L/ Y7 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Y! u- z' V$ g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 `) n8 a! l* D8 D3 Y  D% N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 B0 d' O# W1 b; C+ M

  67. " I: C* H7 d2 F" c2 ?
  68. dma_addr_t dmaphyssrc1 = 0;6 g! i, T7 t6 C: I+ A( v& J
  69. dma_addr_t dmaphyssrc2 = 0;" }. t$ d; |' \1 i; u) ^1 y5 {, k
  70. dma_addr_t dmaphysdest1 = 0;
    ! b2 p) Z* k& a/ w6 i7 h
  71. dma_addr_t dmaphysdest2 = 0;* w7 {6 y0 `$ |1 ?+ F, H
  72. % i5 |, s$ a' X* H7 z
  73. char *dmabufsrc1 = NULL;
    # l% Q/ n1 u" ~9 Z
  74. char *dmabufsrc2 = NULL;
    8 f* U. F2 L: T2 x7 o4 J5 I
  75. char *dmabufdest1 = NULL;
    7 G4 y' Z* @# \: `3 q8 j
  76. char *dmabufdest2 = NULL;
    % r8 e7 _9 V8 h  c

  77. & J, D4 b: d/ |: O* ]2 C' c
  78. static int acnt = 512;* }) }% x! O5 g4 G# ?7 B
  79. static int bcnt = 8;* y8 b- T5 F% E% {  _* q8 h
  80. static int ccnt = 8;" H7 }' Z% Z; t# u
  81. * t, Z6 P, V( P7 m# o& o/ Y/ c3 p$ h
  82. module_param(acnt, int, S_IRUGO);
    $ c% w7 P# y: x, H8 Q( H/ |4 q
  83. module_param(bcnt, int, S_IRUGO);8 ^$ t1 z! f7 `& c* V  ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& E; q2 V* u2 Z5 P& @
9 h7 ~+ S, L5 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 p0 f$ c1 d% S! D" [8 Z( n. \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% v: X6 _# g) ^+ I# }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 T* {* t: L: @9 r0 v- i3 E# n( Y) P1 _

7 _5 B; `6 i  A" e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 14:49 , Processed in 0.039404 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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