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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 a1 V. [( b9 e" u; [' `, |7 S
  1. [code]EDMA sample test application3 H4 e  K; q# @$ D5 G
  2. /*
    4 P3 ~# P9 m+ _% B% l. h
  3. * edma_test.c
    ( R9 @/ P, Q8 y0 l4 X
  4. *- ?2 b6 T, `. y$ Q  {0 N
  5. * brief  EDMA3 Test Application' }' A2 L3 m1 P
  6. *
    5 j: `) N4 G1 m. g7 `( ^8 }
  7. *   This file contains EDMA3 Test code.
    + r0 J# [2 C9 d1 a1 v+ R: ^
  8. *. }! o3 Y& U# \! p) F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & ^) p# C  o; q" B# F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; O8 K8 q( h7 b6 \
  11. *         TO CHANGE.0 ~; x) {& s$ ~7 \
  12. *7 K1 ?: z% W) D$ z+ ^0 I& r; |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( S* O3 t6 `0 ?6 \! ]
  14. *, e, S+ c' v! |: M5 y
  15. * This program is free software; you can redistribute it and/or
    3 W8 |$ d  r9 ]
  16. * modify it under the terms of the GNU General Public License as7 ?: S5 x9 w5 D; F8 x( Z
  17. * published by the Free Software Foundation version 2., J2 V9 w& |' a* a7 l8 L
  18. *; H% }1 D0 `6 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: F( ^2 b7 W: Y) f
  20. * kind, whether express or implied; without even the implied warranty
    0 u1 W8 h4 l, g1 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ N$ {4 M, \5 A; O- N: v
  22. * GNU General Public License for more details.
    : e7 E( F3 o3 U- d5 @* I
  23. */
      a7 X5 u4 H# H+ F3 }

  24. 7 o* l: Y4 }8 V+ O
  25. #include <linux/module.h>
    , D1 z9 M; P$ O4 k( x0 K1 L
  26. #include <linux/init.h>3 b: a8 U7 _  F! M
  27. #include <linux/errno.h>! `+ P' q- H0 Z1 S' o0 x6 h" V
  28. #include <linux/types.h>& B) O6 e) k& M9 o6 R. o
  29. #include <linux/interrupt.h>
    7 C5 j7 i9 J. V8 M! t
  30. #include <asm/io.h>5 G7 V5 B  ^9 ?" ~+ |- M
  31. #include <linux/moduleparam.h>; O) z/ ~& i. j0 f
  32. #include <linux/sysctl.h>
    6 z6 P; T7 J/ [! _' W* z
  33. #include <linux/mm.h>
    / @2 f! M: f/ I0 z1 O/ E
  34. #include <linux/dma-mapping.h>
    ( q6 U  \4 I% d
  35. 3 C( x/ L/ N5 A8 E: e
  36. #include <mach/memory.h>
    8 D" J; z- Y0 o4 |" Y* l
  37. #include <mach/hardware.h>% v/ h: }+ f! Y- o# Q# F
  38. #include <mach/irqs.h>8 j6 K  F9 T$ |7 m2 b+ O) C1 {" c* [
  39. #include <asm/hardware/edma.h>
    % b$ r6 X; w& |- H* |1 ?; u

  40. $ s7 d- z+ Z7 A' m2 D2 ~
  41. #undef EDMA3_DEBUG; F; J8 h7 ]6 d! j, ~+ T/ p
  42. /*#define EDMA3_DEBUG*/
    2 ]' Y  J. |+ n! w1 n* P' O9 v5 H6 r
  43. & {7 J$ p4 g( T) J6 P5 I
  44. #ifdef EDMA3_DEBUG$ b+ S3 m' g5 |( H+ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 h8 F4 ]" p# W. H6 Q9 Z; P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 r  o$ f( W9 k, w' D& n5 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  J$ m# B/ p: x7 x7 [# t2 C
  48. #else0 J% T" P' H2 J3 P- g
  49. #define DMA_PRINTK( x... )
      X( G( Q$ z) W; L. s: I% _/ E% y
  50. #define DMA_FN_IN
    ; _' X: g' p+ _2 T& r1 }
  51. #define DMA_FN_OUT* |2 a, n5 X/ _; ^* ^
  52. #endif9 ]: [+ x+ W, p! m

  53. / E# y. O6 v4 `) O& p  m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 f( @9 V, N0 B( t8 ~
  55. #define STATIC_SHIFT                3% s0 {+ u  c3 O/ g
  56. #define TCINTEN_SHIFT               20
    ! T; J4 {8 ?5 }, r
  57. #define ITCINTEN_SHIFT              21
    ) B' k- [+ A: d& I" B. ?# B9 {
  58. #define TCCHEN_SHIFT                22
    * g: _& W; y* r, r* I$ l' y
  59. #define ITCCHEN_SHIFT               23
    3 ^+ p  D. F  g* H

  60. 0 O: R7 y+ [7 \: v$ P, \
  61. static volatile int irqraised1 = 0;5 D8 D- n; @& z: Q" `" G$ R
  62. static volatile int irqraised2 = 0;
    : ^% W$ j0 U0 K4 W( ]; \& J/ E7 \& B

  63. " M& f4 h0 W+ \6 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 r- O3 E; K8 [! B7 E( C7 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 }, n. J4 r2 K4 C9 }8 H0 G! }% T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * I8 u% e, _5 g

  67. % ~" h( \0 h* b% G
  68. dma_addr_t dmaphyssrc1 = 0;8 t- {6 P8 K0 w  w. m6 _
  69. dma_addr_t dmaphyssrc2 = 0;
      }7 d6 H4 k5 i# i
  70. dma_addr_t dmaphysdest1 = 0;
    - s% `3 o" H( e! q$ Q
  71. dma_addr_t dmaphysdest2 = 0;& G) ~6 J/ e3 R( P* V; z" e
  72. - h" a/ ]% }' X$ a1 r
  73. char *dmabufsrc1 = NULL;
    8 B; t  ~/ U# Q4 n" R: }
  74. char *dmabufsrc2 = NULL;0 s& E6 }2 \+ Q% H$ a* K/ n0 V
  75. char *dmabufdest1 = NULL;
    " q. c$ q. ^4 L- C
  76. char *dmabufdest2 = NULL;
    / w8 y! _; h+ ?  L

  77. / t8 g" X/ h# |) _, L, ^: J* o
  78. static int acnt = 512;
    $ ^& Q/ R" ?$ Q$ ?
  79. static int bcnt = 8;% V% ]. I% ~. ]
  80. static int ccnt = 8;
    * {& `: Q# Y8 K0 H, ]1 C5 m

  81. , K+ z3 t! r6 |1 V$ F! G! K0 _1 ^
  82. module_param(acnt, int, S_IRUGO);* J6 g8 J- p9 v! g9 X% D# B& M3 D
  83. module_param(bcnt, int, S_IRUGO);
    . Q: u# I2 q- e9 D6 i  u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; P* A" w" x6 W& B$ G2 N* Y0 n6 @0 m3 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( |- k6 \0 {  |- c! _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- k- o; L' N3 J; k8 I+ Y1 g, J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% N$ ?) {" o$ K
: \$ ]4 p8 Q* l  s

4 ?7 V; X, a7 S  U$ e: d7 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-10 22:10 , Processed in 0.041378 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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