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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 {. _, U8 b; V5 N
  1. [code]EDMA sample test application
    , w* |% ]8 J! k3 t5 E! r" w
  2. /*
    $ B2 L  J4 }* b% [3 J7 d
  3. * edma_test.c
    / [: G3 E9 @4 H8 |/ V! e
  4. *& {0 w% }2 N$ T( r2 y  V- s# q
  5. * brief  EDMA3 Test Application8 i2 f2 r* t4 ~& `& s
  6. *" T) P9 H2 Q8 s/ n8 e( B; q9 w9 W
  7. *   This file contains EDMA3 Test code.
    * q/ I5 }, {! A* [0 y( w
  8. *
    ! b' K. v, ?% f% y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      a) O/ j9 U) f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 V9 g& l2 t; B: `
  11. *         TO CHANGE.
    , u0 Q* @1 M# I) ?! b- |" M* |
  12. *' ~/ p1 e' V7 L" Y  g$ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, y# e- \: U) Z5 ?5 b# ~$ L
  14. *- w5 A: m. d2 U: c) \6 E4 N* z
  15. * This program is free software; you can redistribute it and/or
    , a/ I+ B# N& O! x
  16. * modify it under the terms of the GNU General Public License as5 ]5 K2 ^/ t8 F- s: B5 {: K4 b
  17. * published by the Free Software Foundation version 2.# @. F( K% j9 r+ F8 L5 u
  18. *4 K. @4 v/ \% A, A1 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( [$ w  u. D4 u7 i
  20. * kind, whether express or implied; without even the implied warranty* O& L5 l' y. W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! s5 j9 g; {: v0 R7 P. k
  22. * GNU General Public License for more details.
    4 ]) c: _! I) J; `' I4 D2 O2 Q( o
  23. *// u" O, y2 c; ~& N9 Q# T& k6 W
  24. 8 }6 R" `# c. p( V$ d* W; e
  25. #include <linux/module.h>$ V4 F7 C' e& G+ d
  26. #include <linux/init.h>% c5 X- X* A' W" m8 x2 t. T
  27. #include <linux/errno.h>
    % g. d# ^( j0 j% U9 Z4 ^( G
  28. #include <linux/types.h>2 g% ]7 g3 X" I; o
  29. #include <linux/interrupt.h>3 w! t5 p9 Q1 o$ r* Q  a( r% a6 C
  30. #include <asm/io.h>
    ' u/ C% _& C: W9 f' N
  31. #include <linux/moduleparam.h>/ |3 W2 t6 I8 i
  32. #include <linux/sysctl.h>
    ( S: x2 I3 R. ^2 s$ `2 R" ?
  33. #include <linux/mm.h>
    - A- r  l! V5 R5 O9 I- w  h# e
  34. #include <linux/dma-mapping.h>
    ( ~% X% D/ O- q* b% I# J

  35. 8 D: {2 e" ~5 }4 M) h) L7 w
  36. #include <mach/memory.h>
    ' h7 c- A9 F! Y9 b  c& g2 Y
  37. #include <mach/hardware.h>
    , T+ U" W: ?- g5 q/ ?+ W
  38. #include <mach/irqs.h>
    4 `' r1 x7 `( }+ k$ t) m
  39. #include <asm/hardware/edma.h>! n) ^, ?, |* A0 f8 M

  40. ! C6 r( [) x0 D6 z" ]
  41. #undef EDMA3_DEBUG2 U% T0 e$ }% `0 Y+ ~
  42. /*#define EDMA3_DEBUG*/0 M9 c) f# ], B1 i3 v( A3 ^
  43. * C$ @6 u& E, J" Q! j& s3 f
  44. #ifdef EDMA3_DEBUG
    ! j2 e0 o( |% K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( C/ {/ S! ~: J  }1 x' N; p- |: {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . I; O8 Y6 w4 @" {1 m3 P+ D, J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 A, X* r9 P) {5 K
  48. #else
    + z+ n" U- l5 X4 z: s
  49. #define DMA_PRINTK( x... )) `/ }8 O7 q( ]4 Y1 W! K6 B
  50. #define DMA_FN_IN( o1 I3 U' T4 e6 T3 [
  51. #define DMA_FN_OUT
    ' ?3 o- f: O0 U8 \; g: K8 e
  52. #endif6 P  f& r# c7 T0 u! b
  53. / N( L/ b2 L, g2 D2 C- j5 e9 a3 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 ?& Y% f3 D6 U2 d1 k4 @
  55. #define STATIC_SHIFT                3
      B6 o* d  G9 m8 y0 H
  56. #define TCINTEN_SHIFT               20
    : f. H. T& T: m9 ]
  57. #define ITCINTEN_SHIFT              21
    ; p4 k( {  \$ l0 X. H8 w* C# R% p2 Y
  58. #define TCCHEN_SHIFT                22
    5 {6 v% s: [2 D1 t1 n, R4 l
  59. #define ITCCHEN_SHIFT               23
    + O$ f  V( Y4 t

  60. % [0 P" [  u: @; ~# v( w# Z4 y, T
  61. static volatile int irqraised1 = 0;# @; o2 R) Y+ Q. y, p; e: f
  62. static volatile int irqraised2 = 0;
    ! d* V$ P9 r9 f  A7 w) X% Z' z

  63. 3 g# E% Z8 r# u7 V: H2 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " H$ @/ _* y2 C6 d4 w- b# @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 b1 E, B; N. M& }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ f6 m9 g3 J' U$ e. E
  67. 6 s5 @0 v4 d" ~. H
  68. dma_addr_t dmaphyssrc1 = 0;4 P* X' N, G4 ^, s, j9 [
  69. dma_addr_t dmaphyssrc2 = 0;
    9 t- `( T. K2 c! R- N, \+ P3 B
  70. dma_addr_t dmaphysdest1 = 0;
      I. a: B; i% \
  71. dma_addr_t dmaphysdest2 = 0;
    # C. N$ m4 G3 C, [# Y/ g% K
  72. $ E: Q( m1 M# N( X* @6 r3 Y
  73. char *dmabufsrc1 = NULL;/ A" @2 T4 R4 m% c$ u- g2 C
  74. char *dmabufsrc2 = NULL;7 B1 P( F7 s- d) p& o4 _
  75. char *dmabufdest1 = NULL;& j! c4 }4 o  W/ t9 l& j) h
  76. char *dmabufdest2 = NULL;. j& D) }# Q- X

  77. ! S9 a: s) S9 p6 |
  78. static int acnt = 512;: p# d2 C' U* @, _
  79. static int bcnt = 8;6 j, P+ o2 Q4 o" u7 M
  80. static int ccnt = 8;
    ; X) ~6 `2 b4 z% X# V& H

  81. * n2 A9 u& Y7 [. x
  82. module_param(acnt, int, S_IRUGO);
    7 W! j/ ^' _' h, ^) J' b/ t
  83. module_param(bcnt, int, S_IRUGO);( X! N5 j& x2 I) h: r* _1 P+ c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; S# f% d. L5 l1 z0 ?: I- l7 x, W# E

/ B" G8 v' T8 G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# u3 I9 d# ]% F0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 L, I/ \( f9 i: y7 y4 P1 e4 b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' v. W' h: o; J
  H% _5 {& P% \4 g0 c8 |- r. @  t. P9 v+ ?2 z6 Y9 B* W" D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 21:39 , Processed in 0.038169 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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