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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ a( C- L! y) o1 a/ V& P% y
  1. [code]EDMA sample test application0 [8 ?: }: A) Q. w0 ^0 ?
  2. /*
    * r) S8 K3 C5 c; x1 E( I
  3. * edma_test.c2 ^) R( w# T# v% e
  4. *! y" Y9 H( R4 H& a/ B
  5. * brief  EDMA3 Test Application
    ! b+ J) y9 n" Z' }
  6. *0 @6 J/ _% Z4 P+ k2 }
  7. *   This file contains EDMA3 Test code.
    + f0 e/ k# q" z0 ]
  8. *; W/ Z' A/ }" E# n" J/ c0 U2 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. K' U  M' A# j1 V6 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . ]3 b" D# }% B+ ~
  11. *         TO CHANGE.
    . f6 T# L0 }( }9 M, s) m$ h. f+ S5 R  P
  12. *
    ! ^: ~- Z& Y9 x' V/ {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 Z: w! u- {( H- ]8 B( b
  14. *  @+ G! N% s6 m& z
  15. * This program is free software; you can redistribute it and/or
    . x( b: N) t1 _& Z  R; C
  16. * modify it under the terms of the GNU General Public License as1 d5 @! O# E3 n& l0 G7 N7 N
  17. * published by the Free Software Foundation version 2.( u) A2 `% s, h% Y/ d2 h
  18. *
    5 y3 Q) i" ?. o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: V  v$ s' g# [/ b: Z
  20. * kind, whether express or implied; without even the implied warranty! A7 a3 ^! ]4 D( a+ g3 ?. Z9 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 d- W5 M# j, D# C" b' Y
  22. * GNU General Public License for more details.
    # x& K. z9 A2 l2 F1 F6 k* w3 v+ \
  23. */- a) a4 r6 c; |
  24. $ q' y/ O6 a4 P
  25. #include <linux/module.h>
    ; V/ M$ \# W8 x  P) K% b* j6 t$ }
  26. #include <linux/init.h>
    * C; ?4 t3 c- c
  27. #include <linux/errno.h>* N  r2 S& y, T, O" t
  28. #include <linux/types.h>6 {9 w2 j- I9 P3 y% |
  29. #include <linux/interrupt.h>
    2 B0 r' Q4 ~. q
  30. #include <asm/io.h>" Y' y. R  ~; b6 Z- s$ x
  31. #include <linux/moduleparam.h>
    " I6 ]7 d* V. [6 R3 S
  32. #include <linux/sysctl.h>- n% T6 o5 T6 r6 o; t
  33. #include <linux/mm.h>0 J2 g$ P2 O- [6 h& d
  34. #include <linux/dma-mapping.h>
    ' o! N' f8 \- Q/ v$ V

  35. * A; C1 m/ a7 Y9 @' G4 k4 g
  36. #include <mach/memory.h># v1 M9 i. h3 p, w& F
  37. #include <mach/hardware.h>' S2 J. q4 a6 L3 u
  38. #include <mach/irqs.h>1 A' y, `/ h4 R( P
  39. #include <asm/hardware/edma.h>
    8 |* O" v0 W& k

  40. $ C: ^/ C0 X$ ]. v
  41. #undef EDMA3_DEBUG
    0 F5 I! f" ^- ]8 Y3 `1 L; P' `
  42. /*#define EDMA3_DEBUG*/
    1 V# N& c- T$ i" N5 G: u5 R

  43. - g! _0 \+ b  A! Z, n6 j! Y
  44. #ifdef EDMA3_DEBUG5 g+ }- y6 X# |0 F& [+ ^( f3 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" A. J8 v- p6 o' ~' N/ T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), ]  ~% q9 `8 I; q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* J9 ~8 s: I& D/ i" ?
  48. #else( K. q- K. E% J; u7 q& x, Q
  49. #define DMA_PRINTK( x... )5 s4 Q/ d. B8 ?* u
  50. #define DMA_FN_IN
    1 Y' l$ e' E( @* Z& Z
  51. #define DMA_FN_OUT$ A$ H2 ^, L# D2 U
  52. #endif
    3 n( J- o0 ~: V" e. [) z; F
  53. & w2 A6 ~, G$ _3 z, f" i4 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) M' {- A* {- M, r! d  W+ M: E5 k
  55. #define STATIC_SHIFT                36 `1 s/ A+ f/ B
  56. #define TCINTEN_SHIFT               20
    ( L# P. Q! p) _! I. a8 k
  57. #define ITCINTEN_SHIFT              21
    + L) V% N# C% l% b2 U4 N
  58. #define TCCHEN_SHIFT                220 {5 [) I" A& N" M" n
  59. #define ITCCHEN_SHIFT               23; W8 D/ ~# r* G4 l9 J
  60. " T1 c8 M! f) U# h, l4 T7 ~! \3 w
  61. static volatile int irqraised1 = 0;
    ; o& m4 Q( l2 J5 w: C
  62. static volatile int irqraised2 = 0;
    + s, d7 X6 \5 n% u+ o* T, b
  63. $ ^! O" R( ~# n" ^+ ^$ ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ^- a  U4 m; D' t# W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! ]9 e/ t: k* W" d: D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! F+ f, L% p& t

  67. : p/ m, [* C" H+ ~! q4 {) {+ r
  68. dma_addr_t dmaphyssrc1 = 0;
    3 j3 c1 d& }. J
  69. dma_addr_t dmaphyssrc2 = 0;* X4 _: p) v- O" }3 G* r' y
  70. dma_addr_t dmaphysdest1 = 0;8 d. U; Q% g* G9 X6 M
  71. dma_addr_t dmaphysdest2 = 0;' D5 A. }9 [- C& H& k) k
  72. 0 T" S& S$ E: U) Z2 ^* f8 w0 s# i3 H
  73. char *dmabufsrc1 = NULL;  p$ G  s* ]9 q9 F
  74. char *dmabufsrc2 = NULL;
    9 p. a- A) h# G
  75. char *dmabufdest1 = NULL;1 V" c/ F5 u" F* y  p4 _  h, q1 [
  76. char *dmabufdest2 = NULL;
    7 }6 i/ _# Z; `" U2 D
  77. : L/ o+ h9 @1 P
  78. static int acnt = 512;5 ~$ ?( v9 F1 ?; ?3 c& W5 q1 E$ U  m
  79. static int bcnt = 8;
    - ^) @1 _, b" w' B& E6 ?
  80. static int ccnt = 8;
      q, J$ C! s: y( O5 ^: p! a8 t
  81. % d* X; S0 Q2 K3 v# q4 H
  82. module_param(acnt, int, S_IRUGO);
    : }; G; P8 f& Z$ d4 W
  83. module_param(bcnt, int, S_IRUGO);1 C( Y$ _' k) k+ h" e7 n- e+ o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ V: h8 ]$ V2 K0 A/ O$ S

# x7 h/ _+ C7 z  P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: N) N. T( E& t6 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 N* ?' O- N. n. M2 v# M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 J. u: X" t" u- A
7 E7 P3 F* t9 N8 s1 j$ X( K4 f7 E* d( o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-28 12:32 , Processed in 0.044234 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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