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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% B0 c$ l" h$ |4 {; |
  1. [code]EDMA sample test application& K, ~+ E, [* r" l$ S+ n
  2. /*
    $ Y2 O7 k5 K$ I  f; H! V# d8 O
  3. * edma_test.c
    : A% S9 Q3 D% ~1 W7 {/ |4 x
  4. *. S2 z3 G+ `) o. O
  5. * brief  EDMA3 Test Application4 w, q0 E) X  K2 q5 q% u
  6. ** o) A/ M. ^$ ^2 I
  7. *   This file contains EDMA3 Test code.
    + D( W! r, `+ [* p7 m
  8. *: ?; ^' v4 ~- z% V# V+ l8 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' u8 b) `/ n4 z; q$ L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" P# q3 T* N, i1 T* A3 I4 `5 @: s
  11. *         TO CHANGE.7 e. b7 A6 `* O$ e
  12. *
    % k) H0 h6 x6 _( c% O$ a  r+ @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & G9 G5 l, V" n( Q* O9 k/ z
  14. *; `* G& x7 C. ?5 I0 H
  15. * This program is free software; you can redistribute it and/or' E) y4 s8 W' i2 m, C1 V
  16. * modify it under the terms of the GNU General Public License as
    ) p8 X. e6 u5 v# F* q" Q# _
  17. * published by the Free Software Foundation version 2.8 T; o) }6 q, E& b
  18. *
    : W! L0 P  T9 ~1 r; C# m; n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : W2 G0 o- {- T- D5 q- a9 f/ A
  20. * kind, whether express or implied; without even the implied warranty
    8 Z# \8 @6 f. Z0 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . l: Z3 m  `$ x9 b" T* f
  22. * GNU General Public License for more details.
    5 c$ p8 ]1 l5 u; l7 p# j
  23. */1 L4 e- `' a& E1 E1 x: F
  24. $ R$ W% J6 i7 E' d% D0 A
  25. #include <linux/module.h>+ ~$ W) ]+ g) V
  26. #include <linux/init.h>* F+ C% U) `3 P6 K& g5 p
  27. #include <linux/errno.h>
    / k4 ~: b0 w4 u
  28. #include <linux/types.h>, D$ N. s$ X3 r7 r
  29. #include <linux/interrupt.h>: o5 U9 t4 _; b: Y5 k. {& r
  30. #include <asm/io.h>; z+ X6 o9 g. D% H* L, c1 g9 W  O
  31. #include <linux/moduleparam.h>2 t( g* H  H; Z: W
  32. #include <linux/sysctl.h># e# b0 {8 B  a  P4 O9 s' }7 O4 Z# n
  33. #include <linux/mm.h>  t+ b+ i: Q7 S6 F: J1 N9 w! X
  34. #include <linux/dma-mapping.h>; I; k! r  i/ o% m5 f* P/ a
  35. 4 @2 J3 }! o% Q2 F5 G9 A  W
  36. #include <mach/memory.h>6 f. f8 I1 k; {; w& h
  37. #include <mach/hardware.h>. E; h/ n+ n1 e. d3 Q/ c8 R
  38. #include <mach/irqs.h>
    , C6 x  p: P7 ~9 a, ?; H$ b
  39. #include <asm/hardware/edma.h>
    9 r$ [& X5 G$ }% ]" S" U
  40. + p8 U( t# h% W# c/ P7 U
  41. #undef EDMA3_DEBUG( Q, Y$ }! P, L$ ^: W) }0 ^; K, @
  42. /*#define EDMA3_DEBUG*/5 d) V+ \! A5 |* y$ C- G4 a# j

  43. # _) \8 x, ?, ]/ g7 d( o
  44. #ifdef EDMA3_DEBUG
    - I  q& N% Y- p  N& X2 s  i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 I* Q$ a) m7 a6 r% q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( J3 {. ?* J( \- q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% U( d& ^& K1 G' d% B
  48. #else
    & |) o0 I# H+ T# W/ P
  49. #define DMA_PRINTK( x... )
    ) o  `/ w5 l$ L( Q! p* v
  50. #define DMA_FN_IN
    ( S# p6 `2 q2 i3 g) J# M
  51. #define DMA_FN_OUT
    $ }$ F6 ^- h, w4 h. ~
  52. #endif
    7 p! l9 f1 J2 n1 g5 k% K  `3 W

  53.   W# C) x) p+ k5 O: X$ U# Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / c2 T( a8 b# _3 r
  55. #define STATIC_SHIFT                3, `) M. l; M* @1 {. I  J
  56. #define TCINTEN_SHIFT               20% T' e3 e/ ~" q( H! d3 z
  57. #define ITCINTEN_SHIFT              211 B3 Q! @" R$ `. g% m, x" K$ O
  58. #define TCCHEN_SHIFT                22' Y( i+ c  `) g( ?9 U. W, t
  59. #define ITCCHEN_SHIFT               234 v5 e$ U* a! ]; s: l$ s, J

  60. 9 h0 v6 |, @& N  I/ x- j& z
  61. static volatile int irqraised1 = 0;
    6 z; h8 ~& h4 e6 p/ K+ ]8 ~: A! s
  62. static volatile int irqraised2 = 0;
    3 f4 [) X) G. q% {. [3 A, {2 y

  63. 2 U* T1 ^2 b2 \2 {+ p" d# N# O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ^$ U# |* \" b5 |, {4 F8 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 G" F# }" u  t+ J5 p% |- R8 a, H/ ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ], x% d  L/ H8 A  ?* Y

  67. + i. @) S: S: c1 Y& t7 z: U
  68. dma_addr_t dmaphyssrc1 = 0;, ]* r$ H0 Y9 f1 C2 i
  69. dma_addr_t dmaphyssrc2 = 0;# j/ N/ j! G. `0 W7 V# H$ v
  70. dma_addr_t dmaphysdest1 = 0;
    6 e( C0 h4 A% D; Y" P
  71. dma_addr_t dmaphysdest2 = 0;
    ! O7 A" I8 q; B* m) _5 C( ~

  72. 5 g# |& T1 M. i( Z2 l0 U  g5 U
  73. char *dmabufsrc1 = NULL;2 v: n: {# I8 C6 `
  74. char *dmabufsrc2 = NULL;
    - o6 r( J/ ~% G5 H! O# w
  75. char *dmabufdest1 = NULL;
    , W. [5 x1 \! L$ N/ p% Q
  76. char *dmabufdest2 = NULL;
    1 _7 ^% q! S. c. f6 p. \: T
  77.   i; ^# a7 X/ ^% |$ O% c
  78. static int acnt = 512;
    ; m: A% [, V) E' e. ~) N
  79. static int bcnt = 8;
    7 ~0 Q1 k. @. i' l0 N7 K
  80. static int ccnt = 8;/ y0 Z. \# K( m. w: O7 J6 t3 y
  81. ! |4 n- d/ E* ^! A" L
  82. module_param(acnt, int, S_IRUGO);' {0 N) O9 l+ J5 z% Q: S2 h
  83. module_param(bcnt, int, S_IRUGO);3 f6 j$ B/ w7 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" H2 c7 p. o7 c
/ ^9 q7 O" F, `$ {# \" {& H5 g) m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( i/ N1 C' U9 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ u. C' k  l. }/ C. B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 m- `6 q, p1 I. m6 ^6 I
' V3 U4 z2 w2 B: b4 J6 f: Z  y7 [

: r) {+ a' d8 u# u+ w/ t1 h5 Q" m4 S; U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 09:47 , Processed in 0.036619 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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