OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; T# B$ x: A2 v; C% A, r7 o
  1. [code]EDMA sample test application1 g! k1 h& D2 S& Y# y
  2. /*/ b- I, C2 I8 [3 P' I# l( p- n9 _3 {
  3. * edma_test.c1 {' P, c  o; G, {, J) |
  4. *
    * g( i: h! |- y0 g  Z
  5. * brief  EDMA3 Test Application
    7 M6 k/ n7 }% l; q
  6. *
    " a% B/ a1 g, X+ Y! l
  7. *   This file contains EDMA3 Test code.
    . m  B% P4 Z! [' W$ e+ S" V: d
  8. *
    5 H. \& m3 a% X% u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Z' q( X+ {% g( f! T2 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' g+ P- Q1 D- h- r1 F
  11. *         TO CHANGE.* R2 w8 ?: S$ g2 p) Y9 ~
  12. *
    " v' F$ _( j$ q2 ?  S. |8 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 e- I% _8 X. y' l$ V( s
  14. *
      [5 {$ l0 [0 s9 W. j: _, K0 Z
  15. * This program is free software; you can redistribute it and/or
    5 o' ~+ G+ g7 x6 O6 t, ]
  16. * modify it under the terms of the GNU General Public License as
    & @9 `, k2 F' U% [
  17. * published by the Free Software Foundation version 2.: {5 u- Z- c' d' k7 o6 o
  18. *# `6 F0 M6 q, h/ F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & _" f- m# d  B3 Z) I2 `
  20. * kind, whether express or implied; without even the implied warranty
      q, ~( \" K$ ]/ j( t; h0 |: Q  m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . [' u; x- f# p
  22. * GNU General Public License for more details.
    2 y7 ^0 L. n( G, p$ E, }
  23. */- s$ _0 _- _! T* K) U' @0 @
  24. / m" @9 \$ G8 V9 m6 D+ b: G. F# `
  25. #include <linux/module.h>3 |- m/ o1 ]9 y) n& d. G
  26. #include <linux/init.h>
    3 ^! A' A1 ?' E
  27. #include <linux/errno.h>
    $ t* d- s( x. [- Z5 m6 d
  28. #include <linux/types.h>
    # b( _2 c; i0 g5 D2 `2 z9 {
  29. #include <linux/interrupt.h>
    8 ?9 w$ O# N# g- u( d+ ?
  30. #include <asm/io.h>
    4 N; \. Q2 v+ q4 W
  31. #include <linux/moduleparam.h>: K. g$ m! d9 G  k  I. u
  32. #include <linux/sysctl.h>
    * R! e0 t) e7 q7 |' ^
  33. #include <linux/mm.h>4 q4 D# o8 f) e& N* [
  34. #include <linux/dma-mapping.h>
    4 P% J1 |2 ^- k+ M
  35.   b4 j  B  H8 B8 K" p
  36. #include <mach/memory.h>; a9 ?' s; B% D2 O6 C: n: m, m6 b
  37. #include <mach/hardware.h>
    7 a& ~/ c9 F' E2 d
  38. #include <mach/irqs.h>* Q  `/ S1 E2 w% t) R/ s
  39. #include <asm/hardware/edma.h>
    # n6 x, G( j/ {; e5 W2 e* P
  40. ) }2 [# }, |1 l6 f; Z* k
  41. #undef EDMA3_DEBUG" u( |0 |# }1 ]% a4 d+ H" b
  42. /*#define EDMA3_DEBUG*/& ?# S& q! N- E

  43. 0 A; O! m9 h+ W+ b' V" J
  44. #ifdef EDMA3_DEBUG
    9 o/ T; \9 s3 U0 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! K" q# H7 w- o! R* W6 X/ K5 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 |8 b% U5 k4 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : {! O/ H% q; z3 U
  48. #else5 O  }4 G' p. c- c  `
  49. #define DMA_PRINTK( x... )
    8 y' @. m! O4 I: D0 h
  50. #define DMA_FN_IN+ f# Y. m, t9 {6 z5 U2 L
  51. #define DMA_FN_OUT
    , u/ _' \! V& r. x9 U4 ]
  52. #endif- {  m8 t- z1 q, ^. t  ~0 }" A
  53. 6 [5 B% U, U- Y3 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); D6 ]' Y, x0 E2 C1 p
  55. #define STATIC_SHIFT                3
    0 M. l6 k' |! y6 \5 W8 w
  56. #define TCINTEN_SHIFT               20
    ( x( ^/ p  n' \0 N' A" M2 ]
  57. #define ITCINTEN_SHIFT              21
    / A) I5 @. `. @" v/ e) j# _
  58. #define TCCHEN_SHIFT                22  I3 g0 n' S: @$ ~9 `: t
  59. #define ITCCHEN_SHIFT               23
    0 j, z9 s& |9 X% w7 V

  60. ! V0 G2 ?) V( i9 `& Y6 ^
  61. static volatile int irqraised1 = 0;$ r' f; E8 v2 G/ m9 I
  62. static volatile int irqraised2 = 0;; h, [  o- g! l7 Z4 n3 r

  63. ; k3 s& t# b5 p. e" G8 M- ]6 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ^7 ?0 x& `, N3 B) O) ]" }* w5 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 K% G( [3 Z9 T1 E  C/ q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ]( Y# x& U7 p

  67. 7 J  k- O  L1 H. M6 C
  68. dma_addr_t dmaphyssrc1 = 0;) |9 @* S& ]3 s( y
  69. dma_addr_t dmaphyssrc2 = 0;
    " p* y3 Y' W* ^( u
  70. dma_addr_t dmaphysdest1 = 0;
    ; Z" v7 O% ~8 U
  71. dma_addr_t dmaphysdest2 = 0;1 }  `. N0 s, G5 r

  72. 6 T& [. Y# Q  r- ^  v' ?
  73. char *dmabufsrc1 = NULL;
    : W2 `3 j% }% M: ]; S% W$ [0 ~
  74. char *dmabufsrc2 = NULL;
    9 @1 [# ]1 w- L+ R; w/ ?% G) s
  75. char *dmabufdest1 = NULL;
    - Z  C" S& O2 ^. T' y
  76. char *dmabufdest2 = NULL;, e5 g' d  N; [0 n: t

  77. % {, d3 l/ [5 r
  78. static int acnt = 512;1 a  B; G* r1 M; u  e# v) i1 H
  79. static int bcnt = 8;
      z8 ?, j# `/ d4 Q" o. I7 O
  80. static int ccnt = 8;7 H+ C" f1 t; ]1 S5 q4 V& m
  81. , [5 u/ ~+ d* {( N7 D. |7 l
  82. module_param(acnt, int, S_IRUGO);
    9 f/ X4 ?/ }. n/ W/ V
  83. module_param(bcnt, int, S_IRUGO);
    2 m6 ~% R+ P5 |0 T# }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 x3 |  g% o% U* e% `
/ q$ C" X. I1 j. N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 W) M* y9 z$ O; o# I! D, N9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) R9 [$ ~2 c% L: Y; |8 s* v2 s( l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' B  R" g  @0 e! _4 T6 S( V+ L  K0 d4 o4 `4 r
' L: A5 L' o/ \; s' [& v3 l, J' O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-5-12 19:49 , Processed in 0.039490 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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