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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 z2 z7 T7 i  j! N; U- h
  1. [code]EDMA sample test application
    * D% E, t3 X( o, M
  2. /*
    4 G- g! [7 q& q2 G/ q3 m! M6 [
  3. * edma_test.c) \6 y/ t- i5 `! R" h
  4. *+ r5 f2 b2 [2 K! t
  5. * brief  EDMA3 Test Application
    1 r6 \& U, I1 w% S: s
  6. *- W% W5 t7 [* C
  7. *   This file contains EDMA3 Test code.7 i: g0 o; \- [- a, m6 e' k
  8. *
    : c& d- u8 i7 f2 u3 C& @/ P# c7 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % N! H0 n- W8 k& ?1 Y: O* h9 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ F, A# Y, I& x$ ^6 o* o
  11. *         TO CHANGE.
    1 b8 |# h9 C( J
  12. ** s  Z- R  c0 }0 h: c2 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( Y" P. ?' V. S, P$ o. _. ?0 _
  14. *! F5 W, `/ ]0 y4 T& B
  15. * This program is free software; you can redistribute it and/or
    ( d2 O* ]" k0 w+ N- r3 x
  16. * modify it under the terms of the GNU General Public License as
    ( ^, w; t" j* o! J/ N
  17. * published by the Free Software Foundation version 2./ s+ l  m0 ]; f
  18. ** d5 A4 h( v: e1 C0 j- o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + H, m! f2 @5 J: k) P: E
  20. * kind, whether express or implied; without even the implied warranty5 m$ f, T: I! F' B7 c6 P- e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 w8 t4 r8 ?5 g6 t1 G8 P" O8 l
  22. * GNU General Public License for more details.) W3 ?& b4 E) [1 D/ `' C! G! D- c4 Q
  23. */3 o4 C7 G; H5 U
  24. ' P* i) c8 l: C" T# S
  25. #include <linux/module.h>. r& L4 O! z7 S0 d. Y0 h
  26. #include <linux/init.h>* ^& @  ^' @( j0 {! ?, f' i
  27. #include <linux/errno.h>
    0 K# T; \+ P0 T2 i' m! [
  28. #include <linux/types.h>
    ! v2 o" g# R5 C4 m' t
  29. #include <linux/interrupt.h>4 u  t- Z2 [6 |2 V) D
  30. #include <asm/io.h>3 e, Q& O* C; _2 o2 u% q
  31. #include <linux/moduleparam.h>
    ( d- r2 m" K7 h: |5 v. D# {
  32. #include <linux/sysctl.h>
    * S1 l7 ~' B5 }# T: f
  33. #include <linux/mm.h>
    , \" I9 n/ B: r! v
  34. #include <linux/dma-mapping.h>
    + @- \9 k9 n5 M
  35. ( m/ X, M4 t3 @" F, ~/ _8 C& k
  36. #include <mach/memory.h>
    . C$ A/ G' v4 K1 s4 S% u
  37. #include <mach/hardware.h>
    + J: ]* g- f; z8 f! y
  38. #include <mach/irqs.h>
    , \4 Q4 k4 Z+ p
  39. #include <asm/hardware/edma.h>' u0 g( m' P6 Y- L
  40. ; X* M# P/ C5 X4 e% {6 d
  41. #undef EDMA3_DEBUG
    " s, h1 L- U4 v- l, b
  42. /*#define EDMA3_DEBUG*/
    ' N! G3 d; L6 Y2 h$ L% R* m

  43. - q+ s% g" B/ a2 I3 D- j+ r/ v! p$ E
  44. #ifdef EDMA3_DEBUG; C2 b  U8 r& E/ F1 V& Z$ [  ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- Q9 r5 g% ~' {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 I  I% N% G( Y2 j- s+ r+ D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ E3 b* U: D% h# x6 o7 ^1 \
  48. #else
    % ]. B, A  a+ |9 V5 @6 ^
  49. #define DMA_PRINTK( x... )1 y: a& _  R/ z+ ?: S: I: R
  50. #define DMA_FN_IN* d% t3 K4 k& X8 F) b  g
  51. #define DMA_FN_OUT
    / T  T) I; \) F
  52. #endif
    2 R+ T. U) {7 s4 a/ S* d
  53. & C. k3 }: W$ `6 {/ ?. D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ @  G$ l! C  U. h: A; o: G
  55. #define STATIC_SHIFT                3# f% ^2 E7 `4 f# T% w# L
  56. #define TCINTEN_SHIFT               20
    ; q4 Y8 X5 a  m0 y
  57. #define ITCINTEN_SHIFT              218 n' E+ v1 e( D# Z" B4 H4 L
  58. #define TCCHEN_SHIFT                22& Z0 M+ X; s& f! c0 N3 I
  59. #define ITCCHEN_SHIFT               237 T5 {8 ]2 Q8 j( [
  60. 3 [( F3 r( z; \' Q0 z  G
  61. static volatile int irqraised1 = 0;
    * F& L; X" U' v7 f
  62. static volatile int irqraised2 = 0;
    ' V" A4 z; W# ]! q% b3 S

  63. " T+ D8 `" t$ k9 C  i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 m& a' V' c/ _/ w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 T1 d  K% `% W2 [/ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Z* w5 j* C5 x- Q" r

  67. # \3 q6 `: y0 w
  68. dma_addr_t dmaphyssrc1 = 0;0 J7 J3 X- v* E. S: b4 j; T; {
  69. dma_addr_t dmaphyssrc2 = 0;
    3 I* Z' I6 m( U" f
  70. dma_addr_t dmaphysdest1 = 0;  e1 h; g/ _: C$ l; W. @! I
  71. dma_addr_t dmaphysdest2 = 0;
    1 _+ P( ~9 l+ k- ^6 O( H
  72. $ m8 W' ?$ Z3 v! p3 Z
  73. char *dmabufsrc1 = NULL;' d2 G3 W* l( J& u& h6 ?2 v; ^
  74. char *dmabufsrc2 = NULL;$ P9 f) O; @9 O* {
  75. char *dmabufdest1 = NULL;
    2 t8 A& h5 |% t0 o% y/ K. g8 x
  76. char *dmabufdest2 = NULL;' g8 w; t% ~; t1 ]; ]! P% ^

  77. # x( [7 E* s$ G+ `& N
  78. static int acnt = 512;2 P6 }& n2 N1 r: q6 U
  79. static int bcnt = 8;
    6 j7 {0 H; {9 S7 n  p/ {
  80. static int ccnt = 8;+ u0 C* q- D  D, a, f, Z

  81. ; d, h( }8 O. ], W9 c3 A
  82. module_param(acnt, int, S_IRUGO);
    $ q3 P1 U+ e1 L' G- ~+ `' n6 _
  83. module_param(bcnt, int, S_IRUGO);! Z2 R) x# x4 `, x' _7 ^+ v) X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; i6 ~) _0 T2 M# v3 v* [5 ~5 d
! O# `# ?3 {; r$ ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ?2 m' R! R+ j0 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; z# k4 B  H' _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 P0 b2 r9 R( v- b( d
, R& n; B+ h: f* P1 W  k! m2 A+ {3 Y, f* ?) {% C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 14:52 , Processed in 0.037978 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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