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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# v  @- `- N. t% l# k
  1. [code]EDMA sample test application
    % g) z# I5 r1 p% }; M. T
  2. /*" u; K8 D+ K# ]5 V8 ?6 m
  3. * edma_test.c
      \) X( d6 k2 O/ t1 @: j; C
  4. *" C+ ~) t) X9 B" ]4 E1 \( ]/ `
  5. * brief  EDMA3 Test Application
    1 h9 u- c9 U4 N4 q& R
  6. *6 r# B$ a6 f; ]  i6 p
  7. *   This file contains EDMA3 Test code.8 `5 u# m6 ]% J$ g. T
  8. *
      i0 L6 X) _# r) M5 p: U( g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / |" k1 P& g+ t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 A3 V7 e, R/ K+ L- n
  11. *         TO CHANGE.
    % {' ^" R: g% d' F. g% p# W
  12. *
    " W3 u* ^6 E9 E( f5 u6 C8 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) C6 l( C" I8 J! H9 a
  14. *& G" e3 q0 f' W5 ?% |) r# i4 T. H, ]
  15. * This program is free software; you can redistribute it and/or4 \* q: M' n- {3 _& S
  16. * modify it under the terms of the GNU General Public License as
    6 w8 F2 W' z( M: ]! c3 ^
  17. * published by the Free Software Foundation version 2., C' R7 {4 ?$ {
  18. *
    : p0 D' \9 J& m( T) [# M/ e7 v( {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # ?2 r+ @' |4 K3 Q  _
  20. * kind, whether express or implied; without even the implied warranty0 p+ H4 A6 `- q; ~1 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! ^9 K' \9 H3 B, l) ]
  22. * GNU General Public License for more details.. D  z. Z8 X4 B1 e0 |
  23. */" K5 v" I. N' W

  24. ) r) H3 p: i8 T  d4 F2 v7 N
  25. #include <linux/module.h>
    ) n0 b4 y6 E7 X) C1 `- ]6 |" g
  26. #include <linux/init.h>
    ; k$ B5 Q' q5 [: c1 y/ E
  27. #include <linux/errno.h>
    6 Q# u; p& c) F! @3 j
  28. #include <linux/types.h>
    4 D2 r' D' n' _8 ]. |
  29. #include <linux/interrupt.h>" Q8 n+ p: P! D; v
  30. #include <asm/io.h>- |  Q2 g+ D1 m  o  X. y
  31. #include <linux/moduleparam.h>$ X4 k$ z! N3 f8 _. N
  32. #include <linux/sysctl.h>6 v/ l; T; d1 d* Q/ S7 [, C
  33. #include <linux/mm.h>2 ?3 F6 e4 a. N; [* \' t  R1 y
  34. #include <linux/dma-mapping.h>7 |1 b. t/ q8 g7 W, E* _

  35. 0 |6 a$ M/ ~8 R- T1 c1 {
  36. #include <mach/memory.h>
    1 Z+ C! Y) C/ r. k1 v' x. g( {. o: s
  37. #include <mach/hardware.h>
    ( t' |& I$ }3 I& c: L
  38. #include <mach/irqs.h>
    ; u% I0 ?8 c" B* p: r- J
  39. #include <asm/hardware/edma.h>! x5 P9 o7 |" p
  40. 7 s: M0 S5 `6 q& W8 M3 Z0 |
  41. #undef EDMA3_DEBUG
    3 T1 O! M( O) w- ?
  42. /*#define EDMA3_DEBUG*/+ P% g* }/ {. w; [
  43.   q; g7 z  S/ ^0 O' X' l
  44. #ifdef EDMA3_DEBUG2 g: }- A8 `9 l) I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 B; I8 ?7 S* q2 ?5 I2 g- D0 W! m& P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" b0 a* L( J+ ?7 l6 `* a! z( F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " k$ ~. i" ]3 P9 R
  48. #else
    7 m/ y3 h# F9 z" U5 q5 z* ?6 N& A
  49. #define DMA_PRINTK( x... )
    2 Z$ z* n& x8 P' N/ e0 I
  50. #define DMA_FN_IN4 Q1 x3 I+ w5 ^- ?; ]& U
  51. #define DMA_FN_OUT
    " |' m' A' K3 x, T# L! w
  52. #endif! w; h6 r4 A& I& s2 }0 V! L' d8 \

  53. ; g, b- x: \) J, k7 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : y' `; q5 K9 _( v7 \2 B
  55. #define STATIC_SHIFT                3
    - {# m3 b' M, ?4 ?4 U2 e8 B
  56. #define TCINTEN_SHIFT               20' t3 K& w. f0 U. |' h' M! e; O
  57. #define ITCINTEN_SHIFT              21
    / z# G4 Z: M3 b: W5 l
  58. #define TCCHEN_SHIFT                22, w6 t: W0 m& w) b) Y) B; x% P7 D
  59. #define ITCCHEN_SHIFT               23
    : Y( M8 I3 B3 k% d* S) {- X6 i/ @
  60. " ?( o! K) C: ~6 K0 |; ]
  61. static volatile int irqraised1 = 0;
    ( `. q* |! X8 G5 w( Q0 @) ]0 f- i
  62. static volatile int irqraised2 = 0;, @1 q$ D1 J7 e4 U1 m. ]% J
  63. ) J; I6 K( [: Q- h) |- b$ t/ \. H6 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# Z8 p; ~4 i0 M/ i4 F0 n5 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' m+ q$ K# _' H2 b' `- Q; w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ?9 E( w1 l# U# m$ G5 U# z5 w
  67. 5 D5 |% G9 s% @6 _' A
  68. dma_addr_t dmaphyssrc1 = 0;
    2 W+ [* f( \" Y! l# T8 O- k
  69. dma_addr_t dmaphyssrc2 = 0;' V4 S, A( }# b$ @1 |  z4 o
  70. dma_addr_t dmaphysdest1 = 0;
    0 n0 E4 i# H! L0 r' y1 H0 I
  71. dma_addr_t dmaphysdest2 = 0;; [/ Y  _9 G4 Y  A

  72. ! C9 G- }' H! T
  73. char *dmabufsrc1 = NULL;
    + o  V# @3 Z! u# X7 W
  74. char *dmabufsrc2 = NULL;
    1 x9 {1 }  ~+ |
  75. char *dmabufdest1 = NULL;; l# ^4 A8 C8 C  P' k
  76. char *dmabufdest2 = NULL;6 f+ n& E+ c" ]$ s7 }- n+ b, z3 Y: W2 d
  77. 9 c9 m7 A' ~1 k% }  W7 a
  78. static int acnt = 512;
    9 V* O( S7 f3 c- g0 Y- c
  79. static int bcnt = 8;" v- `2 E# I+ y
  80. static int ccnt = 8;
    & H, L! ^7 q( O7 |

  81. 8 r# }7 ]9 K: Q+ o$ v
  82. module_param(acnt, int, S_IRUGO);
    . M6 r5 t0 A; o& q
  83. module_param(bcnt, int, S_IRUGO);+ G% O6 B9 O* z" i4 h  ?# `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 w3 p. i; B3 p8 g
3 B7 o/ K$ p; a) n: \. w+ W. L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 A* w; M2 p+ P8 O  R" [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; e4 S/ S, z. P$ E; T$ [# e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& r" _* p4 B  [& [

: ]1 B8 l3 x( t  u' Z9 z
% o, |: e$ X) Q( @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-8 23:56 , Processed in 0.043433 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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