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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . K) _3 w7 r7 C3 w7 B$ w
  1. [code]EDMA sample test application3 l8 s. X# Z6 S; f) J
  2. /*2 A% n+ `) T0 z5 T- c8 m
  3. * edma_test.c9 p& ~4 m% P3 a( C9 I# o6 h2 n
  4. *
    % s# v1 g5 {: A+ R$ N$ [" n
  5. * brief  EDMA3 Test Application& e0 t3 }  j& R9 N' J
  6. *# x1 `& p8 U1 Y5 H( O7 z
  7. *   This file contains EDMA3 Test code.
    : \8 A, F4 j% x
  8. *
    # g+ ]; D) r8 }9 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; l# W2 C% x8 T# Y7 z% y( y' a" R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 J, Y$ U( z: T% k
  11. *         TO CHANGE.0 n* b2 N; D- l" @
  12. *+ }7 b; r/ H7 B& f+ E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # r5 ?( D( R, r5 w
  14. *
    " V3 U0 l) X% Q' z) \6 f
  15. * This program is free software; you can redistribute it and/or
    9 r% x8 l4 r& T, D4 T  [/ [
  16. * modify it under the terms of the GNU General Public License as0 n9 f; W6 r! P
  17. * published by the Free Software Foundation version 2.
    $ z5 I- b1 v8 i9 R
  18. *4 n) Q" ~3 U* q. _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* I% a/ [  T1 R4 g8 x- E
  20. * kind, whether express or implied; without even the implied warranty: Y# \  O7 p# G% t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 Y2 W' h8 l. M: Z9 w
  22. * GNU General Public License for more details.2 ?7 I9 D4 A3 I
  23. */$ C/ w# \4 y$ S; B
  24. ! [9 q- \- T8 ~0 i  _5 Z3 P
  25. #include <linux/module.h>
    ( K# k" g* e: h5 M, L( C1 w
  26. #include <linux/init.h>, _# @. t# ^6 M4 l9 z% n- I
  27. #include <linux/errno.h>; ?: k' m+ t6 F& x% D6 m6 q2 }4 r
  28. #include <linux/types.h>
    " y6 |! [7 O9 R' F/ C
  29. #include <linux/interrupt.h>  {- Y- R& F% s, D
  30. #include <asm/io.h>/ j" \$ Q8 r. E( |/ N, I8 P
  31. #include <linux/moduleparam.h>
    + N$ }% L7 b% {. L
  32. #include <linux/sysctl.h>, k) r( e5 ^  Y7 `( K; d) `* ^
  33. #include <linux/mm.h>" ^0 R( S/ s. ]
  34. #include <linux/dma-mapping.h>7 V" U  e, p& k

  35. 3 U/ E+ O: T) u, r: J
  36. #include <mach/memory.h>
    9 P( b& n; H5 R# `2 Z* X+ C# W
  37. #include <mach/hardware.h>
    " K- l7 `' H" {5 m3 G
  38. #include <mach/irqs.h>
    / @( C- i% C7 \# ^; |3 @* {+ O' _
  39. #include <asm/hardware/edma.h>/ O. g( s! X, j, y7 g# C- U
  40. . k% W7 K: R9 u1 ?& ?! b
  41. #undef EDMA3_DEBUG5 E% h2 g( I+ H' o! ]) c
  42. /*#define EDMA3_DEBUG*/6 \6 n& _8 J5 a
  43. 8 r5 ?7 a3 n# q- s5 ~2 m
  44. #ifdef EDMA3_DEBUG& t5 n7 L1 o' ?* x/ U* M5 m* k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 O3 x: H' k) ]+ \0 ?' x5 C( |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      ~& v$ R$ v% l# ?3 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * z/ u9 M) }3 [( O
  48. #else: H( \1 ~0 n% X' j' `& h
  49. #define DMA_PRINTK( x... )3 F5 F# Q/ M, R4 I2 Y5 B1 X# ^
  50. #define DMA_FN_IN
    3 W( Z: l! A% j3 s3 N9 d  m4 X
  51. #define DMA_FN_OUT  N" B% E+ o; u$ f
  52. #endif
    ! O8 Z; H. n% e7 I0 F" p+ U

  53. 8 i& q# b( V! H% X) {9 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; A$ c8 n* M0 x& T
  55. #define STATIC_SHIFT                32 |/ L. x' a6 D
  56. #define TCINTEN_SHIFT               20: \: r, F9 b2 Q+ [0 [9 ]2 o; q
  57. #define ITCINTEN_SHIFT              21% K0 ^% w& F. |: }0 l8 x( P
  58. #define TCCHEN_SHIFT                225 }$ K" l& Y) ~- U
  59. #define ITCCHEN_SHIFT               23  x7 m7 r/ B" S# _& L1 c, R

  60. * O. F& ^* D) e- A. S2 J* }
  61. static volatile int irqraised1 = 0;0 e4 y! k3 ~0 i
  62. static volatile int irqraised2 = 0;& @: M3 K5 h" a" @* ~+ ?7 P

  63. 5 \$ i1 ^9 Z( ^& o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) k6 j0 a! x  V& `7 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ I7 P/ z8 H6 r' W1 c/ s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # }* |& d" k% P, M1 {4 u: [
  67. # p4 W% ?# ~/ }4 l" s
  68. dma_addr_t dmaphyssrc1 = 0;5 P7 z; X- U, v9 C: o4 r# R
  69. dma_addr_t dmaphyssrc2 = 0;) {# u& I" q( M3 M8 r$ @
  70. dma_addr_t dmaphysdest1 = 0;
    2 o( ?9 d/ ?, G% ~" R
  71. dma_addr_t dmaphysdest2 = 0;
    1 H: A6 |$ O( H1 n4 c" o) R& H2 |
  72. / W4 B$ T+ J& J( Y) U
  73. char *dmabufsrc1 = NULL;
    4 h* `9 W% }& d- \& {! X, b5 F
  74. char *dmabufsrc2 = NULL;
    8 p; B# F  [; c8 I/ Z5 c0 c9 t  a2 s
  75. char *dmabufdest1 = NULL;$ \5 ~6 s3 T3 c
  76. char *dmabufdest2 = NULL;
    2 B% N( U; j- b! I" I; e( @* V
  77. * o0 N, b$ k8 u+ Z* _0 C9 r* E
  78. static int acnt = 512;! {: Q3 ]: j, Q  r% K
  79. static int bcnt = 8;
    0 p1 W) h; F2 P5 N
  80. static int ccnt = 8;
    1 }" q2 }, I1 J
  81. + @$ O' h4 f% T, ^$ r' J. B# m
  82. module_param(acnt, int, S_IRUGO);
    3 r5 c' ?4 l2 {0 v8 I. c3 z
  83. module_param(bcnt, int, S_IRUGO);
    0 r. E6 @7 n% A( X8 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; m# b1 i3 U* a5 \. m: m
4 O2 p3 f, T' ]( i8 m3 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ c3 A  V( u. P; {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ d* W: ~3 p; c6 S& T- m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 Z8 l1 L. K; K* Q; ~
% z& H0 e  s' C& W; v  P& Y5 V# i

2 l; X& o% g' I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-13 14:46 , Processed in 0.043324 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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