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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 i8 k5 e5 Q* n( [6 H0 b
  1. [code]EDMA sample test application5 v8 U, R1 ]! A* q4 V! L
  2. /*
    ; l: [, u: J  V( H1 A
  3. * edma_test.c
    ' D# l. p- K/ f) N$ T
  4. *5 s  S8 r  o% d, B- p! e
  5. * brief  EDMA3 Test Application
    1 S: B: w- u* B5 O0 F4 |* K4 d" q
  6. *+ c8 t( V) `" E( R0 |  A
  7. *   This file contains EDMA3 Test code.
    , G; I$ k; P; A" c0 T
  8. *
    2 d( i4 r6 o* ~& g5 N$ N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , g! x) I- \: f) N6 r9 `4 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& Z! f3 h4 D1 q9 N# b
  11. *         TO CHANGE.. k7 g# V9 D& q) s6 Y/ @
  12. *
    ' j( h! I, ?- M4 y8 @: i6 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ f) t- ~& y% |  J! b  J1 @) V& F  h
  14. *
    6 j8 Z+ I  K! A/ S* c% F" x0 }; }
  15. * This program is free software; you can redistribute it and/or
    & E, t; i' Q% g. @0 U" H& \
  16. * modify it under the terms of the GNU General Public License as
    * f" k! j/ o5 W. L* d" w* Q) Q" h, n
  17. * published by the Free Software Foundation version 2.* O2 x9 z( \5 @$ f8 Z
  18. *
    . L* u- u- P9 v7 U8 X2 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' D, q0 t; z' c  N
  20. * kind, whether express or implied; without even the implied warranty
    3 t' l$ m8 Y  K/ L" \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . u. b* u* U! J
  22. * GNU General Public License for more details.
    ; a: r! @( _+ G/ u/ H) o
  23. */
    6 g" x4 N0 ]! \' D. p7 ^
  24. : ~& a+ X0 M. B
  25. #include <linux/module.h>3 _2 ~/ m1 j; Z7 R9 ^3 P
  26. #include <linux/init.h>9 G' y' ~9 w4 Q- B% t1 J5 @. {
  27. #include <linux/errno.h>
    7 [6 J4 n* d0 R& a- T9 W+ m  _% Q
  28. #include <linux/types.h>
    : h* C+ q3 O2 r8 `3 Y: k0 l
  29. #include <linux/interrupt.h>- H6 l% T: L. B# s, Q# S6 Q
  30. #include <asm/io.h>8 T, O. G/ A* [3 r7 y$ |3 O
  31. #include <linux/moduleparam.h>
    6 U& b: F  K* c+ ]# j* Q8 B
  32. #include <linux/sysctl.h>
    , k( H$ {% U' N4 c& e
  33. #include <linux/mm.h>
    7 u2 r5 k* c  A4 [* P2 U
  34. #include <linux/dma-mapping.h>/ g. X' z8 T4 W, A
  35. ' r* Y+ L# I% I& r  B3 G4 W
  36. #include <mach/memory.h>
    ( d) C0 K; K/ c4 K$ T/ @7 h# _
  37. #include <mach/hardware.h>. p1 x/ K# S0 ~" P: V1 m0 c
  38. #include <mach/irqs.h>% f9 F$ O" Q! ]: h1 p5 w2 G1 C4 U
  39. #include <asm/hardware/edma.h>
    1 x( v' k+ a* j* A/ P) `, }; C
  40. 8 P! \7 K, E9 i. P
  41. #undef EDMA3_DEBUG  U# i9 U- s7 S) a; J/ T* s. X
  42. /*#define EDMA3_DEBUG*/
    6 K; Y: v# @/ e; t, z

  43. ; h0 H. u; r! J8 T' t
  44. #ifdef EDMA3_DEBUG% m* L0 D/ L% T9 j6 _5 x/ a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) P% K8 H: ?3 n) k2 X: Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) y* K7 ~1 M+ N) n% Z" Q7 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) |0 Y2 x# L* [2 v
  48. #else4 A! L. \3 e: f) t6 A+ U$ i/ M
  49. #define DMA_PRINTK( x... )
    . M# p& U# D- a# A
  50. #define DMA_FN_IN
    - U$ P. |. P2 ?0 o9 B* Q% g
  51. #define DMA_FN_OUT
    & V& ^7 m$ l( r0 C7 F- o
  52. #endif& y; m. q# o) ^* n( {* C

  53. , N  t2 u3 j/ M9 a+ `7 n: [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / ]/ t  @! p( A8 L
  55. #define STATIC_SHIFT                3
    & {: `" k6 ^' [9 D3 Z
  56. #define TCINTEN_SHIFT               200 ^/ [1 l9 B+ x, D9 |
  57. #define ITCINTEN_SHIFT              21
    % L( Z2 b5 j# A
  58. #define TCCHEN_SHIFT                22" U* X% M' e- v: q* H8 v
  59. #define ITCCHEN_SHIFT               23
    0 l! S- [' w% {0 \1 K; h  s# D& ^

  60. , @# \7 @4 R0 p3 }. w! R$ a: M
  61. static volatile int irqraised1 = 0;
    ( K5 j, Q  \$ s8 O. c! a; q
  62. static volatile int irqraised2 = 0;
    0 b' J7 H$ K9 }: Y% ?7 q' O

  63. % L5 Y9 s- b2 K# j1 x' R# H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P# K2 y, M, X- R5 T! e- {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 Q/ r3 d0 [4 a/ s# k: ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 m# t8 p; Z: t

  67. ( Q2 F- d& q1 E: z- j* G
  68. dma_addr_t dmaphyssrc1 = 0;6 O) D- x3 q- H3 q
  69. dma_addr_t dmaphyssrc2 = 0;" {5 g8 ^+ c2 b4 L9 [6 _
  70. dma_addr_t dmaphysdest1 = 0;
    * }% s. s3 ~: u
  71. dma_addr_t dmaphysdest2 = 0;+ f# T+ e% u4 z
  72. , b! U! c, E4 f0 N2 Z9 v) C
  73. char *dmabufsrc1 = NULL;
    8 J3 `1 Q' X0 z. J: f
  74. char *dmabufsrc2 = NULL;; x: ]+ j" S) H$ _
  75. char *dmabufdest1 = NULL;  o( O$ v# G( M+ Q+ S; N
  76. char *dmabufdest2 = NULL;
    6 V) _8 l; ^! a/ a

  77. % P) O8 z7 Z( G1 i# c6 K# a
  78. static int acnt = 512;
    6 b( ]) l; ~( H
  79. static int bcnt = 8;
    ( B- y& q/ f- v  B: K
  80. static int ccnt = 8;  i% B6 ?% F/ D
  81. - N: E3 R% n. K- p6 J
  82. module_param(acnt, int, S_IRUGO);
    3 y6 L$ L" }! ^$ b' o
  83. module_param(bcnt, int, S_IRUGO);+ P, P% C+ z" `0 w/ K* ]$ U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ M5 z9 i8 `* v" ?4 ?

% N/ j+ S; |2 a& d# G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# n" ^  t; t4 L; W% g- S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 Z! D, O5 |- {9 z3 [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& C) L, i, i: C) g9 S
2 r, z: \+ a2 f
& I! k2 J! j2 y3 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 13:24 , Processed in 0.038505 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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