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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ]4 Q9 Q9 X8 @' _  O: |/ n
  1. [code]EDMA sample test application( G1 R" h8 y9 E8 {) p+ L& z
  2. /*
      ]* Z! i: y8 y# D4 I" k7 ?& [
  3. * edma_test.c+ T; n+ G) V1 F9 O4 {" n2 {
  4. *, q9 k6 r4 C1 V! i9 K2 T
  5. * brief  EDMA3 Test Application
    * A% G) }3 ~* A8 F) d( P
  6. *
    : S1 O3 Y( [. W. I) @5 Q6 ]  S$ V7 Z5 T
  7. *   This file contains EDMA3 Test code.
    4 \. }7 I5 Z" w& m
  8. *
    " R: g) V/ w% B9 l: T. |8 S2 m6 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% k  L+ b7 p7 T, R( t( G5 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 ^5 I& a4 [" O2 s+ r- w7 M
  11. *         TO CHANGE.
    " u( C, w2 T% s* l
  12. *
    ' M. U* O8 i2 X$ h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 S; H' }: T0 R
  14. *
    ' U( e7 t) Z: Y! @9 ?+ }% `+ s
  15. * This program is free software; you can redistribute it and/or
    1 _$ {3 q6 s% `; a4 R$ D& ]
  16. * modify it under the terms of the GNU General Public License as3 Y' A" u! m( k+ o2 ?! y  ^
  17. * published by the Free Software Foundation version 2.+ K4 f# X7 s" B! B) u
  18. *
    9 P% I0 M* a% C$ f3 N- A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( P+ }' U! W( `& U) }2 y* V
  20. * kind, whether express or implied; without even the implied warranty
    % }$ P( r, y+ P. G9 B- U" l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + F& C) Z+ j: [: E
  22. * GNU General Public License for more details.4 C. `2 W8 q( k7 v! k
  23. */
    & Z# d" P" \/ |) N
  24. 2 X+ [1 m+ o1 S5 K9 J3 T! e
  25. #include <linux/module.h>
    ; W: P  _5 f1 q0 h, p7 {
  26. #include <linux/init.h>
    9 K+ M4 F4 n5 B: R8 q( }; @/ Y/ y
  27. #include <linux/errno.h>" y* ~) p7 n. A0 l" I8 |0 b) l3 u
  28. #include <linux/types.h>
    " j9 k4 l" I) d7 O
  29. #include <linux/interrupt.h>
    6 C0 D+ I0 w( q% c4 X
  30. #include <asm/io.h>
    . K" I3 `8 {' e/ \
  31. #include <linux/moduleparam.h>5 d# e9 ?+ C& F3 ~
  32. #include <linux/sysctl.h>
    6 \' T5 S3 c: z5 ^
  33. #include <linux/mm.h>2 H# a7 r. [9 D- ~
  34. #include <linux/dma-mapping.h>) R; c' E' x$ W. i; U; f

  35. & d- g" `6 G' }  V
  36. #include <mach/memory.h>$ c5 v7 O) S: h$ i4 i
  37. #include <mach/hardware.h>
    1 z( Z0 X0 U7 G: B) }' V
  38. #include <mach/irqs.h>
    * Y/ B1 g* w* R/ \! v
  39. #include <asm/hardware/edma.h>; l9 U7 v( o" b7 A5 Y
  40. # S7 n1 ~# N# I1 h; x
  41. #undef EDMA3_DEBUG
    ' i. p0 B: c# O! C4 S' W
  42. /*#define EDMA3_DEBUG*/
    6 `, u1 a) f: p9 N# L
  43. 5 L6 _, V0 b1 n) m
  44. #ifdef EDMA3_DEBUG
    . `8 \8 \$ Y4 ^& z$ f* x* R4 |! k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( o/ s' z/ W6 k. A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 v# E' X5 ]1 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 y7 }3 v# E0 q; [. C+ W/ ]  u
  48. #else
    ( k$ \3 B0 m2 N$ M0 R
  49. #define DMA_PRINTK( x... )9 r9 g* n& J1 S3 G- x
  50. #define DMA_FN_IN! E5 V+ |+ g2 ]6 f# W
  51. #define DMA_FN_OUT
    & h. p* B8 ?6 i. g
  52. #endif
    2 F& g  x, ]* k  Y/ \- h
  53. ( W( i& T; _# `' c3 W# b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& D4 D: p: M4 E! m6 x
  55. #define STATIC_SHIFT                3- ^% P$ O; S8 g9 d' u# X
  56. #define TCINTEN_SHIFT               209 R+ [1 d1 y; S$ q
  57. #define ITCINTEN_SHIFT              21* e+ K6 L* l7 G, S! c) K7 n
  58. #define TCCHEN_SHIFT                22
    ' A- c1 L0 B# W
  59. #define ITCCHEN_SHIFT               230 z  \0 A8 ^6 l
  60. 3 g% [; I6 B( s$ F$ t2 k: b& e
  61. static volatile int irqraised1 = 0;
    ; X' ?, T0 e/ A% K
  62. static volatile int irqraised2 = 0;
    : X$ e' P9 s( o" N' `( i

  63. 6 l( D* v. K/ c0 b+ S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) q0 }& m- q) v/ a1 A+ C2 I  h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 _4 j1 }- F4 h7 p  U* J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ {2 U$ l( ~" f( {: k+ R
  67. ' k' p1 r9 q+ H" p/ g" t
  68. dma_addr_t dmaphyssrc1 = 0;
    - v& C% G4 y, d4 X8 N1 Z
  69. dma_addr_t dmaphyssrc2 = 0;) ~0 Z/ k9 {* Q! C+ m; O
  70. dma_addr_t dmaphysdest1 = 0;
    . M5 b; b* c1 k, a& T5 w
  71. dma_addr_t dmaphysdest2 = 0;0 o" h5 ?3 q8 j. o- A9 h
  72. 2 o8 a8 j* r% [3 C/ _/ D8 r
  73. char *dmabufsrc1 = NULL;
    4 g6 _. p& w% A1 }4 t
  74. char *dmabufsrc2 = NULL;
    0 [% w" c5 z+ u7 g- x, W8 ]1 s* o
  75. char *dmabufdest1 = NULL;
    6 [9 B! u4 F) ^2 e5 m' z4 A
  76. char *dmabufdest2 = NULL;3 U. K3 m* z5 d( M; n, d- U6 V
  77. 7 T; m9 C& b/ T) T  |- P
  78. static int acnt = 512;
    0 f- |$ e% }( m5 j
  79. static int bcnt = 8;
    - o0 a( {2 T( t
  80. static int ccnt = 8;
    ; q1 D* Y5 o* T! X7 N
  81. + D' t* j( O7 M) Z
  82. module_param(acnt, int, S_IRUGO);
    + F" ?$ M) t4 I5 T( f3 K- W9 K
  83. module_param(bcnt, int, S_IRUGO);& S: _" s. \- r. N8 g# Y) H5 ^" I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 u; G, l5 `* |$ g% c1 k- I) x  d& C/ j6 z: J/ M+ p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) g; X8 |4 w( }" w/ Q# K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ ^% g- x. g: l  C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) p- d" L. p% o2 X8 W9 ]/ Z

% R) {6 N* I# p6 g" X% ^8 @9 B: N7 ^* K7 k9 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 16:31 , Processed in 0.051522 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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