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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ M  `: t; A9 q0 w; _' Z
  1. [code]EDMA sample test application
    - F/ f/ ^2 L0 Q# _7 ?5 a& v
  2. /*
    % u5 u3 w3 {! ]
  3. * edma_test.c
    & u: f5 y3 I( T" o
  4. *: m/ O! h/ p( v' t' v( g
  5. * brief  EDMA3 Test Application
    8 c' C. r, q9 n, q
  6. *
    % ]3 e7 g/ \: j: E: _
  7. *   This file contains EDMA3 Test code.! T/ X# v& o3 [; N
  8. *
    ; S- X- a# u, }& F7 [. B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 L& ?1 B6 Z* F' h8 @. ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . h, G0 ?( r$ @$ K
  11. *         TO CHANGE.
    / m8 b( z' `# z( R$ y; X5 i
  12. *
    ' |3 \- u( M9 x6 I3 z, m. ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( n9 D% ?8 Z/ H" \: T
  14. *4 b+ T7 J; x; Z( K3 ~$ \
  15. * This program is free software; you can redistribute it and/or
    7 I5 P# a6 y% y$ B
  16. * modify it under the terms of the GNU General Public License as, Y* ]# `; P1 n9 U  w
  17. * published by the Free Software Foundation version 2.
    + S) n8 u( d3 k; t( x1 i$ \$ j
  18. *+ G* Z& d: r% y' t4 c7 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , n% P1 a3 Z( A8 S
  20. * kind, whether express or implied; without even the implied warranty
    5 \1 x5 {- ^$ O% M' i% l; @2 S# u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 W+ c7 @& \7 ~' Y* S
  22. * GNU General Public License for more details.: E% _( c2 {) D9 t* ~' w$ ?  ?3 j
  23. */
    ' a# q$ @- Y; L; d# o) C- m
  24. - P/ Q  \2 b' E# E" X% T! A
  25. #include <linux/module.h>
    5 o8 a$ E# v, U7 f* S* p
  26. #include <linux/init.h>
    : B$ ]" R3 J# Z, D
  27. #include <linux/errno.h>
    & O* e% I  a, @# S9 r9 }
  28. #include <linux/types.h>
    - p, k5 n$ j' D9 y) `  m
  29. #include <linux/interrupt.h>% w: Z& `3 J7 }. f# K2 x/ L% |6 p
  30. #include <asm/io.h>
    * y* U! ]; ^; Z& Y/ M
  31. #include <linux/moduleparam.h>
    % e9 d2 b+ Q2 o$ |7 X$ }
  32. #include <linux/sysctl.h>
    $ [( B, a% [5 `* U8 ~3 Y; C
  33. #include <linux/mm.h>
    3 p: b, `( [2 s$ O
  34. #include <linux/dma-mapping.h>7 L! n" A, _9 i& w8 }
  35. ( W. H6 U' S1 I+ X, g) \+ z
  36. #include <mach/memory.h># j* D0 m% D9 {8 a: r
  37. #include <mach/hardware.h>
      k3 g0 o. h2 l1 J! `" U
  38. #include <mach/irqs.h>
    $ V) t" o7 N% W
  39. #include <asm/hardware/edma.h>2 w- G; [: T# z5 ]- k3 W& n; y" B

  40. 5 C8 P" p7 G/ `3 S, Y4 R0 g
  41. #undef EDMA3_DEBUG
    $ d: A0 B2 L0 m2 F3 Y/ t
  42. /*#define EDMA3_DEBUG*/
    5 X" M$ u4 [2 V1 u" ~* n

  43. " M0 d  L0 l: ^. I
  44. #ifdef EDMA3_DEBUG: q8 L: p2 L5 ]* l& B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' l0 d( [2 e" U$ O7 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 {! {* T$ z3 q8 ~$ x# c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / ]9 e7 d' J! {: Y
  48. #else$ n( p) D6 q5 b. `5 ?
  49. #define DMA_PRINTK( x... )* w9 x, U* Y# d4 L+ U4 e
  50. #define DMA_FN_IN
    7 z1 ^# c3 I& K" _: Q3 [" b
  51. #define DMA_FN_OUT
    , p' m# i8 J6 O3 i+ l
  52. #endif
    * e4 `5 S+ t) x0 y. s. k* m! g

  53. ; R4 A/ w% n7 r0 [4 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 M) |) G" Z7 a
  55. #define STATIC_SHIFT                3
    ( e9 l0 F# h3 v5 _1 }
  56. #define TCINTEN_SHIFT               208 V/ N  [% v2 P/ a. A6 ^+ I
  57. #define ITCINTEN_SHIFT              21
    ; W% w1 m# T: @* h- a
  58. #define TCCHEN_SHIFT                22
    . ~5 ~% S- L4 }* R8 K
  59. #define ITCCHEN_SHIFT               23
    9 s5 U* \; ~* h5 v3 a
  60. % H) e9 J5 L# o/ U. l
  61. static volatile int irqraised1 = 0;! P6 P7 U5 t& O' Y8 Z/ d
  62. static volatile int irqraised2 = 0;
    # t4 ?  @3 O3 ]. A; V
  63. ; U) ^; v7 ^% [1 I9 l$ P7 K6 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) U+ h0 Y2 w( S( k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' e- G- U; U; ~! z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 I  _9 k% L% x6 B7 f& v0 q% U

  67. ; d/ m4 t) |+ d, h) S7 G% {: I
  68. dma_addr_t dmaphyssrc1 = 0;
    7 [/ F9 X) i1 G7 ~: e4 y- J! J9 q
  69. dma_addr_t dmaphyssrc2 = 0;" p9 ]# E7 Z. [: {
  70. dma_addr_t dmaphysdest1 = 0;
    3 K, H5 m2 J  |! T( `; c% @0 i
  71. dma_addr_t dmaphysdest2 = 0;
    4 }1 V& R) ^3 f7 r, m6 y/ R3 b! \

  72. 4 C* I0 R  ^0 ]
  73. char *dmabufsrc1 = NULL;+ s3 c( q& b- R6 T
  74. char *dmabufsrc2 = NULL;
    - S' T* A3 n1 K4 |- S
  75. char *dmabufdest1 = NULL;& \* H* f- f0 M. j4 H
  76. char *dmabufdest2 = NULL;0 S' k, L9 C0 E; u8 Y
  77. 3 D8 q5 ]; H' G3 \
  78. static int acnt = 512;. ^( v4 B8 V+ a, l$ b9 x$ M0 }' B
  79. static int bcnt = 8;
    2 d; A  j' _3 f# m0 ?: A
  80. static int ccnt = 8;+ p! X7 x* N. H; F& q
  81. . y6 z# m) A0 g0 `+ j1 ]7 r/ ~# @
  82. module_param(acnt, int, S_IRUGO);' l, C3 A2 R6 ]- ~1 L9 }9 e
  83. module_param(bcnt, int, S_IRUGO);
    0 r3 G2 D% H& ?6 y5 F! Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. E) R* ]' T  S2 U) N% X  g3 j1 Y( o/ U; d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* b" {$ Q) o. f7 t/ O5 garm-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 Y5 U$ V, o: d- [# p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! C) y: I6 q- h# [$ N: J. t

% M: N+ X* N0 D, M( B7 \5 J. P) N+ h, ]% E  `$ C! h8 s% J3 `+ _; @0 D8 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 03:57 , Processed in 0.038575 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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