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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) l" s( L" ]1 T9 T) E4 S4 s
  1. [code]EDMA sample test application0 R% e( }4 {* u; u) H
  2. /*
    / N* O- M& ^7 r8 h8 s( M
  3. * edma_test.c/ A6 A9 A" c" f, M6 F' m4 \* b: c7 o
  4. *
    ) w. h7 Y4 e( u2 F3 E( f% R( f" K
  5. * brief  EDMA3 Test Application- y& N1 f! B. [8 x/ p8 N; j$ `
  6. *
    , ^# \/ A& C& S  e8 h
  7. *   This file contains EDMA3 Test code.
    ) b& s; O5 s# ]( X' c; M. F$ o
  8. *
    7 P, F2 q8 r9 o3 p8 d" [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 \# }8 |2 r3 y" x) \, R2 [1 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * ?# ]: a5 u3 F1 m2 I5 Q3 W
  11. *         TO CHANGE.( E& I6 P; r  v% @
  12. *2 w- e# Z$ _( u& t( V0 c6 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 q' n+ T0 O6 {% ~
  14. *, p' Y; T) ^% m
  15. * This program is free software; you can redistribute it and/or1 f, f3 @* o2 [1 N! L8 N! h1 x# C
  16. * modify it under the terms of the GNU General Public License as. I! U6 C! ^7 n$ M$ b
  17. * published by the Free Software Foundation version 2.
      }8 D& W; L3 E
  18. *' o9 S) w" S3 Z% [: b/ l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + @0 A  c: E- l5 q; ~
  20. * kind, whether express or implied; without even the implied warranty
    1 w- p. A  @9 V; F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 a% X, C: l9 e8 E3 X! `
  22. * GNU General Public License for more details.
    8 {" m2 h' k/ t2 K
  23. */
    / X8 h% ~) E( {) @+ o5 b/ K" [0 P

  24. ' t4 p" k2 F8 I7 K" y: }
  25. #include <linux/module.h>
    0 j. r! }$ f$ y/ }8 G
  26. #include <linux/init.h>* P! Y8 ^/ C& O1 a4 r
  27. #include <linux/errno.h>
    " Q; q( @: k$ r3 G
  28. #include <linux/types.h>
    6 o7 y7 @, {/ V$ W6 p
  29. #include <linux/interrupt.h>* p3 N! `, D& }0 K
  30. #include <asm/io.h>; |5 f7 |% A6 k/ n; W; R6 w
  31. #include <linux/moduleparam.h>
    # l5 y. Z9 m% d& R( t
  32. #include <linux/sysctl.h>
      b8 A* `! q1 K
  33. #include <linux/mm.h>( ]# X- i6 Z; i; ~  C1 C
  34. #include <linux/dma-mapping.h>
    5 N7 U5 q. h3 V% {
  35. ( `+ p( k; r" N2 M2 G' _# Z
  36. #include <mach/memory.h># H) G. w8 M7 I# y1 w7 e
  37. #include <mach/hardware.h>
    5 [* F' N: W# P7 F1 n9 u
  38. #include <mach/irqs.h>/ v5 O  i) Q$ F) B  g
  39. #include <asm/hardware/edma.h>
    / h4 e8 P. x3 w" ~- X
  40. 0 N- h0 c! H! F- D1 F/ v
  41. #undef EDMA3_DEBUG9 `! l+ n) o: X% F" y. D
  42. /*#define EDMA3_DEBUG*/0 ?  Y0 D2 g, L

  43. ; C6 ~( @8 H) x& k% b
  44. #ifdef EDMA3_DEBUG
    7 ^- `& E* |& f) M* M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ X# ]2 T2 N1 U- z7 D4 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ j4 R5 A8 u7 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / I& d& _& o( E0 V9 s
  48. #else; a6 ?8 M2 ?5 r1 I. `& a: f
  49. #define DMA_PRINTK( x... )
    ; P( _' s; H4 l% e; b5 I5 |6 x
  50. #define DMA_FN_IN
    % [5 X, N# U$ Y
  51. #define DMA_FN_OUT
    9 c" N: e! Q7 [2 O/ k. i
  52. #endif
    ) C( K, e, V2 N/ H+ K

  53. 3 ~8 q# h+ A6 j) t+ T% f6 p( C; I. k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / C% a9 t+ _- g3 f
  55. #define STATIC_SHIFT                3
    ( N  E1 m) u$ B8 \7 t0 t
  56. #define TCINTEN_SHIFT               20
    % @8 d# x8 ^! v7 P& n2 V# e! i
  57. #define ITCINTEN_SHIFT              21
    * n, g% C! m5 \6 g! k
  58. #define TCCHEN_SHIFT                224 @, y' F) Y% W; [' X  Z
  59. #define ITCCHEN_SHIFT               23  M9 Z8 U. s: |9 R) G
  60. / Y( c6 L/ D: L+ t' s% S
  61. static volatile int irqraised1 = 0;
    1 U+ M5 g/ W& I+ F) M: a& J# s( K
  62. static volatile int irqraised2 = 0;: G  M3 l& ]. p

  63. 1 ~0 c7 X; V: u& O3 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 K# u2 E9 Z% W1 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' K& B9 j8 F" M) y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " b1 L( W+ i; [

  67. / q5 F3 @/ v7 _, R: s* c5 L+ T
  68. dma_addr_t dmaphyssrc1 = 0;
    + Q  R! P2 V9 \5 x+ J
  69. dma_addr_t dmaphyssrc2 = 0;
    ) Y/ r5 U: z. l: ~% p# [
  70. dma_addr_t dmaphysdest1 = 0;
    # q$ Q" b, T4 {7 D! ?+ l
  71. dma_addr_t dmaphysdest2 = 0;
    ' g  e* e, |5 s, y/ u

  72. 2 s5 V4 Q& u/ K( b" t- y
  73. char *dmabufsrc1 = NULL;. U) a# u# n6 |( Z* }: r( K
  74. char *dmabufsrc2 = NULL;
    5 c* E' l. {1 c
  75. char *dmabufdest1 = NULL;' ~& e# f3 a4 Z/ F2 u
  76. char *dmabufdest2 = NULL;) O+ Z1 `3 @5 I, W9 }) X. A3 x1 m

  77. . }  q8 J2 q( H3 o6 U# E
  78. static int acnt = 512;
    5 K" t" q: l3 s
  79. static int bcnt = 8;
    - R# @+ _  T: b" `, h
  80. static int ccnt = 8;
    + T: A0 K, I& Q# M. d6 k8 e
  81. ( {8 L" Y$ l' K$ C9 X9 K# S
  82. module_param(acnt, int, S_IRUGO);
    % D1 @0 l9 ^& m" d. X
  83. module_param(bcnt, int, S_IRUGO);) ~- q! C5 ]8 X, P  N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. ]% Y  G! ?4 N

: A- t" r( C8 {: a0 I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! b2 ~8 T; {8 z$ [5 @: v5 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# O) L. v4 c& I+ Y  f" D, I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 J! o6 n4 ]9 k7 v

( p; A/ f& u8 ~* ^0 W
9 z( ^; k, H. P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 22:24 , Processed in 0.037207 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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