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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! J  P& R5 m* J! w. X, l* H
  1. [code]EDMA sample test application3 G# {/ h+ J9 [5 j% V9 b0 D$ d
  2. /*: r6 Z8 [0 P7 L' w/ P( u
  3. * edma_test.c
    $ B- ^- q$ s  n0 K/ z4 T
  4. *$ f: v$ |, `. O9 H
  5. * brief  EDMA3 Test Application3 ^6 j7 e4 r. x: v* |' ], g2 V! T
  6. *1 t( R/ J* _2 v. S
  7. *   This file contains EDMA3 Test code.
    $ |; _$ s" a! k, `4 }  h
  8. *
    1 \4 ], F, W: R* Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % @7 X, Z  |' q' h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 i, L0 U/ O2 r& \* u
  11. *         TO CHANGE.
      l& D' L7 b8 y! n0 O  p
  12. *2 K: n; K! @6 Q* A" F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 b& p: y9 v# x
  14. *$ q# P9 p3 G3 G* j/ S
  15. * This program is free software; you can redistribute it and/or2 W& f# q! P/ B3 @
  16. * modify it under the terms of the GNU General Public License as
    - A( s$ A1 `5 u' K
  17. * published by the Free Software Foundation version 2.
    # `2 G2 f+ h; G9 X, R; E% V9 e, h
  18. *
    ! q0 p7 {  f+ I% d/ Y  x  U3 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ H! t/ B5 P& l: p# E% P  Q
  20. * kind, whether express or implied; without even the implied warranty/ l7 ~$ Z) ]# s4 H" n5 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  i  j  ?8 m+ r. G
  22. * GNU General Public License for more details.
    1 z% B. Y7 i2 @0 p# Y; }; z1 c9 U
  23. */- |: d8 w5 Z' g3 Q$ z$ r9 x

  24. 1 `: H! s' C' r' G, v6 a  ~  h# D0 ]4 B
  25. #include <linux/module.h>% w2 l3 C, Y- G0 y" K' c
  26. #include <linux/init.h>
    ; Q! U- P* |: `5 G! f
  27. #include <linux/errno.h>1 @  r9 q4 L5 l5 A$ \' N7 M2 ^) Q/ J
  28. #include <linux/types.h>
    & f9 J- c( b& m. ]9 C+ i
  29. #include <linux/interrupt.h>
    + O+ ^9 U4 d' T6 ?# D% z$ |
  30. #include <asm/io.h>+ ^$ G7 d( F: g: Y) l, G
  31. #include <linux/moduleparam.h>
    ) c8 }7 p5 F& E7 j
  32. #include <linux/sysctl.h>+ C& w8 ]9 M7 m% L: }
  33. #include <linux/mm.h>
    2 E" ^; Z4 h7 i% j2 O$ P
  34. #include <linux/dma-mapping.h>% D$ V# k& m* W% \, r
  35. ! d& P0 w3 i  }
  36. #include <mach/memory.h>
    , D* Q1 b) ?( z$ A8 f
  37. #include <mach/hardware.h>8 r- Q  c( m9 W9 ^3 y! e# B2 j
  38. #include <mach/irqs.h>8 V# c( ?) U5 d5 d
  39. #include <asm/hardware/edma.h>! R4 Y1 L5 j$ g5 t: s' A- f

  40. 5 c7 ^! Q/ M9 G, H3 |0 @
  41. #undef EDMA3_DEBUG8 P0 s9 G# U) C2 C8 h$ u
  42. /*#define EDMA3_DEBUG*/
    . C$ m" t4 e9 G4 }; N$ C; r" F
  43. % G- h! ^: Y8 U5 v1 @$ N) b# K
  44. #ifdef EDMA3_DEBUG1 r6 E( H- Y; Y4 m0 A! i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* {) T/ ^. G1 X% D7 D2 G" p+ v7 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), o1 W+ ~: v1 [3 F" ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( Z! e9 p. A# z$ W: K2 c8 Q
  48. #else
    * s6 o  u4 N* q! M. b: `5 o
  49. #define DMA_PRINTK( x... )
    4 h) z% N2 U- c# @! F
  50. #define DMA_FN_IN
    ( ~5 b1 R8 D- f8 i* t' h
  51. #define DMA_FN_OUT
    0 D4 \# O4 k7 Z
  52. #endif
    ( a, r& h! \+ S, y4 U* k1 M/ M

  53. : m; J# u4 {& K  o- W. |6 Y, V5 t( u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 g: h- `& z0 [1 h* |9 U
  55. #define STATIC_SHIFT                3
    : z+ J( a! z2 \7 D( N! m
  56. #define TCINTEN_SHIFT               204 ^. N& o$ Z1 I
  57. #define ITCINTEN_SHIFT              211 f% N9 t( |1 g8 }
  58. #define TCCHEN_SHIFT                22+ E3 h8 P$ v% K+ C% g6 F
  59. #define ITCCHEN_SHIFT               23# }7 k  @, j' [: u, t3 p

  60. ) G5 `  l: N* V" f
  61. static volatile int irqraised1 = 0;! F. c+ z4 c* ]1 C$ t5 Y0 A' P
  62. static volatile int irqraised2 = 0;
    $ F  S9 `$ {, D
  63. $ ?% e3 s0 n+ w( |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( j, _& N9 K; }8 Z. M7 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! T. D, D& T& B- j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 O! s/ P: q0 W! Z
  67. 4 {; ?+ L% w' }" s; D
  68. dma_addr_t dmaphyssrc1 = 0;3 v4 Y, _; O5 S7 G! Q# v
  69. dma_addr_t dmaphyssrc2 = 0;5 i9 B! A8 v! v$ t; a) z
  70. dma_addr_t dmaphysdest1 = 0;9 H+ `5 f. N: e. G6 g1 \2 H' U
  71. dma_addr_t dmaphysdest2 = 0;8 q( a# K: w8 T8 R
  72. 5 ^+ t8 s; R$ L, h% m
  73. char *dmabufsrc1 = NULL;% A& u& D3 ?; k& ]
  74. char *dmabufsrc2 = NULL;6 h- {1 t0 _: [( w. Z9 X" [
  75. char *dmabufdest1 = NULL;9 h& }2 e% w1 |
  76. char *dmabufdest2 = NULL;
    - Z1 Q4 I3 L( e

  77. * Z7 a; d% \4 T* g
  78. static int acnt = 512;! [) ?8 M$ l  h: N! ^' J5 T0 j( X" x6 ]
  79. static int bcnt = 8;
    / X$ w: X' g$ z/ y# s3 p$ ~$ {& W
  80. static int ccnt = 8;. A0 z9 l1 W! C# p  V) N% b$ q: S2 @

  81. 0 E; |3 z: A5 c0 V
  82. module_param(acnt, int, S_IRUGO);
    & L; q  o- t/ {+ i+ m
  83. module_param(bcnt, int, S_IRUGO);$ Z! y, t: P$ I8 S3 e0 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! V# F' m" H0 j2 T: z% T

4 U$ }* B' y; e5 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 c: o4 P  `, w" F% a3 n( P8 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! _" b9 |/ T0 y3 o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, a/ T8 b* E: m
% |+ E8 p4 n! e. D, l) r/ k7 h% D

* A, K0 v* @) f3 g3 I+ }9 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 21:23 , Processed in 0.038932 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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