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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 `6 C$ ]- l" Y* }% Y: T
  1. [code]EDMA sample test application. r6 ^, `9 O. `0 H
  2. /*+ E2 M! M5 M5 r' U
  3. * edma_test.c" L  G% H4 N# e, b5 J
  4. *
    1 Q1 u  _, U: `/ f; m# l
  5. * brief  EDMA3 Test Application, V6 N0 z, b4 u; a- ^" S) N
  6. *
    3 D( j) }3 N4 O" C3 f
  7. *   This file contains EDMA3 Test code.
    / q+ y. ~; O& @% }
  8. *" i# F: a/ `; \4 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, V1 l* i4 Y0 }; n0 `( [  L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 U5 R+ Q# C7 p+ a& b  P
  11. *         TO CHANGE.% H( e+ c; k' c( A3 v
  12. *2 S# N% P. n8 e- \) |8 I0 j/ @1 C) f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 X2 l6 i- m9 v3 Q/ l
  14. *
    " V2 v% p) I7 N5 ?0 P- b
  15. * This program is free software; you can redistribute it and/or! w, o- T4 D) B  W: k
  16. * modify it under the terms of the GNU General Public License as# g* g0 c) x5 S& t
  17. * published by the Free Software Foundation version 2.0 ~; T7 H1 ]  ?" p1 \# i
  18. *
    & N% T( ^* ]" @7 y5 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 v( o8 H7 }+ j2 F4 \" I
  20. * kind, whether express or implied; without even the implied warranty6 i# Y, k. g4 ?, D9 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' V1 U* z1 I! f
  22. * GNU General Public License for more details.
    % l  ?. ^1 t1 A! N2 H3 Z+ p
  23. */
    8 Z+ d- h( n+ g& O, v
  24. & t, M4 p) K! b. A! y7 l0 U
  25. #include <linux/module.h>
    4 b! I4 T4 y$ \& h- P5 z! C
  26. #include <linux/init.h>! E) [+ H# K2 ?) c
  27. #include <linux/errno.h>2 T. a: c0 q7 Y& [) m3 l2 ?
  28. #include <linux/types.h>& x, _; w1 ~1 Z, w: U3 c! s+ F
  29. #include <linux/interrupt.h>
    7 v7 t% |- L/ e2 s) u& v/ ^
  30. #include <asm/io.h>
    " q4 q# B' I5 @4 z/ v- P; J$ [
  31. #include <linux/moduleparam.h>
    " V+ u$ b2 O& e  T/ ^1 t  e) U
  32. #include <linux/sysctl.h>
    9 J% l$ D( \* \' H+ X
  33. #include <linux/mm.h>+ i# w7 I  k* w: w: o- I3 t$ n
  34. #include <linux/dma-mapping.h>
    : G6 e* y6 y; M

  35. 1 Y8 k1 O8 m0 ~$ E8 d& q
  36. #include <mach/memory.h>
    ' G* F8 n  T- o1 _" F$ Z6 y  c, |! O/ V4 p
  37. #include <mach/hardware.h>: u  S- r# i& B" m2 j# G8 F3 Y
  38. #include <mach/irqs.h>
    - S7 Q- @! v% s! T: f9 r$ T1 A& k4 I
  39. #include <asm/hardware/edma.h>; n; ]% n* t" C  n; ?9 |/ D

  40. ; X% }) v2 z: Y
  41. #undef EDMA3_DEBUG) W" f% P- E1 k+ W
  42. /*#define EDMA3_DEBUG*/
    ' R# s" G* c/ u/ j
  43. + c& N# T! H) a# B, K* s+ \6 |
  44. #ifdef EDMA3_DEBUG
    * Z% ?; g7 W- x' C, A1 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 F8 {- y" `2 }( V3 g  j. j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 g4 T9 D4 ]8 |8 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# o! ]% t5 |" B3 c
  48. #else7 e9 h* ~) y, |8 F
  49. #define DMA_PRINTK( x... )
    3 ?% v6 M1 j$ z  ?
  50. #define DMA_FN_IN
    " P8 Y  S: k  _; N! h
  51. #define DMA_FN_OUT
    & l. s' R* Y& X: ]4 _
  52. #endif7 B5 X  l9 L" L

  53. 8 j! s: _& v9 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- r8 C/ e, N0 s4 J% s) V
  55. #define STATIC_SHIFT                3
    9 q1 b3 [" [/ T1 b4 `% b- }
  56. #define TCINTEN_SHIFT               200 s& i1 B2 G  X' n( u$ u* ?8 |
  57. #define ITCINTEN_SHIFT              21  U: Y* l+ M7 v1 t) n
  58. #define TCCHEN_SHIFT                22
    ( v& I3 N. @7 @
  59. #define ITCCHEN_SHIFT               236 e6 q# v5 h( a/ Z% g$ T8 K
  60. 9 a; b% V# I) Y/ }5 r
  61. static volatile int irqraised1 = 0;/ _% X  n" [  c( ~. E( w7 ]
  62. static volatile int irqraised2 = 0;; b( L# D1 v! T
  63. 3 x' {0 e2 U9 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( c7 H- A& Q% |$ n/ `$ ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' q7 r( a% Y0 D6 I, O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& f" |: v4 G7 J# s

  67. 3 o- U2 l- `6 C& S4 x) ^
  68. dma_addr_t dmaphyssrc1 = 0;
    ) e2 m- D9 E0 F( W9 w# T
  69. dma_addr_t dmaphyssrc2 = 0;7 j4 O$ H3 P% c( @& }5 r0 M
  70. dma_addr_t dmaphysdest1 = 0;
    / Q# J6 i7 r6 q3 q( N/ z6 z: f
  71. dma_addr_t dmaphysdest2 = 0;; X! q8 Z' v6 ]. u1 X$ f( t
  72. * S* p# ~0 X3 f7 }+ c! A, _5 J
  73. char *dmabufsrc1 = NULL;$ X5 x) V  J8 k, U. A2 S+ ?
  74. char *dmabufsrc2 = NULL;
    7 m/ Y' u4 ]+ z6 K
  75. char *dmabufdest1 = NULL;( A7 y7 z' x0 V" h
  76. char *dmabufdest2 = NULL;9 p9 `9 t( v  q' C+ V0 J2 H

  77. : N# _( y6 v/ p1 Q6 s/ t* i
  78. static int acnt = 512;
    2 g; D# A2 b+ Q, o+ z
  79. static int bcnt = 8;) r% p4 p. G, o' c
  80. static int ccnt = 8;+ a8 M: z8 N, a- o6 p( T0 Y! a

  81. ( s7 d+ Y: P6 }* |2 W
  82. module_param(acnt, int, S_IRUGO);# x* S3 k0 e) x6 ^+ R. P  ~" F$ ?
  83. module_param(bcnt, int, S_IRUGO);6 f; v$ `/ [3 c5 z# }& J0 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ ~4 T" E4 F1 L/ {$ s5 b2 L3 g8 y2 o+ G: ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ]6 S# L0 N) @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# F; E3 J# x- ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 U5 c" L: i% X8 }* [! b
/ O; e7 l3 O9 M! r4 {7 h% {
) B. F8 A5 p! n% k) G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 06:13 , Processed in 0.035187 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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