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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : r, u5 H4 E5 R' Q( R- D
  1. [code]EDMA sample test application3 x4 a, G7 h* K  y
  2. /*
    - y7 O" e2 h) ?- `* a
  3. * edma_test.c
    1 u2 }. \5 N' K& }7 G5 A
  4. *2 |. t$ L$ y0 x; G" n; n" K
  5. * brief  EDMA3 Test Application
    3 z8 M# m; P2 E+ ?& U( J% |% ?; _5 t/ Q
  6. *
    3 f0 w8 n  j7 v7 z# f! X- n+ |
  7. *   This file contains EDMA3 Test code.! F4 R5 ?0 u3 ~6 z
  8. *" L$ A* X. x$ N4 z7 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! K7 b( r( {  P8 t& Q$ Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 e5 t  l2 b! J8 M( |" L' V& ^
  11. *         TO CHANGE.* N2 k# @9 M  Z
  12. *. K6 Q( |, c% \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' Z0 g* j  A7 f
  14. *& t9 }+ G8 Q* }+ U" A- r. r
  15. * This program is free software; you can redistribute it and/or" g3 F" _' {- I3 m5 q: b
  16. * modify it under the terms of the GNU General Public License as- i7 A  ^' `  v6 L: o
  17. * published by the Free Software Foundation version 2.
    : U9 X. F/ _# x# O+ N; y8 k  U
  18. *$ H9 `* x# E( d; U5 q6 `( F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . H6 b) Y( I! m; G" b0 j$ [9 {
  20. * kind, whether express or implied; without even the implied warranty
    + }- t6 s: b- K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: ^' o5 p0 M, U3 _5 L
  22. * GNU General Public License for more details.
    * _8 H/ Z  v, Q$ N7 ], H- ^3 s
  23. */$ j) ]- {- Y3 ?

  24. $ Y# c$ N( v/ @( r, Y
  25. #include <linux/module.h>7 L# u0 x/ Z0 z: G1 b) w6 P& O
  26. #include <linux/init.h>
    * w. A; q! ^0 ?
  27. #include <linux/errno.h>
    $ n/ v% _  h& i; X' Z
  28. #include <linux/types.h>& z$ f- y8 c- h' s5 n1 P  l+ M1 i
  29. #include <linux/interrupt.h>
    8 M+ J6 G0 @8 c* u! i; c# n
  30. #include <asm/io.h>
    4 \3 |0 B# K. _# b
  31. #include <linux/moduleparam.h>
    - H& g0 L% I2 B* b- q
  32. #include <linux/sysctl.h>
    1 f+ i3 G4 `6 c7 W) ]7 N& X2 C
  33. #include <linux/mm.h>
    - R4 X- ~0 O" Z" p
  34. #include <linux/dma-mapping.h>
    . n4 q; `3 x" C3 B

  35. 4 a* x. b! [2 _* o
  36. #include <mach/memory.h>
    0 F3 q& o, k- g; R% _
  37. #include <mach/hardware.h>+ `3 J8 U7 Y; a
  38. #include <mach/irqs.h>
    8 B. W6 G% q/ v: P) X! L7 C' @$ [
  39. #include <asm/hardware/edma.h>" _; [" H0 ~* L! C  u+ H6 ^
  40. - O% P& g5 L  p$ _. P1 u
  41. #undef EDMA3_DEBUG" c% w: ^- M% S! `# L  Y( h
  42. /*#define EDMA3_DEBUG*/6 D) ^3 A' V. u* t
  43. $ U5 K" u  w1 o8 f1 [6 e3 U( X
  44. #ifdef EDMA3_DEBUG* ~/ @; R3 [! S5 j8 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) V( _  E- c4 c, ]5 t- o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 b; R  D. p6 d; W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / C- F* `) w+ Z5 J( G
  48. #else# Y0 v. [2 Y1 @5 ~
  49. #define DMA_PRINTK( x... )
    # P1 ?2 ?* u" I3 E6 `4 q
  50. #define DMA_FN_IN5 I  i9 x. I2 s# G
  51. #define DMA_FN_OUT* ]0 `# c1 X5 j8 o
  52. #endif
    ( C2 z- J2 v$ p- ~: v* u/ d

  53.   J7 O# `5 k& h" t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). H1 ]2 ?7 J$ v% Q% L
  55. #define STATIC_SHIFT                3: n1 k" j/ J0 S* a* E% `
  56. #define TCINTEN_SHIFT               202 z. M( x( T* }* f
  57. #define ITCINTEN_SHIFT              21
      c4 j) T- U: {0 e3 j# t" @4 n* U! ^* N) `
  58. #define TCCHEN_SHIFT                222 t9 L- S4 R8 ?9 ?1 o1 D
  59. #define ITCCHEN_SHIFT               23
    6 {, W& f5 y! K1 K# d- p

  60. ! ^6 p5 c' [7 o1 n. |
  61. static volatile int irqraised1 = 0;% P0 Q9 b0 M8 ^/ f; _0 O$ Q! t; b
  62. static volatile int irqraised2 = 0;
    1 `+ l2 r+ j; |8 c* s* ?8 i9 g
  63. 0 C1 M' W7 z; c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , q( c. l, Z1 X# T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " H! \# X2 [+ }5 W1 M7 l6 f$ O& d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . h+ k& a& O0 O4 q( w
  67. * W3 j, g5 @( z7 N" n9 p
  68. dma_addr_t dmaphyssrc1 = 0;
    : Q1 A8 O; L8 k/ ^- Q
  69. dma_addr_t dmaphyssrc2 = 0;
    0 d- W9 |6 |* h: a) F( b
  70. dma_addr_t dmaphysdest1 = 0;3 I; k* B; B# B
  71. dma_addr_t dmaphysdest2 = 0;  o( {6 u$ z' [- v2 j4 e" N( u

  72. : i! q! I2 E% \# Y
  73. char *dmabufsrc1 = NULL;, D3 a% _9 T" S. O! C8 S! ]% ?5 {
  74. char *dmabufsrc2 = NULL;' h1 w% G* B7 H1 I  a8 L9 M
  75. char *dmabufdest1 = NULL;- f  E: k4 M- }; ~! a
  76. char *dmabufdest2 = NULL;3 x, n6 S7 O9 |
  77. 1 z' o2 d+ n+ g- F* @1 K
  78. static int acnt = 512;
    0 c! D( p3 a$ c6 N; p
  79. static int bcnt = 8;
    1 x3 N& u* h6 R( E; m  w
  80. static int ccnt = 8;
    ' i& H7 |. ~# }: l, O

  81. ; t. @2 J, o2 @
  82. module_param(acnt, int, S_IRUGO);
    ' c4 }5 d4 M  m
  83. module_param(bcnt, int, S_IRUGO);  C% `. d, T6 D7 R$ q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' [% O1 Q0 Z- L/ z0 @2 D5 Y) O; T; |6 ]# v1 s; X7 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: P/ a/ S% ?+ U% w% _% p1 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- x- g' X; M8 S7 j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 S& Y0 A+ q' J" ~; S9 ~2 Q2 \3 c* u' i; S

; q8 V4 k5 ~. J' o7 E0 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 20:19 , Processed in 0.038738 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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