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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) e8 ~* O, i+ d" U% P# t3 S
  1. [code]EDMA sample test application
    3 I/ W' w# O4 F: w2 d
  2. /*# \1 ~6 }# m, H+ i( s1 T( A
  3. * edma_test.c6 u9 B: @( H3 f! `/ M7 n; E
  4. *5 k' T5 i  J4 v4 }1 `2 Z6 L( h5 E
  5. * brief  EDMA3 Test Application
    & B- k  P$ G' ^8 C. t8 J* }' T. _
  6. *
    4 X1 V+ ^& b3 L2 D. j7 C7 V
  7. *   This file contains EDMA3 Test code.& E+ ], ^. }, Q/ s+ N- V9 ]- c
  8. *+ e1 K% L6 J- G) h; P( ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 g0 O, w& Y+ `9 q3 O, _( y! G0 o2 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" w9 o& n5 k& D
  11. *         TO CHANGE.
    # C. {' D; p/ c) ]- \
  12. *
    ; U* c2 B5 y$ a! }! b0 F& Z* r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 X; A7 z; X; W
  14. ** B7 L8 v- J; F( E) _" X) E2 c# P
  15. * This program is free software; you can redistribute it and/or
    * E$ l' D& Y) e, l
  16. * modify it under the terms of the GNU General Public License as
    9 z7 T1 c: S1 h' L8 x, N
  17. * published by the Free Software Foundation version 2.( F" B% U1 Z6 V6 U' l  S
  18. *, j2 D* T6 B6 C6 x5 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 a' i: T0 ~6 ^9 I9 T1 }! M8 a
  20. * kind, whether express or implied; without even the implied warranty
    * T# \+ Z1 p7 U9 J2 |& Q' a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* C/ O6 x2 E. f- K+ n, b
  22. * GNU General Public License for more details.4 S9 A+ g% [. k: l7 ~
  23. */2 c. U) ]6 t2 s5 u
  24. " h% q1 N" J: b! K
  25. #include <linux/module.h>
    * y) a: I3 `- ~' T' m; W9 L! @
  26. #include <linux/init.h>/ I/ e1 L) X2 n: Y1 }! X
  27. #include <linux/errno.h>- p( T+ D# S, r' g
  28. #include <linux/types.h>( ^% d. U: J( t0 G$ g3 ^! Q- p! U0 s
  29. #include <linux/interrupt.h>
    7 t3 }- V# Y4 Q
  30. #include <asm/io.h>
    3 J! M8 w1 Q$ a7 F5 x
  31. #include <linux/moduleparam.h>
    6 d% B" l& j) y0 f! k; u
  32. #include <linux/sysctl.h>
    % z6 q1 f- \& f; ^
  33. #include <linux/mm.h>
    0 z/ @: w* S! {$ S
  34. #include <linux/dma-mapping.h>( @2 U' m8 e# l9 V" [

  35. . ?+ O1 [4 j# R5 y+ J
  36. #include <mach/memory.h>3 P- q# a; t4 L% t9 P0 i# ?
  37. #include <mach/hardware.h>; a% ]2 b0 V  V; v
  38. #include <mach/irqs.h>
      ^# [7 d. ^! C, c. F. W& s7 s
  39. #include <asm/hardware/edma.h>7 f. d7 ^2 z0 l0 l% V/ g' r/ k3 `2 s( y
  40. + I- c1 o) C( L; S
  41. #undef EDMA3_DEBUG. {  D$ i) B* H. G' M$ @
  42. /*#define EDMA3_DEBUG*/, L9 ?* @* P. E4 _% ]0 {
  43. ; ]# @( x. P2 j, p1 `
  44. #ifdef EDMA3_DEBUG: X" j# k3 V/ H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ I) r" Q. [$ K3 B4 @; [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); d; p" r% _/ H) j0 \0 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( p" z: o  p3 A8 _4 q! M$ \
  48. #else
    . {9 k2 b. o, }1 }
  49. #define DMA_PRINTK( x... )
    ( E4 x0 e+ L8 N! h; z! g
  50. #define DMA_FN_IN7 w# F: ^, C3 f* l; f" l/ `9 K
  51. #define DMA_FN_OUT( E$ y! }- r3 T- p" j
  52. #endif
    ! e1 I. T4 R, b. V$ y% ^
  53. ( m" {1 |6 \& p6 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " ]$ J& M: e$ ~; L7 A% S* d4 i+ S
  55. #define STATIC_SHIFT                3; o1 A( Y/ e  D5 Y2 a% b
  56. #define TCINTEN_SHIFT               20
    6 l' G2 p8 y3 E& K2 B! a5 _+ D
  57. #define ITCINTEN_SHIFT              21' \, [* L8 X; q5 ^* F+ Y7 Q7 o! a
  58. #define TCCHEN_SHIFT                22; T/ Q* i* t/ D- V* b
  59. #define ITCCHEN_SHIFT               23( z& D4 K, z) O% i
  60. " u4 w7 m. |1 A! v5 y7 m
  61. static volatile int irqraised1 = 0;
    ( X% v; V# k5 x- ^2 ?
  62. static volatile int irqraised2 = 0;
    ( O: T3 g+ s  F! S2 |
  63. + Q2 u+ ]# U: w1 E" ]( v- q" K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 c- {' s' r. ]* `5 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ~! R+ M# J; a7 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% _; p6 V# c% \, B- O: [' T
  67. 9 v7 S" f4 i) Z3 {
  68. dma_addr_t dmaphyssrc1 = 0;
    6 u* Q1 Y' N( B; Z- v! {
  69. dma_addr_t dmaphyssrc2 = 0;
    3 r) A0 |0 m3 r; ^( o. B9 Y/ f' w9 a# B$ Q
  70. dma_addr_t dmaphysdest1 = 0;
    0 o0 Z" Y5 g; Q. A1 ]' J" h
  71. dma_addr_t dmaphysdest2 = 0;
    8 X! [: f$ P4 Q4 Y0 e

  72. + F! R% V, e- _2 G. u: P
  73. char *dmabufsrc1 = NULL;- j1 ^% T8 w3 C1 B/ P3 e
  74. char *dmabufsrc2 = NULL;' |: X- r  y" w# k, b, v* ]5 U$ E0 {
  75. char *dmabufdest1 = NULL;& L& s: c) x6 N/ F: L
  76. char *dmabufdest2 = NULL;
    8 x2 G, L: ~5 f/ p& P( [, u; E- b  ?

  77. . P  \2 V. P, L; Z
  78. static int acnt = 512;7 h. f$ `! Y1 e, h) D1 _
  79. static int bcnt = 8;9 _1 U+ ?; p3 @+ `- S; r$ M
  80. static int ccnt = 8;
    4 h5 v$ t2 O$ _- x

  81. * x# \8 m% L  ~2 H: ]* I
  82. module_param(acnt, int, S_IRUGO);) W8 A/ Q$ N- R7 w5 S, g
  83. module_param(bcnt, int, S_IRUGO);" X  Y7 {9 A5 M. ~3 x/ t" v' o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- O  O8 ~* u0 A# H
+ C0 o: X% b. a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 `% g6 @/ I2 M. ?: qarm-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 J; ~0 l( D3 l3 w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 U  T) k# i1 W; Y* h

- h- o! D' F1 {9 [0 z& z8 r6 e3 u8 F+ X" v- h6 A& ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 18:35 , Processed in 0.047458 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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