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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; F+ K! K- w* \3 I
  1. [code]EDMA sample test application
    ( P( l. M2 v' D3 I# x9 e
  2. /*! d( `3 c; R0 N
  3. * edma_test.c
      P% A6 a  V. K
  4. *
    " z7 J+ q2 ~6 u+ D. R5 P( L4 c& e
  5. * brief  EDMA3 Test Application
    5 \9 Y/ a3 X0 n' ?' J
  6. *; P/ a& x- k" r% z: h
  7. *   This file contains EDMA3 Test code.
    8 ?9 v3 b% M- |& }8 \$ s
  8. *$ R0 ^' W  [% s. ^+ V7 _+ [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 G$ V! k+ ?7 z; F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / ]  F; }- j: Z* r4 p" r; z. ^
  11. *         TO CHANGE.0 S2 X( F' V+ F( a
  12. *0 g4 s5 k9 ^! V6 _: L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / x( ]/ k( V( _8 @4 J( P
  14. *
    ; Z& }; k0 w; D: T: u  G3 ^8 R
  15. * This program is free software; you can redistribute it and/or
    1 j. D1 n2 h+ S  j1 o/ k
  16. * modify it under the terms of the GNU General Public License as% t$ N8 \; [. U2 D' D
  17. * published by the Free Software Foundation version 2.
    6 n3 ^+ S# n& P# Z! ?/ m* E
  18. *2 m3 r7 N! H6 M3 T$ m" P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 u) ?' N4 I# v1 l
  20. * kind, whether express or implied; without even the implied warranty+ n, f) S1 a6 {) Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 e: q% I! D5 y% B6 D0 G+ R
  22. * GNU General Public License for more details.
    ; c# V) q' q* \- A  f5 Y
  23. */
    8 p# G, V: a. g1 c9 ^. `. [
  24. + M- Q/ j3 G# o( u( ~
  25. #include <linux/module.h>
      |% o) j7 H. r
  26. #include <linux/init.h>
    7 `7 X# u; h5 t3 X# {* ?6 U
  27. #include <linux/errno.h>- A$ v6 Z2 @# O! V4 X  I% `
  28. #include <linux/types.h>
    ( Q" K! `1 z( x* i
  29. #include <linux/interrupt.h># r3 M/ V4 q6 U
  30. #include <asm/io.h>2 @) b3 I, Q# @( q& v2 \
  31. #include <linux/moduleparam.h>! M( J2 c3 k% P4 O: p; @+ A
  32. #include <linux/sysctl.h>
    3 X0 N- L1 J' f; N' w& U/ G
  33. #include <linux/mm.h>
    , X. C1 W4 G& T( @0 D# J
  34. #include <linux/dma-mapping.h>: k) \/ Z0 n! R
  35. & ?0 \0 n% y: U! D- K, }2 t" q3 s& ^0 {
  36. #include <mach/memory.h>2 d. M  A0 g3 H' o+ z) i4 N  J
  37. #include <mach/hardware.h>
    ) G% P1 p  b9 S; K# n
  38. #include <mach/irqs.h>& Z2 r1 Q. W9 s% a
  39. #include <asm/hardware/edma.h>
    7 h7 M, z' o* ~) j2 e1 S$ F. C$ Z& h
  40. 8 L5 u- T  @  s( _8 a# j
  41. #undef EDMA3_DEBUG- }; t  }9 i, ~* q$ Q% w% j& O
  42. /*#define EDMA3_DEBUG*/8 e5 ~! D, Z$ z/ B; b' \9 x9 Q
  43. ( x# s' Z5 c; C1 o$ I6 t4 h; m
  44. #ifdef EDMA3_DEBUG" j. K' f, c$ Y/ s: e, t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! G9 O2 `: |" Y2 X; |/ c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 }! k' _/ Y8 j$ y- A) k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) b- s& s" D$ B! t8 ?' z
  48. #else( F2 z+ c+ c3 w
  49. #define DMA_PRINTK( x... )7 {7 `$ T0 J* a# }  s
  50. #define DMA_FN_IN, f2 r& n! ^) H- I( P" N
  51. #define DMA_FN_OUT
    + g4 S$ f' e  \5 O5 v7 w' }
  52. #endif2 f# p* j( x" ~. N- H9 Z6 R
  53. 3 h+ C9 K; Y& P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  V+ W8 j( ]( g' h
  55. #define STATIC_SHIFT                3
    , \  H* q/ f) j
  56. #define TCINTEN_SHIFT               20
    5 d, ?8 k% L0 W1 L9 H
  57. #define ITCINTEN_SHIFT              21  e) c3 B, X3 d
  58. #define TCCHEN_SHIFT                22
    9 _# C7 h; N+ s' G
  59. #define ITCCHEN_SHIFT               23# a' `$ `3 F9 Q  p! _# T

  60. 0 N: K% ?' w# D
  61. static volatile int irqraised1 = 0;# K# u& ]+ |+ Y  l) p
  62. static volatile int irqraised2 = 0;) d2 o2 l% _0 I+ a
  63. $ k/ H- }( I  I+ R  B+ `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 o: Q1 H- n- p: B# Z* _" L6 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?/ S8 }2 a2 {% }: e3 G# z# P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 M9 N$ L. @; y) V

  67. # \3 a) F, M& _; j- _" x* e
  68. dma_addr_t dmaphyssrc1 = 0;/ g3 P$ A8 d8 w1 [9 r! F
  69. dma_addr_t dmaphyssrc2 = 0;
    . H, ?7 E3 e  L: ]4 L
  70. dma_addr_t dmaphysdest1 = 0;7 B/ E2 d" @0 M1 H& u  G( U
  71. dma_addr_t dmaphysdest2 = 0;& f2 U- k2 e8 F  `/ O8 w# c: u

  72. ; w3 t0 t, o; k  [
  73. char *dmabufsrc1 = NULL;
    " T8 r9 S* E. s* K; J7 d4 D
  74. char *dmabufsrc2 = NULL;# Y2 h# L  F! g$ @. }% B
  75. char *dmabufdest1 = NULL;! p! K; W4 T& {: O
  76. char *dmabufdest2 = NULL;
    " ^) S$ B0 K$ m

  77. / ?: s4 |0 P# M' K. Q1 T
  78. static int acnt = 512;
      g7 b9 F% ]  G/ ]; n1 ?5 c
  79. static int bcnt = 8;
    " |0 X* I4 Y5 G3 E/ s
  80. static int ccnt = 8;
    ; w: B+ H* k9 T% _, F, U$ O" s
  81. ; d+ D5 h( a9 k' V" ]( m( b+ A
  82. module_param(acnt, int, S_IRUGO);6 ?! d# k% X/ Y1 e  ^; C
  83. module_param(bcnt, int, S_IRUGO);
    # }- W! G, q* w) N2 [4 J0 }2 {& k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- Y' P) C6 c5 C8 A

% {# t( J/ [" [' g+ K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- W5 n1 H8 d! q8 t$ T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# _  X2 H7 p& P; o; p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 W3 c" C: s  [, T4 D+ D; C8 }, M" F. a0 m; J& s

8 {' ^* l1 q6 I0 l! |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 15:10 , Processed in 0.039678 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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