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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 F& P' o0 E& E; t
  1. [code]EDMA sample test application5 W" q* W. q3 \, Y% I
  2. /*2 E% Y. N" `5 s) e9 R7 u6 k
  3. * edma_test.c
    + T" C: P) B! w+ P3 @
  4. *
    . v6 J  z4 Y$ p: n5 V' v) p
  5. * brief  EDMA3 Test Application, f5 W$ R+ A5 A8 ]! N( W
  6. *& l# d4 T: K+ o# A
  7. *   This file contains EDMA3 Test code.! @/ p+ c- w% W8 ~
  8. *, @0 I. P6 V2 O) u8 ~( \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & g+ n3 t# w' J* [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ T, z, X) L8 m# J- @3 Q
  11. *         TO CHANGE.# o" i5 y0 @+ }/ Q- N7 M
  12. *
    " G! [2 H! I% t. {6 E( x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% ]/ a( P, K5 z: f7 }5 Q! W# e' n8 i, u
  14. *
    9 a9 r  }5 G* N- h$ e
  15. * This program is free software; you can redistribute it and/or3 y- ~+ O' ?% `- }. W
  16. * modify it under the terms of the GNU General Public License as3 }1 H6 Z$ Z/ U* E
  17. * published by the Free Software Foundation version 2., W! U, x2 H5 a; a4 y# {0 k
  18. *
    + j  O5 m1 g3 D# @- I5 l0 l4 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . o9 u8 G2 U2 d2 D; z9 z" n
  20. * kind, whether express or implied; without even the implied warranty1 n6 P2 S3 p0 w" O# R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % S/ O+ u' U0 N) C; v1 j: H4 Z
  22. * GNU General Public License for more details.
    ( b  M/ m0 E7 y
  23. */
    + y& \3 q# a3 V! A  V
  24. & \' W$ c# i+ b( g: P
  25. #include <linux/module.h>) O, {* w; p. W# i
  26. #include <linux/init.h>5 J! |2 a+ R0 h. O: r) Y
  27. #include <linux/errno.h>
    9 f* ~4 K* R4 t' N: ?* _3 k
  28. #include <linux/types.h>
    5 O( C! ?+ A# I7 {: g, j- Q
  29. #include <linux/interrupt.h>
    ; L0 r9 r4 Y: q. t' L3 P9 C% [
  30. #include <asm/io.h>
    ! C3 Z2 q! e1 }7 j1 t, ]0 Q
  31. #include <linux/moduleparam.h>: ~* W% @. f4 A+ L0 C
  32. #include <linux/sysctl.h>( z6 r# |. [$ g( @8 h5 P7 X
  33. #include <linux/mm.h>7 X9 b0 G4 \: m* m. Y, S
  34. #include <linux/dma-mapping.h>( R, Y7 B# P/ X
  35. " n' G4 U* W/ C- N) ~7 I
  36. #include <mach/memory.h>$ W; h. l  O4 `, P7 W; o
  37. #include <mach/hardware.h>
    : B% W2 p$ {" {$ D$ j
  38. #include <mach/irqs.h>
    # j0 \' Q4 y+ l
  39. #include <asm/hardware/edma.h>
    - \6 ]3 E! f( `& }

  40.   x! t' L- a- [9 x
  41. #undef EDMA3_DEBUG' m: o! p: d6 t
  42. /*#define EDMA3_DEBUG*/6 r  I, o# ~4 C- x- e

  43. 6 `- l- N- Y) u2 s0 d5 F7 ]
  44. #ifdef EDMA3_DEBUG
    - d% Z/ ]) F1 t: z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P% ]7 v0 v" n6 ]$ U" `7 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 B+ Z5 Z" f  ~0 _. z+ r3 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; F  u# n3 T* y& F
  48. #else% ^* Y" r0 Q2 r6 C3 \
  49. #define DMA_PRINTK( x... )
    - Y$ B$ K3 N" S8 X6 @  R1 Z
  50. #define DMA_FN_IN
    % I7 _1 T& P6 [& |: M
  51. #define DMA_FN_OUT
    0 E0 W7 W6 y% \# P  M1 H7 R
  52. #endif. k) W/ J9 X2 p3 H4 s8 d* V6 U

  53. / {4 M  x7 ^+ V7 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( N  ?9 W; W' x; Y- `2 Z9 A
  55. #define STATIC_SHIFT                3! b6 h6 P# }/ E
  56. #define TCINTEN_SHIFT               20
    + R/ G, M% D8 \3 c5 o$ @5 S* w
  57. #define ITCINTEN_SHIFT              21! ]- U) t8 v/ ~5 ?" a6 _
  58. #define TCCHEN_SHIFT                22$ p" O: g% s6 V3 H& w
  59. #define ITCCHEN_SHIFT               237 |6 R3 a5 p/ p) i8 e8 ]9 i

  60. 3 o+ o+ i, P! i: F
  61. static volatile int irqraised1 = 0;6 m# i" c) ~$ B* F  M
  62. static volatile int irqraised2 = 0;% d3 k, U% x+ C) ^3 n

  63.   g) U, _0 n6 S  [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - c' h. v/ h7 Y7 L8 M2 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 T5 M& y* ~  y/ S  p" l( m* K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 y$ K' @6 g# L9 C! h
  67. # j1 o% Z& S) w6 @, ~$ f
  68. dma_addr_t dmaphyssrc1 = 0;. w( V7 p" H) o7 g# ?
  69. dma_addr_t dmaphyssrc2 = 0;
    - }, V$ p) A# ]% G* M' c1 U+ H! j+ W
  70. dma_addr_t dmaphysdest1 = 0;
    8 j! s5 ^2 t: E6 \! _
  71. dma_addr_t dmaphysdest2 = 0;
    8 {) d# J/ Z" M7 Z' _! D. U* Z+ a
  72. 3 ?! d  K& X/ z! g1 v
  73. char *dmabufsrc1 = NULL;
    8 H1 Y  q3 Q: j8 e3 f0 B
  74. char *dmabufsrc2 = NULL;
    3 i; y6 Z& u) d$ L9 q
  75. char *dmabufdest1 = NULL;
    6 I& B3 I  N7 _
  76. char *dmabufdest2 = NULL;6 u4 E  }, O- X

  77.   ^( Z  L) c6 s$ }/ \9 z6 X
  78. static int acnt = 512;% A6 |- m' L4 ~; L
  79. static int bcnt = 8;/ M& X/ j5 A1 w, d) Q1 r: A
  80. static int ccnt = 8;
    3 E3 ]8 a; X$ c. L$ [8 \- c6 ^8 F3 E
  81. * ~$ k  l; w5 @: V5 j- D
  82. module_param(acnt, int, S_IRUGO);; `7 }! H) x2 m5 Q5 U) |; \; N  K
  83. module_param(bcnt, int, S_IRUGO);% j5 q$ ~& V/ {1 Y$ b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 G( s0 L/ f. @% R' C& p6 m2 N# R  ^0 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& Z% p  D- ?7 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' S: {  L+ @/ o1 @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 a% b, _! a( D

8 q. o6 W7 g  ?
6 d6 w  a* u' g6 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 02:55 , Processed in 0.035819 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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