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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; f" D$ _( p7 A- D
  1. [code]EDMA sample test application4 s; ?8 s2 a$ ]! T5 w; G; ]
  2. /*- O( e) R4 J( O
  3. * edma_test.c
    8 ?$ s& f4 G/ |% ~5 l- c
  4. *
    $ ?9 z/ a1 f5 |+ @* R; j8 p6 S
  5. * brief  EDMA3 Test Application% S+ \0 a- `$ B* v) I; K; h
  6. *
    ( }8 Z( [  v: H7 W2 h6 D$ t
  7. *   This file contains EDMA3 Test code.
    - E6 s7 A% M7 z
  8. *
    ; u# p7 D5 y2 Q# C9 e- c& T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 F2 ?4 ^+ Q' D9 ^+ C4 z. C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , u* l0 X7 F2 G+ f
  11. *         TO CHANGE.2 \1 d4 c* e% |& K9 r
  12. *
    0 Z5 \. [0 n6 ^5 Z* K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' W6 j0 |' Y* T; P
  14. *
    . R& ?/ f7 E9 G2 p5 F8 L( r- K$ m4 m
  15. * This program is free software; you can redistribute it and/or& x! M+ S! Z9 c6 j2 V* B% j. G3 ?5 V! ~
  16. * modify it under the terms of the GNU General Public License as
    . A  h( \! v0 K6 ~; N
  17. * published by the Free Software Foundation version 2.
    6 Z& b" B0 j7 D
  18. *
    ; D, O* I7 w4 Y. a) a; p' J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; r/ R% V" s) g  `. z
  20. * kind, whether express or implied; without even the implied warranty
    ) k2 p! o7 y7 l* I  Q* t( x! j. n0 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! K  q% W6 i$ g( S" w0 Z% u: x
  22. * GNU General Public License for more details.( U) D8 b" w4 B: F3 s% S) n
  23. */
    % h) ]6 F- e4 p* P5 X* k
  24. 1 \! |! ~5 F' u$ r* u, L7 a: P6 ]
  25. #include <linux/module.h>
    0 ?( e( i; h) v9 P1 e0 {  R
  26. #include <linux/init.h>
    % o  \# a  z8 D9 `1 a# _
  27. #include <linux/errno.h>; A0 @( P7 @, _0 w
  28. #include <linux/types.h>
    8 G! J- y$ U, J3 j* j) h6 z& n
  29. #include <linux/interrupt.h>2 [) D- D4 \# i, O$ ?7 @6 n
  30. #include <asm/io.h>
    : m6 a7 ]1 O+ Y2 P
  31. #include <linux/moduleparam.h>
    - @9 x5 e( V* ~2 G; S5 R% ~, I( S
  32. #include <linux/sysctl.h>3 l6 s* g* w3 V5 o) j
  33. #include <linux/mm.h>5 f5 P! }& G' \" y7 {- ]
  34. #include <linux/dma-mapping.h>7 ~, A4 U+ }8 X! U8 T. C

  35.   s$ k3 d; A: u$ t% V  _" _. k
  36. #include <mach/memory.h>  q9 x, @; T5 [
  37. #include <mach/hardware.h># a8 Z( j! O7 `
  38. #include <mach/irqs.h>
    $ l% A8 c% e; l* G
  39. #include <asm/hardware/edma.h>8 N+ V2 m1 h# M, c* h

  40. 2 m  |# Q' g$ c% D9 Q/ @, n
  41. #undef EDMA3_DEBUG$ i! {# W# C2 ?/ F3 f
  42. /*#define EDMA3_DEBUG*/4 f( }7 G- V1 m& m) C
  43. ! K  W: I- C/ N2 s
  44. #ifdef EDMA3_DEBUG
    & d- I% f% @' e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ v, D  W+ n( _- h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - M% |7 u! i( p0 w3 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) R+ K3 |" c% L1 g
  48. #else
    - ^4 ^$ O9 b; `: m5 [1 l4 `1 X; _5 i& s
  49. #define DMA_PRINTK( x... )/ J9 ^- v/ j# o0 k- A7 G2 e* [4 i
  50. #define DMA_FN_IN
    : U& I) e5 }( Z& @6 o, z& i+ U
  51. #define DMA_FN_OUT+ v! Y- B- {4 I* }  Y7 d' |6 L
  52. #endif& j1 y  Q' R9 `; o4 _4 x4 Q
  53. 6 u2 P3 [6 L  R" S, g6 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) e) d  K' `6 a+ T  s9 H1 w0 L
  55. #define STATIC_SHIFT                30 i( ]1 I' d6 K' `+ l9 m$ i/ `
  56. #define TCINTEN_SHIFT               20' V- Z' c  R5 S. g; H5 q
  57. #define ITCINTEN_SHIFT              21
    # R1 n2 w7 N( I+ l9 x" Y
  58. #define TCCHEN_SHIFT                22- M/ ~6 G, P6 q3 T' |( }1 j
  59. #define ITCCHEN_SHIFT               23# P5 `' w# c. ?: Q

  60. # i! v4 U3 D5 G
  61. static volatile int irqraised1 = 0;
    ) a; D6 ^' q2 P' H
  62. static volatile int irqraised2 = 0;" v  `% k& T; d

  63. 2 J. r& l# b) o0 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' @  a' }9 ^( U( A" J6 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ W) G0 @8 f0 w5 W; ?! ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 B: _; {3 i. Q; Z# R# N
  67. . R$ W7 A* D4 ]: V2 v
  68. dma_addr_t dmaphyssrc1 = 0;2 w+ ~! g  N# w$ \0 p, w( N5 j
  69. dma_addr_t dmaphyssrc2 = 0;% z$ V3 I6 `5 X9 a9 V
  70. dma_addr_t dmaphysdest1 = 0;$ h3 ?: m" i7 f
  71. dma_addr_t dmaphysdest2 = 0;
    0 t* H! Q9 a; Z( ^

  72. / ~& x5 F& w( O, L4 K6 v9 J
  73. char *dmabufsrc1 = NULL;
    & S5 f2 x+ f5 }) j" l: u; h( K9 }
  74. char *dmabufsrc2 = NULL;- H4 ~+ d% D4 [
  75. char *dmabufdest1 = NULL;- e% I3 z! l; t7 U) U
  76. char *dmabufdest2 = NULL;
    4 Z8 [: k' i& M+ [/ L

  77. & U2 v" e" {# c6 F3 g
  78. static int acnt = 512;
    , k( e+ D* ~6 S& @3 r! k: H5 U+ |
  79. static int bcnt = 8;; i4 z/ e5 B! _' H  [
  80. static int ccnt = 8;
    & V* Y7 q: _) n% H, ~1 t

  81.   s9 q- ]: ~* k& M! s1 v6 ~7 |
  82. module_param(acnt, int, S_IRUGO);0 a- d7 _' i; I- v5 B5 [, X- B
  83. module_param(bcnt, int, S_IRUGO);
    7 {5 O& [9 |9 Y0 g2 f4 c6 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 Q' A% R# y# |3 K5 [2 P) t; k; q  F/ S' M; N: N9 e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" `7 Z9 H4 j; R3 V/ R  b( H5 |/ }" iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- V5 u, N/ ^% |* ?' x# ~0 {/ L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Z( @7 v' ^' o' x% A+ N
! z4 i: m, w# E7 _- s& j) e
' J% A' G6 j. G: t3 F/ \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 16:32 , Processed in 0.039086 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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