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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( L. T1 _6 ^2 i) i, k2 j0 B
  1. [code]EDMA sample test application
    6 O. n; [$ |; v" U
  2. /*
    1 f1 d1 Y7 G2 m, s* X% r+ D
  3. * edma_test.c) W2 i  Q# K$ s) c" T
  4. *8 C$ J( n4 z0 Y2 R- m
  5. * brief  EDMA3 Test Application% z$ p- G. e( }; ?+ _
  6. *: |" e! C" B5 F  ?' h2 k7 ?
  7. *   This file contains EDMA3 Test code.4 h2 q3 w$ w  R* G3 ^
  8. *1 G2 x0 v1 r, M4 G1 w: r& Z: f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 f. V7 ]: A+ _+ Z( X. t- H% z0 L7 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 c7 k" z  j! c0 j' p% q( g
  11. *         TO CHANGE.7 Q; v$ w% S, ]8 k2 j( H, e5 o
  12. *
      D" K, @) I8 L6 k/ f7 j4 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( ?8 q- p0 @, o3 B8 @. Y
  14. ** S9 Q" Q1 P: \$ Q0 I7 `5 @
  15. * This program is free software; you can redistribute it and/or# b' n0 ~! E& v5 U/ T9 ]7 }
  16. * modify it under the terms of the GNU General Public License as
    & d' }. J5 N) Y; J
  17. * published by the Free Software Foundation version 2.) G; x- p- d* ?
  18. *& T0 \: y* l, B  _! L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 J1 {7 v5 ~, s
  20. * kind, whether express or implied; without even the implied warranty
    2 x8 u+ M" l, S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 w, r( Y3 q0 D& o8 }, s( i0 P2 |
  22. * GNU General Public License for more details.
    9 g% h1 f, T- F9 r
  23. */& o& a7 K9 N9 }: [. N9 i/ C. z2 I

  24. 8 p/ A- ~/ ]  u' B6 p
  25. #include <linux/module.h>6 ?( o- N! K* ^- q) l* D& A
  26. #include <linux/init.h>7 o6 h5 j- J2 E2 [! B+ s4 V( A
  27. #include <linux/errno.h>) K" o2 R& ~3 n1 S# {1 [( n% o/ Q
  28. #include <linux/types.h>0 G; h* g: u  G- J
  29. #include <linux/interrupt.h>
    # M: X5 u% Y2 x$ x) W0 s7 \
  30. #include <asm/io.h>4 G6 Y$ D, N  e, q+ R
  31. #include <linux/moduleparam.h>& G, d9 g" e1 P$ }; F
  32. #include <linux/sysctl.h>
    ; _) z3 t9 F9 K3 J' U
  33. #include <linux/mm.h>% z8 E: @0 S( Z; i
  34. #include <linux/dma-mapping.h>
    : g4 H) {8 Y/ e# w, v7 A
  35. ! ]7 s8 X. }8 g8 M. U! K
  36. #include <mach/memory.h>
    $ a3 Z; |5 f+ L- N" ]; G
  37. #include <mach/hardware.h>
    7 W% v3 i9 q6 ^2 Q
  38. #include <mach/irqs.h>
    4 A9 \7 \2 p# p' }: w; M' I
  39. #include <asm/hardware/edma.h>
    : W1 B3 e- @- z7 S

  40. ) s( f$ l9 c" g0 E
  41. #undef EDMA3_DEBUG
    0 U/ c' u0 p. G
  42. /*#define EDMA3_DEBUG*/
    ! l. p8 t& q# z/ G1 H

  43. : m3 h- }5 v! O( `
  44. #ifdef EDMA3_DEBUG
    7 V/ j* Y. C0 p& w8 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - g" Q! P  b* P8 F7 N9 ~2 L4 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / @! M6 e; J" O  ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 V, e7 e3 f! c% A" h
  48. #else" t3 ~0 H5 E. C  f' D
  49. #define DMA_PRINTK( x... )
    1 W9 a0 i% G9 t
  50. #define DMA_FN_IN& B  g; }. X) u
  51. #define DMA_FN_OUT+ X% E( @3 V( Q% y( I+ A
  52. #endif2 g4 A1 _& J6 o* g8 V  R

  53. * D5 g% G0 n0 o( U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - v! H" U! Q/ K, d, a& D; i7 m
  55. #define STATIC_SHIFT                3
    3 W. f" z- g: S. B' G- L9 }+ E
  56. #define TCINTEN_SHIFT               20) L! d* ?9 }* Y- a
  57. #define ITCINTEN_SHIFT              21
    % s5 r4 g: d2 o1 b' @- K
  58. #define TCCHEN_SHIFT                22
    - [$ ^6 r; p; ?8 x) e; v3 q4 S3 S
  59. #define ITCCHEN_SHIFT               23
    / h- ^# X5 \- k5 t  _! L

  60. & S! J' V- E: C; E& j' l) A$ n
  61. static volatile int irqraised1 = 0;
    - o' W4 r7 R, d' G% G& S
  62. static volatile int irqraised2 = 0;
    " `* A, m) i; b9 p7 L6 N
  63. $ w4 V) n+ h8 o, o) A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " j0 ?4 X" T, j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i2 K  {4 r1 R" c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! k7 c5 o) E8 l5 e0 C  Z
  67. 6 S  n( h' M& `
  68. dma_addr_t dmaphyssrc1 = 0;
    / g" i) Z; w% P8 u
  69. dma_addr_t dmaphyssrc2 = 0;0 |# j( U/ u' a# T2 P
  70. dma_addr_t dmaphysdest1 = 0;+ L" q) ?- V9 Z% L$ ]* S
  71. dma_addr_t dmaphysdest2 = 0;
    " j4 W  f, K, L/ z
  72. 4 R! b  ]/ O' p: r! x" L! y8 j
  73. char *dmabufsrc1 = NULL;
    ; S9 ?/ w" z& K% ~* }  N) D, `
  74. char *dmabufsrc2 = NULL;
    / p! U* N; c$ e6 M; U
  75. char *dmabufdest1 = NULL;
    0 t3 y' n1 ~6 ~4 e+ T& L' A, R2 c
  76. char *dmabufdest2 = NULL;
      c+ \' I8 R0 V
  77. 5 B, L- z% r$ H( [( R5 Y) W& D
  78. static int acnt = 512;
    ) X& `" \( E, m4 J" r- a( F% k
  79. static int bcnt = 8;
    ( V* B0 @6 [' R; O% C0 J2 y
  80. static int ccnt = 8;
    2 T( F' @4 \0 l4 _! t
  81. 8 K$ [* z$ K/ Y
  82. module_param(acnt, int, S_IRUGO);
    5 F) Q4 |  @: `0 h4 D0 @
  83. module_param(bcnt, int, S_IRUGO);
    ' Y1 `0 L& j( E. u) P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ m$ }0 t+ ]& h9 R4 D# u. r& @$ U. R5 L# g8 S: d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. K7 k) g# I) G9 u) b" U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# u3 ~" H  m3 C5 m+ P. `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ~. C6 h, r% @0 m: f
! l) R' g% P5 n; V& C7 S  o5 b6 H
3 R/ m3 B, P$ ]) b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 14:40 , Processed in 0.038610 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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