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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 d1 o2 m# V  y# n9 G
  1. [code]EDMA sample test application
    . g' O9 Q# I% |1 _* D" j* p- p# k
  2. /*
    : }9 u1 {9 L0 t$ o/ Z
  3. * edma_test.c
    # @) d$ \! Q! k. Y: `, r
  4. *
    2 l) d/ }/ @& H: A7 ^; Q
  5. * brief  EDMA3 Test Application! g1 o6 P0 e9 V6 c( Y: R6 L+ o0 i1 Q
  6. *
    6 P4 `$ v1 j, r/ w
  7. *   This file contains EDMA3 Test code.% f1 L& s, Y) p4 }( e* }: U( [
  8. *  R4 ?1 }9 ]! N! G+ K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & _3 H: y4 v+ Y" u3 q. x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! M$ F: Q( q% _  G! Z1 h
  11. *         TO CHANGE.
    4 L$ i2 w4 Q- T8 O
  12. *& o* I! ~: z) j5 f  J. o+ q' F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ v2 m; z; v3 Q; T/ k# h
  14. *9 D0 m9 w1 ^5 w3 j4 M( l
  15. * This program is free software; you can redistribute it and/or7 c! ?- r/ m9 }" l$ I: b) ~
  16. * modify it under the terms of the GNU General Public License as0 V& l& S' `! o: k3 p
  17. * published by the Free Software Foundation version 2.
    * G9 s3 q) a. X* M9 m# [
  18. *
    - c7 W7 M: c! F) ]/ K; k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& w( A, A6 J9 p
  20. * kind, whether express or implied; without even the implied warranty/ c' o) n" M+ e7 e3 \1 D" x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 h5 r. W/ x7 w4 w, U- d* m7 N/ W
  22. * GNU General Public License for more details.* T" R* L) X/ v- K
  23. */3 y; P, G' _: f- x  B; J

  24. " {! h$ I" S( A( F4 |8 o* N
  25. #include <linux/module.h>* T, {9 Q9 c6 w# o  B: M9 _
  26. #include <linux/init.h>5 F. h2 {. c; D( q0 H' @" ]  @+ E
  27. #include <linux/errno.h>
    1 L5 ~$ |/ C4 @3 B
  28. #include <linux/types.h>+ I7 G/ a& Y2 N4 T
  29. #include <linux/interrupt.h>+ E7 s+ T4 M( p+ E" f
  30. #include <asm/io.h>
    5 w" c2 h2 A$ l2 u* ]- D, |
  31. #include <linux/moduleparam.h>
    4 R% T% k* \+ M1 R* D
  32. #include <linux/sysctl.h># x: D6 T  h' v
  33. #include <linux/mm.h>! Y% s+ ?; [' S& I3 j
  34. #include <linux/dma-mapping.h>5 F3 D) l. U' n8 g' W6 \, G6 R
  35. 7 ]! u! C8 @; M% M) e8 D( [
  36. #include <mach/memory.h>
    8 I6 Z' B# o7 I/ G( h$ d+ l
  37. #include <mach/hardware.h>
    7 w$ u. a( \8 Z/ V# `
  38. #include <mach/irqs.h>
    % [, j) ?, H/ c4 o  {
  39. #include <asm/hardware/edma.h>
    & p$ G0 I2 F, X5 n

  40. ) U7 z' C& l8 M! x8 v, {+ ^# m
  41. #undef EDMA3_DEBUG8 O% z# j! h5 W3 _( N3 F& [4 [3 Z
  42. /*#define EDMA3_DEBUG*/
    8 f% H) G5 T1 w; V, S0 ~# F
  43. , O7 U% ?# x3 x# ~' P
  44. #ifdef EDMA3_DEBUG
    % J# D4 g' p6 X7 Z5 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 X' G, f$ Z# @4 h( X# z+ H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 `2 N+ F- x0 q* t0 i9 A- P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! v" O5 r+ |9 V' b5 b* K0 R# z
  48. #else3 l' p8 F& K# o! H9 o7 l
  49. #define DMA_PRINTK( x... )4 V8 H2 @3 l( N: Q. E4 Q- c. S
  50. #define DMA_FN_IN1 n) h8 }# [5 p% x
  51. #define DMA_FN_OUT% s8 ?9 H. p; {8 w( k7 I
  52. #endif
    ! k8 U$ u% c1 s3 W9 C
  53. % b+ Q- q5 _( {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 S) J5 V$ e( F" N3 s; d) V0 S
  55. #define STATIC_SHIFT                3
    + ^/ u; y; H7 g6 g3 E3 A/ G, m
  56. #define TCINTEN_SHIFT               20
    . k- T+ W$ X2 x9 N6 Z- z# g. b
  57. #define ITCINTEN_SHIFT              21# S8 ], ?& z* ?7 J. u, r  G
  58. #define TCCHEN_SHIFT                22+ t3 u4 \4 P2 P" c8 S0 V
  59. #define ITCCHEN_SHIFT               23
    , F8 U) ^' G* x( v! y! U+ ^

  60. ; d) D( N/ O# W( H' l
  61. static volatile int irqraised1 = 0;3 P! _' |# }0 q2 k2 m
  62. static volatile int irqraised2 = 0;% r6 n+ E; ^/ }8 I" O; Y( Q

  63. , H: T8 I5 N) i* A. w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : g9 d' H! ]: d* Z1 y. V& A5 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p: p/ m8 U: T  k3 M9 e" W; f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 p# G/ O6 m3 g5 }% y- B9 ~$ r
  67. ) x) L/ T4 ^9 ~* D: T
  68. dma_addr_t dmaphyssrc1 = 0;! J0 r9 ~0 K9 J% P! d  S
  69. dma_addr_t dmaphyssrc2 = 0;
      j6 a9 G6 ?( h8 \, w% t. Z4 Z
  70. dma_addr_t dmaphysdest1 = 0;
    8 |7 f' M% o! A0 r
  71. dma_addr_t dmaphysdest2 = 0;5 b# d: g3 h2 F6 l' I

  72. , j' S% {" q& L! M2 x$ C( l# n7 X
  73. char *dmabufsrc1 = NULL;
    ; r- f; S. Y$ E
  74. char *dmabufsrc2 = NULL;
    ) ]5 Z% x% C/ @! k
  75. char *dmabufdest1 = NULL;6 d& ]+ k. t8 x2 N& ^3 ?, B3 h/ l
  76. char *dmabufdest2 = NULL;
    ( o# D+ T) L$ n/ v" y. C
  77. 1 ^+ O8 \; l6 Z& `- _! Z; k9 u- ~
  78. static int acnt = 512;
    ' X0 W6 C; m7 i) g: ]9 A. k  [
  79. static int bcnt = 8;4 b9 s4 r! C- p. B, P
  80. static int ccnt = 8;
    . s. H. _3 [3 H% h7 H( O: W

  81. ' _( A! l6 p( ^0 U; c
  82. module_param(acnt, int, S_IRUGO);
    , g6 J$ B' G& t; N) U  ~5 {/ l
  83. module_param(bcnt, int, S_IRUGO);: ?/ \8 H: v/ {! c1 a0 `/ h4 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' s/ s6 d; h/ R+ ]" n9 }6 w  ]1 I6 c8 P) X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& @$ o( ~' Q# s/ A. garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ r$ T* K! M; g3 J, V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ q; c8 v+ Y- ~8 M
: c* O  ^& z8 {) d6 C
+ K) @- Z* D" F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 16:12 , Processed in 0.042363 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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