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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . N+ [0 X& i; j; n
  1. [code]EDMA sample test application! L* y4 C5 l' G/ d
  2. /*' y# x2 ?) D0 {; d* A
  3. * edma_test.c4 O. f2 s3 s  ]7 t: d% W4 Y
  4. *
    " G" w8 S0 U! [9 D, q* ~( h$ N* p. |
  5. * brief  EDMA3 Test Application+ \- n) u. D' c1 l7 Q
  6. *% R8 `; k, s" X/ |
  7. *   This file contains EDMA3 Test code.7 T6 Y4 c6 Q1 I+ g  q+ ?
  8. *
    - D6 M. k  Q4 w3 J$ K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' [4 G: P/ D, T5 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' h+ }- P% k9 m; y" b/ n7 s
  11. *         TO CHANGE.
    7 F4 `0 v1 w2 b2 z/ ^1 e
  12. *
    # f# {+ Q5 N1 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. i7 }8 _; \( p+ {
  14. */ B6 E4 N- F$ Z3 b8 W/ y. T3 d9 y
  15. * This program is free software; you can redistribute it and/or5 y# @  I  X5 r  d/ t
  16. * modify it under the terms of the GNU General Public License as9 D) C0 `0 h. S& p6 y4 u+ Z( a
  17. * published by the Free Software Foundation version 2.3 [/ N6 U+ k, v3 k/ I9 G7 f
  18. *- a5 i1 X- W+ C4 _2 L- T4 v% `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 d" O1 s! l1 t1 X( b( k3 ~: k/ @
  20. * kind, whether express or implied; without even the implied warranty
    0 ^, `' }# a- p4 H8 n, p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' Q  {& q0 T: J8 }
  22. * GNU General Public License for more details.
    3 y  K0 K0 U, `; ?5 [
  23. */& d! y# n8 i; `+ W- @7 {

  24. 2 a4 F$ A' G9 e0 X! j; ]* P
  25. #include <linux/module.h>7 x. l, N) o( T; O- A( Y
  26. #include <linux/init.h>" H2 @$ j4 [$ I
  27. #include <linux/errno.h>5 b& q# @* |/ E5 T0 g4 G/ a- ^* {
  28. #include <linux/types.h>5 z8 c0 n2 K" F# b& n
  29. #include <linux/interrupt.h>
    6 B) s3 K7 Z9 `: I3 G% A
  30. #include <asm/io.h>) S4 ?( G4 m# Y
  31. #include <linux/moduleparam.h>
    : C- e8 F1 \. y
  32. #include <linux/sysctl.h>' k9 l; |8 B0 f- j! {) t& T' V
  33. #include <linux/mm.h>
      ~5 n% t( D' M
  34. #include <linux/dma-mapping.h>
    9 q# o/ c1 J; d1 L  [5 p! \1 x
  35. , F& f9 d" n$ B, G9 C
  36. #include <mach/memory.h>
    % v" h0 o  o% D; N! @2 s
  37. #include <mach/hardware.h>
    $ u. U  S$ T" e% b/ `; L
  38. #include <mach/irqs.h>
    , z$ `* o7 _# C6 v3 j
  39. #include <asm/hardware/edma.h>2 t' ?7 U9 w& M; n3 Z

  40. % T( Y0 C" \. H4 ^
  41. #undef EDMA3_DEBUG9 d2 `) _  Y; H7 d5 l3 [# ~5 x
  42. /*#define EDMA3_DEBUG*/! A8 T# G2 J; @, U

  43. ' q5 w6 h; \1 C3 O& [! U1 L
  44. #ifdef EDMA3_DEBUG9 v4 L/ |# ]2 K& W, p# ^) W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 j+ L# K' u# I4 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' y" i& Z; Q8 R0 A9 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ X# O% B: a7 g# S: n
  48. #else1 n9 U  M1 X% F- y+ m! t3 x
  49. #define DMA_PRINTK( x... )
    % W  D' A1 ?1 X
  50. #define DMA_FN_IN4 b$ M  n5 S3 u# U, w  [
  51. #define DMA_FN_OUT' N/ l  b/ ]0 T: ]( u0 Y# Y/ M: p
  52. #endif, {9 X- I- O! K+ U: m* Z
  53. - A9 |* U" Y5 k" h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" P( ?9 G# \/ C" S
  55. #define STATIC_SHIFT                3
    2 w( S7 ]/ }1 l  F% w
  56. #define TCINTEN_SHIFT               20
    - Y9 s# c0 R! l. f
  57. #define ITCINTEN_SHIFT              21* _8 S/ B7 u# d0 e7 @  U: \
  58. #define TCCHEN_SHIFT                223 l1 ?  |( W. e# [1 X3 |
  59. #define ITCCHEN_SHIFT               23
    1 W2 }1 K+ N7 l/ k4 E& z2 y& r

  60. ( z8 T$ z: b4 b# x; B
  61. static volatile int irqraised1 = 0;
    ! E; C) X/ S) y& X- {! J  n- E
  62. static volatile int irqraised2 = 0;
    7 Z( e6 ^% m( m% x

  63. 2 I9 l8 d* h4 N3 j- E- {+ l8 A3 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 _& J" D# W4 T4 C) G3 U. t: j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ?" O6 f, {; E6 P- h) U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' h! T, _* o  n( K/ A- t

  67. ; U$ z( o" e( I3 K! F, |5 G6 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    * u+ J+ y* f8 i. x0 `( L
  69. dma_addr_t dmaphyssrc2 = 0;) v4 Y* T1 D3 L+ b0 v1 r
  70. dma_addr_t dmaphysdest1 = 0;
    + q+ w! F: Q" W" T  \  G3 o
  71. dma_addr_t dmaphysdest2 = 0;
    $ Z, ~/ q: ^! t& A6 {
  72. & Z8 t- y/ K) c5 K6 L+ `$ g
  73. char *dmabufsrc1 = NULL;$ e8 j$ m) L* Y8 `9 N+ `
  74. char *dmabufsrc2 = NULL;! y+ d; N; K' h* N) r% J! Y$ z
  75. char *dmabufdest1 = NULL;
    % Q, i- O. R/ ~( g5 X( M. L- s4 H0 Q
  76. char *dmabufdest2 = NULL;
    ) B+ d/ v. V0 _" N% |) x# @

  77. ' S, D6 R/ y' [( {! ~: C: [
  78. static int acnt = 512;
    * Z* D! w. N/ ?# @1 h) Y
  79. static int bcnt = 8;
    & [3 J  m" `& s
  80. static int ccnt = 8;
    0 ^: t: d/ e0 g3 L5 c

  81. 0 H! S" n, J. U& g4 t+ Q& F
  82. module_param(acnt, int, S_IRUGO);1 d" q0 _4 {7 I1 |5 D/ ^
  83. module_param(bcnt, int, S_IRUGO);0 ~+ v7 |3 h5 q5 ]2 K% v2 @) |1 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 _0 Y9 T6 G8 O% [* U( |

1 a6 x+ Z# D# S! n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ]  A* d5 d0 F1 M0 D/ }  I
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 E# Q1 A# [3 r1 n5 Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 o9 Q. W: l' r; g9 H

/ W- x0 G+ P/ H: V2 \/ L
) R1 U& B5 s) C* ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-16 09:23 , Processed in 0.043472 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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