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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 m# z  ]/ \+ R7 y
  1. [code]EDMA sample test application
    0 a+ P) t  q* B( B; g  }0 @6 i
  2. /*' ]7 X- Z  v0 w2 P" f4 w0 ]
  3. * edma_test.c  o$ W7 a' K' B8 P& B# L
  4. *
    / ~/ ]: q* u5 j
  5. * brief  EDMA3 Test Application
    7 k% I8 V& c  Z1 z
  6. *
    # J6 A5 K# n9 |8 T
  7. *   This file contains EDMA3 Test code.
    ; N& N, P4 Q5 a# Y; Y
  8. *
    5 e$ _! Q0 d+ k/ Y$ w- j! a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( V  a- K) U, x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 H2 X+ R( G- j% f' _2 O& i. m
  11. *         TO CHANGE.2 B, D, U% c! c* w$ |, D- p
  12. *! k: Z* ]# `. v; R* d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * O9 }6 z' V1 b3 \3 X' Y$ f5 F
  14. *
    ; A0 I) E9 \. i  _* q3 r. t
  15. * This program is free software; you can redistribute it and/or
    : w. w  j) }8 s: M! E* P
  16. * modify it under the terms of the GNU General Public License as/ P; X! M5 c6 h( G
  17. * published by the Free Software Foundation version 2.
    " C' T0 \" }5 h. }2 S, E1 x' w; V! l
  18. *
    ( Q4 \! m3 I6 X+ \' @2 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & j1 F) A0 B9 l4 M  d: {4 {4 n
  20. * kind, whether express or implied; without even the implied warranty% g( \5 j# N* Y  Y2 k2 a3 i' f/ \( a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 }9 H' l0 A/ b3 o
  22. * GNU General Public License for more details.' V" \5 f* g# W. F8 E5 d
  23. */
    7 O! [. S; G$ i1 t* M

  24. 5 V% d$ E" F' m
  25. #include <linux/module.h>! Q9 m) E+ z. v5 E
  26. #include <linux/init.h>
    3 Z$ A4 e' K# a; R6 E
  27. #include <linux/errno.h>7 t& J& i# j  u. a3 z# @
  28. #include <linux/types.h>- Y+ S- P2 W7 ~3 j
  29. #include <linux/interrupt.h>6 R  W! }& [4 m" o# P
  30. #include <asm/io.h>5 G- r' b! [( R
  31. #include <linux/moduleparam.h>4 M; V$ H0 O/ L9 [  l
  32. #include <linux/sysctl.h>
    ! r$ y5 n$ l* Z/ @
  33. #include <linux/mm.h>
    + `; L% {& h0 ]. n2 |
  34. #include <linux/dma-mapping.h>
      @- f; S! {4 @3 R
  35. # T1 H4 w; a. n% @& H2 [) g
  36. #include <mach/memory.h>
    . ~5 ~. b% W# y+ p, i, D$ A
  37. #include <mach/hardware.h>  h- A9 S8 j7 y$ n* u- c' I; z
  38. #include <mach/irqs.h>
    $ n: n6 c/ p, o" M; T( c
  39. #include <asm/hardware/edma.h>. x1 c* _. b! x5 O7 E

  40. : n! h& b9 E% Q2 [- _3 W
  41. #undef EDMA3_DEBUG# a8 ^& d$ v+ O& J$ J# H
  42. /*#define EDMA3_DEBUG*/( d  A# ^8 h( M
  43. ' w: v* R* R" t+ Q; V2 [
  44. #ifdef EDMA3_DEBUG8 x1 p7 W( l0 t3 y8 U" c; f, V: Z/ G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 ?# E. a, b( }- q5 C! g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  z' h. d% r0 Q! Q& i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 u: H% O  ]( b" {3 w; b! d
  48. #else
    0 ?; H. z5 G8 ~# D/ {% t
  49. #define DMA_PRINTK( x... )3 H- z0 {/ f) }: ^( E5 q
  50. #define DMA_FN_IN
    ; D  K( x7 ~: {5 A3 V4 ~
  51. #define DMA_FN_OUT% d1 U& L) a& ^
  52. #endif
    * H* x1 g2 T2 R/ m% U
  53. 4 k/ S/ H8 {/ Y" |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # q8 D- h; V, {6 d! P; G
  55. #define STATIC_SHIFT                3! `1 x* S2 y6 J; c  D+ {; O
  56. #define TCINTEN_SHIFT               20
    * ]' i( u0 m; h1 v) U
  57. #define ITCINTEN_SHIFT              211 q: j; a& G( y  y
  58. #define TCCHEN_SHIFT                22
    + o# L  C3 f2 {  J" l2 X
  59. #define ITCCHEN_SHIFT               23
      t! ~) v2 s8 j; }

  60. % x  h- U( }' j+ f3 ?" s
  61. static volatile int irqraised1 = 0;
    6 c% v3 [& s) p- e# G# N/ M
  62. static volatile int irqraised2 = 0;" o  M4 [3 e& o* k7 z
  63. # g2 C  j, {9 N' |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 o8 C1 n/ _+ L3 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m9 C! h. t  b# l* Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% F; ~4 y0 Z1 r5 E6 j1 r

  67. ) }$ Q- m! h1 X4 _. J
  68. dma_addr_t dmaphyssrc1 = 0;# B. `9 ?0 K; k# [. C
  69. dma_addr_t dmaphyssrc2 = 0;
    5 Z3 a) t, b! M9 v+ m
  70. dma_addr_t dmaphysdest1 = 0;
    9 z1 X, T; M" u/ T4 p
  71. dma_addr_t dmaphysdest2 = 0;
    9 @1 ]  ~" E) `2 L0 K; T' J6 V
  72. 3 U& m' g5 X, V; C
  73. char *dmabufsrc1 = NULL;+ y% U( p" i7 K7 Z
  74. char *dmabufsrc2 = NULL;
    2 T( v* w( `& W4 P: v
  75. char *dmabufdest1 = NULL;
    / M2 D; t" f2 I
  76. char *dmabufdest2 = NULL;
    ; Z" w+ _" o! k9 ]
  77.   |' c; z: @# ^- E
  78. static int acnt = 512;
    / r7 p/ W- x  S& c
  79. static int bcnt = 8;1 k+ F+ C* O# ^9 y, N! k% R. N
  80. static int ccnt = 8;
    8 M/ @; R1 s* {# `& ~' W7 ~
  81. 0 p/ n2 B* b9 ~; B
  82. module_param(acnt, int, S_IRUGO);5 g" l  F; v0 g; q6 p( G
  83. module_param(bcnt, int, S_IRUGO);6 j7 A% |' z4 N! U& k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% j  c0 d' f( ]& n
! q" V$ L3 m5 `- o! ^+ p5 V) R0 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" L2 U& p# G) n- n7 V  y- x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# F5 e+ ~; b1 _2 n% |1 e) D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( c0 i" W, [8 }, Z0 W
/ E* `* x& Q1 T: p& U. s( H9 d$ \
3 Y8 E, u- Z1 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 17:34 , Processed in 0.050248 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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