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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) i/ z: w. t$ q5 Y: B! A
  1. [code]EDMA sample test application) l% j% V  ?6 `5 J3 X% h. ?
  2. /*2 J2 U3 v7 r5 T) _
  3. * edma_test.c" z6 C2 D# I0 K+ @# q( C3 b
  4. *+ ^* N4 h) \  O, A7 A& B) b0 d1 u* S* g
  5. * brief  EDMA3 Test Application
    # `1 p+ ]+ b( \( ^# p
  6. *
    " V9 C5 x/ m# [* N4 _. b* X
  7. *   This file contains EDMA3 Test code.2 s5 D0 M# c( y7 |6 b
  8. *
    * b" m" s0 M, c% f8 X9 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 p/ G& W( a" f6 W( f5 _" X" {. r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" {  Y1 g; B% ~) I
  11. *         TO CHANGE.% H* V( J3 V; o/ H
  12. *
    # B+ p& v6 D" i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 s2 g+ A1 e- k6 W
  14. *# ]& |6 A2 J4 L" e2 J3 @
  15. * This program is free software; you can redistribute it and/or
    $ m& d# S- G, e1 ?
  16. * modify it under the terms of the GNU General Public License as2 J1 i3 `0 M6 Y% h3 n2 l% c; d
  17. * published by the Free Software Foundation version 2.
    7 i/ n' M/ i( b6 e/ p  |- `
  18. *
    8 y/ k7 E2 w- S7 y2 d# ]' k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % n  _& v+ A7 r
  20. * kind, whether express or implied; without even the implied warranty: `  v) r( B7 H5 V3 M- D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 n: a* F  Q- U
  22. * GNU General Public License for more details.
      N1 P' P4 }. y
  23. */
    " F% m; v3 F5 l: {/ `9 P! X
  24. 4 q! Y- W+ {8 u4 E# N3 ^! w, o
  25. #include <linux/module.h>
    " f1 {& K( g0 W. ^! ]" o
  26. #include <linux/init.h>' G$ i4 x  G$ R7 G, A/ ^
  27. #include <linux/errno.h>
    . g% ~  z8 I" B6 N5 _& H/ f
  28. #include <linux/types.h>' c: t! H. q3 ?0 l5 r1 b" B
  29. #include <linux/interrupt.h>
    9 `6 P' Y) D+ I
  30. #include <asm/io.h>
    8 ^+ U$ }- i: P4 R3 h7 n) N) A
  31. #include <linux/moduleparam.h>
    6 E( k6 d; ^6 H- }1 n( \' t
  32. #include <linux/sysctl.h>% A; E6 Z; v7 x. \2 X, a
  33. #include <linux/mm.h>. Y' C/ {9 n: \
  34. #include <linux/dma-mapping.h>2 [3 E, R$ q2 g8 U3 }

  35. * C/ ^( E" r% f
  36. #include <mach/memory.h>
    : E5 Z" n" P1 m+ V3 w. z
  37. #include <mach/hardware.h>0 Z* }! a3 G9 x/ Z! W' Y: ?" k6 x( P
  38. #include <mach/irqs.h># R  V0 b8 T' M+ `4 T
  39. #include <asm/hardware/edma.h>
    + q& e: e3 l" I
  40. 1 I" b8 A1 U& A+ N
  41. #undef EDMA3_DEBUG
    8 ?7 q: R! |6 ]+ P
  42. /*#define EDMA3_DEBUG*/
    " n0 C( d# M' q

  43. 8 d5 Y' N+ t( Q, u3 }8 G+ h7 Z
  44. #ifdef EDMA3_DEBUG; j! M; o0 H: Q1 O: I' A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 ]5 t$ i. [+ }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 d+ x: e- H3 S: a: T- ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 c1 o6 {- U( G1 J( ?7 q
  48. #else
    ; U% w; h0 H$ `! Z8 Z' f9 G
  49. #define DMA_PRINTK( x... )) w) y6 [2 c# X! x5 D8 S/ M. t
  50. #define DMA_FN_IN
    & D/ K9 T! L# P% A
  51. #define DMA_FN_OUT
    3 _; L/ \0 X1 u' P0 I3 j; E
  52. #endif1 O. r+ ^6 H6 i- r  i) Z

  53. : o4 D; ~4 J5 g2 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  c# [4 A0 ]/ ?( _. P+ m, a
  55. #define STATIC_SHIFT                3
    6 t) h: B# h0 h5 D0 C4 N) x3 t
  56. #define TCINTEN_SHIFT               20
    ; c; h7 b( t; x% a/ a2 y
  57. #define ITCINTEN_SHIFT              21. ], v  K: K, q0 P7 e4 X
  58. #define TCCHEN_SHIFT                22
    * I" [* f0 n; R
  59. #define ITCCHEN_SHIFT               235 j9 y; y/ Y  U5 Y% H& E

  60. 9 L3 R! F4 U3 l0 Q# z9 g; k/ x6 ]0 W8 J
  61. static volatile int irqraised1 = 0;
    # g9 ~7 }0 P6 i! C+ |
  62. static volatile int irqraised2 = 0;
    ; T$ ~: U8 `$ Z- j
  63. 0 S# Z% X' X& H) D4 L9 |* q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, }& I: Z( ]4 k+ y; ^! K: |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # j7 x5 u3 |. {% Z& ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, F: l8 u, J1 a: P) k
  67. 2 A' X( \5 B/ @! p
  68. dma_addr_t dmaphyssrc1 = 0;
      Q  Q/ x/ _/ u' O6 B9 ~
  69. dma_addr_t dmaphyssrc2 = 0;" k! z5 l0 E  H6 V
  70. dma_addr_t dmaphysdest1 = 0;- s( C% U( ~5 y5 [" c9 d
  71. dma_addr_t dmaphysdest2 = 0;3 X" X4 b; \3 y  {  m' {
  72. ( q$ x/ O, @1 e$ [3 `% Y2 N+ f: x
  73. char *dmabufsrc1 = NULL;0 B2 @; K6 @9 R5 g8 D4 k' R. O
  74. char *dmabufsrc2 = NULL;- J! C2 L+ J, n
  75. char *dmabufdest1 = NULL;
    2 L/ A5 j1 t8 ~- ?! g
  76. char *dmabufdest2 = NULL;
    1 J- L; K" d+ d+ H2 H# W1 H8 r

  77. 6 e1 ~* y! _5 U% e: B
  78. static int acnt = 512;# l! f5 w& Z1 N
  79. static int bcnt = 8;: I. p: D2 C# p3 y2 f8 G
  80. static int ccnt = 8;
    7 D# F; ~9 j8 c$ J

  81. + ~: z6 Z9 a. K' W  A3 j% f  C
  82. module_param(acnt, int, S_IRUGO);9 L5 F; d& D* ?4 g7 L9 [
  83. module_param(bcnt, int, S_IRUGO);
    7 K$ q" m0 p+ o5 g, }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* p$ b$ q" B9 ^3 n, [
) E2 z, X2 H' }( I# [1 @  A$ N- L  E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: g( Z# D" c' P: @2 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ U2 ]6 x/ [% [" B0 n+ m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ~# L/ ?% }& A
( p- V/ f  D* T" j; u# M# q' _) N7 P& I6 }) S7 V6 [8 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 14:40 , Processed in 0.041731 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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