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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : C$ j) E$ F( q% a
  1. [code]EDMA sample test application& x( Z& r0 a5 T" L3 ?
  2. /*' ]$ f* @, j( |# T. P7 w. i
  3. * edma_test.c
    7 n9 x( P& O5 D' u9 f1 d# H( q0 r0 E7 m
  4. *; Q) b& E' Q! f/ f6 b# L: d5 ^
  5. * brief  EDMA3 Test Application
    " a1 o4 W$ i6 h% {5 K
  6. *
    ) Q, Y0 T/ K# \- u1 F9 q* s# k$ R' e
  7. *   This file contains EDMA3 Test code.
    4 N/ G/ O) F/ F) Q9 P/ p
  8. *  M* S0 m3 t, a- ]7 g7 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 C9 ?4 ?3 A8 j) F' r) }, y/ _. p- j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( b3 P+ _# g5 S" Q
  11. *         TO CHANGE.
    & t' C( f6 F4 d% D8 @4 X
  12. *
    1 k1 g7 w7 N0 `; y6 }4 n( Z( ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; E. Z5 J0 d4 l1 f
  14. *7 @9 T' I3 w" w$ k
  15. * This program is free software; you can redistribute it and/or5 o1 ?2 {  w( X, {
  16. * modify it under the terms of the GNU General Public License as
    / H/ e2 e* \( E# n  `( z' j, U
  17. * published by the Free Software Foundation version 2.
    ( Y  h5 e2 `, N9 e, j
  18. *
    , @& W: M7 v2 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 l/ T/ A5 Y7 J, y9 H
  20. * kind, whether express or implied; without even the implied warranty
    ! }. C7 k5 v) k# e3 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - a6 L( \& N9 ~2 k
  22. * GNU General Public License for more details.
    * F  h# G% m+ S3 X& J. C
  23. */
    " {0 L" j' L6 l, k0 N+ X% }3 S, }

  24. 6 [; V, T- Q4 ]  u4 A. ^4 U5 I
  25. #include <linux/module.h>
    ( U6 [# `# [& a9 `1 l, G
  26. #include <linux/init.h>" t% D: ~2 b1 t" Q! x( p& F* K  Z
  27. #include <linux/errno.h>
    + ]: v. \( F6 C
  28. #include <linux/types.h>
    ! @& z1 G5 ]( }3 L, L0 t/ I+ C; h
  29. #include <linux/interrupt.h>- M  U' H4 u0 ?/ ^( s$ G
  30. #include <asm/io.h>
    - H) o6 E! U, O; f4 _
  31. #include <linux/moduleparam.h>: F3 I; ]* p/ F; \0 Y% b  J! K/ p( H/ R
  32. #include <linux/sysctl.h>* A' L2 l" E0 o8 w
  33. #include <linux/mm.h>
    " N6 E8 e4 E  C" s6 A
  34. #include <linux/dma-mapping.h>1 [4 Y6 n7 r, N4 L2 H
  35.   X' C: E% ?) R5 ?6 W: n- i6 Z
  36. #include <mach/memory.h>! L! n% a  r" p. M& ]
  37. #include <mach/hardware.h>
    0 E" I9 {$ U- O, G" k
  38. #include <mach/irqs.h>
    4 X! _2 L6 k0 p
  39. #include <asm/hardware/edma.h>, h  T6 T3 v3 R8 Z  `' [: b
  40. * G" C. t8 w: {# R. M
  41. #undef EDMA3_DEBUG
    ) c4 s& d; N6 [8 ~  I# O
  42. /*#define EDMA3_DEBUG*/) V! L: l1 X3 a+ j' R
  43. - [$ A' b: l0 t+ a" r5 ]
  44. #ifdef EDMA3_DEBUG
    ! f- g$ E1 `2 |1 C1 c1 S; n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ R. e# R8 t, M& d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* D0 i: k" C0 w  D9 j' C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ L5 C8 Z* W7 _( D8 C
  48. #else
    , f1 ^' d4 L0 h
  49. #define DMA_PRINTK( x... )
    9 D7 U* d: [/ w  e) {0 V1 _
  50. #define DMA_FN_IN
    5 t0 C9 C5 z) R9 R  B- B; Q
  51. #define DMA_FN_OUT9 _5 X% ^" W+ @8 o
  52. #endif
    1 b8 r4 l8 V: T( d3 h* D5 }/ n- Y
  53. 2 t; K3 i" O5 c! k2 E" A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 E& w6 T0 F6 y+ p2 y
  55. #define STATIC_SHIFT                3
    ' O. j9 j1 w/ l6 w  k2 h3 ?
  56. #define TCINTEN_SHIFT               20
    / ]% w* B- t, R+ z% f. _9 t+ x7 M
  57. #define ITCINTEN_SHIFT              21$ H9 P. @/ Y5 F% h# f
  58. #define TCCHEN_SHIFT                22
    ) @# c+ G  J' c& h2 x6 v: }
  59. #define ITCCHEN_SHIFT               23
    1 p' C# P% B/ q* I) ?' X
  60. : s* l1 c9 P; q7 V# ^  H! y
  61. static volatile int irqraised1 = 0;: n) e9 E( S. W9 K5 M6 I& g
  62. static volatile int irqraised2 = 0;
    ' j! n8 ~7 g! [% p! b  \9 S
  63. 0 W. ?1 G* ]/ ~/ e/ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 L0 K) j( F; F+ C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % E: y7 L! O( y  f  T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " E  Q- K7 ^' I5 U  c

  67. 7 o, r! h# ]2 ]. d, ~7 ~  l- {
  68. dma_addr_t dmaphyssrc1 = 0;
      b6 c# u4 R. k: W6 F) L1 }1 N$ Y
  69. dma_addr_t dmaphyssrc2 = 0;
    4 r$ Y; e& H' {- S8 f
  70. dma_addr_t dmaphysdest1 = 0;
    / C3 g  ~0 m& J* t& ]" P/ d  @& x+ q
  71. dma_addr_t dmaphysdest2 = 0;7 B- `- d3 [8 F2 I: [& |. O3 n* r

  72. $ t' W/ \2 Z5 T/ f' V: N, C
  73. char *dmabufsrc1 = NULL;
    3 n" h' k0 S: |
  74. char *dmabufsrc2 = NULL;. I2 j  ?6 V  d7 U4 j2 q
  75. char *dmabufdest1 = NULL;
    5 e1 m! Z8 R9 T' j
  76. char *dmabufdest2 = NULL;
    . c# k7 A- _/ t
  77. ) X' u' Q0 j  D1 H; f% n5 x
  78. static int acnt = 512;
    ; S, Z3 ~% Z) p7 z) X& s; l
  79. static int bcnt = 8;
    # Z# M( O: [+ D0 y3 G; A
  80. static int ccnt = 8;
    , f! P. ~' ~' L( \% Q. W' A
  81. 1 P. k8 b; Q1 s& v5 W% W5 s  \# a
  82. module_param(acnt, int, S_IRUGO);
    3 {" e6 i. t' w( t/ b
  83. module_param(bcnt, int, S_IRUGO);
    5 G- R% U: A) Y3 a' a: i8 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% }- \6 U5 \9 W- [0 q$ u1 R% Z5 R
  D) N* n8 d9 N! u1 M6 j2 o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- Y: q( k# T: _7 j* Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, c+ ]4 r% b4 {- g/ M! W$ B0 E& `4 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ {, L$ o5 C% N! e
3 M+ [: m/ F+ L9 C' I, W7 p. t6 J) t, ^# L7 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 07:11 , Processed in 0.039602 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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