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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' k( r3 W+ F* R! i; q  W; |2 Q
  1. [code]EDMA sample test application! G% g1 T, g  U) j, L$ @- v$ g. z
  2. /*) o- J$ {& T( \% Q: ~+ G
  3. * edma_test.c) O' F. q' L+ b1 C8 h! h
  4. *. B2 k4 [$ a9 @; f5 V
  5. * brief  EDMA3 Test Application' O" a0 y2 p- f5 E
  6. *
    : q1 v, V3 E1 p, @
  7. *   This file contains EDMA3 Test code.4 U8 ]; w3 F9 P" q/ s* s8 \7 S) p
  8. *8 U8 r5 k% K- }' L; K( R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; g( V" F% z. K; y$ {5 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. p: F! u! @9 C) ]+ E; n9 j( a
  11. *         TO CHANGE.' @2 Y! \) x; w  z7 D7 ?0 H
  12. *
    % m* X( d' r2 [% n( U$ r5 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! n; n5 Z/ `6 I% R! E( i1 Z& Y( P
  14. *
    2 ?' \$ a1 J# w! a& H
  15. * This program is free software; you can redistribute it and/or
    9 |, c2 m0 x. x0 ^0 d
  16. * modify it under the terms of the GNU General Public License as. U3 C, [# S, {( x: |
  17. * published by the Free Software Foundation version 2.
    ! W7 c( Q/ Q7 t
  18. *0 N9 w, q* X2 A4 U4 C) _+ F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# U! h/ k( O. p% O. v6 n
  20. * kind, whether express or implied; without even the implied warranty
    0 M6 h2 b& z2 W( [5 ^6 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 {) u8 d/ k! l. O
  22. * GNU General Public License for more details." X* X* \8 L8 @1 K
  23. */1 F. M4 A& J( \( n3 L0 K& r5 ?1 I

  24. + [0 U7 P$ D, @( h1 T7 M; L
  25. #include <linux/module.h>
    1 V4 J! `  j1 ]* k' Q/ C0 i
  26. #include <linux/init.h>
      y# O5 h5 G% q+ F% }8 w2 D2 y; F
  27. #include <linux/errno.h>9 e* b. a6 r# `9 |
  28. #include <linux/types.h>2 y1 N; Q, V2 W1 x9 v# h
  29. #include <linux/interrupt.h>: Q4 Y& \  O, @' a
  30. #include <asm/io.h>
    4 D/ n0 ]' O, C( }4 {
  31. #include <linux/moduleparam.h>( U2 E: h. n# b" s. f! l
  32. #include <linux/sysctl.h>
    : z8 f/ U8 Y: i1 k; o: y, z
  33. #include <linux/mm.h>
    8 s2 Y" |: T& o, E. |3 m% Z
  34. #include <linux/dma-mapping.h>- w/ _) ~; n6 U0 t% f

  35. 4 Z; y0 S+ {% W- S  ?6 L
  36. #include <mach/memory.h>+ C1 Z, g$ o- {/ F5 O
  37. #include <mach/hardware.h>
    8 y/ ?) ?. U9 B+ Y$ X  ^
  38. #include <mach/irqs.h>
    ! V1 {, s0 T& ^) e
  39. #include <asm/hardware/edma.h>$ e8 Q& ?4 \8 W+ I# l4 t
  40. 0 _- Q& G; ?4 T8 Q
  41. #undef EDMA3_DEBUG3 p1 s( [4 N+ I7 b, L& r; ?6 H- @
  42. /*#define EDMA3_DEBUG*/5 Z. f% n! S! v9 a7 b; r

  43. % B* J6 J; u! T) M
  44. #ifdef EDMA3_DEBUG  W9 c% p/ C: x+ K. Y5 W9 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( {0 k0 K# k3 e* m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( K9 ~% U+ m. t% J, T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 z  i! D; q' P( [2 d
  48. #else
    / x8 v* C! u% d3 n
  49. #define DMA_PRINTK( x... ). B7 G* l4 E2 f" y
  50. #define DMA_FN_IN
    3 I) O* v6 P! L$ M0 ^
  51. #define DMA_FN_OUT
    - |: b8 N" n- @: ^) C! v
  52. #endif
    9 n* D1 x; X- P) S

  53.   G4 @4 g& Z! J' h: p! v8 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! q! T; Z. s! Z$ D2 D
  55. #define STATIC_SHIFT                3
    # n1 m% j+ A  R, k6 \: z' W9 Q' }
  56. #define TCINTEN_SHIFT               201 X$ `& K# y; T& b! c4 c# v+ k; h
  57. #define ITCINTEN_SHIFT              211 r* b, {% l1 \
  58. #define TCCHEN_SHIFT                22
    ) t! a4 p6 W  D2 E
  59. #define ITCCHEN_SHIFT               23
      K& Q, m6 ^7 Y
  60. ! ?" [% A' Z0 k+ F6 |0 j0 a4 |
  61. static volatile int irqraised1 = 0;! _5 u6 g2 j. u
  62. static volatile int irqraised2 = 0;! `  z# @, u) F( }' y1 ?

  63. % I  D; K# H. x: d6 f* E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, [2 m/ s; z) M5 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : U& h& T* O1 z  l( \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" N$ ?6 W$ Z3 Y4 v7 `
  67. 1 w) u* _& `  G" Z# U  I3 C
  68. dma_addr_t dmaphyssrc1 = 0;
    " A1 z& x" c! A
  69. dma_addr_t dmaphyssrc2 = 0;, g2 Z, S8 p4 R3 t  R* @3 e
  70. dma_addr_t dmaphysdest1 = 0;5 ~* f1 H3 M. x9 a2 F
  71. dma_addr_t dmaphysdest2 = 0;
    ' Z. ?" A. T8 s( ?5 z. i* M: S7 o

  72. ) R$ C4 R, _. U- k1 r8 H7 ^2 k! t+ g) T  L
  73. char *dmabufsrc1 = NULL;
    + @2 q& T9 Z+ V7 [: P2 g9 i
  74. char *dmabufsrc2 = NULL;- L0 e: |4 \% y9 D* T
  75. char *dmabufdest1 = NULL;0 ^8 U' c, L, Q0 _0 |8 _
  76. char *dmabufdest2 = NULL;" b9 u. g$ w9 y
  77. " y# j& t7 Q' o/ G7 H
  78. static int acnt = 512;
    4 L4 ]5 b3 O' L5 t
  79. static int bcnt = 8;
    - F3 h- p" W: Q# l
  80. static int ccnt = 8;% n+ N& i! R2 j' p, x; `1 J: e  j+ B

  81. $ X+ L4 m2 \/ w! z2 I3 t  [' @
  82. module_param(acnt, int, S_IRUGO);$ z" r# q4 N1 W6 ~* O, ^
  83. module_param(bcnt, int, S_IRUGO);
    ! H) H3 L# B8 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* |  O3 x! \4 c0 R% s) |$ M2 U% y
" W: _! B6 J" ~" x& }7 C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' F* o( U" {) @* T, Z1 X! }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 g5 b/ C7 z) y0 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( e1 Z  t# [; r. }5 y, T6 I

: c! m! w0 Z$ Q# M" t
* Y; j  L9 \. |2 g3 X0 `( Q8 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-16 12:27 , Processed in 0.037147 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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