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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: }  f" ^$ L' u0 r: h( W# H& N# M
  1. [code]EDMA sample test application0 d+ @: G. I9 C# u+ M. c
  2. /*
    6 V4 e& h  E! L/ u
  3. * edma_test.c
    # w" ^) C* J0 @* a, S# Z
  4. *% q) y% M/ z- ?& ^+ C
  5. * brief  EDMA3 Test Application
    9 q. i4 _& }4 _- d6 ^
  6. *
    & h0 a; a" ~) X# {! O7 Y
  7. *   This file contains EDMA3 Test code.
    : r1 P# V$ t# G5 b# `0 z/ `5 @
  8. *: Z' ?- \1 D. H8 r, _& E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ |' Z% v: E5 M% L4 D# a$ S" `0 k6 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- s9 C9 r0 u5 u
  11. *         TO CHANGE.) A2 W! ?! n# X1 E$ [  y) n7 J
  12. *
    % l# C, h, I% f" F( V7 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: }* w6 N# T7 B& e2 u
  14. *
    / q; P, a0 C& f5 E: w" {
  15. * This program is free software; you can redistribute it and/or
    4 T" ?5 u$ I9 Y0 C; `0 s( q
  16. * modify it under the terms of the GNU General Public License as: U( I9 c" H+ ]5 C% d
  17. * published by the Free Software Foundation version 2.
    # P! `- m' j  O! a" P6 H/ g1 [: w( |
  18. *
    . s* H9 q) z7 a% Z: G9 G0 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 b& K" E+ W4 w. [
  20. * kind, whether express or implied; without even the implied warranty
    1 \) z5 u, F  {$ B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- Y% s& j( [: t+ q- R3 A) R
  22. * GNU General Public License for more details.
    7 a  Q  L) R& J4 u  v
  23. */
    2 y5 w- E+ Q) ^. Z8 v1 u  s

  24. 5 W$ [/ s7 T8 @1 q# _, E" y& g
  25. #include <linux/module.h>
    # S+ |; q4 Z/ z
  26. #include <linux/init.h>0 |  x  b  x' `; s
  27. #include <linux/errno.h># f! W# d+ p5 g4 w' t8 j* E
  28. #include <linux/types.h>9 u5 `0 k$ R6 d0 y2 H& E" _" E! H
  29. #include <linux/interrupt.h>
    9 [4 B2 c) }$ z, E8 @
  30. #include <asm/io.h>( X" J" s& L. v' K1 C( T
  31. #include <linux/moduleparam.h>
    & S0 A, E# v1 {  e2 K+ g) c
  32. #include <linux/sysctl.h>/ c5 _1 s: A6 _# J
  33. #include <linux/mm.h>& ^# U' N1 A1 @, o
  34. #include <linux/dma-mapping.h>, V" Q( ?9 |0 R

  35. 5 j6 U8 H8 W1 b3 R7 q$ M2 O- `
  36. #include <mach/memory.h>6 B+ k6 d2 `" b+ I
  37. #include <mach/hardware.h>" W1 P) e5 O# b7 C8 \, A; X' _
  38. #include <mach/irqs.h>
    8 s' H/ l' M4 _
  39. #include <asm/hardware/edma.h>0 m2 {+ A( U0 U

  40. % G& W$ Y$ ], C  z- M
  41. #undef EDMA3_DEBUG
    # I9 i, c& I" F4 y5 i1 h- U
  42. /*#define EDMA3_DEBUG*/
      f2 O6 S/ y% ^1 Q8 b

  43. ; v! O& j2 `, Y$ z
  44. #ifdef EDMA3_DEBUG
    9 ?! l! I! e$ q% p, y* i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% [6 v$ a" o" o1 g' k4 Q* W0 l1 c  O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 b1 M+ p, O& U9 ~5 }. Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 B5 U0 D- ?  C8 }
  48. #else2 V2 j/ y+ b5 X* R$ ^
  49. #define DMA_PRINTK( x... )
    9 H8 K4 s: m- z' W$ [, H; F" ?
  50. #define DMA_FN_IN0 c! @3 v; x4 S1 h
  51. #define DMA_FN_OUT
    8 A: o- Q8 F- M1 s- c
  52. #endif
    . }* U( ]' ?+ {$ g
  53. 1 K$ j9 `: ?0 Y8 r# s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! [0 S. l, C/ b" P- G
  55. #define STATIC_SHIFT                3
    - V: _! ?3 O2 w( S4 H( P4 [3 [
  56. #define TCINTEN_SHIFT               208 F+ O3 w* C% _# J% i0 a7 F
  57. #define ITCINTEN_SHIFT              21
    * z' o) X" ]# B8 g
  58. #define TCCHEN_SHIFT                226 V0 L+ M& I" o! n
  59. #define ITCCHEN_SHIFT               23
      g* B6 N) x: b- W: Q
  60. ( A1 y: b" D' o( ^
  61. static volatile int irqraised1 = 0;
    ) E7 z8 l  b6 s. X
  62. static volatile int irqraised2 = 0;( }+ Y$ t7 B3 D, V9 U
  63. 7 V3 z/ |% x  G) A# I0 E+ ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 b* c0 l/ E. h+ z3 q* L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! V1 X5 g/ L! X: X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: L2 W& B! ]( `

  67. : [- e9 v  E9 A
  68. dma_addr_t dmaphyssrc1 = 0;
    9 b$ I+ d  M: p5 R, x+ p0 N. N
  69. dma_addr_t dmaphyssrc2 = 0;
    # c% {1 _9 g2 w) C* q
  70. dma_addr_t dmaphysdest1 = 0;; S' J! ~/ N$ C6 b
  71. dma_addr_t dmaphysdest2 = 0;
    , w7 e3 D% K9 k6 f
  72. 9 T* E5 f) ?) \, s% n+ i) I+ [6 q) ?; y+ ?
  73. char *dmabufsrc1 = NULL;# b7 y" i0 ]7 q" B3 t7 o
  74. char *dmabufsrc2 = NULL;- V5 s, J4 O- z
  75. char *dmabufdest1 = NULL;3 N2 }$ N* M( d. g" h
  76. char *dmabufdest2 = NULL;" @  d& n8 X% Q

  77. " u6 L8 d5 l3 ~8 l" H
  78. static int acnt = 512;
    0 {* U0 _# i3 T3 C% c& t
  79. static int bcnt = 8;- w6 `; J/ O! Q& G. E4 G
  80. static int ccnt = 8;- A5 `' W8 H6 ?  z2 r

  81. 2 ]/ _6 |7 C2 |* t* K; h
  82. module_param(acnt, int, S_IRUGO);
    : A9 d; J2 ^4 D1 x$ P8 ^0 _
  83. module_param(bcnt, int, S_IRUGO);
    % l; a$ x( }4 x( y# ?! A$ o- I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, A1 G  s6 K# T2 U/ a8 T7 b
6 Y1 Q' ~9 Z# L2 `, C  F& {# O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, G9 G2 F  @, |/ I; D# d$ Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" {( C$ a$ D) w4 Z6 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 M: n, F% I' [; L4 w& S
2 \; g- t( A: R. B! L. W# K0 ?4 F& k2 [+ w: q( n8 y- {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 18:41 , Processed in 0.038769 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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