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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 F$ l! f, T8 C$ J* Y) x7 }
  1. [code]EDMA sample test application# E! t2 Z) ~' J
  2. /*9 t8 G1 M- f3 R* d/ ?0 v
  3. * edma_test.c
    . {( j7 Y9 T  B6 {0 F/ l0 B. ~
  4. *
    ! l: o( g# s" p2 C" A0 c& M* R; m
  5. * brief  EDMA3 Test Application9 d8 I  _9 a( D3 e: j3 |; `
  6. *
    0 ?; s# |( \& Z4 T) }
  7. *   This file contains EDMA3 Test code.: R8 p- `9 ^/ _/ }- T3 w" X+ F: `
  8. *
    + j- O& G4 Y# @6 B* W2 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 K2 ]0 ^! U+ y1 V( I6 }3 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! h. k" d$ l0 q0 O
  11. *         TO CHANGE.7 R% \% v/ J  o" s' ^0 J
  12. *
    & i2 Q1 p& U; a" W. r% {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! g9 j7 O4 ~8 q0 u- I6 f
  14. *
    ' i0 D& G! V9 b* ~
  15. * This program is free software; you can redistribute it and/or
    6 L  G! G4 {* Y
  16. * modify it under the terms of the GNU General Public License as
    1 }3 o: V0 y  E. w5 S
  17. * published by the Free Software Foundation version 2.
    8 I/ z2 e/ `5 X: e' s2 Q
  18. *
      @3 I' u7 A* s2 Z& Z# i' \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' l% l. `2 m" I' Y! ^6 f0 S5 f3 Q" X
  20. * kind, whether express or implied; without even the implied warranty8 _9 W6 f2 F$ Z  D7 j/ @9 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . m( X( s, e1 P9 M! k7 N
  22. * GNU General Public License for more details.
    + H* q1 j4 x7 u# @* X
  23. */
    8 }' V: |' D4 p

  24. $ g- q2 Y( a- d7 N, Z: Y; M
  25. #include <linux/module.h>" O& q9 ]# m1 h# v! O# |
  26. #include <linux/init.h>* R' f3 S& V* q% S! i/ r2 u
  27. #include <linux/errno.h>% k4 J  f! o# W; i9 ~
  28. #include <linux/types.h>5 t' S. O5 Q' ?) y3 p
  29. #include <linux/interrupt.h>
    , A' x9 ]4 F. [( {
  30. #include <asm/io.h>* U1 V, O3 G: v: s6 p7 N' j) b
  31. #include <linux/moduleparam.h>! r& N( q" i, m- U  m
  32. #include <linux/sysctl.h>
    8 t0 G3 @" N. F3 i: U7 k; A
  33. #include <linux/mm.h>. @7 H9 h" v0 Z% i
  34. #include <linux/dma-mapping.h>" c' T" j$ q. A2 C+ b6 e& T$ z$ q

  35. 5 f! G8 u4 L4 {6 a; p5 e
  36. #include <mach/memory.h>
    1 J3 ^1 Q8 o3 J3 w
  37. #include <mach/hardware.h>6 N+ g5 W  X6 K& A; g
  38. #include <mach/irqs.h>
    , v1 |  ?2 s8 U6 k2 [- p
  39. #include <asm/hardware/edma.h>
    1 m- U" z# }3 ]: h0 b( ^" E

  40. ' Z" x7 N6 [* O7 H: u
  41. #undef EDMA3_DEBUG
    % A& D) q' J0 g- C! _8 h/ I" ~/ t
  42. /*#define EDMA3_DEBUG*/
    ) k0 U9 y, Q* P+ b/ }' L
  43. 7 k' V1 b, U. x* w; C/ S
  44. #ifdef EDMA3_DEBUG  w5 j5 U2 o) q" g" e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 ]2 D# F5 P6 x0 y- q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # o1 J7 w; H+ P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 g8 @; [; r7 l9 _
  48. #else. t" W8 Z3 U' A6 j% t. w- h
  49. #define DMA_PRINTK( x... )2 o1 a# V3 W5 }
  50. #define DMA_FN_IN4 J5 b7 R& [- ?5 n( G2 w/ Y) t) ?
  51. #define DMA_FN_OUT
    % a& ?0 I% g& C- ?/ g. l0 B
  52. #endif
    ! u& R8 b# y# n1 x1 g) _
  53. % m* ?$ e. z4 U( j& [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) P* g' t& w- I. c) v6 p
  55. #define STATIC_SHIFT                37 W% p4 h7 W7 S1 p- _. H: J3 g  n; y/ B
  56. #define TCINTEN_SHIFT               20+ e& O$ V, o4 P+ i7 X' N
  57. #define ITCINTEN_SHIFT              214 \1 r+ t5 ]' G* s) I! s
  58. #define TCCHEN_SHIFT                22
      X3 B" w$ K  k
  59. #define ITCCHEN_SHIFT               234 e, r" F5 v3 S& O1 ]

  60. 6 A8 ^7 X+ ~( J% {* x- C
  61. static volatile int irqraised1 = 0;
    ' k; h* V5 e: L( q
  62. static volatile int irqraised2 = 0;$ b  }% s% L4 _4 N5 ~8 q
  63. 0 I' f" b3 X  |( z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; y# Q5 Z1 C, j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) [1 Y! _1 b7 |# D& ?9 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 s" H/ `% r7 s: b

  67. " `% Y0 H2 T' ]5 W4 ~# c% @0 i
  68. dma_addr_t dmaphyssrc1 = 0;
    ( ]0 d* C; z! j4 t6 ]! a9 X
  69. dma_addr_t dmaphyssrc2 = 0;0 Z$ Q; ?+ G) O, v1 Y8 [& [; I
  70. dma_addr_t dmaphysdest1 = 0;
    + B  K0 }! j2 T- h9 T5 T7 H
  71. dma_addr_t dmaphysdest2 = 0;
    * |+ p+ B2 V. v+ M- u. w
  72. ! X) d2 ~4 T! B, \) q
  73. char *dmabufsrc1 = NULL;
    ; ?. V9 W. T. T: |4 k
  74. char *dmabufsrc2 = NULL;& E7 m8 d7 j- s
  75. char *dmabufdest1 = NULL;
    . r; I5 _+ {& L) |% J' D
  76. char *dmabufdest2 = NULL;# B( E' D2 Y7 j

  77. 5 r; m3 V  [% ^0 m/ \" Y4 P
  78. static int acnt = 512;9 o$ J# t- C' K  @7 p+ s$ D
  79. static int bcnt = 8;
    8 ^' \# n& S9 {7 c7 q
  80. static int ccnt = 8;
    ) }6 z+ N; ?: V+ J. t$ B! f

  81. ( J0 R. q" E  T! S8 E) ]0 D
  82. module_param(acnt, int, S_IRUGO);9 Q/ v, o- B1 E2 ^
  83. module_param(bcnt, int, S_IRUGO);
    ) t/ f1 ~1 ?: R# b% R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- n) F4 T0 ^5 H5 G8 G1 W
8 Y" q8 l0 ?4 \4 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 v8 W+ j( V6 F! k1 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. E2 L$ E/ ^& e8 A3 w& m& U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 C' S* A5 G% w+ q4 N  I2 v! }8 r
% p- O% M! i  Q0 E7 G: h+ e' J2 X# n: g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 01:41 , Processed in 0.039128 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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