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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ v, W# J3 ]& _  N. k" q2 m/ Z" g+ Z
  1. [code]EDMA sample test application
    . {9 O. I$ q' H7 i+ M
  2. /*
    ) d& x* h' b7 P& }' L3 G
  3. * edma_test.c
    3 B) D2 N3 _+ g3 y7 A
  4. *
    3 n( g0 I0 z' G# U. L
  5. * brief  EDMA3 Test Application  Q5 n5 ^; m" v* ]- B  M4 [% i
  6. *1 y! d0 U; o$ X8 W
  7. *   This file contains EDMA3 Test code.
    , f6 ]; o9 G. O7 ?$ i" E
  8. *
    $ i2 k: D) e( q' p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ?$ r- A8 }+ f. Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      l9 V% B) X0 R# C& B: Z* ~- [* [+ B
  11. *         TO CHANGE.
    % p% C0 g& m( c- v* D8 f
  12. *$ {/ ]2 B% F( V% \0 `4 K2 I+ b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: Z6 K, i8 O0 z6 G! _/ o
  14. *
      r9 [( i$ a7 e* J3 k" O
  15. * This program is free software; you can redistribute it and/or
    4 g& L! {/ W: u, o. Z, P; r" U
  16. * modify it under the terms of the GNU General Public License as
    0 y- X0 e) ?* P" r; }
  17. * published by the Free Software Foundation version 2.3 g2 {6 f9 I1 z' n
  18. *
    2 E# m4 q. Z5 y4 a& q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 M* m! T  K, w+ ?1 r4 K) f2 `& A
  20. * kind, whether express or implied; without even the implied warranty
    * d) f: ?" |& T" k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( n; `9 {2 {: }# M, m& D
  22. * GNU General Public License for more details.' G5 g* _7 \0 z3 Q. t& N; u
  23. */
    6 p( ]" |. y3 b9 M

  24. + I- Y9 X8 V( D( d
  25. #include <linux/module.h># R/ q3 N% p. h* q2 I$ ]/ O
  26. #include <linux/init.h>0 H  m- f( x2 M5 T/ p# Z( J+ m( e* d
  27. #include <linux/errno.h>
    " _) P1 g( F( r  {  h
  28. #include <linux/types.h>- p, v4 ]& L, V" f; a' k
  29. #include <linux/interrupt.h>
    . x7 S; |' A/ L- T0 p
  30. #include <asm/io.h>7 |& `! a2 D4 R2 B3 F0 S7 ?4 h
  31. #include <linux/moduleparam.h>6 ?/ K+ {, `, a, [
  32. #include <linux/sysctl.h>7 _5 k4 n0 I! J6 b( D# B
  33. #include <linux/mm.h>' h, F2 b! q- ~
  34. #include <linux/dma-mapping.h>: F: v9 k! e# @9 y

  35. % Z  Q4 B' I0 i. P# S
  36. #include <mach/memory.h>
    & c" N6 t8 F4 y  a* z- ^
  37. #include <mach/hardware.h>
    6 P8 C/ F9 _6 x' H; r. M- Z
  38. #include <mach/irqs.h>: h1 T6 _1 _2 h' u5 D
  39. #include <asm/hardware/edma.h>
    ' T" l7 m# D$ j2 M

  40. ! c+ \/ n& I& T
  41. #undef EDMA3_DEBUG
    0 N7 R% h4 o5 g' X2 H9 r9 D
  42. /*#define EDMA3_DEBUG*/
    & O* Q) {3 K% Z( P( J

  43. 8 ~6 p. b  J/ `) Y
  44. #ifdef EDMA3_DEBUG
    * R$ {, f  [+ `4 {. M9 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & p. i$ H' O( E4 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 D+ A9 M- r& l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * z) \  {9 U# h$ ^. X8 i
  48. #else+ v; D) G8 s9 B0 C: c
  49. #define DMA_PRINTK( x... )
    " |# F7 C" h9 T
  50. #define DMA_FN_IN3 B. t* E/ o. a0 S  R/ J- K0 f
  51. #define DMA_FN_OUT. M) a7 r% p8 ~# P9 ]
  52. #endif
    2 }  T; i5 z1 n& A' k

  53. & {3 ~% [3 r1 [  J& K. l) U, `: F( P+ p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , o9 \& Q9 a0 |. v  _% N' U; k
  55. #define STATIC_SHIFT                3
    / G7 }9 E- m4 O2 X" Y: e$ T
  56. #define TCINTEN_SHIFT               200 Z& Z, u/ G* D7 R' B" \8 }+ K5 |
  57. #define ITCINTEN_SHIFT              21
    3 f3 x& C/ \; ^  P$ M1 C
  58. #define TCCHEN_SHIFT                22/ u3 D0 c. ~; d$ S, @5 n8 s5 q
  59. #define ITCCHEN_SHIFT               232 I' y" j* q/ ?  D4 y( m
  60. 4 f+ J; f8 U9 ?6 e' W) g& I1 \
  61. static volatile int irqraised1 = 0;
    " m; V# I" G- x4 H* f" l
  62. static volatile int irqraised2 = 0;9 S/ w8 E0 B. O

  63. * L' ~& j; N, O: c7 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 \  R% H$ \. `' v+ j, s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 x- p! e+ x; t, Q% X$ k4 b7 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  \  b8 A2 i; s' @( `/ M' R1 j

  67. / Y  y7 H2 a4 [
  68. dma_addr_t dmaphyssrc1 = 0;
    % p: a, K5 }' w, X2 ^+ v/ K
  69. dma_addr_t dmaphyssrc2 = 0;
    6 C' V; C0 u( N) r6 g& S
  70. dma_addr_t dmaphysdest1 = 0;
    # @" V% j/ S  z
  71. dma_addr_t dmaphysdest2 = 0;
    5 p& O& y# F* W6 {! L# _$ f
  72. $ P0 s" b1 G2 v% g0 T
  73. char *dmabufsrc1 = NULL;
    . f# o8 E; D$ g; l/ M% W
  74. char *dmabufsrc2 = NULL;6 a! x( r, n. Q' h3 k6 |0 L0 |
  75. char *dmabufdest1 = NULL;& K; x2 G( s, G: o( R+ F
  76. char *dmabufdest2 = NULL;
    & g4 ]* n9 K' H

  77. + r% ~0 Y' ?5 T
  78. static int acnt = 512;7 w1 P8 l4 H/ z2 L5 a/ x
  79. static int bcnt = 8;7 \" t+ P! @; E/ s/ J
  80. static int ccnt = 8;; N  B6 @9 E. ]7 V) p
  81. . C- Q5 [5 D! A5 b
  82. module_param(acnt, int, S_IRUGO);
    % o, S; b  O  h8 V0 X2 h, f' Y
  83. module_param(bcnt, int, S_IRUGO);$ ?3 x& P  @/ W2 n+ P% L# P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  c! c2 e6 h9 j# W
' a, z, l9 G) t; Y% X# a- K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 D6 X9 D  g# z% ~! j; m8 {' \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" l. w7 E; b5 k0 x  [& s2 q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ t8 A* p! g& R, v. [9 o
. {7 A" Q* d7 }' ?! _% q4 v! C. j: B4 O( D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 11:50 , Processed in 0.040280 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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