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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 n& u* q# E$ Q* y
  1. [code]EDMA sample test application
    / n( I: o  a7 G6 O
  2. /*
    * i; k( u' L4 q/ {' K
  3. * edma_test.c8 |$ K  V, L' o- T6 S
  4. *
    ) \* U4 s$ }5 D9 u9 t! M
  5. * brief  EDMA3 Test Application
    ( g4 m) |5 O/ g+ n6 \7 z, K$ g; ^
  6. *
    ' |1 ~( Z2 J$ P  Y, L: Z6 c9 g
  7. *   This file contains EDMA3 Test code.; ^4 O3 _2 B3 ]' V$ i
  8. *
    # t3 Q6 u, a6 G" E0 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' F3 f* s0 }& ]" G4 J  I- \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  V% w$ j$ w3 T
  11. *         TO CHANGE.* W3 c7 V; s* o
  12. *
    $ {8 Q$ K4 D2 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 z! n* Z+ f1 ^2 B1 ]+ \
  14. *2 l  |# [: F$ N0 x5 ^
  15. * This program is free software; you can redistribute it and/or6 v# i- j  L6 y3 b3 Q4 r
  16. * modify it under the terms of the GNU General Public License as, A+ I& ?: H6 |* |( e8 C
  17. * published by the Free Software Foundation version 2.
    ! ^) m5 k$ R- E" Q" @# n
  18. *3 J3 a6 N, X- W) C, p/ @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 B5 ~+ m/ {" R6 ^. Q! t1 k
  20. * kind, whether express or implied; without even the implied warranty
    , u, \& O  `( U  r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) n1 E) D3 C* M; ~+ X( }
  22. * GNU General Public License for more details.
    ; d0 Y' f- i* e. w  E' i
  23. */" _1 S5 ~. J# Q0 Y5 @+ E

  24. & O( w8 f: a. j" ^- d
  25. #include <linux/module.h>' i0 F, o3 `; Z3 K& |* t" y
  26. #include <linux/init.h>
    : a# _. @4 Y6 t
  27. #include <linux/errno.h>
    . X1 d4 q" v0 ?/ A; x
  28. #include <linux/types.h>1 X3 m% C2 b8 n! }9 M$ x! L% R
  29. #include <linux/interrupt.h>9 ^0 c0 v. N2 t" d; E: Q; q# `
  30. #include <asm/io.h># A5 g- X/ J0 g6 ]/ Z9 B
  31. #include <linux/moduleparam.h>
    - t9 D8 ]0 Z; T: a/ g# N- R
  32. #include <linux/sysctl.h>3 m/ r- p) u1 g& ~9 H: h* f2 |- K  s
  33. #include <linux/mm.h>% z1 d- t) E: D5 y9 C! a
  34. #include <linux/dma-mapping.h>
    7 i6 m" y, X, w2 c$ i1 R
  35. 8 x$ @5 t; {, e5 {5 K: C
  36. #include <mach/memory.h>( B0 i5 q3 N0 j0 l! R/ K+ m
  37. #include <mach/hardware.h>! \& v' L, m1 P2 B
  38. #include <mach/irqs.h>0 i! K. h, P9 A
  39. #include <asm/hardware/edma.h>
    " Y* Y& ~" L6 G% o
  40. # X) P5 D( C: I+ h8 m
  41. #undef EDMA3_DEBUG
      b6 D$ W, S/ J* }( a
  42. /*#define EDMA3_DEBUG*/
    * o6 B. ~4 ~1 V' N) R2 I

  43. 7 L" u9 G' }, O1 v
  44. #ifdef EDMA3_DEBUG+ v& B% e' g" J4 `, |7 r! }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ T( ~  W( X& i3 u. S3 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# h& I5 z) h+ a$ ?+ J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ |! o$ _( Z! c! D2 k
  48. #else
    / G) @- a: N7 {$ L/ {
  49. #define DMA_PRINTK( x... )
    * }' W7 b8 n& N; H- h
  50. #define DMA_FN_IN; @& h( x5 q: S# c' [
  51. #define DMA_FN_OUT
    9 D1 V4 P5 X# I% u
  52. #endif
    ( O! k: W9 y- a. g! w3 f

  53. $ J- ^" j1 Y* R3 K7 n& D' {0 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 N" ^1 j" W  n( Y1 I/ T# K
  55. #define STATIC_SHIFT                3( G/ {8 S( N) p* b8 s1 R
  56. #define TCINTEN_SHIFT               20* A' a# W2 e- \% H# {  f
  57. #define ITCINTEN_SHIFT              211 `; X, m9 w% P8 q
  58. #define TCCHEN_SHIFT                22
    * m, Q- y# v" u. C  B: O3 S5 J0 G
  59. #define ITCCHEN_SHIFT               23
    ! f1 h4 W: T0 ]. i# R% b

  60. - c/ e5 S8 W7 F& U5 D. I3 r4 v
  61. static volatile int irqraised1 = 0;$ S6 K0 ~- l2 W$ u
  62. static volatile int irqraised2 = 0;: D5 `; A+ h2 f6 M% o

  63. & J* k- G9 S- E; Z' {- \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& H( H( O% @1 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" w) u" _# w& u! x; m/ \# y) t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F0 z8 w9 @4 e) P1 S( n4 ^
  67. 4 o/ H6 x, f! ~$ m% c% i8 E' K
  68. dma_addr_t dmaphyssrc1 = 0;9 t8 d& o6 a8 o8 m0 f  |
  69. dma_addr_t dmaphyssrc2 = 0;: ?6 r) I8 g3 I$ ?+ X: ~
  70. dma_addr_t dmaphysdest1 = 0;% `) W! A$ ^# p
  71. dma_addr_t dmaphysdest2 = 0;
    3 w9 {4 {7 H( n) C1 R

  72. # c0 I, Y6 t2 s) \( A
  73. char *dmabufsrc1 = NULL;
    3 R3 C" _3 f- f) |* D
  74. char *dmabufsrc2 = NULL;; |: k1 ]& ^& r+ I0 M
  75. char *dmabufdest1 = NULL;+ u# U. k- @  e- I2 z5 e4 H
  76. char *dmabufdest2 = NULL;5 s3 l9 ?) _7 t

  77. " S$ W& U7 W* r
  78. static int acnt = 512;5 h; W1 q% a5 i+ A( g
  79. static int bcnt = 8;! I8 A/ Q0 E1 A2 j# O$ \! i% S
  80. static int ccnt = 8;
    * z3 Y) e$ n- q6 o; O
  81. 8 O7 \8 {+ r7 S; j) m
  82. module_param(acnt, int, S_IRUGO);" ]9 C) l) N4 M  {/ M9 J; i
  83. module_param(bcnt, int, S_IRUGO);- O! u6 _+ B3 k. f3 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; Z2 T/ g( P0 k& r# b- N* C

8 D* F$ J- g' k, y8 _8 G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* U3 B1 w9 h2 ~8 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ q# C) W' E0 x% c7 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& g; S' L4 j5 G
$ n8 u. \9 J2 L/ }1 d* V1 i
  P! H1 P, k$ M. Q* x4 `5 i# g' H8 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 00:13 , Processed in 0.043715 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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