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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 O- X( I$ ~1 m
  1. [code]EDMA sample test application0 A0 M4 C1 j# J; k
  2. /*, c) l; ]: y. F$ {
  3. * edma_test.c
    9 Y0 j0 p3 X- n; T$ f% s7 Z  f
  4. *0 X  D) n7 [( t- n) S
  5. * brief  EDMA3 Test Application/ i* n5 e# x  G! l
  6. *8 M9 E. @: w# P6 @+ u0 F
  7. *   This file contains EDMA3 Test code.
    3 |# Q. W1 U, r3 s. @9 q
  8. *
    6 ~4 [' K/ G9 o! O9 O. A: x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! z9 b* l! X" x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * [0 p- J9 Z. s2 L" U& R
  11. *         TO CHANGE.
    % G4 |- F: u/ U/ j4 W* j! [$ N
  12. *0 q5 n; j% j6 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 w& x: g0 K% S% ~# U2 Q7 E
  14. *5 d% n! v6 [  R, _+ G9 G" C+ w4 s
  15. * This program is free software; you can redistribute it and/or
    : f. h3 X* g) ^( b
  16. * modify it under the terms of the GNU General Public License as
    ! Q3 P+ R$ _) S+ [" v' _6 o
  17. * published by the Free Software Foundation version 2.3 Z* f5 v3 V5 }8 o
  18. *( V# H% a4 g! h7 j' |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 R' U1 t! ^# e$ W" J
  20. * kind, whether express or implied; without even the implied warranty
    ( g; z$ Y  V( }# J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 g; I0 U- f3 u' R6 E% {9 |
  22. * GNU General Public License for more details.: C3 z; g1 T* @/ ]* d& {
  23. */- e5 F, a+ H4 W! [7 @! K' y

  24. / q) A" f, i, M! ?% H0 u$ O
  25. #include <linux/module.h>
      H7 O9 Q1 z7 G5 ~( y
  26. #include <linux/init.h>
    * B3 R& A/ v# L+ |' B* {6 h
  27. #include <linux/errno.h>
    6 g4 ~8 ~1 A; G9 Q& r; p
  28. #include <linux/types.h>  k+ U- S  z8 t- ~/ L8 Z- m$ ?: a* [
  29. #include <linux/interrupt.h>- W# O3 u8 b- \9 t9 b& Y  Y
  30. #include <asm/io.h>) g$ r1 P! P. K
  31. #include <linux/moduleparam.h>
    ! u+ F# K8 W$ l8 G
  32. #include <linux/sysctl.h>
    * c' a3 n. S9 Q# d3 V
  33. #include <linux/mm.h>9 `  e( c5 v, X+ H% ~2 l
  34. #include <linux/dma-mapping.h>
    7 C* A, ]# d& r2 m
  35. 4 s7 l" M% {) U0 l7 D, ^
  36. #include <mach/memory.h>, L* K1 e" w5 Q9 L+ n3 @8 z$ |
  37. #include <mach/hardware.h>/ z, \1 q2 l7 Y& U3 y
  38. #include <mach/irqs.h>  s: K! [% Q# G% X. i/ \
  39. #include <asm/hardware/edma.h>4 S& L; Z2 x- `- S( n

  40. ; z( X/ \' ]  F2 W. p/ w
  41. #undef EDMA3_DEBUG
    % D, _5 s' V% [. R: r
  42. /*#define EDMA3_DEBUG*/1 [( z& C/ q6 b5 [4 h  |& a
  43. # u. x7 X. B3 I3 @6 a' {
  44. #ifdef EDMA3_DEBUG( J. u- o! R% Q# P1 i# D' u) ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 t) N  n1 Y1 }/ E) h( d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 {4 [. s9 ^; Z8 T% |: i/ k. n3 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) x. p$ @8 g8 d6 `7 X  s# B8 J
  48. #else" d% E9 X3 m& i3 d
  49. #define DMA_PRINTK( x... )0 _& [. G7 L8 j
  50. #define DMA_FN_IN
    3 s1 I5 r# [: v7 F# l: d7 \& T
  51. #define DMA_FN_OUT. {$ M+ e$ e* h" Q8 O6 x7 e
  52. #endif
    9 S9 N1 r6 }/ S% B* O) O0 t4 ?

  53. # R$ c* g+ @* Z, b; D, C* o' {$ ~. s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ T4 m  y9 E, ~, z
  55. #define STATIC_SHIFT                3/ E8 `4 \$ m0 V) D  N9 i
  56. #define TCINTEN_SHIFT               20
    6 Z" G* B( p+ ]
  57. #define ITCINTEN_SHIFT              21
    5 ?* s- B2 X5 @, |; W( B
  58. #define TCCHEN_SHIFT                228 V. K' l7 o* r; a* k
  59. #define ITCCHEN_SHIFT               23# x3 o) q4 p4 ?, ]% @
  60. 7 _- {' a( X2 ?3 e* W
  61. static volatile int irqraised1 = 0;
    # p3 E6 k$ T! S' b' @7 p6 m* J+ T
  62. static volatile int irqraised2 = 0;
    - L5 ^. q7 }8 S$ \
  63. 3 I7 o& V4 o" b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 p9 b! h2 k" p9 L5 l5 P* A: e4 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * y0 V* q) W  w* h# q4 g3 |. M) o8 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 h; H+ {6 z1 H9 B2 R, E5 L
  67. - O. R5 {* @) a7 h* Q( E; S
  68. dma_addr_t dmaphyssrc1 = 0;
    * W) |5 k" J  |( I1 J
  69. dma_addr_t dmaphyssrc2 = 0;. N( {( L. k7 {0 ]/ g) |
  70. dma_addr_t dmaphysdest1 = 0;
    / r8 d, u& h* s$ Q
  71. dma_addr_t dmaphysdest2 = 0;
    8 `, X4 ^/ g( H: `
  72. ! _! Z; H, ]( P" d" u
  73. char *dmabufsrc1 = NULL;# Z+ `6 C6 }0 G* w( _! s
  74. char *dmabufsrc2 = NULL;5 N  }. F6 _5 F. A$ r& Y8 A
  75. char *dmabufdest1 = NULL;
    . b# G7 G$ A0 L, k9 p4 A) P2 X
  76. char *dmabufdest2 = NULL;
    8 P" ^7 |: r$ W) @
  77. % X1 |- E( \( h' t1 h
  78. static int acnt = 512;8 [( l& ^+ H4 ?) x
  79. static int bcnt = 8;* k' U- B  K: k6 }: N' k. r9 M# ]
  80. static int ccnt = 8;8 L; a- ]# ^% O

  81.   i: D; Z* `' a! f
  82. module_param(acnt, int, S_IRUGO);
    . i" |* \5 t+ p7 ]9 Y" O- ]
  83. module_param(bcnt, int, S_IRUGO);
    " s6 I4 I3 c( E. n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) P1 B" y5 [3 c9 M7 i

% R( c9 [: L# k' h* E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) p' |! I8 U5 G# U1 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; V0 h2 }9 _( f- V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& @8 ~* R9 B. L' l
6 C8 b, i' q. g# _# d8 ]6 A# d$ h, Y3 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-2 16:37 , Processed in 0.035070 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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