OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 M' `! @! J6 d' U- F
  1. [code]EDMA sample test application! k, J% g& S* T; ]
  2. /*
    + w" f  H/ F# T9 n; l3 d+ X
  3. * edma_test.c
    % y# C+ J. g" r& f; [
  4. *1 y( K* P  S  x$ q8 {9 a; b# f
  5. * brief  EDMA3 Test Application+ X4 s: n+ R) @7 B
  6. *
    . I& j* V" L7 X& G1 p
  7. *   This file contains EDMA3 Test code.- C" L! W& I" s  m5 m5 y8 g" c2 S
  8. *$ G) `+ }( m4 G1 T# o+ f0 y) \# c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 `5 d% c" r7 d* D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. w2 ]4 G& T  U) O
  11. *         TO CHANGE.
    ! E( h% K2 H- q& f8 h9 L* M
  12. *# P: p- g! `# _/ i! f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) {3 ~- P* T* j0 m9 Y' O$ C
  14. *
    2 T5 V  I6 c7 _/ S* K% |
  15. * This program is free software; you can redistribute it and/or
    ) |  C5 W" H, n" \" w& g, h, \
  16. * modify it under the terms of the GNU General Public License as
    4 S- e" m$ Y/ g- U, y" J$ M' h
  17. * published by the Free Software Foundation version 2.! t9 ]. J: e8 ~8 f+ D6 l$ }) z9 A1 D
  18. *0 u" F2 F0 P, n' r7 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# t$ @9 k" R9 `% |. A8 i, b
  20. * kind, whether express or implied; without even the implied warranty
    + m0 o  J/ v. h4 g* |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 g* I6 i( U3 r7 l% _" `
  22. * GNU General Public License for more details.' a& H0 h. r2 R# {5 z
  23. */
    $ P1 u# E* n5 _
  24. 2 C1 ~. B1 @" S! O
  25. #include <linux/module.h>
    - |4 a2 B9 t; i, n
  26. #include <linux/init.h>  c$ k- @4 i7 Y: q# m/ V
  27. #include <linux/errno.h>' p3 [. J8 r" J2 m
  28. #include <linux/types.h>5 c5 z/ g6 A& @- n% I( q* x: @
  29. #include <linux/interrupt.h>! j8 r/ s* L' ?3 ]1 v( i
  30. #include <asm/io.h>6 @: y! t: i! c
  31. #include <linux/moduleparam.h>. P' {/ v* K" Q
  32. #include <linux/sysctl.h>: u: ~# h# J& y
  33. #include <linux/mm.h># ?& @; M' T. W- Z5 S9 U
  34. #include <linux/dma-mapping.h>
    4 G; _7 y3 t) ]2 Z1 z* s
  35. 4 I) c2 X) Z! v( `  z
  36. #include <mach/memory.h>
    2 b, c% ~5 `$ y) d8 [* L. A) `. ?, q
  37. #include <mach/hardware.h>
    # ?5 U4 T7 b( |  {4 A
  38. #include <mach/irqs.h>, k' g: L* [' D. B  ~& }
  39. #include <asm/hardware/edma.h>
    3 ]0 R2 E  f3 D2 k
  40. & a  C/ a  M! {3 L5 b
  41. #undef EDMA3_DEBUG$ P" }  I! u- M9 B
  42. /*#define EDMA3_DEBUG*/2 T4 @! T; ?- K

  43. . s0 T4 c! C; ^& j) z* B
  44. #ifdef EDMA3_DEBUG
    4 j  Z/ }% X, Q4 R1 F- Z/ x  ^# b# o; u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* V  S! z! C8 K) P, v! ?# ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ j( [" k0 _5 m& h/ T4 `" ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), d( c) \3 \7 g5 ?, G
  48. #else
    : |7 K: X- x" v- W8 M* _
  49. #define DMA_PRINTK( x... )/ p  k0 F7 @- H! K. T3 [" {
  50. #define DMA_FN_IN% }5 r$ ?+ O/ c8 H  o8 B% A
  51. #define DMA_FN_OUT2 e! D1 ]; m. H! Y% D
  52. #endif' I7 K. q2 }' h$ S2 R

  53. / f/ j9 @: c7 @4 d6 S; M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- v0 `" H8 `' w
  55. #define STATIC_SHIFT                3
    ! j% b8 j: L; M' B  E+ m8 b8 d% C
  56. #define TCINTEN_SHIFT               209 ^$ }- F$ G# T7 H# E: [! N) v& h$ y
  57. #define ITCINTEN_SHIFT              21
    & p3 B8 E& l; L4 a+ y
  58. #define TCCHEN_SHIFT                22
    : g7 D$ K# Z0 I/ c9 O# i, D* G- [
  59. #define ITCCHEN_SHIFT               236 d* K$ O7 b# @( l) w8 M
  60. % C) p* F" v2 L+ H7 @8 H9 X
  61. static volatile int irqraised1 = 0;
    2 L/ m3 k0 `. P* O- ~' y1 ?
  62. static volatile int irqraised2 = 0;
    ; {6 {7 V5 X. @2 e- z% [6 ?

  63. ' K4 T8 P2 G7 M# j' p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Y" ]0 b. ?! \% N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 w, _: i: _6 f2 i# R* _  z4 a1 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }* \- |; G& q) ~7 `
  67. # V" O7 [- E. T: Q
  68. dma_addr_t dmaphyssrc1 = 0;0 Y" d; ?) Y* A0 `( w7 ~; Q! a2 M. Q5 U
  69. dma_addr_t dmaphyssrc2 = 0;5 y5 I- E3 |' A' O, \' e- C5 p
  70. dma_addr_t dmaphysdest1 = 0;
    ! U& j/ u) h* o: q. W' m
  71. dma_addr_t dmaphysdest2 = 0;- R: S6 D/ P6 H9 ]; {$ o, F
  72. ! y" h& @' w! J( F) ^
  73. char *dmabufsrc1 = NULL;9 ?$ {* L" n, C' d
  74. char *dmabufsrc2 = NULL;
    4 _2 _% I+ ^/ d4 _' b3 P
  75. char *dmabufdest1 = NULL;
    ( A' q3 y/ i) s0 q* f( T
  76. char *dmabufdest2 = NULL;
    6 }6 i, p. e! S# W5 d; A
  77. : S5 s( j4 d2 Q1 N" m4 ]( A# ?
  78. static int acnt = 512;( z) _5 _5 @/ l" o$ q. l2 d' b+ C
  79. static int bcnt = 8;, _, ]/ I/ ~5 X( \# s0 q* q' N
  80. static int ccnt = 8;/ W; n8 }2 O- `
  81. . R/ R# f6 r9 y' |. B" `" t4 a
  82. module_param(acnt, int, S_IRUGO);2 c& s) `- b! ?
  83. module_param(bcnt, int, S_IRUGO);
    : U, O4 \7 ~6 [" o- h, j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* z. I) F  H. L* b0 j3 l* L% X
4 t! ]2 U( u: g  h1 s. k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( Y3 W& P. f& A2 t/ I  z+ Q8 |0 iarm-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 ^- Q3 l9 n, ^% u8 C: Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ i) {6 f" b0 g

3 b& a/ @, n+ ~6 l" |- P& H: d1 P& O0 h( @& i+ I  ]4 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 23:49 , Processed in 0.035814 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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