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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 A) K. \2 f+ i8 m1 h* ^+ m
  1. [code]EDMA sample test application1 V7 z# i3 o8 n
  2. /*! T7 @! M& Y& |( Q3 v+ m5 B
  3. * edma_test.c
    5 t! e3 j  B9 a% f" t8 [% H
  4. *
    0 B! {& A6 ]' I: l
  5. * brief  EDMA3 Test Application) P( N+ s! k2 `' z# V, N6 g
  6. *
    : `; U7 z  d7 g, L2 j: i
  7. *   This file contains EDMA3 Test code.- e% [2 `8 D& ]* f8 |' ?
  8. *
    + l% ?# }0 j# O# l( k6 ~( t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ @! `7 M8 o6 \, ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 g+ Q9 ~+ }& o% g: _) O
  11. *         TO CHANGE.
    : @* x, d! m$ l8 z5 F3 H
  12. *+ |* P" M) E3 K: U1 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 a6 Y* O; L, E1 {( S& R8 e
  14. *
    7 v* S1 N6 W3 m+ L3 y) k  f$ g$ d
  15. * This program is free software; you can redistribute it and/or! w3 y) S! u$ ]! u9 o3 V& ]! A
  16. * modify it under the terms of the GNU General Public License as
    ' O! o( z5 x! G/ y5 l) f4 h
  17. * published by the Free Software Foundation version 2.
    5 Z$ X5 t  X& i/ P! Q/ S
  18. *
    4 w7 ?! s/ l2 p$ J0 f( |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. J& K; a1 [% t8 v+ s7 O4 t' z& C
  20. * kind, whether express or implied; without even the implied warranty
    % Q6 W( R. S) c" ~  @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ o/ l9 d# [. p  U" K! H
  22. * GNU General Public License for more details.
    - F( \, \! ?' ~6 n, N6 ]
  23. */- B5 P0 c! y0 C' n1 W' }& o
  24. * o9 f* v6 O9 \( ~4 P
  25. #include <linux/module.h>
    ! b+ ^$ b2 V- `- G
  26. #include <linux/init.h>
    6 z$ T: s# Q/ b5 [1 q
  27. #include <linux/errno.h>
    1 E% g. k1 `' |/ d  N- N
  28. #include <linux/types.h>
    0 ]& y8 ~1 K! V, ^
  29. #include <linux/interrupt.h>: U. ~( Z" W+ X, f5 m' T
  30. #include <asm/io.h>& q8 O6 w/ i- e
  31. #include <linux/moduleparam.h>
    , J. }2 O; [3 ?  u
  32. #include <linux/sysctl.h>* U: O8 ]9 D9 }9 N. S* Y
  33. #include <linux/mm.h>* ?$ ]+ o7 w9 O" z% L
  34. #include <linux/dma-mapping.h>
    ) j( u) ]4 ~, U. G0 h+ E

  35. * c- ?/ i. w0 T8 I  g2 T
  36. #include <mach/memory.h>0 ~" ~/ @0 U4 z. [# Q& U- {3 [8 h
  37. #include <mach/hardware.h>& ^3 e/ r* R, p' ^' k+ `' d  y* F
  38. #include <mach/irqs.h>5 u2 g% c& r/ v/ J) a' e
  39. #include <asm/hardware/edma.h>  a) j9 w  |1 Z6 @

  40. " A& K6 S; V% I% e
  41. #undef EDMA3_DEBUG) J' J0 }3 k' l6 L. L! Z
  42. /*#define EDMA3_DEBUG*/
    1 V3 L+ h5 N" N" P% b1 {

  43. ! ]' Y1 w, ~& a+ K0 ~1 g! [- j
  44. #ifdef EDMA3_DEBUG
    : v, R9 [& J& V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  j* \0 K& ]8 ]7 j# h" e1 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). \( |' p3 ~3 n7 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 J3 j, r, d+ x5 B
  48. #else
    & E7 L! f; @8 l+ C
  49. #define DMA_PRINTK( x... )
    + t  [! c# ^( Z3 [
  50. #define DMA_FN_IN( u$ Z, E- a, T& i, O0 N5 V8 w
  51. #define DMA_FN_OUT' G9 Y; ]6 f3 H9 X: P; a0 e+ n
  52. #endif( [, I# G4 l' V- [8 b( O
  53. 6 j3 Q' k4 W) E7 c- I  r7 |6 b, L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - @; S6 g4 ^5 \8 \
  55. #define STATIC_SHIFT                3% V4 S0 k  e5 _. z( h
  56. #define TCINTEN_SHIFT               20  l0 J. \1 [0 c2 i% k* T. w
  57. #define ITCINTEN_SHIFT              21
    6 ^) h8 V6 t5 A
  58. #define TCCHEN_SHIFT                22: c1 o( o- {( \: M0 A; P6 q
  59. #define ITCCHEN_SHIFT               232 \8 e- O5 b+ H% I' v" |

  60. ; V: W* ^" ]- S! M
  61. static volatile int irqraised1 = 0;/ [5 B- B2 X# H- I2 R( m- l
  62. static volatile int irqraised2 = 0;" C* Y8 }# T% j# c' I
  63. # {4 I) X# Y1 U0 U6 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" x3 g: y$ R! O4 u. o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Q; K9 x! G5 p$ E0 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 L) U; n0 a9 V7 Z1 w- \' X

  67. % V" |! k4 @% c2 w: d2 k7 _
  68. dma_addr_t dmaphyssrc1 = 0;$ ^5 h# q6 }! f1 B& z
  69. dma_addr_t dmaphyssrc2 = 0;
    4 v9 a1 i: t$ Q9 d3 a
  70. dma_addr_t dmaphysdest1 = 0;
    % K' J; U. T$ U6 x) T9 Y6 O
  71. dma_addr_t dmaphysdest2 = 0;
    ; `" L- L! i/ k7 f% O6 I$ K
  72. ; l7 F5 y# p# C. a
  73. char *dmabufsrc1 = NULL;9 ?8 M$ I+ U( X
  74. char *dmabufsrc2 = NULL;8 q# e3 c+ s* s8 h( C6 d! W8 J
  75. char *dmabufdest1 = NULL;' K$ d9 |' e8 M) W4 c5 Y
  76. char *dmabufdest2 = NULL;
    ( E6 `8 z% z2 [
  77. & r* D9 @5 n; M; N  V* K5 B
  78. static int acnt = 512;
    7 ]" \% w1 U2 S
  79. static int bcnt = 8;
    . J0 D- |% r: @7 i' S6 |. ~1 y) R& B
  80. static int ccnt = 8;
    - ?) Y: M0 u9 `  h8 F5 n

  81. # Y. m) R$ q, n$ d# K  J" M) R/ Y) K
  82. module_param(acnt, int, S_IRUGO);  a, D2 y$ U. h9 U8 Z+ W" K/ E
  83. module_param(bcnt, int, S_IRUGO);2 ~" j' T( B3 N2 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; k* \6 Y7 t3 n4 {) r

: U/ L/ z; m4 F9 ~) `8 R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( z, P: ?# I' O% R5 m: A5 S7 ?5 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 N3 C* r1 f8 i* K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- \9 U1 F8 A! `2 I- `
- Q' i/ e# x7 K- {4 {
+ [9 H' t9 i; c; Q3 _9 A- _8 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 14:29 , Processed in 0.037820 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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