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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) f" d1 h$ x: N, L- b
  1. [code]EDMA sample test application
    " N) ], s4 P6 y1 X' _
  2. /*
    : P% k# C: K. ~3 h& |
  3. * edma_test.c% R( L6 W: U5 M' ^
  4. *
    2 m9 y) i( |+ f; S( |, M$ |6 w9 x
  5. * brief  EDMA3 Test Application+ @. ?8 A+ u; J( h+ K
  6. *
    / d1 E& d& g9 o2 ]7 @- R( `
  7. *   This file contains EDMA3 Test code.
    7 g8 L$ ^7 h, F3 E2 D
  8. *
    7 R. v8 ?/ J! E' w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) j, L$ U# w! A4 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% Q4 c0 W, ^' e. T. L! S- `5 G9 r
  11. *         TO CHANGE.
    % F$ b# E! `7 U( z
  12. *
    + y: z, `& {9 U' ^! ]# g: v6 \; {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 X6 s+ t( U* l
  14. *
    8 V( j! D$ @, o
  15. * This program is free software; you can redistribute it and/or
    ) e$ C  Q! `2 X) {( L
  16. * modify it under the terms of the GNU General Public License as
    . l) K5 ~4 X$ U: j  s$ V! G% e: e
  17. * published by the Free Software Foundation version 2.$ d, q! a- h: q1 e7 i
  18. *
    7 |, b2 x: w( W# ], a5 C: P" @- d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 i+ i' Q: C6 I- j; n
  20. * kind, whether express or implied; without even the implied warranty
    ) W" Q. {& R4 L- D6 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 n( A6 ?. Y- g% ~
  22. * GNU General Public License for more details.
    % J' ^) ?# Z9 ?- i% y8 T9 R6 A
  23. */7 X0 I0 q! L/ [/ P0 U

  24. ! V2 l! F6 U9 m% X; X
  25. #include <linux/module.h>0 d' H3 T0 A; j: ^9 e$ y3 {
  26. #include <linux/init.h>5 S, h) ^9 _1 H7 o: a
  27. #include <linux/errno.h>
    6 C0 S6 j) w' G: }) z( x7 V' d( F
  28. #include <linux/types.h>
    " L) P" r8 L1 x3 u. |! b% x: g. e, T
  29. #include <linux/interrupt.h>
      l% p' Z* Z% F' k
  30. #include <asm/io.h>
    7 U% [2 ?! N: E; R3 ]
  31. #include <linux/moduleparam.h>% T* P$ Z& X* M) Y0 |6 b
  32. #include <linux/sysctl.h>
    : z  }4 J. ~: `7 W
  33. #include <linux/mm.h>
    : B+ K% L( l2 W, {
  34. #include <linux/dma-mapping.h>. K8 g* N2 i% E. |* w% j/ l9 F

  35. ' p) Z- L* H) I% i0 R3 Y! Q! |
  36. #include <mach/memory.h>
    7 h3 m' G' a' a- m
  37. #include <mach/hardware.h>% r/ ^4 f' E. Y, \
  38. #include <mach/irqs.h>6 H: X/ c9 l' K- K6 y: U  G# J  \
  39. #include <asm/hardware/edma.h>+ A; u9 ~. E  t6 L8 n3 K/ O

  40. . `# D/ n! h  [- {* g: P. L2 j+ L
  41. #undef EDMA3_DEBUG
    7 s; Z- p/ a0 E6 M+ h
  42. /*#define EDMA3_DEBUG*/4 L  E* T9 I  n( _4 F- I2 F9 _: k

  43. / K+ f) r+ \8 q" Q9 L: ^
  44. #ifdef EDMA3_DEBUG) Z3 a) C6 e3 ]) {- D7 V' Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 t7 ^' L& i1 d6 M0 J1 N3 D) d& K( t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  c% ~2 N9 ~$ V& D# V7 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 x+ }! X2 C, `( n+ A
  48. #else
    ; A! _- G8 f( B% x/ g
  49. #define DMA_PRINTK( x... )+ N3 S( [# E' P
  50. #define DMA_FN_IN$ s3 a1 o' P: o
  51. #define DMA_FN_OUT
    & U! _* j; M8 L
  52. #endif9 P9 J6 `( Y( }
  53. 6 m. w) ?, A9 H) k5 v- m$ _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 K# V9 v5 X5 e( K
  55. #define STATIC_SHIFT                31 o7 P1 |& g" O1 q! d6 J" x
  56. #define TCINTEN_SHIFT               208 ]% I1 `& J' M5 o( I( R8 M! z
  57. #define ITCINTEN_SHIFT              21
    2 x( g! R& V$ z) ^% }, T
  58. #define TCCHEN_SHIFT                227 h  {4 A! Z" J  |5 X1 B
  59. #define ITCCHEN_SHIFT               23
    1 x; h" {" @, _* U

  60. 7 h7 N- I: w& z
  61. static volatile int irqraised1 = 0;% v; |+ H( O9 p7 y% H- n# u
  62. static volatile int irqraised2 = 0;6 ^% c5 }/ Q$ T7 S' ^; |7 B
  63. 9 y* R2 E! \  ^0 X# @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v9 O( W9 O# ~/ l4 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! [4 ?0 a, {2 E# i9 ]& }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]! V2 j2 S, O, o

  67. . m1 p5 o5 X3 V$ ^" ?: m; w
  68. dma_addr_t dmaphyssrc1 = 0;: s/ L8 X+ _( P0 J1 Y( _
  69. dma_addr_t dmaphyssrc2 = 0;
    ) Z) ^- Y! i6 D6 y2 {
  70. dma_addr_t dmaphysdest1 = 0;: _9 `- z. i( S5 A
  71. dma_addr_t dmaphysdest2 = 0;; E  I" K) N2 C

  72. " `) {" O( i* v1 c: z$ @2 ?
  73. char *dmabufsrc1 = NULL;) K% X' @6 T  e/ u* A# A+ h
  74. char *dmabufsrc2 = NULL;$ y/ M* x( p7 [( r6 C
  75. char *dmabufdest1 = NULL;! b+ D  T; o# W% G# f
  76. char *dmabufdest2 = NULL;
    8 _5 y. K- H# |* z
  77. . ]2 k% X  g5 c9 c) k0 P, P
  78. static int acnt = 512;8 l' g+ J4 L4 F
  79. static int bcnt = 8;4 R' q% o8 _) Z+ l! k
  80. static int ccnt = 8;
    : S' @2 F& s3 U; {

  81. $ W1 E9 C3 {( v* v
  82. module_param(acnt, int, S_IRUGO);
    # T3 ^0 _' P( |; \" O  b6 K
  83. module_param(bcnt, int, S_IRUGO);/ o  ^9 |) l3 M3 u3 C5 E% R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 z1 [, B4 d0 |4 |! W5 S
3 v0 T% g/ S4 a, c5 s. Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: y- X; I4 x2 |4 Y7 U8 n/ I9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 M( u1 {# L9 t1 H3 A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% E: b) P% I2 m5 E6 Y. [% ]
2 b/ D8 N8 W  H9 I* ?; W1 Q
! Z, J' p* H' _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 17:03 , Processed in 0.039839 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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