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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 V% B4 a2 I! v; w' A) T: p
  1. [code]EDMA sample test application
    4 B& w' Q% g% n8 A3 U! B: d% E
  2. /*. v# E' l3 F$ ]! G+ Q+ G$ z9 s# \
  3. * edma_test.c
    ; G  S% a" N$ Q- y! A9 @
  4. *! J4 M6 Q* G! i+ m( y: l
  5. * brief  EDMA3 Test Application
    % r  r8 r/ H, `) W* x% K
  6. *. \! A1 D! Y- b( q; q. `- T
  7. *   This file contains EDMA3 Test code.
    1 c' B) e+ f- Y, b% V$ Q
  8. *
    2 V  B+ S! F/ T" v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 i6 ^) ~, T+ f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 I7 D  U' D2 [3 C
  11. *         TO CHANGE.# L( x) r! w) p3 t0 b
  12. *
    6 c' r. W* O8 a& r# j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - u' m$ D/ i, c+ y7 D
  14. *% O. ^. ]# \6 z! ?9 n' @1 e( ]
  15. * This program is free software; you can redistribute it and/or- g# S, ^/ \0 H
  16. * modify it under the terms of the GNU General Public License as
    3 p( Y9 y! J9 `/ y6 S0 e/ P- j" r
  17. * published by the Free Software Foundation version 2.
    7 e: Y5 _! ?8 W) a3 c% L
  18. *
    ( j, s+ o& _+ T0 h/ `' Y$ O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ g% c) K" c$ q, b& T! l
  20. * kind, whether express or implied; without even the implied warranty+ [9 S9 K) Y4 E- y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 L5 O) k  p/ j4 w$ Z
  22. * GNU General Public License for more details.
    4 C" |: Y5 a3 B. M, a
  23. */
    ; [: X. t; q1 ~" d/ X( X
  24. 2 d. O& R8 E" ^; A" d, g1 C- X
  25. #include <linux/module.h>5 J! K2 L+ r' q2 z4 D
  26. #include <linux/init.h>+ X- p* B, w2 c$ m8 [' ]- m
  27. #include <linux/errno.h>9 i- H* \0 m" P
  28. #include <linux/types.h>
    3 a1 k' H8 n, p- [) T; b6 |2 \
  29. #include <linux/interrupt.h>! Y" l3 }# A0 P# V3 R1 t; Q* {
  30. #include <asm/io.h>
    / I' i7 f9 a9 S+ j
  31. #include <linux/moduleparam.h>% J, y3 _. m/ [7 W) \8 }
  32. #include <linux/sysctl.h>
    ! h* ^, h* v- S  y8 E+ j% p
  33. #include <linux/mm.h>; G: ^+ g4 A- z9 I: z) k" V" ^
  34. #include <linux/dma-mapping.h>
    % i6 J4 F9 E8 ^7 Y6 v
  35. + M- k: I4 ~0 m
  36. #include <mach/memory.h>
    ( X" Y, l7 R9 p, c9 `, _" ]
  37. #include <mach/hardware.h>
      T7 J% X, r; S5 z' t
  38. #include <mach/irqs.h>
    9 h/ Y( \% U9 U: v6 z9 M5 v. U
  39. #include <asm/hardware/edma.h>6 O! R" `9 i  B0 W) D7 c+ g6 q$ g" t
  40. # @5 w! T8 K4 M7 V; r
  41. #undef EDMA3_DEBUG
    : q% r2 @- O7 _. c! g
  42. /*#define EDMA3_DEBUG*/0 `1 \  S4 w- Y( t
  43. / v; I# [. F1 N. j
  44. #ifdef EDMA3_DEBUG/ K" z" x. U% n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 P4 Z. N, i: U  z5 _3 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 |8 q2 ]6 p8 h+ @: Y% o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 S; U! r3 o) h( L# ~' f" f
  48. #else/ u# d1 a% V3 W5 |* j# Y
  49. #define DMA_PRINTK( x... )% h+ l& J& p0 f
  50. #define DMA_FN_IN/ I2 N8 `/ c' G! \. E
  51. #define DMA_FN_OUT
    7 x* k( i$ ?- N5 [" ]) i
  52. #endif
    0 q& V- f6 ?/ ]. U, T  E" L

  53. 1 H  d# g( y  Q5 ~; E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      ]3 h. e8 c# K! I
  55. #define STATIC_SHIFT                3/ d1 ?5 [- d+ Z
  56. #define TCINTEN_SHIFT               207 y7 a) V1 {+ F) x* P+ I; l. n! E
  57. #define ITCINTEN_SHIFT              211 Y/ ~0 r: f/ k
  58. #define TCCHEN_SHIFT                222 Y, p% g( Y# }- _* h4 s: x
  59. #define ITCCHEN_SHIFT               23+ _6 d  X) `; G6 V! S
  60. + K5 E6 H9 e, A7 W
  61. static volatile int irqraised1 = 0;$ U) `- D  f$ s9 {: P6 G' P
  62. static volatile int irqraised2 = 0;
    " `8 p3 v- V" C9 h! r1 z

  63. ( b. U+ r# ^& K& G. ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; B" y! a6 K% G, ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ t' I1 q2 m: W( Z; c- N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + K6 |5 w) g2 L2 E) l. R' e
  67. # J% u# a% H0 k% I( u
  68. dma_addr_t dmaphyssrc1 = 0;
    8 j9 X3 p0 @7 J: _  H$ L
  69. dma_addr_t dmaphyssrc2 = 0;
    & I* P0 V% x, V9 Y7 m5 O0 R" R7 e) ]
  70. dma_addr_t dmaphysdest1 = 0;! F- L; b; {  ]
  71. dma_addr_t dmaphysdest2 = 0;8 U3 `/ x$ {' s) G: ]/ \
  72. 2 V: g* E  n& C+ d
  73. char *dmabufsrc1 = NULL;0 g4 T% i* ^8 d. x  I  c
  74. char *dmabufsrc2 = NULL;
    8 S3 \  L2 s+ \6 q- p; |) I
  75. char *dmabufdest1 = NULL;6 Y# i2 Z* f& b$ u1 C: O2 i
  76. char *dmabufdest2 = NULL;1 p) i0 l& u, H6 C$ s- c: Q
  77. & u, Z( P7 Z8 X6 X  K
  78. static int acnt = 512;
    : A! x4 G  s* J! ^
  79. static int bcnt = 8;7 `. Q8 o4 \6 j! W6 Z$ z  R
  80. static int ccnt = 8;
    * L6 ^; @2 p2 P* u$ s
  81. - M' B1 T9 e: [1 c
  82. module_param(acnt, int, S_IRUGO);: m! {7 D$ M- j2 b4 S' y6 o0 a
  83. module_param(bcnt, int, S_IRUGO);1 c- L' A# y" a/ G8 W& D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% V1 ^  ?* h6 l4 o
) ?: K  E! O: ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. [, Q! F9 n9 J/ T* [# ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ f3 l. G) j3 I9 M. L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* v9 G  J7 b& ~) T. P! u
% N; U5 {1 w9 G9 x0 o# O
8 y  |1 {+ ]( A2 c5 Q( ]  y; N  A% |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 16:37 , Processed in 0.041242 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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