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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( k6 o( n* R( f9 E) W
  1. [code]EDMA sample test application; O# ?/ w& k1 @% H3 X' T
  2. /*
    # a' |, z; a3 W8 q
  3. * edma_test.c2 a" k6 j2 X- t- e
  4. *
    + k$ N) J( ]+ K( _( ^; c( r1 n
  5. * brief  EDMA3 Test Application
    ' v) Z, _$ a7 r* {$ v0 E, I
  6. *: F: T: B# T1 M9 t. W4 s: J8 p/ z
  7. *   This file contains EDMA3 Test code.
    1 k6 N, R8 q2 m' S, I1 c
  8. *. _; \. [1 Y1 [7 p2 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , h! v5 B, t4 }/ M* y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 s* ~+ |( Z6 N) q
  11. *         TO CHANGE.
    2 K  p3 e5 R6 I4 ]% R4 Y
  12. *7 |1 P% t' S) ?. u) V' C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Y6 ^3 c/ ?5 d2 L8 T
  14. *
    + o/ {" R0 J6 H( A; w
  15. * This program is free software; you can redistribute it and/or/ Z! V3 W- g* q) |4 Y
  16. * modify it under the terms of the GNU General Public License as" ^6 O) q4 W& j) Z0 z. D
  17. * published by the Free Software Foundation version 2.( c/ T: O. v- k  `
  18. *7 {3 V6 o; C# X! W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- C- N" |/ J1 r& ?; f# z
  20. * kind, whether express or implied; without even the implied warranty  f" y- e* E& I4 p# L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 G, ]/ F8 v/ H# c; o0 _, p
  22. * GNU General Public License for more details.
    ! i+ C/ F3 E0 \) q
  23. */# E* k7 z, b+ P5 N, h

  24.   M9 N: ^0 ]9 V' {7 k& t
  25. #include <linux/module.h>
    ! y; e/ ~& ?9 f& X7 l
  26. #include <linux/init.h>) E' H$ v' W" R/ ~6 F: b
  27. #include <linux/errno.h>
    9 S" e/ Z' ~% H  T, x6 E' P$ ?
  28. #include <linux/types.h>$ M; K8 ]# r6 m6 u& I7 v
  29. #include <linux/interrupt.h>9 V0 n7 A0 `1 l4 l2 E
  30. #include <asm/io.h>
    ( X' v, L  R7 h2 ?  W8 M
  31. #include <linux/moduleparam.h>) P$ e( C4 i7 {6 f& |3 U
  32. #include <linux/sysctl.h>
    ! \7 f+ F# U* H7 h# B* A
  33. #include <linux/mm.h>. m, ?$ R, R% I+ [8 ?1 T) T9 E
  34. #include <linux/dma-mapping.h>
    1 @" R- a# H! Y0 _! L
  35. ) U: \( {) u/ ]3 m
  36. #include <mach/memory.h>
    " I$ V6 f# S3 Y- ]
  37. #include <mach/hardware.h>; m1 }; d+ F! L
  38. #include <mach/irqs.h>
    0 R& J9 N& g& Q) H# C# C
  39. #include <asm/hardware/edma.h>! k& C' c" k" ~  H  V- L+ _; W
  40. 3 n- o5 ?, S3 I. V/ ^' w
  41. #undef EDMA3_DEBUG  R' F. `2 F# Y
  42. /*#define EDMA3_DEBUG*/
    1 f7 T# h$ E2 V8 A1 m( l

  43. % D' T2 O. I: P  s
  44. #ifdef EDMA3_DEBUG6 X6 @% ?1 Z+ @3 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 i) l; K3 M2 X2 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 n! [  g/ Y/ q/ l! e+ E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) W8 d; L0 j# H5 P: ~* [
  48. #else* k9 G, J1 Q# y( F4 i
  49. #define DMA_PRINTK( x... )
    # _: R! S" e  F/ W2 n
  50. #define DMA_FN_IN
    # B3 M$ D1 O4 T0 W) m6 f* Z: x. c
  51. #define DMA_FN_OUT
    4 o  R% p% `3 Y& H4 S- |
  52. #endif
    : ^5 G- {- |. W& |+ l

  53. 2 `( Q$ g, r- p# w% O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / ]% p+ [6 @+ m# o4 P4 g
  55. #define STATIC_SHIFT                3
      |4 S* p5 j% n
  56. #define TCINTEN_SHIFT               20
    9 Z: ^# \& k! R- J9 f
  57. #define ITCINTEN_SHIFT              216 u6 t, X  {  n8 l0 X: a, G
  58. #define TCCHEN_SHIFT                22$ j" ]4 q! @, d4 U; c
  59. #define ITCCHEN_SHIFT               23, M/ o2 [  V# [0 N) E; l5 {

  60. : A! p) f- `, J4 u1 H6 w% M2 d% d
  61. static volatile int irqraised1 = 0;. S' p* K3 H' U  l6 n
  62. static volatile int irqraised2 = 0;$ r& {$ {  s- ~, O6 z. G
  63.   O+ W- g6 l' k/ K5 U1 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- G$ N" k: U- J' o7 b1 ~- Z( B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ x" m$ R3 a. c+ m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' a# P. g+ Z% `4 k9 g+ u5 w

  67. 9 N' r$ w5 h- Y1 G7 G; l9 D
  68. dma_addr_t dmaphyssrc1 = 0;3 z  p$ T5 c; X" s
  69. dma_addr_t dmaphyssrc2 = 0;
    ; m1 Y8 k3 n  L6 ]
  70. dma_addr_t dmaphysdest1 = 0;
    ) L0 k0 P- g9 M. l# c5 _
  71. dma_addr_t dmaphysdest2 = 0;% [3 x. g" ?" U8 B6 ~- q

  72. 3 M* \4 a, f' A2 c! m
  73. char *dmabufsrc1 = NULL;! a4 L+ D, z5 Z
  74. char *dmabufsrc2 = NULL;
    5 I; C$ N3 l+ l
  75. char *dmabufdest1 = NULL;
    8 e- c- m9 W; W5 X4 p0 R
  76. char *dmabufdest2 = NULL;
    + i* D8 x0 U2 _! w0 o9 t+ M3 C! Y
  77. " O; d* T" Y7 |% b% y! i8 b
  78. static int acnt = 512;( ~! y) Y2 w3 }4 d- A
  79. static int bcnt = 8;
    0 I. V( z4 L- l; P6 H
  80. static int ccnt = 8;8 w* n$ D) t6 a9 E0 L! @
  81. ! t# b* S8 m9 P$ S& Q
  82. module_param(acnt, int, S_IRUGO);
    ( S- c4 w6 |& \
  83. module_param(bcnt, int, S_IRUGO);2 \6 z- Q3 H2 W* j( |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ R# j% M/ D+ {- _/ _3 q: U
9 x' c' \+ U" ^( w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ F1 ]# r6 S* t! y, Y- @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 L+ g( f; w  v6 |. q( k/ W( ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- d5 {. z5 l* q- w4 {
6 Z- H5 \: p$ Q8 U' T$ w# ]3 a( J
/ L7 j9 d: P+ ^5 c9 X( x( [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 14:28 , Processed in 0.053560 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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