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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 O& @& D/ h$ Z( g# G
  1. [code]EDMA sample test application
    ! u1 }. U5 [; J# g( D  ^: d
  2. /*
    6 d( O) ~3 A' ~+ C0 |# f
  3. * edma_test.c
      ?7 ]+ L/ A8 ?% B+ R" j0 [( q  A, `" a
  4. *% t6 v( w: G6 [1 v/ U
  5. * brief  EDMA3 Test Application
    : Z& g1 _$ M5 Y1 t9 c* [
  6. *$ ?. e# K; [: b7 n- i
  7. *   This file contains EDMA3 Test code.. O  I) }% ~0 X3 _# _/ z+ n8 M
  8. *3 Z4 p- a$ s- m9 v) x6 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # J) p3 x7 @7 C6 x, \7 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * V5 W7 T$ ~5 p" ?2 z/ J& h" \
  11. *         TO CHANGE.
    , v  m; f, E% S$ c) e# k- f! [/ G
  12. *8 ?% R+ C$ r* g, }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : M% A* i4 P# k; T$ e; Z; ^. k
  14. *
    " i; T3 Y- g% {7 [! N7 x
  15. * This program is free software; you can redistribute it and/or# N+ l+ c- l6 l1 R3 I. }! a* }( G% h
  16. * modify it under the terms of the GNU General Public License as4 S& [+ p1 a2 Q3 X) T
  17. * published by the Free Software Foundation version 2./ ~) c3 c$ [7 b: i6 e4 ?0 @1 {
  18. *
    7 r7 E( r9 f7 L/ E! Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 Q/ Z3 E1 M) Z' a: D+ ]4 M% C
  20. * kind, whether express or implied; without even the implied warranty; ]1 U6 }6 d' I2 L1 Y6 ]2 J3 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      F3 G4 J+ b$ [' O
  22. * GNU General Public License for more details.
    4 j' m7 r% G& P/ e
  23. */
    4 B$ C1 a; `' E4 ]
  24. ( N" F; f4 n; S+ d
  25. #include <linux/module.h>- a4 c7 _+ [' F" b# O+ y& _0 Q
  26. #include <linux/init.h>" w. O( k/ P/ A  M' W
  27. #include <linux/errno.h>+ G9 T9 N. l. Z
  28. #include <linux/types.h>: u7 z1 t+ P; ^7 C  Z. P. g+ h0 o6 K
  29. #include <linux/interrupt.h>  o: ^* i' P# v( E+ W
  30. #include <asm/io.h>
    # a' e7 _3 l( k6 o( p1 U2 J
  31. #include <linux/moduleparam.h>& ]& n: E4 h: o9 l  ]9 u, x. e- R
  32. #include <linux/sysctl.h>2 `- ?" F4 @: I. b* g
  33. #include <linux/mm.h>
    1 S+ e) @$ \! {. z
  34. #include <linux/dma-mapping.h>  k+ x! ?1 T# L! W! A6 S# G: g; D: c

  35. 6 R& s# D0 q+ P. I; d
  36. #include <mach/memory.h>
    5 S: O" h% b/ q- t9 }( @$ r7 h% L. n
  37. #include <mach/hardware.h>
    . `) o- i- k# ]$ o- c
  38. #include <mach/irqs.h>
    0 B( X* z" O! X6 h' y; |
  39. #include <asm/hardware/edma.h>5 D9 F: w5 O) Y4 v9 u

  40. # T" |# O( g" k* p! X0 v
  41. #undef EDMA3_DEBUG
    % d  ~/ t) N! L& u; F! p3 P8 d$ k
  42. /*#define EDMA3_DEBUG*/  D9 q& M, w- j4 P3 x! }

  43. ( J: @! m% u5 _9 G' T
  44. #ifdef EDMA3_DEBUG( A  Y9 J4 M# @3 }+ S, j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' h4 p/ R* N0 S" E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- K: ^% m3 l$ F) r* K. f( q9 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* _" _( h9 d% @' p8 t3 T+ G( a
  48. #else
    1 G1 B3 y4 W$ w# x" S; z
  49. #define DMA_PRINTK( x... )) H$ v- s- j2 E1 t, G
  50. #define DMA_FN_IN, |" H# @. O' s7 s; H
  51. #define DMA_FN_OUT
    , O- b! e# v# i1 I
  52. #endif
    ) S9 j& n/ r, t* w5 Z2 p$ K- [
  53. - U2 S. P' ?6 E" j; o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): k& H9 f( |+ D) k
  55. #define STATIC_SHIFT                3, E+ v; K8 H  L1 E) Y
  56. #define TCINTEN_SHIFT               201 L/ i/ v9 k% S7 e* ^
  57. #define ITCINTEN_SHIFT              21
    $ \, H) u5 b% Q- n
  58. #define TCCHEN_SHIFT                22
    ) U, z* d9 F+ Z2 x- }* S' ^; N* f! z
  59. #define ITCCHEN_SHIFT               23
    1 i: r( d6 m5 a

  60. . u/ j# X" i) x9 p
  61. static volatile int irqraised1 = 0;* E4 d* p1 z( W- g/ }5 ]
  62. static volatile int irqraised2 = 0;9 O/ P! ?7 _. j8 h5 D/ W

  63. / d! O8 l( x! R! l9 p, h+ k4 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - Y0 \0 y6 a" V' e! \( T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R$ [! H4 Y3 R* Z- C7 Q/ p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 R5 \- v# j5 W9 q: \$ b0 F
  67. 5 h0 B, m0 p4 v0 X
  68. dma_addr_t dmaphyssrc1 = 0;
    6 E, d' Z; c- n  H! H( K" {
  69. dma_addr_t dmaphyssrc2 = 0;. e  m+ S) {( o. q
  70. dma_addr_t dmaphysdest1 = 0;: R( d1 X  X6 g1 y* D& g* d# j6 s
  71. dma_addr_t dmaphysdest2 = 0;
    + z/ h$ _2 Q2 ]: q# c

  72. , [# P* R2 x8 v2 ?" }; z- ?( Q
  73. char *dmabufsrc1 = NULL;
    ! y+ |: e) q* R- u# A% _# G) t) H
  74. char *dmabufsrc2 = NULL;
    & ]1 K: Y$ c9 t
  75. char *dmabufdest1 = NULL;
      R! S7 L6 ?2 ~  a
  76. char *dmabufdest2 = NULL;
    $ ?: `& H( ~. t  H; M1 p
  77. , l2 {  O/ T7 d6 }5 k) c
  78. static int acnt = 512;+ A# p  g9 P% {  ?
  79. static int bcnt = 8;
    ; j; Z: j& a% S3 l; [
  80. static int ccnt = 8;
    ! B$ ?6 M" j, s9 j  W, T* t  j
  81. 4 ~9 B+ k$ B0 ^3 T4 G
  82. module_param(acnt, int, S_IRUGO);" s" @3 w: e1 |8 V0 w
  83. module_param(bcnt, int, S_IRUGO);
    ) q& K, l" R* i4 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) J$ @, K' F. P6 a  H
! J/ Y  Z1 d; ]- `! F# E% X' L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ R6 r" z, g9 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: ]3 n" b  i* M! h2 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: G# `2 L' @, l& E  n

- h/ A8 B8 y' w! l) u/ G: G4 }; X; F+ B9 f6 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 03:19 , Processed in 0.038642 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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