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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 B* I3 Z* ]( f3 w0 Y
  1. [code]EDMA sample test application
    4 V. N  x2 }/ |5 ?
  2. /*# b( z  x1 ~  f) Q; R) R
  3. * edma_test.c
    8 d6 G7 p' L  T7 {& F( I, M
  4. *
    3 D' L) y! ^/ ^
  5. * brief  EDMA3 Test Application
    6 g' j0 L  ~+ V2 g" x
  6. *) Z# Z. F9 J# A9 m0 z  l$ R
  7. *   This file contains EDMA3 Test code.
    ! |6 r4 D! A8 I( l5 }% O
  8. *
    - R* p( p6 e+ a8 [$ T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # e% Q  D9 t1 |7 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ }9 Q  j# w# ?& V( G
  11. *         TO CHANGE.
    ' b1 M/ {4 Q" m
  12. *( d/ ?" `$ s1 b9 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / _# q) {( w; D. Y3 o
  14. *; `+ g" `& Q$ z" Z
  15. * This program is free software; you can redistribute it and/or
    2 D, X0 K8 ?6 u# J0 a& I. T
  16. * modify it under the terms of the GNU General Public License as
    - T4 t! Z4 |: W/ N1 g6 K* x; R0 N4 w
  17. * published by the Free Software Foundation version 2.
    , ~" G+ Q7 V  r& M& W# P4 u
  18. *1 u( w4 q6 ]: x: W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 A3 E$ Z3 k  k0 \/ [6 B
  20. * kind, whether express or implied; without even the implied warranty
    ' |0 o/ u- ~; R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; T2 Y) C) n' r3 D
  22. * GNU General Public License for more details.
    . R4 h5 s# @, R! K  b# V
  23. */" @1 K3 e( `6 O7 f- g; X% |

  24. & T; P) c5 j, B: N% D& U- p3 ?, y
  25. #include <linux/module.h>1 g, U9 \; ^; ?2 \: t" s
  26. #include <linux/init.h>  N% e/ h; Y  ]9 ]
  27. #include <linux/errno.h>
    * V( e2 k/ i' e: w, T" _  x" T. }5 a
  28. #include <linux/types.h>/ E% W5 @) [% s
  29. #include <linux/interrupt.h>
    0 Q5 j3 N2 F+ p! q% M
  30. #include <asm/io.h>
    , f9 x4 w/ }; y* q# C! m0 h5 O: H
  31. #include <linux/moduleparam.h>! a& f1 O. S' f* E& @" _" [
  32. #include <linux/sysctl.h>% W" |3 u2 M( ?
  33. #include <linux/mm.h>& K0 l- _* ^3 U
  34. #include <linux/dma-mapping.h>
    $ s+ R' p( g, J% G6 j+ Z6 ^

  35. % g: i' Y, n+ J  L2 D
  36. #include <mach/memory.h>
    6 ~: M( s5 O2 K- ^7 w( C7 r8 H
  37. #include <mach/hardware.h>* c( K6 y! L+ I( o7 @8 Z6 e+ }
  38. #include <mach/irqs.h>& |2 P9 e7 k- F
  39. #include <asm/hardware/edma.h>
    % S! v) D1 z' M

  40. 1 _) s6 b* Y; x: N0 P' {
  41. #undef EDMA3_DEBUG
    1 \* k$ E& m3 `7 `/ u
  42. /*#define EDMA3_DEBUG*/6 s# a; f9 l- o
  43. $ D/ G! l6 ^, }- {
  44. #ifdef EDMA3_DEBUG1 J1 B; J+ u- P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 [& _5 o" s, {, U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). P$ `+ ^; ~2 K5 X% L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" a8 L+ C) @4 |/ v- l& f! {
  48. #else7 @5 l+ d/ \  M6 u  E  j7 ?5 h
  49. #define DMA_PRINTK( x... )
    6 s$ f* q: c7 P" k; @5 e' f# q
  50. #define DMA_FN_IN4 N7 h/ R7 U' p) ]/ L- \
  51. #define DMA_FN_OUT2 L6 w0 K9 C9 a# T/ Z# ]- }
  52. #endif0 W6 {3 b; z6 T) R, ]9 y. s
  53. 8 i7 c3 W/ X1 r$ T& {" Y8 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 W  K( s, C7 ]7 h5 N' w1 J) X* W
  55. #define STATIC_SHIFT                37 {2 V5 I! Y. W  X
  56. #define TCINTEN_SHIFT               20' \9 ?! _% u2 s. p1 b$ i: u$ K
  57. #define ITCINTEN_SHIFT              21/ v( \% s: p8 X/ F. W8 ?# X. M
  58. #define TCCHEN_SHIFT                22, B5 I! X0 f/ `, J( C4 y8 o
  59. #define ITCCHEN_SHIFT               237 U! i3 I: G7 k( l5 U

  60. 9 l$ S  U" c9 N4 Q) z/ L) O$ o
  61. static volatile int irqraised1 = 0;
    6 p# z6 j1 a( t% h7 f, z2 H5 m+ h
  62. static volatile int irqraised2 = 0;
    / p; w, \% }% J! t! `1 W: c

  63. 1 \, g; u+ O1 j; C! ~( D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) |5 X' j: G# q( s* _% m2 p5 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o& z) V% ?1 H! p( ~7 H) ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u# M9 _' W+ _& A# [9 F* s

  67. ( n; p' e2 }5 e6 L  G
  68. dma_addr_t dmaphyssrc1 = 0;
    & E* a+ V% k8 T7 ?. h- [6 B9 N
  69. dma_addr_t dmaphyssrc2 = 0;
    5 b/ [9 A& ~) t; ~
  70. dma_addr_t dmaphysdest1 = 0;# Q/ b$ [: x3 H. T4 W
  71. dma_addr_t dmaphysdest2 = 0;" Q' Y# ~8 s% k* m! f3 {
  72. ; x# i% m% `5 h2 ^6 I/ T1 E* R
  73. char *dmabufsrc1 = NULL;8 K  s/ `* W/ e' O! P8 }
  74. char *dmabufsrc2 = NULL;& a" g2 E0 t3 O! e
  75. char *dmabufdest1 = NULL;) E: p: v, D4 Q. B% ?& y: f
  76. char *dmabufdest2 = NULL;* H, I$ ?1 F9 a4 J8 @8 s# v

  77. 6 g! j$ j! e1 c' {
  78. static int acnt = 512;# L4 ~& F$ `/ \$ G
  79. static int bcnt = 8;
    , F5 f9 J3 U8 ^/ D" R  V: x. Q
  80. static int ccnt = 8;
    ; O) B; m0 D: P, I- b: S

  81. 7 b% [' o- n( H8 Y- r
  82. module_param(acnt, int, S_IRUGO);4 f- S- s+ q+ g( t/ H- g
  83. module_param(bcnt, int, S_IRUGO);4 N0 U( o5 a! C8 M+ W# p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 q, f8 T' s, m! E1 f* M+ `4 C
1 y* v# D# w; O: M  ]* e' D& W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ]8 |3 ]( C9 T- n. Q! D6 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 e5 }2 R% ]! R% I$ Y6 Q. u) z8 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X: c- Y; G* h! s' H! q  U
7 p: W% S# X$ M: U% F; G  I* ~, a0 F( y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-13 21:52 , Processed in 0.039140 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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