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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 e1 `, i: ?& `5 r. I5 J! ~" C) @
  1. [code]EDMA sample test application" S7 w  G# `, F: u" d$ D& Y
  2. /*: |8 T" k( y, v& ^$ y$ ]# P
  3. * edma_test.c
    ( C9 n9 O& X! N
  4. *
    & K: A) T" s3 E+ i0 Z# ?
  5. * brief  EDMA3 Test Application
    5 i; R9 w% E* k# a
  6. *
    ; l2 Z- ]( x3 b4 z
  7. *   This file contains EDMA3 Test code.: K/ Y( j2 h, G* D1 x" \3 R0 @
  8. *
    8 m" g0 ~1 \& u& D  b0 Y% i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . H7 f+ \1 w# v0 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 {2 {2 o' A1 @) r) U' @8 D
  11. *         TO CHANGE.
    1 c0 }" s7 N% V4 o6 Z+ @
  12. ** x; C  V. W5 u; Q/ t1 D' W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- U1 P9 a1 c9 {' s% P$ H9 k; [1 _
  14. *4 _# H% C3 L' N! X# y4 ]4 s0 S$ J: N
  15. * This program is free software; you can redistribute it and/or! Y0 N- J* N8 l2 i
  16. * modify it under the terms of the GNU General Public License as* T9 P, X' z# o& W
  17. * published by the Free Software Foundation version 2.
    9 O" j7 H7 {4 a
  18. *
    ( h6 P. j; F" g7 N9 [7 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 z+ r6 G; C* G9 y8 s6 C/ k5 a
  20. * kind, whether express or implied; without even the implied warranty4 Y; e$ Q2 P) i3 y& Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ N# V/ k; ]# D6 N2 F: ^
  22. * GNU General Public License for more details.
    + w1 s* }4 Z5 w/ f
  23. */
    " l) @! m2 i. y5 o! f+ O: T1 N# ^

  24. " U/ Z9 L6 F# V& p3 I% s
  25. #include <linux/module.h>
    : u- o* J( A4 }" U. g5 |$ H
  26. #include <linux/init.h>
    ( @* R! n9 ^5 k; w2 V
  27. #include <linux/errno.h>
    8 S3 p" f, w: v* H  b9 \0 Y
  28. #include <linux/types.h>
      j) x5 o8 A8 z' g  t' t
  29. #include <linux/interrupt.h>9 G6 L4 }( n( _3 `* r' |
  30. #include <asm/io.h>; }) E4 f+ l& [" t+ A
  31. #include <linux/moduleparam.h>/ x% Z8 {! o# a3 _9 l8 h5 y" w: P
  32. #include <linux/sysctl.h>
    1 S0 B* \) m( a0 o! D$ |" d
  33. #include <linux/mm.h>
    / G( a& p2 S5 h- Z4 \. L# D
  34. #include <linux/dma-mapping.h>. C, g# m  u! j! y  l
  35. 4 W& h0 n5 R3 V- V% Y3 A
  36. #include <mach/memory.h># l' F3 Q# }2 Y% k: e4 E% e
  37. #include <mach/hardware.h>
    ' E8 T( U% n* l0 F! Q. K
  38. #include <mach/irqs.h>
    / Z# H' M' X6 N, w) |% c
  39. #include <asm/hardware/edma.h>& }$ `2 \* ^; q, c* \! a" m
  40. & F8 h# z# E6 r" u, m
  41. #undef EDMA3_DEBUG
    + I9 q% u/ Z1 |$ Z% u
  42. /*#define EDMA3_DEBUG*/
      _: s. i4 g! c$ ^7 P+ B0 s) y
  43. 7 n) K0 c/ y. b) S# G
  44. #ifdef EDMA3_DEBUG5 \# x; _# G# Y5 h3 D, A  f* L, z/ X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 _! [( m9 I3 U  u0 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 t4 _6 Y; y3 P+ q0 {! S/ I7 l* }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      j3 u1 z' g8 m% P6 p# k$ C
  48. #else
    / c$ L, |+ ~6 w9 Y
  49. #define DMA_PRINTK( x... )
    0 q+ k( e/ e6 d) K- _
  50. #define DMA_FN_IN
    ! U9 y. X" }5 O$ X' v
  51. #define DMA_FN_OUT$ k) K, B& e! X2 o' ~8 \5 b
  52. #endif. y# B& T3 W6 E* b5 a+ y
  53. . g- A" H3 W' Y' ?5 }$ C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + b& a6 t! q! }9 z1 x0 g) T
  55. #define STATIC_SHIFT                30 ?6 I7 B" H6 u' Z( c
  56. #define TCINTEN_SHIFT               206 f, b1 w8 f9 U+ q, \* Z3 O/ d! l
  57. #define ITCINTEN_SHIFT              219 v5 N# y# s+ K, U
  58. #define TCCHEN_SHIFT                22
    1 c0 b7 b$ y- Q
  59. #define ITCCHEN_SHIFT               232 L3 m+ }; J$ Q) G3 _$ w

  60. ; Y, J! K" ~0 u+ C/ e4 |% b
  61. static volatile int irqraised1 = 0;
    9 @# z6 `7 x: h! H
  62. static volatile int irqraised2 = 0;% X% S# c3 R1 y
  63. ; @$ c" U$ k6 V/ }$ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ~8 R: p0 r! ~( w" F0 t: o. o9 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # U1 Q* S/ X9 A: B2 V! S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 s% C' [: c! ]$ [
  67. / [+ R2 {4 M$ T2 Q+ k2 f0 d
  68. dma_addr_t dmaphyssrc1 = 0;
    . _9 y! U0 F. P# J) l, @
  69. dma_addr_t dmaphyssrc2 = 0;
    % g# H* ^- y2 ~: J% f
  70. dma_addr_t dmaphysdest1 = 0;
      Z0 a# m4 o4 P. O  y- T: y
  71. dma_addr_t dmaphysdest2 = 0;
    9 W8 n$ p0 j. m# I5 `

  72. 4 U, `6 d% V# L0 j
  73. char *dmabufsrc1 = NULL;
    6 i0 B: Z6 D8 n% w4 n
  74. char *dmabufsrc2 = NULL;
    ) D$ [8 [* r' ?! r
  75. char *dmabufdest1 = NULL;  ?* T% k* {# \4 X* B3 w
  76. char *dmabufdest2 = NULL;1 W; p5 `8 q/ Z6 l% c' Z
  77. 8 T6 ]* {: V# T7 @' O: |, d
  78. static int acnt = 512;
    ( R9 F# t+ _2 h' ?4 O
  79. static int bcnt = 8;! @5 v4 C; u' z6 M8 p
  80. static int ccnt = 8;
    : ^% F7 l  R/ L2 F, \' V

  81. 7 J4 w7 D* ]1 [& S4 b6 {( ~
  82. module_param(acnt, int, S_IRUGO);- \- H9 K: [1 b' J, t9 k6 b
  83. module_param(bcnt, int, S_IRUGO);( }! e6 C: E# R' g5 X# }: k/ G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- H. o6 O! o8 g
+ p/ Q3 }: X5 I% C' V6 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& @- t. m1 g% x# k0 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( j" N. g3 J* L9 l8 a" N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* f6 t/ }2 N: W" j+ k5 g( D; h" K2 O! X
! ~3 X; l" u1 L0 e' t5 m! O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 11:21 , Processed in 0.038571 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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